| 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/basictypes.h" |
| 6 #include "base/compiler_specific.h" |
| 7 #include "base/path_service.h" |
| 8 #include "base/scoped_temp_dir.h" |
| 5 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
| 10 #include "chrome/common/chrome_paths.h" |
| 6 #include "chrome/installer/util/google_update_settings.h" | 11 #include "chrome/installer/util/google_update_settings.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 9 | 14 |
| 10 class GoogleUpdateTest : public PlatformTest { | 15 class GoogleUpdateTest : public PlatformTest { |
| 16 protected: |
| 17 GoogleUpdateTest() {} |
| 18 virtual ~GoogleUpdateTest() {} |
| 19 |
| 20 virtual void SetUp() OVERRIDE { |
| 21 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 22 PathService::Override(chrome::DIR_USER_DATA, temp_dir_.path()); |
| 23 } |
| 24 |
| 25 private: |
| 26 ScopedTempDir temp_dir_; |
| 27 |
| 28 DISALLOW_COPY_AND_ASSIGN(GoogleUpdateTest); |
| 11 }; | 29 }; |
| 12 | 30 |
| 13 TEST_F(GoogleUpdateTest, StatsConsent) { | 31 TEST_F(GoogleUpdateTest, StatsConsent) { |
| 14 // Stats are off by default. | 32 // Stats are off by default. |
| 15 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); | 33 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); |
| 16 // Stats reporting is ON. | 34 // Stats reporting is ON. |
| 17 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(true)); | 35 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(true)); |
| 18 EXPECT_TRUE(GoogleUpdateSettings::GetCollectStatsConsent()); | 36 EXPECT_TRUE(GoogleUpdateSettings::GetCollectStatsConsent()); |
| 19 // Stats reporting is OFF. | 37 // Stats reporting is OFF. |
| 20 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(false)); | 38 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(false)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 EXPECT_FALSE(google_util::IsOrganicFirstRun("CHMA")); | 60 EXPECT_FALSE(google_util::IsOrganicFirstRun("CHMA")); |
| 43 EXPECT_TRUE(google_util::IsOrganicFirstRun("EUBA")); | 61 EXPECT_TRUE(google_util::IsOrganicFirstRun("EUBA")); |
| 44 EXPECT_TRUE(google_util::IsOrganicFirstRun("GGRA")); | 62 EXPECT_TRUE(google_util::IsOrganicFirstRun("GGRA")); |
| 45 | 63 |
| 46 #if defined(OS_MACOSX) | 64 #if defined(OS_MACOSX) |
| 47 // An empty brand string on Mac is used for channels other than stable, | 65 // An empty brand string on Mac is used for channels other than stable, |
| 48 // which are always organic. | 66 // which are always organic. |
| 49 EXPECT_TRUE(google_util::IsOrganicFirstRun("")); | 67 EXPECT_TRUE(google_util::IsOrganicFirstRun("")); |
| 50 #endif | 68 #endif |
| 51 } | 69 } |
| OLD | NEW |