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

Side by Side Diff: chrome/browser/extensions/location_bar_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 (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 <string> 5 #include <string>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 int tab_id() { 66 int tab_id() {
67 return SessionTabHelper::IdForTab(web_contents()); 67 return SessionTabHelper::IdForTab(web_contents());
68 } 68 }
69 69
70 const Extension* AddExtension(bool has_page_actions, 70 const Extension* AddExtension(bool has_page_actions,
71 const std::string& name) { 71 const std::string& name) {
72 DictionaryBuilder manifest; 72 DictionaryBuilder manifest;
73 manifest.Set("name", name) 73 manifest.Set("name", name)
74 .Set("version", "1.0.0") 74 .Set("version", "1.0.0")
75 .Set("manifest_version", 2) 75 .Set("manifest_version", 2)
76 .Set("permissions", std::move(ListBuilder().Append("tabs"))); 76 .Set("permissions", ListBuilder().Append("tabs").Build());
77 if (has_page_actions) { 77 if (has_page_actions) {
78 manifest.Set("page_action", std::move(DictionaryBuilder().Set( 78 manifest.Set("page_action",
79 "default_title", "Hello"))); 79 DictionaryBuilder().Set("default_title", "Hello").Build());
80 } 80 }
81 scoped_refptr<const Extension> extension = 81 scoped_refptr<const Extension> extension =
82 ExtensionBuilder() 82 ExtensionBuilder()
83 .SetManifest(std::move(manifest)) 83 .SetManifest(manifest.Build())
84 .SetID(crx_file::id_util::GenerateId(name)) 84 .SetID(crx_file::id_util::GenerateId(name))
85 .Build(); 85 .Build();
86 extension_service_->AddExtension(extension.get()); 86 extension_service_->AddExtension(extension.get());
87 return extension.get(); 87 return extension.get();
88 } 88 }
89 89
90 ExtensionService* extension_service_; 90 ExtensionService* extension_service_;
91 91
92 private: 92 private:
93 #if defined OS_CHROMEOS 93 #if defined OS_CHROMEOS
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 NavigateAndCommit(GURL("http://www.yahoo.com")); 191 NavigateAndCommit(GURL("http://www.yahoo.com"));
192 192
193 EXPECT_EQ("Hello", page_action.GetTitle(tab_id())); 193 EXPECT_EQ("Hello", page_action.GetTitle(tab_id()));
194 EXPECT_EQ(GURL(), page_action.GetPopupUrl(tab_id())); 194 EXPECT_EQ(GURL(), page_action.GetPopupUrl(tab_id()));
195 EXPECT_FALSE( 195 EXPECT_FALSE(
196 extension_action_api->PageActionWantsToRun(extension, web_contents())); 196 extension_action_api->PageActionWantsToRun(extension, web_contents()));
197 } 197 }
198 198
199 } // namespace 199 } // namespace
200 } // namespace extensions 200 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698