Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: chrome/test/live_sync/two_client_live_themes_sync_test.cc

Issue 6873061: [Sync] Revamp and re-enable themes/extensions sync integration tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile errors Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/live_sync/two_client_live_extensions_sync_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 TwoClientLiveThemesSyncTest : public LiveThemesSyncTest { 9 class TwoClientLiveThemesSyncTest : public LiveThemesSyncTest {
12 public: 10 public:
13 TwoClientLiveThemesSyncTest() : LiveThemesSyncTest(TWO_CLIENT) {} 11 TwoClientLiveThemesSyncTest() : LiveThemesSyncTest(TWO_CLIENT) {}
14 virtual ~TwoClientLiveThemesSyncTest() {} 12 virtual ~TwoClientLiveThemesSyncTest() {}
15 13
16 private: 14 private:
17 DISALLOW_COPY_AND_ASSIGN(TwoClientLiveThemesSyncTest); 15 DISALLOW_COPY_AND_ASSIGN(TwoClientLiveThemesSyncTest);
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(TwoClientLiveThemesSyncTest, CustomTheme) { 22 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, 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(GetProfile(1))); 26 ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
29 ASSERT_EQ(NULL, GetCustomTheme(verifier())); 27 ASSERT_FALSE(UsingCustomTheme(verifier()));
30 28
31 SetTheme(GetProfile(0), GetTheme(0)); 29 UseCustomTheme(GetProfile(0), 0);
32 SetTheme(verifier(), GetTheme(0)); 30 UseCustomTheme(verifier(), 0);
33 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0))); 31 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
34 ASSERT_EQ(NULL, GetCustomTheme(GetProfile(1))); 32 ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
Raghu Simha 2011/04/19 04:20:05 It's possible that sync could be complete even bef
akalin 2011/04/19 06:48:16 Done.
35 ASSERT_EQ(GetTheme(0), GetCustomTheme(verifier())); 33 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
36 34
37 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 35 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
38 36
39 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0))); 37 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
40 // TODO(akalin): Add functions to simulate when a pending extension 38 // TODO(akalin): Add functions to simulate when a pending extension
41 // is installed as well as when a pending extension fails to 39 // is installed as well as when a pending extension fails to
42 // install. 40 // install.
43 ASSERT_TRUE(ExtensionIsPendingInstall(GetProfile(1), GetTheme(0))); 41 ASSERT_TRUE(ThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
44 ASSERT_EQ(GetTheme(0), GetCustomTheme(verifier())); 42 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
45 } 43 }
46 44
47 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, NativeTheme) { 45 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, NativeTheme) {
48 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 46 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
49 47
50 SetTheme(GetProfile(0), GetTheme(0)); 48 UseCustomTheme(GetProfile(0), 0);
51 SetTheme(GetProfile(1), GetTheme(0)); 49 UseCustomTheme(GetProfile(1), 0);
52 SetTheme(verifier(), GetTheme(0)); 50 UseCustomTheme(verifier(), 0);
53 51
54 ASSERT_TRUE(AwaitQuiescence()); 52 ASSERT_TRUE(AwaitQuiescence());
55 53
56 SetNativeTheme(GetProfile(0)); 54 UseNativeTheme(GetProfile(0));
57 SetNativeTheme(verifier()); 55 UseNativeTheme(verifier());
58 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); 56 ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
59 ASSERT_FALSE(UsingNativeTheme(GetProfile(1))); 57 ASSERT_FALSE(UsingNativeTheme(GetProfile(1)));
Raghu Simha 2011/04/19 04:20:05 This may or may not be false, depending on whether
akalin 2011/04/19 06:48:16 Done.
60 ASSERT_TRUE(UsingNativeTheme(verifier())); 58 ASSERT_TRUE(UsingNativeTheme(verifier()));
61 59
62 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 60 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
63 61
64 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); 62 ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
65 ASSERT_TRUE(UsingNativeTheme(GetProfile(1))); 63 ASSERT_TRUE(UsingNativeTheme(GetProfile(1)));
66 ASSERT_TRUE(UsingNativeTheme(verifier())); 64 ASSERT_TRUE(UsingNativeTheme(verifier()));
67 } 65 }
68 66
69 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, DefaultTheme) { 67 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, DefaultTheme) {
70 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 68 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
71 69
72 SetTheme(GetProfile(0), GetTheme(0)); 70 UseCustomTheme(GetProfile(0), 0);
73 SetTheme(GetProfile(1), GetTheme(0)); 71 UseCustomTheme(GetProfile(1), 0);
74 SetTheme(verifier(), GetTheme(0)); 72 UseCustomTheme(verifier(), 0);
75 73
76 ASSERT_TRUE(AwaitQuiescence()); 74 ASSERT_TRUE(AwaitQuiescence());
77 75
78 UseDefaultTheme(GetProfile(0)); 76 UseDefaultTheme(GetProfile(0));
79 UseDefaultTheme(verifier()); 77 UseDefaultTheme(verifier());
80 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); 78 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
81 ASSERT_FALSE(UsingDefaultTheme(GetProfile(1))); 79 ASSERT_FALSE(UsingDefaultTheme(GetProfile(1)));
Raghu Simha 2011/04/19 04:20:05 Same concern here, as described in the above comme
akalin 2011/04/19 06:48:16 Done.
82 ASSERT_TRUE(UsingDefaultTheme(verifier())); 80 ASSERT_TRUE(UsingDefaultTheme(verifier()));
83 81
84 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 82 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
85 83
86 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); 84 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
87 ASSERT_TRUE(UsingDefaultTheme(GetProfile(1))); 85 ASSERT_TRUE(UsingDefaultTheme(GetProfile(1)));
88 ASSERT_TRUE(UsingDefaultTheme(verifier())); 86 ASSERT_TRUE(UsingDefaultTheme(verifier()));
89 } 87 }
90 88
91 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, NativeDefaultRace) { 89 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, NativeDefaultRace) {
92 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 90 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
93 91
94 SetNativeTheme(GetProfile(0)); 92 UseNativeTheme(GetProfile(0));
95 UseDefaultTheme(GetProfile(1)); 93 UseDefaultTheme(GetProfile(1));
96 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); 94 ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
97 ASSERT_TRUE(UsingDefaultTheme(GetProfile(1))); 95 ASSERT_TRUE(UsingDefaultTheme(GetProfile(1)));
98 96
99 ASSERT_TRUE(AwaitQuiescence()); 97 ASSERT_TRUE(AwaitQuiescence());
100 98
101 // TODO(akalin): Add function that compares two profiles to see if 99 // TODO(akalin): Add function that compares two profiles to see if
102 // they're at the same state. 100 // they're at the same state.
103 101
104 ASSERT_EQ(UsingNativeTheme(GetProfile(0)), 102 ASSERT_EQ(UsingNativeTheme(GetProfile(0)),
105 UsingNativeTheme(GetProfile(1))); 103 UsingNativeTheme(GetProfile(1)));
106 ASSERT_EQ(UsingDefaultTheme(GetProfile(0)), 104 ASSERT_EQ(UsingDefaultTheme(GetProfile(0)),
107 UsingDefaultTheme(GetProfile(1))); 105 UsingDefaultTheme(GetProfile(1)));
108 } 106 }
109 107
110 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, CustomNativeRace) { 108 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, CustomNativeRace) {
111 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 109 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
112 110
113 SetTheme(GetProfile(0), GetTheme(0)); 111 UseCustomTheme(GetProfile(0), 0);
114 SetNativeTheme(GetProfile(1)); 112 UseNativeTheme(GetProfile(1));
115 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0))); 113 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
116 ASSERT_TRUE(UsingNativeTheme(GetProfile(1))); 114 ASSERT_TRUE(UsingNativeTheme(GetProfile(1)));
117 115
118 ASSERT_TRUE(AwaitQuiescence()); 116 ASSERT_TRUE(AwaitQuiescence());
119 117
120 // TODO(akalin): Add function to wait for pending extensions to be 118 // TODO(akalin): Add function to wait for pending extensions to be
121 // installed. 119 // installed.
122 120
123 ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetTheme(0)), 121 ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(0)),
124 HasOrWillHaveCustomTheme(GetProfile(1), GetTheme(0))); 122 HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0)));
125 } 123 }
126 124
127 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, CustomDefaultRace) { 125 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, CustomDefaultRace) {
128 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 126 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
129 127
130 SetTheme(GetProfile(0), GetTheme(0)); 128 UseCustomTheme(GetProfile(0), 0);
131 UseDefaultTheme(GetProfile(1)); 129 UseDefaultTheme(GetProfile(1));
132 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0))); 130 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
133 ASSERT_TRUE(UsingDefaultTheme(GetProfile(1))); 131 ASSERT_TRUE(UsingDefaultTheme(GetProfile(1)));
134 132
135 ASSERT_TRUE(AwaitQuiescence()); 133 ASSERT_TRUE(AwaitQuiescence());
136 134
137 ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetTheme(0)), 135 ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(0)),
138 HasOrWillHaveCustomTheme(GetProfile(1), GetTheme(0))); 136 HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0)));
139 } 137 }
140 138
141 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, CustomCustomRace) { 139 IN_PROC_BROWSER_TEST_F(TwoClientLiveThemesSyncTest, CustomCustomRace) {
142 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 140 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
143 141
144 // TODO(akalin): Generalize this to n clients. 142 // TODO(akalin): Generalize this to n clients.
145 143
146 SetTheme(GetProfile(0), GetTheme(0)); 144 UseCustomTheme(GetProfile(0), 0);
147 SetTheme(GetProfile(1), GetTheme(1)); 145 UseCustomTheme(GetProfile(1), 1);
148 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0))); 146 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
149 ASSERT_EQ(GetTheme(1), GetCustomTheme(GetProfile(1))); 147 ASSERT_EQ(GetCustomTheme(1), GetThemeID(GetProfile(1)));
150 148
151 ASSERT_TRUE(AwaitQuiescence()); 149 ASSERT_TRUE(AwaitQuiescence());
152 150
153 bool using_theme_0 = 151 bool using_theme_0 =
154 (GetCustomTheme(GetProfile(0)) == GetTheme(0)) && 152 (GetThemeID(GetProfile(0)) == GetCustomTheme(0)) &&
155 HasOrWillHaveCustomTheme(GetProfile(1), GetTheme(0)); 153 HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0));
156 bool using_theme_1 = 154 bool using_theme_1 =
157 HasOrWillHaveCustomTheme(GetProfile(0), GetTheme(1)) && 155 HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(1)) &&
158 (GetCustomTheme(GetProfile(1)) == GetTheme(1)); 156 (GetThemeID(GetProfile(1)) == GetCustomTheme(1));
159 157
160 // Equivalent to using_theme_0 xor using_theme_1. 158 // Equivalent to using_theme_0 xor using_theme_1.
161 ASSERT_NE(using_theme_0, using_theme_1); 159 ASSERT_NE(using_theme_0, using_theme_1);
162 } 160 }
OLDNEW
« no previous file with comments | « chrome/test/live_sync/two_client_live_extensions_sync_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698