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

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: Fixed whitespace 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());
25 25
26 scoped_refptr<Extension> theme = GetTheme(0); 26 scoped_refptr<Extension> theme = MakeTheme();
27 ASSERT_EQ(NULL, GetCustomTheme(GetProfile(0))); 27 ASSERT_EQ(NULL, GetCustomTheme(GetProfile(0)));
28 ASSERT_EQ(NULL, GetCustomTheme(verifier())); 28 ASSERT_EQ(NULL, GetCustomTheme(verifier()));
29 29
30 SetTheme(GetProfile(0), theme); 30 SetTheme(GetProfile(0), theme);
31 SetTheme(verifier(), theme); 31 SetTheme(verifier(), theme);
32 ASSERT_EQ(theme, GetCustomTheme(GetProfile(0))); 32 ASSERT_EQ(theme, GetCustomTheme(GetProfile(0)));
33 ASSERT_EQ(theme, GetCustomTheme(verifier())); 33 ASSERT_EQ(theme, GetCustomTheme(verifier()));
34 34
35 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 35 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion(
36 "Waiting for themes change.")); 36 "Waiting for themes change."));
37 37
38 ASSERT_EQ(theme, GetCustomTheme(GetProfile(0))); 38 ASSERT_EQ(theme, GetCustomTheme(GetProfile(0)));
39 ASSERT_EQ(theme, GetCustomTheme(verifier())); 39 ASSERT_EQ(theme, GetCustomTheme(verifier()));
40 } 40 }
41 41
42 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, NativeTheme) { 42 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, NativeTheme) {
43 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 43 ASSERT_TRUE(SetupSync());
44 44
45 scoped_refptr<Extension> theme = GetTheme(0); 45 scoped_refptr<Extension> theme = MakeTheme();
46 SetTheme(GetProfile(0), theme); 46 SetTheme(GetProfile(0), theme);
47 SetTheme(verifier(), theme); 47 SetTheme(verifier(), theme);
48 ASSERT_FALSE(UsingNativeTheme(GetProfile(0))); 48 ASSERT_FALSE(UsingNativeTheme(GetProfile(0)));
49 ASSERT_FALSE(UsingNativeTheme(verifier())); 49 ASSERT_FALSE(UsingNativeTheme(verifier()));
50 50
51 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 51 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion(
52 "Waiting for themes change.")); 52 "Waiting for themes change."));
53 53
54 GetProfile(0)->SetNativeTheme(); 54 GetProfile(0)->SetNativeTheme();
55 verifier()->SetNativeTheme(); 55 verifier()->SetNativeTheme();
56 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); 56 ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
57 ASSERT_TRUE(UsingNativeTheme(verifier())); 57 ASSERT_TRUE(UsingNativeTheme(verifier()));
58 58
59 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 59 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion(
60 "Waiting for native theme change.")); 60 "Waiting for native theme change."));
61 61
62 ASSERT_TRUE(UsingNativeTheme(GetProfile(0))); 62 ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
63 ASSERT_TRUE(UsingNativeTheme(verifier())); 63 ASSERT_TRUE(UsingNativeTheme(verifier()));
64 } 64 }
65 65
66 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, DefaultTheme) { 66 IN_PROC_BROWSER_TEST_F(SingleClientLiveThemesSyncTest, DefaultTheme) {
67 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 67 ASSERT_TRUE(SetupSync());
68 68
69 scoped_refptr<Extension> theme = GetTheme(0); 69 scoped_refptr<Extension> theme = MakeTheme();
70 SetTheme(GetProfile(0), theme); 70 SetTheme(GetProfile(0), theme);
71 SetTheme(verifier(), theme); 71 SetTheme(verifier(), theme);
72 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0))); 72 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0)));
73 ASSERT_FALSE(UsingDefaultTheme(verifier())); 73 ASSERT_FALSE(UsingDefaultTheme(verifier()));
74 74
75 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 75 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion(
76 "Waiting for themes change.")); 76 "Waiting for themes change."));
77 77
78 GetProfile(0)->ClearTheme(); 78 GetProfile(0)->ClearTheme();
79 verifier()->ClearTheme(); 79 verifier()->ClearTheme();
80 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); 80 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
81 ASSERT_TRUE(UsingDefaultTheme(verifier())); 81 ASSERT_TRUE(UsingDefaultTheme(verifier()));
82 82
83 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion( 83 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion(
84 "Waiting for cleared theme change.")); 84 "Waiting for cleared theme change."));
85 85
86 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); 86 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
87 ASSERT_TRUE(UsingDefaultTheme(verifier())); 87 ASSERT_TRUE(UsingDefaultTheme(verifier()));
88 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698