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/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() {} | |
|
Lei Zhang
2012/08/31 20:49:48
needs a virtual destructor as well.
Mattias Nissler (ping if slow)
2012/08/31 20:56:18
Done.
| |
| 18 | |
| 19 virtual void SetUp() OVERRIDE { | |
| 20 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | |
| 21 PathService::Override(chrome::DIR_USER_DATA, temp_dir_.path()); | |
| 22 } | |
| 23 | |
| 24 ScopedTempDir temp_dir_; | |
| 25 | |
| 26 private: | |
| 27 DISALLOW_COPY_AND_ASSIGN(GoogleUpdateTest); | |
| 11 }; | 28 }; |
| 12 | 29 |
| 13 TEST_F(GoogleUpdateTest, StatsConsent) { | 30 TEST_F(GoogleUpdateTest, StatsConsent) { |
| 14 // Stats are off by default. | 31 // Stats are off by default. |
| 15 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); | 32 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); |
| 16 // Stats reporting is ON. | 33 // Stats reporting is ON. |
| 17 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(true)); | 34 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(true)); |
| 18 EXPECT_TRUE(GoogleUpdateSettings::GetCollectStatsConsent()); | 35 EXPECT_TRUE(GoogleUpdateSettings::GetCollectStatsConsent()); |
| 19 // Stats reporting is OFF. | 36 // Stats reporting is OFF. |
| 20 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(false)); | 37 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(false)); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 42 EXPECT_FALSE(google_util::IsOrganicFirstRun("CHMA")); | 59 EXPECT_FALSE(google_util::IsOrganicFirstRun("CHMA")); |
| 43 EXPECT_TRUE(google_util::IsOrganicFirstRun("EUBA")); | 60 EXPECT_TRUE(google_util::IsOrganicFirstRun("EUBA")); |
| 44 EXPECT_TRUE(google_util::IsOrganicFirstRun("GGRA")); | 61 EXPECT_TRUE(google_util::IsOrganicFirstRun("GGRA")); |
| 45 | 62 |
| 46 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
| 47 // An empty brand string on Mac is used for channels other than stable, | 64 // An empty brand string on Mac is used for channels other than stable, |
| 48 // which are always organic. | 65 // which are always organic. |
| 49 EXPECT_TRUE(google_util::IsOrganicFirstRun("")); | 66 EXPECT_TRUE(google_util::IsOrganicFirstRun("")); |
| 50 #endif | 67 #endif |
| 51 } | 68 } |
| OLD | NEW |