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

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

Issue 1379133004: themes: Remove usage of TOOLKIT_GTK define. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 static const char kCustomThemeName[] = "name"; 47 static const char kCustomThemeName[] = "name";
48 static const char kCustomThemeUrl[] = "http://update.url/foo"; 48 static const char kCustomThemeUrl[] = "http://update.url/foo";
49 49
50 #if defined(OS_WIN) 50 #if defined(OS_WIN)
51 const base::FilePath::CharType kExtensionFilePath[] = 51 const base::FilePath::CharType kExtensionFilePath[] =
52 FILE_PATH_LITERAL("c:\\foo"); 52 FILE_PATH_LITERAL("c:\\foo");
53 #elif defined(OS_POSIX) 53 #elif defined(OS_POSIX)
54 const base::FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("/oo"); 54 const base::FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("/oo");
55 #endif 55 #endif
56 56
57 class FakeThemeService : public ThemeService { 57 class FakeThemeService : public ThemeService {
pkotwicz 2015/10/06 16:56:34 FakeThemeService should override ThemeService::IsS
tfarina 2015/10/25 02:43:24 Done.
58 public: 58 public:
59 FakeThemeService() : 59 FakeThemeService() :
60 using_system_theme_(false), 60 using_system_theme_(false),
61 using_default_theme_(false), 61 using_default_theme_(false),
62 theme_extension_(NULL), 62 theme_extension_(NULL),
63 is_dirty_(false) {} 63 is_dirty_(false) {}
64 64
65 // ThemeService implementation 65 // ThemeService implementation
66 void SetTheme(const extensions::Extension* extension) override { 66 void SetTheme(const extensions::Extension* extension) override {
67 is_dirty_ = true; 67 is_dirty_ = true;
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // use_system_theme_by_default bit should be preserved. 561 // use_system_theme_by_default bit should be preserved.
562 fake_theme_service_->SetTheme(theme_extension_.get()); 562 fake_theme_service_->SetTheme(theme_extension_.get());
563 theme_sync_service_->OnThemeChange(); 563 theme_sync_service_->OnThemeChange();
564 const syncer::SyncChangeList& changes = fake_change_processor_->changes(); 564 const syncer::SyncChangeList& changes = fake_change_processor_->changes();
565 EXPECT_EQ(1u, changes.size()); 565 EXPECT_EQ(1u, changes.size());
566 const sync_pb::ThemeSpecifics& change_specifics = 566 const sync_pb::ThemeSpecifics& change_specifics =
567 changes[0].sync_data().GetSpecifics().theme(); 567 changes[0].sync_data().GetSpecifics().theme();
568 EXPECT_TRUE(change_specifics.use_system_theme_by_default()); 568 EXPECT_TRUE(change_specifics.use_system_theme_by_default());
569 } 569 }
570 570
571 #if defined(TOOLKIT_GTK)
572 TEST_F(ThemeSyncableServiceTest, 571 TEST_F(ThemeSyncableServiceTest,
573 GtkUpdateSystemThemeBitWhenChangeBetweenSystemAndDefault) { 572 DISABLED_GtkUpdateSystemThemeBitWhenChangeBetweenSystemAndDefault) {
tfarina 2015/10/05 23:32:02 Is this OK? I was not sure what to use instead.
574 // Initialize to use native theme. 573 // Initialize to use native theme.
575 fake_theme_service_->UseSystemTheme(); 574 fake_theme_service_->UseSystemTheme();
576 fake_theme_service_->MarkClean(); 575 fake_theme_service_->MarkClean();
577 sync_pb::ThemeSpecifics theme_specifics; 576 sync_pb::ThemeSpecifics theme_specifics;
578 theme_specifics.set_use_system_theme_by_default(true); 577 theme_specifics.set_use_system_theme_by_default(true);
579 syncer::SyncError error = 578 syncer::SyncError error =
580 theme_sync_service_ 579 theme_sync_service_
581 ->MergeDataAndStartSyncing( 580 ->MergeDataAndStartSyncing(
582 syncer::THEMES, 581 syncer::THEMES,
583 MakeThemeDataList(theme_specifics), 582 MakeThemeDataList(theme_specifics),
(...skipping 22 matching lines...) Expand all
606 changes.clear(); 605 changes.clear();
607 fake_theme_service_->UseSystemTheme(); 606 fake_theme_service_->UseSystemTheme();
608 theme_sync_service_->OnThemeChange(); 607 theme_sync_service_->OnThemeChange();
609 EXPECT_EQ(1u, changes.size()); 608 EXPECT_EQ(1u, changes.size());
610 EXPECT_TRUE(changes[0] 609 EXPECT_TRUE(changes[0]
611 .sync_data() 610 .sync_data()
612 .GetSpecifics() 611 .GetSpecifics()
613 .theme() 612 .theme()
614 .use_system_theme_by_default()); 613 .use_system_theme_by_default());
615 } 614 }
616 #endif
617 615
618 #ifndef TOOLKIT_GTK
619 TEST_F(ThemeSyncableServiceTest, 616 TEST_F(ThemeSyncableServiceTest,
620 NonGtkPreserveSystemThemeBitWhenChangeToDefaultTheme) { 617 NonGtkPreserveSystemThemeBitWhenChangeToDefaultTheme) {
621 // Set up theme service to use default theme. 618 // Set up theme service to use default theme.
622 fake_theme_service_->UseDefaultTheme(); 619 fake_theme_service_->UseDefaultTheme();
623 620
624 // Initialize to use custom theme with use_system_theme_by_default set true. 621 // Initialize to use custom theme with use_system_theme_by_default set true.
625 sync_pb::ThemeSpecifics theme_specifics; 622 sync_pb::ThemeSpecifics theme_specifics;
626 theme_specifics.set_use_custom_theme(true); 623 theme_specifics.set_use_custom_theme(true);
627 theme_specifics.set_custom_theme_id(theme_extension_->id()); 624 theme_specifics.set_custom_theme_id(theme_extension_->id());
628 theme_specifics.set_custom_theme_name(kCustomThemeName); 625 theme_specifics.set_custom_theme_name(kCustomThemeName);
(...skipping 16 matching lines...) Expand all
645 // use_system_theme_by_default bit should be preserved. 642 // use_system_theme_by_default bit should be preserved.
646 fake_theme_service_->UseDefaultTheme(); 643 fake_theme_service_->UseDefaultTheme();
647 theme_sync_service_->OnThemeChange(); 644 theme_sync_service_->OnThemeChange();
648 const syncer::SyncChangeList& changes = fake_change_processor_->changes(); 645 const syncer::SyncChangeList& changes = fake_change_processor_->changes();
649 EXPECT_EQ(1u, changes.size()); 646 EXPECT_EQ(1u, changes.size());
650 const sync_pb::ThemeSpecifics& change_specifics = 647 const sync_pb::ThemeSpecifics& change_specifics =
651 changes[0].sync_data().GetSpecifics().theme(); 648 changes[0].sync_data().GetSpecifics().theme();
652 EXPECT_FALSE(change_specifics.use_custom_theme()); 649 EXPECT_FALSE(change_specifics.use_custom_theme());
653 EXPECT_TRUE(change_specifics.use_system_theme_by_default()); 650 EXPECT_TRUE(change_specifics.use_system_theme_by_default());
654 } 651 }
655 #endif
656 652
657 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { 653 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) {
658 // Set up theme service to use custom theme that was installed by policy. 654 // Set up theme service to use custom theme that was installed by policy.
659 fake_theme_service_->SetTheme(theme_extension_.get()); 655 fake_theme_service_->SetTheme(theme_extension_.get());
660 656
661 syncer::SyncDataList data_list = 657 syncer::SyncDataList data_list =
662 theme_sync_service_->GetAllSyncData(syncer::THEMES); 658 theme_sync_service_->GetAllSyncData(syncer::THEMES);
663 659
664 ASSERT_EQ(0u, data_list.size()); 660 ASSERT_EQ(0u, data_list.size());
665 } 661 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698