// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/mac/mac_util.h"

#import <Cocoa/Cocoa.h>
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/xattr.h>

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_nsobject.h"
#include "base/system/sys_info.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"

namespace base::mac {

namespace {

using MacUtilTest = PlatformTest;

TEST_F(MacUtilTest, GetUserDirectoryTest) {
  // Try a few keys, make sure they come back with non-empty paths.
  FilePath caches_dir;
  EXPECT_TRUE(GetUserDirectory(NSCachesDirectory, &caches_dir));
  EXPECT_FALSE(caches_dir.empty());

  FilePath application_support_dir;
  EXPECT_TRUE(GetUserDirectory(NSApplicationSupportDirectory,
                               &application_support_dir));
  EXPECT_FALSE(application_support_dir.empty());

  FilePath library_dir;
  EXPECT_TRUE(GetUserDirectory(NSLibraryDirectory, &library_dir));
  EXPECT_FALSE(library_dir.empty());
}

TEST_F(MacUtilTest, TestLibraryPath) {
  FilePath library_dir = GetUserLibraryPath();
  // Make sure the string isn't empty.
  EXPECT_FALSE(library_dir.value().empty());
}

TEST_F(MacUtilTest, TestGetAppBundlePath) {
  FilePath out;

  // Make sure it doesn't crash.
  out = GetAppBundlePath(FilePath());
  EXPECT_TRUE(out.empty());

  // Some more invalid inputs.
  const char* const invalid_inputs[] = {
    "/", "/foo", "foo", "/foo/bar.", "foo/bar.", "/foo/bar./bazquux",
    "foo/bar./bazquux", "foo/.app", "//foo",
  };
  for (size_t i = 0; i < std::size(invalid_inputs); i++) {
    out = GetAppBundlePath(FilePath(invalid_inputs[i]));
    EXPECT_TRUE(out.empty()) << "loop: " << i;
  }

  // Some valid inputs; this and |expected_outputs| should be in sync.
  struct {
    const char *in;
    const char *expected_out;
  } valid_inputs[] = {
    { "FooBar.app/", "FooBar.app" },
    { "/FooBar.app", "/FooBar.app" },
    { "/FooBar.app/", "/FooBar.app" },
    { "//FooBar.app", "//FooBar.app" },
    { "/Foo/Bar.app", "/Foo/Bar.app" },
    { "/Foo/Bar.app/", "/Foo/Bar.app" },
    { "/F/B.app", "/F/B.app" },
    { "/F/B.app/", "/F/B.app" },
    { "/Foo/Bar.app/baz", "/Foo/Bar.app" },
    { "/Foo/Bar.app/baz/", "/Foo/Bar.app" },
    { "/Foo/Bar.app/baz/quux.app/quuux", "/Foo/Bar.app" },
    { "/Applications/Google Foo.app/bar/Foo Helper.app/quux/Foo Helper",
        "/Applications/Google Foo.app" },
  };
  for (size_t i = 0; i < std::size(valid_inputs); i++) {
    out = GetAppBundlePath(FilePath(valid_inputs[i].in));
    EXPECT_FALSE(out.empty()) << "loop: " << i;
    EXPECT_STREQ(valid_inputs[i].expected_out,
        out.value().c_str()) << "loop: " << i;
  }
}

TEST_F(MacUtilTest, IsOSEllipsis) {
  int32_t major, minor, bugfix;
  base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);

