| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/test/scoped_path_override.h" | 9 #include "base/test/scoped_path_override.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 EXPECT_TRUE(GoogleUpdateSettings::RemoveLastRunTime()); | 43 EXPECT_TRUE(GoogleUpdateSettings::RemoveLastRunTime()); |
| 44 EXPECT_EQ(-1, GoogleUpdateSettings::GetLastRunTime()); | 44 EXPECT_EQ(-1, GoogleUpdateSettings::GetLastRunTime()); |
| 45 // Setting and querying the last update time in fast sequence | 45 // Setting and querying the last update time in fast sequence |
| 46 // should give 0 days. | 46 // should give 0 days. |
| 47 EXPECT_TRUE(GoogleUpdateSettings::SetLastRunTime()); | 47 EXPECT_TRUE(GoogleUpdateSettings::SetLastRunTime()); |
| 48 EXPECT_EQ(0, GoogleUpdateSettings::GetLastRunTime()); | 48 EXPECT_EQ(0, GoogleUpdateSettings::GetLastRunTime()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 #endif // defined(OS_WIN) | 51 #endif // defined(OS_WIN) |
| 52 | 52 |
| 53 TEST_F(GoogleUpdateTest, IsOrganic) { |
| 54 // Test some brand codes to ensure that future changes to this method won't |
| 55 // go unnoticed. |
| 56 |
| 57 // GGRV is non-organic. |
| 58 EXPECT_FALSE(google_brand::IsOrganic("GGRV")); |
| 59 |
| 60 // Other GGR* are organic. |
| 61 EXPECT_TRUE(google_brand::IsOrganic("GGRA")); |
| 62 |
| 63 // GGLS must always be organic. |
| 64 EXPECT_TRUE(google_brand::IsOrganic("GGLS")); |
| 65 } |
| 66 |
| 53 TEST_F(GoogleUpdateTest, IsOrganicFirstRunBrandCodes) { | 67 TEST_F(GoogleUpdateTest, IsOrganicFirstRunBrandCodes) { |
| 54 // Test some brand codes to ensure that future changes to this method won't | 68 // Test some brand codes to ensure that future changes to this method won't |
| 55 // go unnoticed. | 69 // go unnoticed. |
| 56 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHFO")); | 70 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHFO")); |
| 57 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHMA")); | 71 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHMA")); |
| 58 EXPECT_TRUE(google_brand::IsOrganicFirstRun("EUBA")); | 72 EXPECT_TRUE(google_brand::IsOrganicFirstRun("EUBA")); |
| 59 EXPECT_TRUE(google_brand::IsOrganicFirstRun("GGRA")); | 73 EXPECT_TRUE(google_brand::IsOrganicFirstRun("GGRA")); |
| 60 | 74 |
| 61 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
| 62 // An empty brand string on Mac is used for channels other than stable, | 76 // An empty brand string on Mac is used for channels other than stable, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_dir)); | 89 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_dir)); |
| 76 ASSERT_TRUE(base::DirectoryExists(consent_dir)); | 90 ASSERT_TRUE(base::DirectoryExists(consent_dir)); |
| 77 | 91 |
| 78 base::FilePath consent_file = consent_dir.Append("Consent To Send Stats"); | 92 base::FilePath consent_file = consent_dir.Append("Consent To Send Stats"); |
| 79 ASSERT_TRUE(base::PathExists(consent_file)); | 93 ASSERT_TRUE(base::PathExists(consent_file)); |
| 80 int permissions; | 94 int permissions; |
| 81 ASSERT_TRUE(base::GetPosixFilePermissions(consent_file, &permissions)); | 95 ASSERT_TRUE(base::GetPosixFilePermissions(consent_file, &permissions)); |
| 82 EXPECT_TRUE(permissions & base::FILE_PERMISSION_READ_BY_OTHERS); | 96 EXPECT_TRUE(permissions & base::FILE_PERMISSION_READ_BY_OTHERS); |
| 83 } | 97 } |
| 84 #endif | 98 #endif |
| OLD | NEW |