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

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

Issue 4732005: [Sync] Added some basic extension sync integration tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed rsimha's comments Created 10 years, 1 month 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/test/live_sync/live_themes_sync_test.h" 5 #include "chrome/test/live_sync/live_themes_sync_test.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 9
10 class SingleClientLiveThemesSyncTest : public LiveThemesSyncTest { 10 class SingleClientLiveThemesSyncTest : public LiveThemesSyncTest {
11 public: 11 public:
12 SingleClientLiveThemesSyncTest() : LiveThemesSyncTest(SINGLE_CLIENT) {} 12 SingleClientLiveThemesSyncTest() : LiveThemesSyncTest(SINGLE_CLIENT) {}
13 virtual ~SingleClientLiveThemesSyncTest() {} 13 virtual ~SingleClientLiveThemesSyncTest() {}
14 14
15 private: 15 private:
16 DISALLOW_COPY_AND_ASSIGN(SingleClientLiveThemesSyncTest); 16 DISALLOW_COPY_AND_ASSIGN(SingleClientLiveThemesSyncTest);
17 }; 17 };
18 18
19 // TODO(akalin): Add tests for model association (i.e., tests that 19 // TODO(akalin): Add tests for model association (i.e., tests that
20 // start with SetupClients(), change the theme state, then call 20 // start with SetupClients(), change the theme state, then call
21 // SetupSync()). 21 // SetupSync()).
22 22
23 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, CustomTheme) { 23 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, CustomTheme) {
24 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 24 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
25 25
26 scoped_refptr<Extension> theme = GetTheme(0);
27 ASSERT_EQ(NULL, GetCustomTheme(GetProfile(0))); 26 ASSERT_EQ(NULL, GetCustomTheme(GetProfile(0)));
28 ASSERT_EQ(NULL, GetCustomTheme(verifier())); 27 ASSERT_EQ(NULL, GetCustomTheme(verifier()));
29 28
30 SetTheme(GetProfile(0), theme); 29 SetTheme(GetProfile(0), GetTheme(0));
31 SetTheme(verifier(), theme); 30 SetTheme(verifier(), GetTheme(0));
32 ASSERT_EQ(theme, GetCustomTheme(GetProfile(0))); 31 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0)));
33 ASSERT_EQ(theme, GetCustomTheme(verifier())); 32 ASSERT_EQ(GetTheme(0), GetCustomTheme(verifier()));
34 33
35 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 34 ASSERT_TRUE(AwaitQuiescence());
36 "Waiting for themes change."));
37 35
38 ASSERT_EQ(theme, GetCustomTheme(GetProfile(0))); 36 ASSERT_EQ(GetTheme(0), GetCustomTheme(GetProfile(0)));
39 ASSERT_EQ(theme, GetCustomTheme(verifier())); 37 ASSERT_EQ(GetTheme(0), GetCustomTheme(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 scoped_refptr<Extension> theme = GetTheme(0); 43 SetTheme(GetProfile(0), GetTheme(0));
46 SetTheme(GetProfile(0), theme); 44 SetTheme(verifier(), GetTheme(0));
47 SetTheme(verifier(), theme);
48 ASSERT_FALSE(UsingNativeTheme(GetProfile(0))); 45 ASSERT_FALSE(UsingNativeTheme(GetProfile(0)));
49 ASSERT_FALSE(UsingNativeTheme(verifier())); 46 ASSERT_FALSE(UsingNativeTheme(verifier()));
50 47
51 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 48 ASSERT_TRUE(AwaitQuiescence());
52 "Waiting for themes change."));
53 49
54 GetProfile(0)->SetNativeTheme(); 50 GetProfile(0)->SetNativeTheme();
55 verifier()->SetNativeTheme(); 51 verifier()->SetNativeTheme();
56 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); 52 ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
57 ASSERT_TRUE(UsingNativeTheme(verifier())); 53 ASSERT_TRUE(UsingNativeTheme(verifier()));
58 54
59 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 55 ASSERT_TRUE(AwaitQuiescence());
60 "Waiting for native theme change."));
61 56
62 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); 57 ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
63 ASSERT_TRUE(UsingNativeTheme(verifier())); 58 ASSERT_TRUE(UsingNativeTheme(verifier()));
64 } 59 }
65 60
66 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, DefaultTheme) { 61 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, DefaultTheme) {
67 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 62 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
68 63
69 scoped_refptr<Extension> theme = GetTheme(0); 64 SetTheme(GetProfile(0), GetTheme(0));
70 SetTheme(GetProfile(0), theme); 65 SetTheme(verifier(), GetTheme(0));
71 SetTheme(verifier(), theme);
72 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0))); 66 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0)));
73 ASSERT_FALSE(UsingDefaultTheme(verifier())); 67 ASSERT_FALSE(UsingDefaultTheme(verifier()));
74 68
75 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 69 ASSERT_TRUE(AwaitQuiescence());
76 "Waiting for themes change."));
77 70
78 GetProfile(0)->ClearTheme(); 71 GetProfile(0)->ClearTheme();
79 verifier()->ClearTheme(); 72 verifier()->ClearTheme();
80 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); 73 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
81 ASSERT_TRUE(UsingDefaultTheme(verifier())); 74 ASSERT_TRUE(UsingDefaultTheme(verifier()));
82 75
83 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 76 ASSERT_TRUE(AwaitQuiescence());
84 "Waiting for cleared theme change."));
85 77
86 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); 78 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
87 ASSERT_TRUE(UsingDefaultTheme(verifier())); 79 ASSERT_TRUE(UsingDefaultTheme(verifier()));
88 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698