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

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, 10 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 540 }
540 541
541 // static 542 // static
542 void ExtensionServiceTestBase::SetUpTestCase() { 543 void ExtensionServiceTestBase::SetUpTestCase() {
543 ExtensionErrorReporter::Init(false); // no noisy errors 544 ExtensionErrorReporter::Init(false); // no noisy errors
544 } 545 }
545 546
546 void ExtensionServiceTestBase::SetUp() { 547 void ExtensionServiceTestBase::SetUp() {
547 testing::Test::SetUp(); 548 testing::Test::SetUp();
548 ExtensionErrorReporter::GetInstance()->ClearErrors(); 549 ExtensionErrorReporter::GetInstance()->ClearErrors();
550 std::vector<std::string> background_keys(
551 extensions::BackgroundManifestHandler::keys());
552 linked_ptr<extensions::BackgroundManifestHandler> background_handler(
553 new extensions::BackgroundManifestHandler);
554 for (size_t i = 0; i < background_keys.size(); ++i) {
555 extensions::ManifestHandler::Register(background_keys[i],
556 background_handler);
557 }
549 extensions::ManifestHandler::Register( 558 extensions::ManifestHandler::Register(
550 keys::kDefaultLocale, 559 keys::kDefaultLocale,
551 make_linked_ptr(new extensions::DefaultLocaleHandler)); 560 make_linked_ptr(new extensions::DefaultLocaleHandler));
552 } 561 }
553 562
554 void ExtensionServiceTestBase::TearDown() { 563 void ExtensionServiceTestBase::TearDown() {
555 extensions::ManifestHandler::ClearRegistryForTesting(); 564 extensions::ManifestHandler::ClearRegistryForTesting();
556 } 565 }
557 566
558 class ExtensionServiceTest 567 class ExtensionServiceTest
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 expected_patterns.ClearPatterns(); 1194 expected_patterns.ClearPatterns();
1186 AddPattern(&expected_patterns, "http://*.google.com/*"); 1195 AddPattern(&expected_patterns, "http://*.google.com/*");
1187 AddPattern(&expected_patterns, "https://*.google.com/*"); 1196 AddPattern(&expected_patterns, "https://*.google.com/*");
1188 EXPECT_EQ(expected_patterns, 1197 EXPECT_EQ(expected_patterns,
1189 extension->GetActivePermissions()->explicit_hosts()); 1198 extension->GetActivePermissions()->explicit_hosts());
1190 1199
1191 EXPECT_EQ(std::string(good1), loaded_[1]->id()); 1200 EXPECT_EQ(std::string(good1), loaded_[1]->id());
1192 EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name()); 1201 EXPECT_EQ(std::string("My extension 2"), loaded_[1]->name());
1193 EXPECT_EQ(std::string(""), loaded_[1]->description()); 1202 EXPECT_EQ(std::string(""), loaded_[1]->description());
1194 EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"), 1203 EXPECT_EQ(loaded_[1]->GetResourceURL("background.html"),
1195 loaded_[1]->GetBackgroundURL()); 1204 extensions::BackgroundInfo::GetBackgroundURL(loaded_[1]));
1196 EXPECT_EQ(0u, loaded_[1]->content_scripts().size()); 1205 EXPECT_EQ(0u, loaded_[1]->content_scripts().size());
1197 // We don't parse the plugins section on Chrome OS. 1206 // We don't parse the plugins section on Chrome OS.
1198 #if defined(OS_CHROMEOS) 1207 #if defined(OS_CHROMEOS)
1199 EXPECT_EQ(0u, loaded_[1]->plugins().size()); 1208 EXPECT_EQ(0u, loaded_[1]->plugins().size());
1200 #else 1209 #else
1201 ASSERT_EQ(2u, loaded_[1]->plugins().size()); 1210 ASSERT_EQ(2u, loaded_[1]->plugins().size());
1202 EXPECT_EQ(loaded_[1]->path().AppendASCII("content_plugin.dll").value(), 1211 EXPECT_EQ(loaded_[1]->path().AppendASCII("content_plugin.dll").value(),
1203 loaded_[1]->plugins()[0].path.value()); 1212 loaded_[1]->plugins()[0].path.value());
1204 EXPECT_TRUE(loaded_[1]->plugins()[0].is_public); 1213 EXPECT_TRUE(loaded_[1]->plugins()[0].is_public);
1205 EXPECT_EQ(loaded_[1]->path().AppendASCII("extension_plugin.dll").value(), 1214 EXPECT_EQ(loaded_[1]->path().AppendASCII("extension_plugin.dll").value(),
(...skipping 4653 matching lines...) Expand 10 before | Expand all | Expand 10 after
5859 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); 5868 EXPECT_FALSE(extensions::HasExternalInstallError(service_));
5860 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); 5869 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx));
5861 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); 5870 EXPECT_TRUE(service_->IsExtensionEnabled(page_action));
5862 5871
5863 ExtensionPrefs* prefs = service_->extension_prefs(); 5872 ExtensionPrefs* prefs = service_->extension_prefs();
5864 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & 5873 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) &
5865 Extension::DISABLE_SIDELOAD_WIPEOUT); 5874 Extension::DISABLE_SIDELOAD_WIPEOUT);
5866 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & 5875 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) &
5867 Extension::DISABLE_SIDELOAD_WIPEOUT); 5876 Extension::DISABLE_SIDELOAD_WIPEOUT);
5868 } 5877 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698