| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" | 5 #include "base/basictypes.h" |
| 6 #include "chrome/browser/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 7 #include "chrome/test/live_sync/live_themes_sync_test.h" | 7 #include "chrome/test/live_sync/themes_helper.h" |
| 8 #include "chrome/test/live_sync/live_sync_test.h" |
| 8 | 9 |
| 9 class SingleClientLiveThemesSyncTest : public LiveThemesSyncTest { | 10 using themes_helper::GetCustomTheme; |
| 11 using themes_helper::GetThemeID; |
| 12 using themes_helper::UseCustomTheme; |
| 13 using themes_helper::UseDefaultTheme; |
| 14 using themes_helper::UseNativeTheme; |
| 15 using themes_helper::UsingCustomTheme; |
| 16 using themes_helper::UsingDefaultTheme; |
| 17 using themes_helper::UsingNativeTheme; |
| 18 |
| 19 class SingleClientThemesSyncTest : public LiveSyncTest { |
| 10 public: | 20 public: |
| 11 SingleClientLiveThemesSyncTest() : LiveThemesSyncTest(SINGLE_CLIENT) {} | 21 SingleClientThemesSyncTest() : LiveSyncTest(SINGLE_CLIENT) {} |
| 12 virtual ~SingleClientLiveThemesSyncTest() {} | 22 virtual ~SingleClientThemesSyncTest() {} |
| 13 | 23 |
| 14 private: | 24 private: |
| 15 DISALLOW_COPY_AND_ASSIGN(SingleClientLiveThemesSyncTest); | 25 DISALLOW_COPY_AND_ASSIGN(SingleClientThemesSyncTest); |
| 16 }; | 26 }; |
| 17 | 27 |
| 18 // TODO(akalin): Add tests for model association (i.e., tests that | 28 // TODO(akalin): Add tests for model association (i.e., tests that |
| 19 // start with SetupClients(), change the theme state, then call | 29 // start with SetupClients(), change the theme state, then call |
| 20 // SetupSync()). | 30 // SetupSync()). |
| 21 | 31 |
| 22 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, CustomTheme) { | 32 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, CustomTheme) { |
| 23 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 33 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 24 | 34 |
| 25 ASSERT_FALSE(UsingCustomTheme(GetProfile(0))); | 35 ASSERT_FALSE(UsingCustomTheme(GetProfile(0))); |
| 26 ASSERT_FALSE(UsingCustomTheme(verifier())); | 36 ASSERT_FALSE(UsingCustomTheme(verifier())); |
| 27 | 37 |
| 28 UseCustomTheme(GetProfile(0), 0); | 38 UseCustomTheme(GetProfile(0), 0); |
| 29 UseCustomTheme(verifier(), 0); | 39 UseCustomTheme(verifier(), 0); |
| 30 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); | 40 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
| 31 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); | 41 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); |
| 32 | 42 |
| 33 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 43 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 34 "Waiting for custom themes change.")); | 44 "Waiting for custom themes change.")); |
| 35 | 45 |
| 36 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); | 46 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
| 37 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); | 47 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); |
| 38 } | 48 } |
| 39 | 49 |
| 40 // TODO(sync): Fails on Chrome OS. See http://crbug.com/84575. | 50 // TODO(sync): Fails on Chrome OS. See http://crbug.com/84575. |
| 41 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
| 42 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, FAILS_NativeTheme) { | 52 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, FAILS_NativeTheme) { |
| 43 #else | 53 #else |
| 44 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, NativeTheme) { | 54 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, NativeTheme) { |
| 45 #endif // OS_CHROMEOS | 55 #endif // OS_CHROMEOS |
| 46 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 56 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 47 | 57 |
| 48 UseCustomTheme(GetProfile(0), 0); | 58 UseCustomTheme(GetProfile(0), 0); |
| 49 UseCustomTheme(verifier(), 0); | 59 UseCustomTheme(verifier(), 0); |
| 50 ASSERT_FALSE(UsingNativeTheme(GetProfile(0))); | 60 ASSERT_FALSE(UsingNativeTheme(GetProfile(0))); |
| 51 ASSERT_FALSE(UsingNativeTheme(verifier())); | 61 ASSERT_FALSE(UsingNativeTheme(verifier())); |
| 52 | 62 |
| 53 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 63 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 54 "Waiting for custom themes change.")); | 64 "Waiting for custom themes change.")); |
| 55 | 65 |
| 56 UseNativeTheme(GetProfile(0)); | 66 UseNativeTheme(GetProfile(0)); |
| 57 UseNativeTheme(verifier()); | 67 UseNativeTheme(verifier()); |
| 58 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); | 68 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); |
| 59 ASSERT_TRUE(UsingNativeTheme(verifier())); | 69 ASSERT_TRUE(UsingNativeTheme(verifier())); |
| 60 | 70 |
| 61 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 71 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 62 "Waiting for native themes change.")); | 72 "Waiting for native themes change.")); |
| 63 | 73 |
| 64 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); | 74 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); |
| 65 ASSERT_TRUE(UsingNativeTheme(verifier())); | 75 ASSERT_TRUE(UsingNativeTheme(verifier())); |
| 66 } | 76 } |
| 67 | 77 |
| 68 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, DefaultTheme) { | 78 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, DefaultTheme) { |
| 69 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 79 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 70 | 80 |
| 71 UseCustomTheme(GetProfile(0), 0); | 81 UseCustomTheme(GetProfile(0), 0); |
| 72 UseCustomTheme(verifier(), 0); | 82 UseCustomTheme(verifier(), 0); |
| 73 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0))); | 83 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0))); |
| 74 ASSERT_FALSE(UsingDefaultTheme(verifier())); | 84 ASSERT_FALSE(UsingDefaultTheme(verifier())); |
| 75 | 85 |
| 76 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 86 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 77 "Waiting for custom themes change.")); | 87 "Waiting for custom themes change.")); |
| 78 | 88 |
| 79 UseDefaultTheme(GetProfile(0)); | 89 UseDefaultTheme(GetProfile(0)); |
| 80 UseDefaultTheme(verifier()); | 90 UseDefaultTheme(verifier()); |
| 81 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); | 91 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); |
| 82 ASSERT_TRUE(UsingDefaultTheme(verifier())); | 92 ASSERT_TRUE(UsingDefaultTheme(verifier())); |
| 83 | 93 |
| 84 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 94 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 85 "Waiting for native themes change.")); | 95 "Waiting for native themes change.")); |
| 86 | 96 |
| 87 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); | 97 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); |
| 88 ASSERT_TRUE(UsingDefaultTheme(verifier())); | 98 ASSERT_TRUE(UsingDefaultTheme(verifier())); |
| 89 } | 99 } |
| OLD | NEW |