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/extensions/active_script_controller_unittest.cc

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 FeatureSwitch::OVERRIDE_ENABLED), 100 FeatureSwitch::OVERRIDE_ENABLED),
101 active_script_controller_(nullptr) {} 101 active_script_controller_(nullptr) {}
102 102
103 ActiveScriptControllerUnitTest::~ActiveScriptControllerUnitTest() { 103 ActiveScriptControllerUnitTest::~ActiveScriptControllerUnitTest() {
104 } 104 }
105 105
106 const Extension* ActiveScriptControllerUnitTest::AddExtension() { 106 const Extension* ActiveScriptControllerUnitTest::AddExtension() {
107 const std::string kId = crx_file::id_util::GenerateId("all_hosts_extension"); 107 const std::string kId = crx_file::id_util::GenerateId("all_hosts_extension");
108 extension_ = 108 extension_ =
109 ExtensionBuilder() 109 ExtensionBuilder()
110 .SetManifest(std::move( 110 .SetManifest(
111 DictionaryBuilder() 111 DictionaryBuilder()
112 .Set("name", "all_hosts_extension") 112 .Set("name", "all_hosts_extension")
113 .Set("description", "an extension") 113 .Set("description", "an extension")
114 .Set("manifest_version", 2) 114 .Set("manifest_version", 2)
115 .Set("version", "1.0.0") 115 .Set("version", "1.0.0")
116 .Set("permissions", 116 .Set("permissions",
117 std::move(ListBuilder().Append(kAllHostsPermission))))) 117 ListBuilder().Append(kAllHostsPermission).Build())
118 .Build())
118 .SetLocation(Manifest::INTERNAL) 119 .SetLocation(Manifest::INTERNAL)
119 .SetID(kId) 120 .SetID(kId)
120 .Build(); 121 .Build();
121 122
122 ExtensionRegistry::Get(profile())->AddEnabled(extension_); 123 ExtensionRegistry::Get(profile())->AddEnabled(extension_);
123 PermissionsUpdater(profile()).InitializePermissions(extension_.get()); 124 PermissionsUpdater(profile()).InitializePermissions(extension_.get());
124 return extension_.get(); 125 return extension_.get();
125 } 126 }
126 127
127 const Extension* ActiveScriptControllerUnitTest::ReloadExtension() { 128 const Extension* ActiveScriptControllerUnitTest::ReloadExtension() {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST | BLOCKED_ACTION_SCRIPT_OTHER, 476 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST | BLOCKED_ACTION_SCRIPT_OTHER,
476 controller()->GetBlockedActions(extension)); 477 controller()->GetBlockedActions(extension));
477 EXPECT_TRUE(controller()->WantsToRun(extension)); 478 EXPECT_TRUE(controller()->WantsToRun(extension));
478 479
479 NavigateAndCommit(GURL("https://www.bar.com")); 480 NavigateAndCommit(GURL("https://www.bar.com"));
480 EXPECT_EQ(BLOCKED_ACTION_NONE, controller()->GetBlockedActions(extension)); 481 EXPECT_EQ(BLOCKED_ACTION_NONE, controller()->GetBlockedActions(extension));
481 EXPECT_FALSE(controller()->WantsToRun(extension)); 482 EXPECT_FALSE(controller()->WantsToRun(extension));
482 } 483 }
483 484
484 } // namespace extensions 485 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698