[sql] Remove _HAS_EXCEPTIONS=0 from build info.
[chromium-blink-merge.git] / chrome / browser / sync / test / integration / two_client_extensions_sync_test.cc
blob6997b55d1481a15b42fd34225aa41ac674755e18
1 // Copyright (c) 2012 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.
5 #include "base/basictypes.h"
6 #include "chrome/browser/sync/test/integration/extensions_helper.h"
7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
9 #include "chrome/browser/sync/test/integration/sync_test.h"
11 using extensions_helper::AwaitAllProfilesHaveSameExtensions;
12 using extensions_helper::AllProfilesHaveSameExtensions;
13 using extensions_helper::DisableExtension;
14 using extensions_helper::EnableExtension;
15 using extensions_helper::HasSameExtensions;
16 using extensions_helper::IncognitoDisableExtension;
17 using extensions_helper::IncognitoEnableExtension;
18 using extensions_helper::InstallExtension;
19 using extensions_helper::UninstallExtension;
21 class TwoClientExtensionsSyncTest : public SyncTest {
22 public:
23 TwoClientExtensionsSyncTest() : SyncTest(TWO_CLIENT) {}
25 ~TwoClientExtensionsSyncTest() override {}
26 bool TestUsesSelfNotifications() override { return false; }
28 private:
29 DISALLOW_COPY_AND_ASSIGN(TwoClientExtensionsSyncTest);
32 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest,
33 StartWithNoExtensions_E2ETest) {
34 ASSERT_TRUE(SetupSync());
35 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
38 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest,
39 StartWithSameExtensions_E2ETest) {
40 ASSERT_TRUE(SetupClients());
42 const int kNumExtensions = 5;
43 for (int i = 0; i < kNumExtensions; ++i) {
44 InstallExtension(GetProfile(0), i);
45 InstallExtension(GetProfile(1), i);
48 ASSERT_TRUE(SetupSync());
49 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
52 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest,
53 StartWithDifferentExtensions_E2ETest) {
54 ASSERT_TRUE(SetupClients());
56 int i = 0;
58 const int kNumCommonExtensions = 5;
59 for (int j = 0; j < kNumCommonExtensions; ++i, ++j) {
60 InstallExtension(GetProfile(0), i);
61 InstallExtension(GetProfile(1), i);
64 const int kNumProfile0Extensions = 10;
65 for (int j = 0; j < kNumProfile0Extensions; ++i, ++j) {
66 InstallExtension(GetProfile(0), i);
69 const int kNumProfile1Extensions = 10;
70 for (int j = 0; j < kNumProfile1Extensions; ++i, ++j) {
71 InstallExtension(GetProfile(1), i);
74 ASSERT_TRUE(SetupSync());
75 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
78 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest,
79 InstallDifferentExtensions_E2ETest) {
80 ASSERT_TRUE(SetupClients());
82 int i = 0;
84 const int kNumCommonExtensions = 5;
85 for (int j = 0; j < kNumCommonExtensions; ++i, ++j) {
86 InstallExtension(GetProfile(0), i);
87 InstallExtension(GetProfile(1), i);
90 ASSERT_TRUE(SetupSync());
91 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
93 const int kNumProfile0Extensions = 10;
94 for (int j = 0; j < kNumProfile0Extensions; ++i, ++j) {
95 InstallExtension(GetProfile(0), i);
98 const int kNumProfile1Extensions = 10;
99 for (int j = 0; j < kNumProfile1Extensions; ++i, ++j) {
100 InstallExtension(GetProfile(1), i);
103 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
106 // TCM ID - 3637311.
107 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest, Add_E2ETest) {
108 ASSERT_TRUE(SetupSync());
109 ASSERT_TRUE(AllProfilesHaveSameExtensions());
111 InstallExtension(GetProfile(0), 0);
113 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
116 // TCM ID - 3724281.
117 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest, Uninstall) {
118 ASSERT_TRUE(SetupSync());
119 ASSERT_TRUE(AllProfilesHaveSameExtensions());
121 InstallExtension(GetProfile(0), 0);
122 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
124 UninstallExtension(GetProfile(0), 0);
125 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
128 // TCM ID - 3605300.
129 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest,
130 UpdateEnableDisableExtension) {
131 ASSERT_TRUE(SetupSync());
132 ASSERT_TRUE(AllProfilesHaveSameExtensions());
134 InstallExtension(GetProfile(0), 0);
135 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
137 DisableExtension(GetProfile(0), 0);
138 ASSERT_FALSE(HasSameExtensions(0, 1));
140 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
142 EnableExtension(GetProfile(1), 0);
143 ASSERT_FALSE(HasSameExtensions(0, 1));
145 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
148 // TCM ID - 3728322.
149 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest,
150 UpdateIncognitoEnableDisable) {
151 ASSERT_TRUE(SetupSync());
152 ASSERT_TRUE(AllProfilesHaveSameExtensions());
154 InstallExtension(GetProfile(0), 0);
155 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
157 IncognitoEnableExtension(GetProfile(0), 0);
158 ASSERT_FALSE(HasSameExtensions(0, 1));
160 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
162 IncognitoDisableExtension(GetProfile(1), 0);
163 ASSERT_FALSE(HasSameExtensions(0, 1));
165 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
168 // Regression test for bug 104399: ensure that an extension installed prior to
169 // setting up sync, when uninstalled, is also uninstalled from sync.
170 IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest,
171 UninstallPreinstalledExtensions) {
172 ASSERT_TRUE(SetupClients());
173 ASSERT_TRUE(AllProfilesHaveSameExtensions());
175 InstallExtension(GetProfile(0), 0);
177 ASSERT_TRUE(SetupSync());
179 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
181 UninstallExtension(GetProfile(0), 0);
183 ASSERT_TRUE(AwaitAllProfilesHaveSameExtensions());
186 // TODO(akalin): Add tests exercising:
187 // - Offline installation/uninstallation behavior