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

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
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/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "chrome/browser/prefs/browser_prefs.h" 58 #include "chrome/browser/prefs/browser_prefs.h"
59 #include "chrome/browser/prefs/pref_registry_syncable.h" 59 #include "chrome/browser/prefs/pref_registry_syncable.h"
60 #include "chrome/browser/prefs/pref_service_mock_builder.h" 60 #include "chrome/browser/prefs/pref_service_mock_builder.h"
61 #include "chrome/browser/prefs/pref_service_syncable.h" 61 #include "chrome/browser/prefs/pref_service_syncable.h"
62 #include "chrome/browser/prefs/scoped_user_pref_update.h" 62 #include "chrome/browser/prefs/scoped_user_pref_update.h"
63 #include "chrome/common/chrome_constants.h" 63 #include "chrome/common/chrome_constants.h"
64 #include "chrome/common/chrome_notification_types.h" 64 #include "chrome/common/chrome_notification_types.h"
65 #include "chrome/common/chrome_paths.h" 65 #include "chrome/common/chrome_paths.h"
66 #include "chrome/common/chrome_switches.h" 66 #include "chrome/common/chrome_switches.h"
67 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 67 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
68 #include "chrome/common/extensions/background_info.h"
68 #include "chrome/common/extensions/extension.h" 69 #include "chrome/common/extensions/extension.h"
69 #include "chrome/common/extensions/extension_l10n_util.h" 70 #include "chrome/common/extensions/extension_l10n_util.h"
70 #include "chrome/common/extensions/extension_manifest_constants.h" 71 #include "chrome/common/extensions/extension_manifest_constants.h"
71 #include "chrome/common/extensions/extension_resource.h" 72 #include "chrome/common/extensions/extension_resource.h"
72 #include "chrome/common/extensions/manifest_handler.h" 73 #include "chrome/common/extensions/manifest_handler.h"
73 #include "chrome/common/extensions/manifest_url_handler.h" 74 #include "chrome/common/extensions/manifest_url_handler.h"
74 #include "chrome/common/extensions/permissions/permission_set.h" 75 #include "chrome/common/extensions/permissions/permission_set.h"
75 #include "chrome/common/pref_names.h" 76 #include "chrome/common/pref_names.h"
76 #include "chrome/common/url_constants.h" 77 #include "chrome/common/url_constants.h"
77 #include "chrome/test/base/testing_profile.h" 78 #include "chrome/test/base/testing_profile.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 539 }
539 540
540 // static 541 // static
541 void ExtensionServiceTestBase::SetUpTestCase() { 542 void ExtensionServiceTestBase::SetUpTestCase() {
542 ExtensionErrorReporter::Init(false); // no noisy errors 543 ExtensionErrorReporter::Init(false); // no noisy errors
543 } 544 }
544 545
545 void ExtensionServiceTestBase::SetUp() { 546 void ExtensionServiceTestBase::SetUp() {
546 testing::Test::SetUp(); 547 testing::Test::SetUp();
547 ExtensionErrorReporter::GetInstance()->ClearErrors(); 548 ExtensionErrorReporter::GetInstance()->ClearErrors();
548 extensions::ManifestHandler::Register( 549 (new extensions::BackgroundManifestHandler)->Register();
549 keys::kDefaultLocale, 550 (new extensions::DefaultLocaleHandler)->Register();
550 make_linked_ptr(new extensions::DefaultLocaleHandler));
551 } 551 }
552 552
553 void ExtensionServiceTestBase::TearDown() { 553 void ExtensionServiceTestBase::TearDown() {
554 extensions::ManifestHandler::ClearRegistryForTesting(); 554 extensions::ManifestHandler::ClearRegistryForTesting();
555 } 555 }
556 556
557 class ExtensionServiceTest 557 class ExtensionServiceTest
558 : public ExtensionServiceTestBase, public content::NotificationObserver { 558 : public ExtensionServiceTestBase, public content::NotificationObserver {
559 public: 559 public:
560 ExtensionServiceTest() 560 ExtensionServiceTest()
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 expected_patterns.ClearPatterns(); 1184 expected_patterns.ClearPatterns();
1185 AddPattern(&expected_patterns, "http://*.google.com/*"); 1185 AddPattern(&expected_patterns, "http://*.google.com/*");
1186 AddPattern(&expected_patterns, "https://*.google.com/*"); 1186 AddPattern(&expected_patterns, "https://*.google.com/*");
1187 EXPECT_EQ(expected_patterns, 1187 EXPECT_EQ(expected_patterns,
1188 extension->GetActivePermissions()->explicit_hosts()); 1188 extension->GetActivePermissions()->explicit_hosts());
1189 1189
1190 EXPECT_EQ(std::string(good1), loaded_[1]->id()); 1190 EXPECT_EQ(std::string(good1), loaded_[1]->id());
1191 EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name()); 1191 EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name());
1192 EXPECT_EQ(std::string(""), loaded_[1]->description()); 1192 EXPECT_EQ(std::string(""), loaded_[1]->description());
1193 EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"), 1193 EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"),
1194 loaded_[1]->GetBackgroundURL()); 1194 extensions::BackgroundInfo::GetBackgroundURL(loaded_[1]));
1195 EXPECT_EQ(0u, loaded_[1]->content_scripts().size()); 1195 EXPECT_EQ(0u, loaded_[1]->content_scripts().size());
1196 // We don't parse the plugins section on Chrome OS. 1196 // We don't parse the plugins section on Chrome OS.
1197 #if defined(OS_CHROMEOS) 1197 #if defined(OS_CHROMEOS)
1198 EXPECT_EQ(0u, loaded_[1]->plugins().size()); 1198 EXPECT_EQ(0u, loaded_[1]->plugins().size());
1199 #else 1199 #else
1200 ASSERT_EQ(2u, loaded_[1]->plugins().size()); 1200 ASSERT_EQ(2u, loaded_[1]->plugins().size());
1201 EXPECT_EQ(loaded_[1]->path().AppendASCII("content_plugin.dll").value(), 1201 EXPECT_EQ(loaded_[1]->path().AppendASCII("content_plugin.dll").value(),
1202 loaded_[1]->plugins()[0].path.value()); 1202 loaded_[1]->plugins()[0].path.value());
1203 EXPECT_TRUE(loaded_[1]->plugins()[0].is_public); 1203 EXPECT_TRUE(loaded_[1]->plugins()[0].is_public);
1204 EXPECT_EQ(loaded_[1]->path().AppendASCII("extension_plugin.dll").value(), 1204 EXPECT_EQ(loaded_[1]->path().AppendASCII("extension_plugin.dll").value(),
(...skipping 4653 matching lines...) Expand 10 before | Expand all | Expand 10 after
5858 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); 5858 EXPECT_FALSE(extensions::HasExternalInstallError(service_));
5859 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); 5859 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx));
5860 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); 5860 EXPECT_TRUE(service_->IsExtensionEnabled(page_action));
5861 5861
5862 ExtensionPrefs* prefs = service_->extension_prefs(); 5862 ExtensionPrefs* prefs = service_->extension_prefs();
5863 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & 5863 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) &
5864 Extension::DISABLE_SIDELOAD_WIPEOUT); 5864 Extension::DISABLE_SIDELOAD_WIPEOUT);
5865 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & 5865 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) &
5866 Extension::DISABLE_SIDELOAD_WIPEOUT); 5866 Extension::DISABLE_SIDELOAD_WIPEOUT);
5867 } 5867 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/image_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698