This source file includes following definitions.
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "base/basictypes.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#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::GetCustomTheme;
using themes_helper::GetThemeID;
using themes_helper::HasOrWillHaveCustomTheme;
using themes_helper::ThemeIsPendingInstall;
using themes_helper::UseCustomTheme;
using themes_helper::UseDefaultTheme;
using themes_helper::UseNativeTheme;
using themes_helper::UsingCustomTheme;
using themes_helper::UsingDefaultTheme;
using themes_helper::UsingNativeTheme;
class TwoClientThemesSyncTest : public SyncTest {
public:
TwoClientThemesSyncTest() : SyncTest(TWO_CLIENT) {}
virtual ~TwoClientThemesSyncTest() {}
private:
DISALLOW_COPY_AND_ASSIGN(TwoClientThemesSyncTest);
};
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomTheme) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_FALSE(UsingCustomTheme(GetProfile(0)));
ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
ASSERT_FALSE(UsingCustomTheme(verifier()));
UseCustomTheme(GetProfile(0), 0);
UseCustomTheme(verifier(), 0);
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)));
ASSERT_TRUE(ThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
}
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DISABLED_NativeTheme) {
#else
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, NativeTheme) {
#endif
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
UseCustomTheme(GetProfile(0), 0);
UseCustomTheme(GetProfile(1), 0);
UseCustomTheme(verifier(), 0);
ASSERT_TRUE(AwaitQuiescence());
UseNativeTheme(GetProfile(0));
UseNativeTheme(verifier());
ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
ASSERT_TRUE(UsingNativeTheme(verifier()));
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
ASSERT_TRUE(UsingNativeTheme(GetProfile(1)));
ASSERT_TRUE(UsingNativeTheme(verifier()));
}
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DefaultTheme) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
UseCustomTheme(GetProfile(0), 0);
UseCustomTheme(GetProfile(1), 0);
UseCustomTheme(verifier(), 0);
ASSERT_TRUE(AwaitQuiescence());
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()));
}
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DISABLED_NativeDefaultRace) {
#else
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, NativeDefaultRace) {
#endif
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
UseNativeTheme(GetProfile(0));
UseDefaultTheme(GetProfile(1));
ASSERT_TRUE(UsingNativeTheme(GetProfile(0)));
ASSERT_TRUE(UsingDefaultTheme(GetProfile(1)));
ASSERT_TRUE(AwaitQuiescence());
ASSERT_EQ(UsingNativeTheme(GetProfile(0)),
UsingNativeTheme(GetProfile(1)));
ASSERT_EQ(UsingDefaultTheme(GetProfile(0)),
UsingDefaultTheme(GetProfile(1)));
}
#if defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DISABLED_CustomNativeRace) {
#else
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomNativeRace) {
#endif
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
UseCustomTheme(GetProfile(0), 0);
UseNativeTheme(GetProfile(1));
ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
ASSERT_TRUE(UsingNativeTheme(GetProfile(1)));
ASSERT_TRUE(AwaitQuiescence());
ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(0)),
HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0)));
}
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());
ASSERT_EQ(HasOrWillHaveCustomTheme(GetProfile(0), GetCustomTheme(0)),
HasOrWillHaveCustomTheme(GetProfile(1), GetCustomTheme(0)));
}
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomCustomRace) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
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));
ASSERT_NE(using_theme_0, using_theme_1);
}
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, 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()));
}
IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DisableSync) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_FALSE(UsingCustomTheme(GetProfile(0)));
ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
ASSERT_FALSE(UsingCustomTheme(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()));
ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
ASSERT_TRUE(AwaitQuiescence());
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)));
}