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

Unified Diff: chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc

Issue 12033093: sync: Implementation of Priority Preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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
Index: chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc
index 7e30fca3a70254d07b4297abd32e86148e04321c..57125dd7a4cf55e5c6b5a3bf63488a305d27541d 100644
--- a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc
+++ b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc
@@ -18,6 +18,7 @@
using browser_sync::DataTypeController;
using content::BrowserThread;
+using syncer::FullModelTypeSet;
class ProfileSyncComponentsFactoryImplTest : public testing::Test {
protected:
@@ -45,6 +46,7 @@ class ProfileSyncComponentsFactoryImplTest : public testing::Test {
datatypes.push_back(syncer::EXTENSION_SETTINGS);
datatypes.push_back(syncer::PASSWORDS);
datatypes.push_back(syncer::PREFERENCES);
+ datatypes.push_back(syncer::PRIORITY_PREFERENCES);
datatypes.push_back(syncer::SEARCH_ENGINES);
datatypes.push_back(syncer::SESSIONS);
datatypes.push_back(syncer::PROXY_TABS);
@@ -59,15 +61,19 @@ class ProfileSyncComponentsFactoryImplTest : public testing::Test {
}
// Asserts that all the default datatypes are in |map|, except
- // for |exception_type|, which unless it is UNDEFINED, is asserted to
+ // for |exception_types|, which unless are UNDEFINED, are asserted to
// not be in |map|.
static void CheckDefaultDatatypesInMapExcept(
DataTypeController::StateMap* map,
- syncer::ModelType exception_type) {
+ FullModelTypeSet exception_types) {
+ DCHECK(exception_types.Size() == 1 ||
+ !exception_types.Has(syncer::UNSPECIFIED));
+
std::vector<syncer::ModelType> defaults = DefaultDatatypes();
std::vector<syncer::ModelType>::iterator iter;
for (iter = defaults.begin(); iter != defaults.end(); ++iter) {
- if (exception_type != syncer::UNSPECIFIED && exception_type == *iter)
+ if (!exception_types.Has(syncer::UNSPECIFIED) &&
+ exception_types.Has(*iter))
EXPECT_EQ(0U, map->count(*iter))
<< *iter << " found in dataypes map, shouldn't be there.";
else
@@ -80,6 +86,11 @@ class ProfileSyncComponentsFactoryImplTest : public testing::Test {
// all types are enabled except for |type|, which is disabled.
void TestSwitchDisablesType(const char* cmd_switch,
syncer::ModelType type) {
+ TestSwitchDisablesType(cmd_switch, FullModelTypeSet(type));
+ }
+
+ void TestSwitchDisablesType(const char* cmd_switch,
+ FullModelTypeSet types) {
command_line_->AppendSwitch(cmd_switch);
scoped_ptr<ProfileSyncService> pss(
new ProfileSyncService(
@@ -91,8 +102,8 @@ class ProfileSyncComponentsFactoryImplTest : public testing::Test {
pss->factory()->RegisterDataTypes(pss.get());
DataTypeController::StateMap controller_states;
pss->GetDataTypeControllerStates(&controller_states);
- EXPECT_EQ(DefaultDatatypesCount() - 1, controller_states.size());
- CheckDefaultDatatypesInMapExcept(&controller_states, type);
+ EXPECT_EQ(DefaultDatatypesCount() - types.Size(), controller_states.size());
+ CheckDefaultDatatypesInMapExcept(&controller_states, types);
}
MessageLoop message_loop_;
@@ -113,7 +124,9 @@ TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) {
DataTypeController::StateMap controller_states;
pss->GetDataTypeControllerStates(&controller_states);
EXPECT_EQ(DefaultDatatypesCount(), controller_states.size());
- CheckDefaultDatatypesInMapExcept(&controller_states, syncer::UNSPECIFIED);
+ CheckDefaultDatatypesInMapExcept(
+ &controller_states,
+ FullModelTypeSet(syncer::UNSPECIFIED));
}
TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableAutofill) {
@@ -128,7 +141,8 @@ TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableBookmarks) {
TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisablePreferences) {
TestSwitchDisablesType(switches::kDisableSyncPreferences,
- syncer::PREFERENCES);
+ FullModelTypeSet(syncer::PREFERENCES,
+ syncer::PRIORITY_PREFERENCES));
}
TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableThemes) {

Powered by Google App Engine
This is Rietveld 408576698