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

Side by Side Diff: chrome/browser/profile_resetter/profile_resetter_unittest.cc

Issue 196753002: [Hotword] Making enabling/disabling the setting enable/disable the hotword extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase because try bots are hanging Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/profile_resetter/profile_resetter.h" 5 #include "chrome/browser/profile_resetter/profile_resetter.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/scoped_path_override.h" 10 #include "base/test/scoped_path_override.h"
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 extensions::Manifest::TYPE_EXTENSION, 610 extensions::Manifest::TYPE_EXTENSION,
611 false); 611 false);
612 service_->AddExtension(ext3.get()); 612 service_->AddExtension(ext3.get());
613 scoped_refptr<Extension> ext4 = 613 scoped_refptr<Extension> ext4 =
614 CreateExtension(base::ASCIIToUTF16("example4"), 614 CreateExtension(base::ASCIIToUTF16("example4"),
615 base::FilePath(FILE_PATH_LITERAL("//nonexistent3")), 615 base::FilePath(FILE_PATH_LITERAL("//nonexistent3")),
616 Manifest::EXTERNAL_POLICY_DOWNLOAD, 616 Manifest::EXTERNAL_POLICY_DOWNLOAD,
617 extensions::Manifest::TYPE_EXTENSION, 617 extensions::Manifest::TYPE_EXTENSION,
618 false); 618 false);
619 service_->AddExtension(ext4.get()); 619 service_->AddExtension(ext4.get());
620 // External component extensions are the exception as they can be disabled
621 // and should not be re-enabled on reset if they have been disabled.
battre 2014/03/14 09:23:15 Could you explain me how these external component
rpetterson 2014/03/14 16:31:28 The update urls are hard coded (most as constants)
620 scoped_refptr<Extension> ext5 = CreateExtension( 622 scoped_refptr<Extension> ext5 = CreateExtension(
621 base::ASCIIToUTF16("example5"), 623 base::ASCIIToUTF16("example5"),
622 base::FilePath(FILE_PATH_LITERAL("//nonexistent4")), 624 base::FilePath(FILE_PATH_LITERAL("//nonexistent4")),
623 Manifest::EXTERNAL_COMPONENT, 625 Manifest::EXTERNAL_COMPONENT,
624 extensions::Manifest::TYPE_EXTENSION, 626 extensions::Manifest::TYPE_EXTENSION,
625 false); 627 false);
626 service_->AddExtension(ext5.get()); 628 service_->AddExtension(ext5.get());
627 scoped_refptr<Extension> ext6 = CreateExtension( 629 scoped_refptr<Extension> ext6 = CreateExtension(
628 base::ASCIIToUTF16("example6"), 630 base::ASCIIToUTF16("example6"),
629 base::FilePath(FILE_PATH_LITERAL("//nonexistent5")), 631 base::FilePath(FILE_PATH_LITERAL("//nonexistent5")),
630 Manifest::EXTERNAL_POLICY, 632 Manifest::EXTERNAL_POLICY,
631 extensions::Manifest::TYPE_EXTENSION, 633 extensions::Manifest::TYPE_EXTENSION,
632 false); 634 false);
633 service_->AddExtension(ext6.get()); 635 service_->AddExtension(ext6.get());
634 EXPECT_EQ(6u, service_->extensions()->size()); 636 EXPECT_EQ(6u, service_->extensions()->size());
635 637
636 ResetAndWait(ProfileResetter::EXTENSIONS); 638 ResetAndWait(ProfileResetter::EXTENSIONS);
637 EXPECT_EQ(4u, service_->extensions()->size()); 639 EXPECT_EQ(3u, service_->extensions()->size());
638 EXPECT_FALSE(service_->extensions()->Contains(theme->id())); 640 EXPECT_FALSE(service_->extensions()->Contains(theme->id()));
639 EXPECT_FALSE(service_->extensions()->Contains(ext2->id())); 641 EXPECT_FALSE(service_->extensions()->Contains(ext2->id()));
640 EXPECT_TRUE(service_->extensions()->Contains(ext3->id())); 642 EXPECT_TRUE(service_->extensions()->Contains(ext3->id()));
641 EXPECT_TRUE(service_->extensions()->Contains(ext4->id())); 643 EXPECT_TRUE(service_->extensions()->Contains(ext4->id()));
642 EXPECT_TRUE(service_->extensions()->Contains(ext5->id())); 644 EXPECT_FALSE(service_->extensions()->Contains(ext5->id()));
643 EXPECT_TRUE(service_->extensions()->Contains(ext6->id())); 645 EXPECT_TRUE(service_->extensions()->Contains(ext6->id()));
644 EXPECT_TRUE(theme_service->UsingDefaultTheme()); 646 EXPECT_TRUE(theme_service->UsingDefaultTheme());
645 } 647 }
646 648
647 TEST_F(ProfileResetterTest, ResetExtensionsByDisablingNonOrganic) { 649 TEST_F(ProfileResetterTest, ResetExtensionsByDisablingNonOrganic) {
648 scoped_refptr<Extension> ext2 = CreateExtension( 650 scoped_refptr<Extension> ext2 = CreateExtension(
649 base::ASCIIToUTF16("example2"), 651 base::ASCIIToUTF16("example2"),
650 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), 652 base::FilePath(FILE_PATH_LITERAL("//nonexistent")),
651 Manifest::INVALID_LOCATION, 653 Manifest::INVALID_LOCATION,
652 extensions::Manifest::TYPE_EXTENSION, 654 extensions::Manifest::TYPE_EXTENSION,
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 new ResettableSettingsSnapshot(profile())); 1096 new ResettableSettingsSnapshot(profile()));
1095 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, 1097 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail,
1096 base::Unretained(&capture))); 1098 base::Unretained(&capture)));
1097 deleted_snapshot.reset(); 1099 deleted_snapshot.reset();
1098 // Running remaining tasks shouldn't trigger the callback to be called as 1100 // Running remaining tasks shouldn't trigger the callback to be called as
1099 // |deleted_snapshot| was deleted before it could run. 1101 // |deleted_snapshot| was deleted before it could run.
1100 base::MessageLoop::current()->RunUntilIdle(); 1102 base::MessageLoop::current()->RunUntilIdle();
1101 } 1103 }
1102 1104
1103 } // namespace 1105 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/extensions/component_loader_unittest.cc ('k') | chrome/browser/search/hotword_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698