Chromium Code Reviews| 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 EXPECT_FALSE(google_brand::IsOrganic("GGRV")); | |
|
Peter Kasting
2017/04/12 20:05:20
Nit: Also EXPECT_TRUE for GGRsomething_else?
Roger Tawa OOO till Jul 10th
2017/04/12 21:51:43
Do you think I should do all the letters?
Peter Kasting
2017/04/12 22:46:03
Not necessarily, I was mainly thinking of catching
| |
| 57 } | |
| 58 | |
| 53 TEST_F(GoogleUpdateTest, IsOrganicFirstRunBrandCodes) { | 59 TEST_F(GoogleUpdateTest, IsOrganicFirstRunBrandCodes) { |
| 54 // Test some brand codes to ensure that future changes to this method won't | 60 // Test some brand codes to ensure that future changes to this method won't |
| 55 // go unnoticed. | 61 // go unnoticed. |
| 56 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHFO")); | 62 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHFO")); |
| 57 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHMA")); | 63 EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHMA")); |
| 58 EXPECT_TRUE(google_brand::IsOrganicFirstRun("EUBA")); | 64 EXPECT_TRUE(google_brand::IsOrganicFirstRun("EUBA")); |
| 59 EXPECT_TRUE(google_brand::IsOrganicFirstRun("GGRA")); | 65 EXPECT_TRUE(google_brand::IsOrganicFirstRun("GGRA")); |
| 60 | 66 |
| 61 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
| 62 // An empty brand string on Mac is used for channels other than stable, | 68 // 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)); | 81 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_dir)); |
| 76 ASSERT_TRUE(base::DirectoryExists(consent_dir)); | 82 ASSERT_TRUE(base::DirectoryExists(consent_dir)); |
| 77 | 83 |
| 78 base::FilePath consent_file = consent_dir.Append("Consent To Send Stats"); | 84 base::FilePath consent_file = consent_dir.Append("Consent To Send Stats"); |
| 79 ASSERT_TRUE(base::PathExists(consent_file)); | 85 ASSERT_TRUE(base::PathExists(consent_file)); |
| 80 int permissions; | 86 int permissions; |
| 81 ASSERT_TRUE(base::GetPosixFilePermissions(consent_file, &permissions)); | 87 ASSERT_TRUE(base::GetPosixFilePermissions(consent_file, &permissions)); |
| 82 EXPECT_TRUE(permissions & base::FILE_PERMISSION_READ_BY_OTHERS); | 88 EXPECT_TRUE(permissions & base::FILE_PERMISSION_READ_BY_OTHERS); |
| 83 } | 89 } |
| 84 #endif | 90 #endif |
| OLD | NEW |