| 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/profiles/profile.h" | |
| 7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 8 #include "chrome/common/extensions/extension.h" | |
| 9 #include "chrome/test/live_sync/live_themes_sync_test.h" | 7 #include "chrome/test/live_sync/live_themes_sync_test.h" |
| 10 | 8 |
| 11 class SingleClientLiveThemesSyncTest : public LiveThemesSyncTest { | 9 class SingleClientLiveThemesSyncTest : public LiveThemesSyncTest { |
| 12 public: | 10 public: |
| 13 SingleClientLiveThemesSyncTest() : LiveThemesSyncTest(SINGLE_CLIENT) {} | 11 SingleClientLiveThemesSyncTest() : LiveThemesSyncTest(SINGLE_CLIENT) {} |
| 14 virtual ~SingleClientLiveThemesSyncTest() {} | 12 virtual ~SingleClientLiveThemesSyncTest() {} |
| 15 | 13 |
| 16 private: | 14 private: |
| 17 DISALLOW_COPY_AND_ASSIGN(SingleClientLiveThemesSyncTest); | 15 DISALLOW_COPY_AND_ASSIGN(SingleClientLiveThemesSyncTest); |
| 18 }; | 16 }; |
| 19 | 17 |
| 20 // TODO(akalin): Add tests for model association (i.e., tests that | 18 // TODO(akalin): Add tests for model association (i.e., tests that |
| 21 // start with SetupClients(), change the theme state, then call | 19 // start with SetupClients(), change the theme state, then call |
| 22 // SetupSync()). | 20 // SetupSync()). |
| 23 | 21 |
| 24 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, CustomTheme) { | 22 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, CustomTheme) { |
| 25 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 23 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 26 | 24 |
| 27 ASSERT_EQ(NULL, GetCustomTheme(GetProfile(0))); | 25 ASSERT_FALSE(UsingCustomTheme(GetProfile(0))); |
| 28 ASSERT_EQ(NULL, GetCustomTheme(verifier())); | 26 ASSERT_FALSE(UsingCustomTheme(verifier())); |
| 29 | 27 |
| 30 SetTheme(GetProfile(0), GetTheme(0)); | 28 UseCustomTheme(GetProfile(0), 0); |
| 31 SetTheme(verifier(), GetTheme(0)); | 29 UseCustomTheme(verifier(), 0); |
| 32 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0))); | 30 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
| 33 ASSERT_EQ(GetTheme(0), GetCustomTheme(verifier())); | 31 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); |
| 34 | 32 |
| 35 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 33 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 36 "Waiting for custom themes change.")); | 34 "Waiting for custom themes change.")); |
| 37 | 35 |
| 38 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0))); | 36 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
| 39 ASSERT_EQ(GetTheme(0), GetCustomTheme(verifier())); | 37 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); |
| 40 } | 38 } |
| 41 | 39 |
| 42 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, NativeTheme) { | 40 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, NativeTheme) { |
| 43 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 41 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 44 | 42 |
| 45 SetTheme(GetProfile(0), GetTheme(0)); | 43 UseCustomTheme(GetProfile(0), 0); |
| 46 SetTheme(verifier(), GetTheme(0)); | 44 UseCustomTheme(verifier(), 0); |
| 47 ASSERT_FALSE(UsingNativeTheme(GetProfile(0))); | 45 ASSERT_FALSE(UsingNativeTheme(GetProfile(0))); |
| 48 ASSERT_FALSE(UsingNativeTheme(verifier())); | 46 ASSERT_FALSE(UsingNativeTheme(verifier())); |
| 49 | 47 |
| 50 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 48 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 51 "Waiting for custom themes change.")); | 49 "Waiting for custom themes change.")); |
| 52 | 50 |
| 53 SetNativeTheme(GetProfile(0)); | 51 UseNativeTheme(GetProfile(0)); |
| 54 SetNativeTheme(verifier()); | 52 UseNativeTheme(verifier()); |
| 55 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); | 53 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); |
| 56 ASSERT_TRUE(UsingNativeTheme(verifier())); | 54 ASSERT_TRUE(UsingNativeTheme(verifier())); |
| 57 | 55 |
| 58 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 56 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 59 "Waiting for native themes change.")); | 57 "Waiting for native themes change.")); |
| 60 | 58 |
| 61 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); | 59 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); |
| 62 ASSERT_TRUE(UsingNativeTheme(verifier())); | 60 ASSERT_TRUE(UsingNativeTheme(verifier())); |
| 63 } | 61 } |
| 64 | 62 |
| 65 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, DefaultTheme) { | 63 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, DefaultTheme) { |
| 66 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 64 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 67 | 65 |
| 68 SetTheme(GetProfile(0), GetTheme(0)); | 66 UseCustomTheme(GetProfile(0), 0); |
| 69 SetTheme(verifier(), GetTheme(0)); | 67 UseCustomTheme(verifier(), 0); |
| 70 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0))); | 68 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0))); |
| 71 ASSERT_FALSE(UsingDefaultTheme(verifier())); | 69 ASSERT_FALSE(UsingDefaultTheme(verifier())); |
| 72 | 70 |
| 73 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 71 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 74 "Waiting for custom themes change.")); | 72 "Waiting for custom themes change.")); |
| 75 | 73 |
| 76 UseDefaultTheme(GetProfile(0)); | 74 UseDefaultTheme(GetProfile(0)); |
| 77 UseDefaultTheme(verifier()); | 75 UseDefaultTheme(verifier()); |
| 78 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); | 76 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); |
| 79 ASSERT_TRUE(UsingDefaultTheme(verifier())); | 77 ASSERT_TRUE(UsingDefaultTheme(verifier())); |
| 80 | 78 |
| 81 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( | 79 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( |
| 82 "Waiting for native themes change.")); | 80 "Waiting for native themes change.")); |
| 83 | 81 |
| 84 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); | 82 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); |
| 85 ASSERT_TRUE(UsingDefaultTheme(verifier())); | 83 ASSERT_TRUE(UsingDefaultTheme(verifier())); |
| 86 } | 84 } |
| OLD | NEW |