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

Unified Diff: chrome/browser/sync/test/integration/two_client_themes_sync_test.cc

Issue 395503004: sync: Refactor themes sync integration tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable self-notifications Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/test/integration/themes_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/test/integration/two_client_themes_sync_test.cc
diff --git a/chrome/browser/sync/test/integration/two_client_themes_sync_test.cc b/chrome/browser/sync/test/integration/two_client_themes_sync_test.cc
index 260e6a4f592cafe052dbf4fa900a7a4d88606495..fc31a4e44b6817ae44151ed900b51ad0cd7d199d 100644
--- a/chrome/browser/sync/test/integration/two_client_themes_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_themes_sync_test.cc
@@ -8,11 +8,11 @@
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/themes_helper.h"
-using sync_integration_test_util::AwaitCommitActivityCompletion;
+using themes_helper::AwaitThemeIsPendingInstall;
+using themes_helper::AwaitUsingSystemTheme;
+using themes_helper::AwaitUsingDefaultTheme;
using themes_helper::GetCustomTheme;
using themes_helper::GetThemeID;
-using themes_helper::HasOrWillHaveCustomTheme;
-using themes_helper::ThemeIsPendingInstall;
using themes_helper::UseCustomTheme;
using themes_helper::UseDefaultTheme;
using themes_helper::UseSystemTheme;
@@ -25,26 +25,19 @@ class TwoClientThemesSyncTest : public SyncTest {
TwoClientThemesSyncTest() : SyncTest(TWO_CLIENT) {}
virtual ~TwoClientThemesSyncTest() {}
- private:
- DISALLOW_COPY_AND_ASSIGN(TwoClientThemesSyncTest);
-};
-
-class LegacyTwoClientThemesSyncTest : public SyncTest {
- public:
- LegacyTwoClientThemesSyncTest() : SyncTest(TWO_CLIENT_LEGACY) {}
- virtual ~LegacyTwoClientThemesSyncTest() {}
+ virtual bool TestUsesSelfNotifications() OVERRIDE {
+ return false;
+ }
private:
- DISALLOW_COPY_AND_ASSIGN(LegacyTwoClientThemesSyncTest);
+ DISALLOW_COPY_AND_ASSIGN(TwoClientThemesSyncTest);
};
-// TODO(akalin): Add tests for model association (i.e., tests that
-// start with SetupClients(), change the theme state, then call
-// SetupSync()).
-
-// TCM ID - 3667311.
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomTheme) {
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+// Starts with default themes, then sets up sync and uses it to set all
+// profiles to use a custom theme. Does not actually install any themes, but
+// instead verifies the custom theme is pending for install.
+IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DefaultThenSyncCustom) {
+ ASSERT_TRUE(SetupSync());
ASSERT_FALSE(UsingCustomTheme(GetProfile(0)));
ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
@@ -55,203 +48,94 @@ IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomTheme) {
ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
- ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
-
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
- // TODO(akalin): Add functions to simulate when a pending extension
+ // TODO(sync): Add functions to simulate when a pending extension
// is installed as well as when a pending extension fails to
// install.
- ASSERT_TRUE(ThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
+ ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
+
+ EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
+ EXPECT_FALSE(UsingCustomTheme(GetProfile(1)));
+ EXPECT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
}
-// TCM ID - 3599303.
-// TODO(sync): Fails on Chrome OS. See http://crbug.com/84575.
-#if defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DISABLED_NativeTheme) {
-#else
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, NativeTheme) {
-#endif // OS_CHROMEOS
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+// Starts with custom themes, then sets up sync and uses it to set all profiles
+// to the system theme.
+IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomThenSyncNative) {
+ ASSERT_TRUE(SetupClients());
UseCustomTheme(GetProfile(0), 0);
UseCustomTheme(GetProfile(1), 0);
UseCustomTheme(verifier(), 0);
- ASSERT_TRUE(AwaitQuiescence());
+ ASSERT_TRUE(SetupSync());
UseSystemTheme(GetProfile(0));
UseSystemTheme(verifier());
ASSERT_TRUE(UsingSystemTheme(GetProfile(0)));
ASSERT_TRUE(UsingSystemTheme(verifier()));
- ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ ASSERT_TRUE(AwaitUsingSystemTheme(GetProfile(1)));
- ASSERT_TRUE(UsingSystemTheme(GetProfile(0)));
- ASSERT_TRUE(UsingSystemTheme(GetProfile(1)));
- ASSERT_TRUE(UsingSystemTheme(verifier()));
+ EXPECT_TRUE(UsingSystemTheme(GetProfile(0)));
+ EXPECT_TRUE(UsingSystemTheme(GetProfile(1)));
+ EXPECT_TRUE(UsingSystemTheme(verifier()));
}
-// TCM ID - 7247455.
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DefaultTheme) {
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+// Starts with custom themes, then sets up sync and uses it to set all profiles
+// to the default theme.
+IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomThenSyncDefault) {
+ ASSERT_TRUE(SetupClients());
UseCustomTheme(GetProfile(0), 0);
UseCustomTheme(GetProfile(1), 0);
UseCustomTheme(verifier(), 0);
- ASSERT_TRUE(AwaitQuiescence());
+ ASSERT_TRUE(SetupSync());
UseDefaultTheme(GetProfile(0));
UseDefaultTheme(verifier());
- ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
- ASSERT_TRUE(UsingDefaultTheme(verifier()));
-
- ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
-
- ASSERT_TRUE(UsingDefaultTheme(GetProfile(0)));
- ASSERT_TRUE(UsingDefaultTheme(GetProfile(1)));
- ASSERT_TRUE(UsingDefaultTheme(verifier()));
-}
-
-// TCM ID - 7292065.
-// TODO(sync): Fails on Chrome OS. See http://crbug.com/84575.
-// TODO(erg): Fails on linux_aura. See http://crbug.com/304554
-#if defined(OS_CHROMEOS) || defined(OS_LINUX)
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DISABLED_NativeDefaultRace) {
-#else
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, NativeDefaultRace) {
-#endif // OS_CHROMEOS
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
-
- UseSystemTheme(GetProfile(0));
- UseDefaultTheme(GetProfile(1));
- ASSERT_TRUE(UsingSystemTheme(GetProfile(0)));
- ASSERT_TRUE(UsingDefaultTheme(GetProfile(1)));
-
- ASSERT_TRUE(AwaitQuiescence());
-
- // TODO(akalin): Add function that compares two profiles to see if
- // they're at the same state.
-
- ASSERT_EQ(UsingSystemTheme(GetProfile(0)),
- UsingSystemTheme(GetProfile(1)));
- ASSERT_EQ(UsingDefaultTheme(GetProfile(0)),
- UsingDefaultTheme(GetProfile(1)));
-}
-
-// TCM ID - 7294077.
-// TODO(sync): Fails on Chrome OS. See http://crbug.com/84575.
-#if defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DISABLED_CustomNativeRace) {
-#else
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomNativeRace) {
-#endif // OS_CHROMEOS
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
-
- UseCustomTheme(GetProfile(0), 0);
- UseSystemTheme(GetProfile(1));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_TRUE(UsingSystemTheme(GetProfile(1)));
-
- ASSERT_TRUE(AwaitQuiescence());
-
- // TODO(akalin): Add function to wait for pending extensions to be
- // installed.
-
- ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(0)),
- HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0)));
-}
-
-// TCM ID - 7307225.
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomDefaultRace) {
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
-
- UseCustomTheme(GetProfile(0), 0);
- UseDefaultTheme(GetProfile(1));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_TRUE(UsingDefaultTheme(GetProfile(1)));
-
- ASSERT_TRUE(AwaitQuiescence());
+ EXPECT_TRUE(UsingDefaultTheme(GetProfile(0)));
+ EXPECT_TRUE(UsingDefaultTheme(verifier()));
- ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(0)),
- HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0)));
+ ASSERT_TRUE(AwaitUsingDefaultTheme(GetProfile(1)));
+ EXPECT_TRUE(UsingDefaultTheme(GetProfile(0)));
+ EXPECT_TRUE(UsingDefaultTheme(GetProfile(1)));
+ EXPECT_TRUE(UsingDefaultTheme(verifier()));
}
-// TCM ID - 7264758.
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomCustomRace) {
+// Cycles through a set of options.
+//
+// Most other tests have significant coverage of model association. This test
+// is intended to test steady-state scenarios.
+IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CycleOptions) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
- // TODO(akalin): Generalize this to n clients.
-
- UseCustomTheme(GetProfile(0), 0);
- UseCustomTheme(GetProfile(1), 1);
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_EQ(GetCustomTheme(1), GetThemeID(GetProfile(1)));
-
- ASSERT_TRUE(AwaitQuiescence());
-
- bool using_theme_0 =
- (GetThemeID(GetProfile(0)) == GetCustomTheme(0)) &&
- HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0));
- bool using_theme_1 =
- HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(1)) &&
- (GetThemeID(GetProfile(1)) == GetCustomTheme(1));
-
- // Equivalent to using_theme_0 xor using_theme_1.
- ASSERT_NE(using_theme_0, using_theme_1);
-}
-
-// TCM ID - 3723272.
-IN_PROC_BROWSER_TEST_F(LegacyTwoClientThemesSyncTest, DisableThemes) {
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
-
- ASSERT_FALSE(UsingCustomTheme(GetProfile(0)));
- ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
- ASSERT_FALSE(UsingCustomTheme(verifier()));
-
- ASSERT_TRUE(GetClient(1)->DisableSyncForDatatype(syncer::THEMES));
UseCustomTheme(GetProfile(0), 0);
UseCustomTheme(verifier(), 0);
- ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
-
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
-
- ASSERT_TRUE(GetClient(1)->EnableSyncForDatatype(syncer::THEMES));
- ASSERT_TRUE(AwaitQuiescence());
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
- ASSERT_TRUE(ThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
-}
+ ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
+ EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
+ EXPECT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
-// TCM ID - 3687288.
-IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DisableSync) {
- ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+ UseSystemTheme(GetProfile(0));
+ UseSystemTheme(verifier());
- ASSERT_FALSE(UsingCustomTheme(GetProfile(0)));
- ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
- ASSERT_FALSE(UsingCustomTheme(verifier()));
+ ASSERT_TRUE(AwaitUsingSystemTheme(GetProfile(1)));
+ EXPECT_TRUE(UsingSystemTheme(GetProfile(0)));
+ EXPECT_TRUE(UsingSystemTheme(GetProfile(1)));
+ EXPECT_TRUE(UsingSystemTheme(verifier()));
- ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes());
- UseCustomTheme(GetProfile(0), 0);
- UseCustomTheme(verifier(), 0);
- ASSERT_TRUE(
- AwaitCommitActivityCompletion(GetSyncService((0))));
-
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
+ UseDefaultTheme(GetProfile(0));
+ UseDefaultTheme(verifier());
- ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
- ASSERT_TRUE(AwaitQuiescence());
+ ASSERT_TRUE(AwaitUsingDefaultTheme(GetProfile(1)));
+ EXPECT_TRUE(UsingDefaultTheme(GetProfile(0)));
+ EXPECT_TRUE(UsingDefaultTheme(GetProfile(1)));
+ EXPECT_TRUE(UsingDefaultTheme(verifier()));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
- ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
- ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
- ASSERT_TRUE(ThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
+ UseCustomTheme(GetProfile(0), 1);
+ UseCustomTheme(verifier(), 1);
+ ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(1)));
+ EXPECT_EQ(GetCustomTheme(1), GetThemeID(GetProfile(0)));
+ EXPECT_EQ(GetCustomTheme(1), GetThemeID(verifier()));
}
« no previous file with comments | « chrome/browser/sync/test/integration/themes_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698