  // The patterns here are:
  // - FALSE/FALSE/TRUE (it is not the earlier version, it is not "at most" the
  //   earlier version, it is "at least" the earlier version)
  // - TRUE/TRUE/TRUE (it is the same version, it is "at most" the same version,
  //   it is "at least" the same version)
  // - FALSE/TRUE/FALSE (it is not the later version, it is "at most" the later
  //   version, it is not "at least" the later version)

#define TEST_FOR_PAST_10_OS(V)      \
  EXPECT_FALSE(IsOS10_##V());       \
  EXPECT_FALSE(IsAtMostOS10_##V()); \
  EXPECT_TRUE(IsAtLeastOS10_##V());

#define TEST_FOR_PAST_OS(V)      \
  EXPECT_FALSE(IsOS##V());       \
  EXPECT_FALSE(IsAtMostOS##V()); \
  EXPECT_TRUE(IsAtLeastOS##V());

#define TEST_FOR_SAME_10_OS(V)     \
  EXPECT_TRUE(IsOS10_##V());       \
  EXPECT_TRUE(IsAtMostOS10_##V()); \
  EXPECT_TRUE(IsAtLeastOS10_##V());

#define TEST_FOR_SAME_OS(V)     \
  EXPECT_TRUE(IsOS##V());       \
  EXPECT_TRUE(IsAtMostOS##V()); \
  EXPECT_TRUE(IsAtLeastOS##V());

#define TEST_FOR_FUTURE_10_OS(V)   \
  EXPECT_FALSE(IsOS10_##V());      \
  EXPECT_TRUE(IsAtMostOS10_##V()); \
  EXPECT_FALSE(IsAtLeastOS10_##V());

#define TEST_FOR_FUTURE_OS(V)   \
  EXPECT_FALSE(IsOS##V());      \
  EXPECT_TRUE(IsAtMostOS##V()); \
  EXPECT_FALSE(IsAtLeastOS##V());

  if (major == 10) {
    if (minor == 13) {
      EXPECT_TRUE(IsOS10_13());
      EXPECT_TRUE(IsAtMostOS10_13());

      TEST_FOR_FUTURE_10_OS(14);
      TEST_FOR_FUTURE_10_OS(15);
      TEST_FOR_FUTURE_OS(11);
      TEST_FOR_FUTURE_OS(12);
      TEST_FOR_FUTURE_OS(13);

      EXPECT_FALSE(IsOSLaterThan13_DontCallThis());
    } else if (minor == 14) {
      EXPECT_FALSE(IsOS10_13());
      EXPECT_FALSE(IsAtMostOS10_13());

      TEST_FOR_SAME_10_OS(14);
      TEST_FOR_FUTURE_10_OS(15);
      TEST_FOR_FUTURE_OS(11);
      TEST_FOR_FUTURE_OS(12);
      TEST_FOR_FUTURE_OS(13);

      EXPECT_FALSE(IsOSLaterThan13_DontCallThis());
    } else if (minor == 15) {
      EXPECT_FALSE(IsOS10_13());
      EXPECT_FALSE(IsAtMostOS10_13());

      TEST_FOR_PAST_10_OS(14);
      TEST_FOR_SAME_10_OS(15);
      TEST_FOR_FUTURE_OS(11);
      TEST_FOR_FUTURE_OS(12);
      TEST_FOR_FUTURE_OS(13);

      EXPECT_FALSE(IsOSLaterThan13_DontCallThis());
    } else {
      // macOS 10.15 was the end of the line.
      FAIL() << "Unexpected 10.x macOS.";
    }
  } else if (major == 11) {
    EXPECT_FALSE(IsOS10_13());
    EXPECT_FALSE(IsAtMostOS10_13());

    TEST_FOR_PAST_10_OS(14);
    TEST_FOR_PAST_10_OS(15);
    TEST_FOR_SAME_OS(11);
    TEST_FOR_FUTURE_OS(12);
    TEST_FOR_FUTURE_OS(13);

    EXPECT_FALSE(IsOSLaterThan13_DontCallThis());
  } else if (major == 12) {
    EXPECT_FALSE(IsOS10_13());
    EXPECT_FALSE(IsAtMostOS10_13());

    TEST_FOR_PAST_10_OS(14);
    TEST_FOR_PAST_10_OS(15);
    TEST_FOR_PAST_OS(11);
    TEST_FOR_SAME_OS(12);
    TEST_FOR_FUTURE_OS(13);

    EXPECT_FALSE(IsOSLaterThan13_DontCallThis());
  } else if (major == 13) {
    EXPECT_FALSE(IsOS10_13());
    EXPECT_FALSE(IsAtMostOS10_13());

    TEST_FOR_PAST_10_OS(14);
    TEST_FOR_PAST_10_OS(15);
    TEST_FOR_PAST_OS(11);
    TEST_FOR_PAST_OS(12);
    TEST_FOR_SAME_OS(13);

    EXPECT_FALSE(IsOSLaterThan13_DontCallThis());
  } else {
    // The spooky future.
    FAIL() << "Time to update the OS macros!";
  }
}

#undef TEST_FOR_PAST_10_OS
#undef TEST_FOR_PAST_OS
#undef TEST_FOR_SAME_10_OS
#undef TEST_FOR_SAME_OS
#undef TEST_FOR_FUTURE_10_OS
#undef TEST_FOR_FUTURE_OS

TEST_F(MacUtilTest, ParseModelIdentifier) {
  std::string model;
  int32_t major = 1, minor = 2;

  EXPECT_FALSE(ParseModelIdentifier("", &model, &major, &minor));
  EXPECT_EQ(0U, model.length());
  EXPECT_EQ(1, major);
  EXPECT_EQ(2, minor);
  EXPECT_FALSE(ParseModelIdentifier("FooBar", &model, &major, &minor));

  EXPECT_TRUE(ParseModelIdentifier("MacPro4,1", &model, &major, &minor));
  EXPECT_EQ(model, "MacPro");
  EXPECT_EQ(4, major);
  EXPECT_EQ(1, minor);

  EXPECT_TRUE(ParseModelIdentifier("MacBookPro6,2", &model, &major, &minor));
  EXPECT_EQ(model, "MacBookPro");
  EXPECT_EQ(6, major);
  EXPECT_EQ(2, minor);
}

TEST_F(MacUtilTest, TestRemoveQuarantineAttribute) {
  ScopedTempDir temp_dir_;
  ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
  FilePath dummy_folder_path = temp_dir_.GetPath().Append("DummyFolder");
  ASSERT_TRUE(base::CreateDirectory(dummy_folder_path));
  const char* quarantine_str = "0000;4b392bb2;Chromium;|org.chromium.Chromium";
  const char* file_path_str = dummy_folder_path.value().c_str();
  EXPECT_EQ(0, setxattr(file_path_str, "com.apple.quarantine",
      quarantine_str, strlen(quarantine_str), 0, 0));
  EXPECT_EQ(static_cast<long>(strlen(quarantine_str)),
      getxattr(file_path_str, "com.apple.quarantine",
          NULL, 0, 0, 0));
  EXPECT_TRUE(RemoveQuarantineAttribute(dummy_folder_path));
  EXPECT_EQ(-1, getxattr(file_path_str, "com.apple.quarantine", NULL, 0, 0, 0));
  EXPECT_EQ(ENOATTR, errno);
}

TEST_F(MacUtilTest, TestRemoveQuarantineAttributeTwice) {
  ScopedTempDir temp_dir_;
  ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
  FilePath dummy_folder_path = temp_dir_.GetPath().Append("DummyFolder");
  const char* file_path_str = dummy_folder_path.value().c_str();
  ASSERT_TRUE(base::CreateDirectory(dummy_folder_path));
  EXPECT_EQ(-1, getxattr(file_path_str, "com.apple.quarantine", NULL, 0, 0, 0));
  // No quarantine attribute to begin with, but RemoveQuarantineAttribute still
  // succeeds because in the end the folder still doesn't have the quarantine
  // attribute set.
  EXPECT_TRUE(RemoveQuarantineAttribute(dummy_folder_path));
  EXPECT_TRUE(RemoveQuarantineAttribute(dummy_folder_path));
  EXPECT_EQ(ENOATTR, errno);
}

TEST_F(MacUtilTest, TestRemoveQuarantineAttributeNonExistentPath) {
  ScopedTempDir temp_dir_;
  ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
  FilePath non_existent_path = temp_dir_.GetPath().Append("DummyPath");
  ASSERT_FALSE(PathExists(non_existent_path));
  EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path));
}

}  // namespace

}  // namespace base::mac
