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

Side by Side Diff: chrome/browser/ui/location_bar/location_bar_browsertest.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, 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
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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
10 #include "chrome/browser/extensions/extension_action.h" 10 #include "chrome/browser/extensions/extension_action.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // successfully hides the star. 139 // successfully hides the star.
140 IN_PROC_BROWSER_TEST_F(LocationBarBrowserTest, 140 IN_PROC_BROWSER_TEST_F(LocationBarBrowserTest,
141 ExtensionCanOverrideBookmarkStar) { 141 ExtensionCanOverrideBookmarkStar) {
142 LocationBarTesting* location_bar = 142 LocationBarTesting* location_bar =
143 browser()->window()->GetLocationBar()->GetLocationBarForTesting(); 143 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
144 // By default, we should show the star. 144 // By default, we should show the star.
145 EXPECT_TRUE(location_bar->GetBookmarkStarVisibility()); 145 EXPECT_TRUE(location_bar->GetBookmarkStarVisibility());
146 146
147 // Create and install an extension that overrides the bookmark star. 147 // Create and install an extension that overrides the bookmark star.
148 extensions::DictionaryBuilder chrome_ui_overrides; 148 extensions::DictionaryBuilder chrome_ui_overrides;
149 chrome_ui_overrides.Set("bookmarks_ui", 149 chrome_ui_overrides.Set("bookmarks_ui", extensions::DictionaryBuilder()
150 std::move(extensions::DictionaryBuilder().SetBoolean( 150 .SetBoolean("remove_button", true)
151 "remove_button", true))); 151 .Build());
152 scoped_refptr<const extensions::Extension> extension = 152 scoped_refptr<const extensions::Extension> extension =
153 extensions::ExtensionBuilder() 153 extensions::ExtensionBuilder()
154 .SetManifest(std::move( 154 .SetManifest(
155 extensions::DictionaryBuilder() 155 extensions::DictionaryBuilder()
156 .Set("name", "overrides star") 156 .Set("name", "overrides star")
157 .Set("manifest_version", 2) 157 .Set("manifest_version", 2)
158 .Set("version", "0.1") 158 .Set("version", "0.1")
159 .Set("description", "override the star") 159 .Set("description", "override the star")
160 .Set("chrome_ui_overrides", std::move(chrome_ui_overrides)))) 160 .Set("chrome_ui_overrides", chrome_ui_overrides.Build())
161 .Build())
161 .Build(); 162 .Build();
162 extension_service()->AddExtension(extension.get()); 163 extension_service()->AddExtension(extension.get());
163 164
164 // The star should now be hidden. 165 // The star should now be hidden.
165 EXPECT_FALSE(location_bar->GetBookmarkStarVisibility()); 166 EXPECT_FALSE(location_bar->GetBookmarkStarVisibility());
166 } 167 }
167 168
168 class LocationBarBrowserTestWithRedesign : public LocationBarBrowserTest { 169 class LocationBarBrowserTestWithRedesign : public LocationBarBrowserTest {
169 public: 170 public:
170 LocationBarBrowserTestWithRedesign() {} 171 LocationBarBrowserTestWithRedesign() {}
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 browser()->tab_strip_model()->GetActiveWebContents(); 212 browser()->tab_strip_model()->GetActiveWebContents();
212 int tab_id = SessionTabHelper::IdForTab(tab); 213 int tab_id = SessionTabHelper::IdForTab(tab);
213 action->SetIsVisible(tab_id, true); 214 action->SetIsVisible(tab_id, true);
214 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( 215 extensions::ExtensionActionAPI::Get(profile())->NotifyChange(
215 action, tab, profile()); 216 action, tab, profile());
216 217
217 // We should still have no page actions. 218 // We should still have no page actions.
218 EXPECT_EQ(0, location_bar->PageActionCount()); 219 EXPECT_EQ(0, location_bar->PageActionCount());
219 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); 220 EXPECT_EQ(0, location_bar->PageActionVisibleCount());
220 } 221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698