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

Side by Side Diff: chrome/browser/themes/theme_syncable_service_unittest.cc

Issue 1229953004: [Sync] Give custom themes priority over default themes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/themes/theme_syncable_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/browser/themes/theme_syncable_service.h" 5 #include "chrome/browser/themes/theme_syncable_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 ->MergeDataAndStartSyncing( 299 ->MergeDataAndStartSyncing(
300 syncer::THEMES, 300 syncer::THEMES,
301 MakeThemeDataList(sync_pb::ThemeSpecifics()), 301 MakeThemeDataList(sync_pb::ThemeSpecifics()),
302 scoped_ptr<syncer::SyncChangeProcessor>( 302 scoped_ptr<syncer::SyncChangeProcessor>(
303 new syncer::SyncChangeProcessorWrapperForTest( 303 new syncer::SyncChangeProcessorWrapperForTest(
304 fake_change_processor_.get())), 304 fake_change_processor_.get())),
305 scoped_ptr<syncer::SyncErrorFactory>( 305 scoped_ptr<syncer::SyncErrorFactory>(
306 new syncer::SyncErrorFactoryMock())) 306 new syncer::SyncErrorFactoryMock()))
307 .error(); 307 .error();
308 EXPECT_FALSE(error.IsSet()) << error.message(); 308 EXPECT_FALSE(error.IsSet()) << error.message();
309 EXPECT_TRUE(fake_theme_service_->UsingDefaultTheme()); 309 EXPECT_FALSE(fake_theme_service_->UsingDefaultTheme());
310 EXPECT_EQ(fake_theme_service_->theme_extension(), theme_extension_.get());
310 } 311 }
311 312
312 TEST_F(ThemeSyncableServiceTest, SetCurrentThemeSystemTheme) { 313 TEST_F(ThemeSyncableServiceTest, SetCurrentThemeSystemTheme) {
313 sync_pb::ThemeSpecifics theme_specifics; 314 sync_pb::ThemeSpecifics theme_specifics;
314 theme_specifics.set_use_system_theme_by_default(true); 315 theme_specifics.set_use_system_theme_by_default(true);
315 316
316 // Set up theme service to use custom theme. 317 // Set up theme service to use custom theme.
317 fake_theme_service_->SetTheme(theme_extension_.get()); 318 fake_theme_service_->SetTheme(theme_extension_.get());
318 syncer::SyncError error = 319 syncer::SyncError error =
319 theme_sync_service_ 320 theme_sync_service_
320 ->MergeDataAndStartSyncing( 321 ->MergeDataAndStartSyncing(
321 syncer::THEMES, 322 syncer::THEMES,
322 MakeThemeDataList(theme_specifics), 323 MakeThemeDataList(theme_specifics),
323 scoped_ptr<syncer::SyncChangeProcessor>( 324 scoped_ptr<syncer::SyncChangeProcessor>(
324 new syncer::SyncChangeProcessorWrapperForTest( 325 new syncer::SyncChangeProcessorWrapperForTest(
325 fake_change_processor_.get())), 326 fake_change_processor_.get())),
326 scoped_ptr<syncer::SyncErrorFactory>( 327 scoped_ptr<syncer::SyncErrorFactory>(
327 new syncer::SyncErrorFactoryMock())) 328 new syncer::SyncErrorFactoryMock()))
328 .error(); 329 .error();
329 EXPECT_FALSE(error.IsSet()) << error.message(); 330 EXPECT_FALSE(error.IsSet()) << error.message();
330 EXPECT_TRUE(fake_theme_service_->UsingSystemTheme()); 331 EXPECT_FALSE(fake_theme_service_->UsingSystemTheme());
332 EXPECT_EQ(fake_theme_service_->theme_extension(), theme_extension_.get());
331 } 333 }
332 334
333 TEST_F(ThemeSyncableServiceTest, SetCurrentThemeCustomTheme) { 335 TEST_F(ThemeSyncableServiceTest, SetCurrentThemeCustomTheme) {
334 sync_pb::ThemeSpecifics theme_specifics; 336 sync_pb::ThemeSpecifics theme_specifics;
335 theme_specifics.set_use_custom_theme(true); 337 theme_specifics.set_use_custom_theme(true);
336 theme_specifics.set_custom_theme_id(theme_extension_->id()); 338 theme_specifics.set_custom_theme_id(theme_extension_->id());
337 theme_specifics.set_custom_theme_name(kCustomThemeName); 339 theme_specifics.set_custom_theme_name(kCustomThemeName);
338 theme_specifics.set_custom_theme_name(kCustomThemeUrl); 340 theme_specifics.set_custom_theme_name(kCustomThemeUrl);
339 341
340 // Set up theme service to use default theme. 342 // Set up theme service to use default theme.
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 655
654 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { 656 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) {
655 // Set up theme service to use custom theme that was installed by policy. 657 // Set up theme service to use custom theme that was installed by policy.
656 fake_theme_service_->SetTheme(theme_extension_.get()); 658 fake_theme_service_->SetTheme(theme_extension_.get());
657 659
658 syncer::SyncDataList data_list = 660 syncer::SyncDataList data_list =
659 theme_sync_service_->GetAllSyncData(syncer::THEMES); 661 theme_sync_service_->GetAllSyncData(syncer::THEMES);
660 662
661 ASSERT_EQ(0u, data_list.size()); 663 ASSERT_EQ(0u, data_list.size());
662 } 664 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_syncable_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698