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