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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_action_test_util_mac.mm

Issue 1330423003: [Extensions Toolbar] Protect against crazy bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final nits Created 5 years, 3 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser_action_test_util.h" 5 #include "chrome/browser/extensions/browser_action_test_util.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 bool BrowserActionTestUtil::HidePopup() { 175 bool BrowserActionTestUtil::HidePopup() {
176 ExtensionPopupController* controller = [ExtensionPopupController popup]; 176 ExtensionPopupController* controller = [ExtensionPopupController popup];
177 [controller close]; 177 [controller close];
178 return !HasPopup(); 178 return !HasPopup();
179 } 179 }
180 180
181 bool BrowserActionTestUtil::ActionButtonWantsToRun(size_t index) { 181 bool BrowserActionTestUtil::ActionButtonWantsToRun(size_t index) {
182 return [GetButton(browser_, test_helper_.get(), index) wantsToRunForTesting]; 182 return [GetButton(browser_, test_helper_.get(), index) wantsToRunForTesting];
183 } 183 }
184 184
185 void BrowserActionTestUtil::SetWidth(int width) {
186 BrowserActionsContainerView* containerView =
187 [GetController(browser_, test_helper_.get()) containerView];
188 NSRect frame = [containerView frame];
189 frame.size.width = width;
190 [containerView setFrame:frame];
191 }
192
185 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() { 193 ToolbarActionsBar* BrowserActionTestUtil::GetToolbarActionsBar() {
186 return [GetController(browser_, test_helper_.get()) toolbarActionsBar]; 194 return [GetController(browser_, test_helper_.get()) toolbarActionsBar];
187 } 195 }
188 196
189 scoped_ptr<BrowserActionTestUtil> BrowserActionTestUtil::CreateOverflowBar() { 197 scoped_ptr<BrowserActionTestUtil> BrowserActionTestUtil::CreateOverflowBar() {
190 CHECK(!GetToolbarActionsBar()->in_overflow_mode()) 198 CHECK(!GetToolbarActionsBar()->in_overflow_mode())
191 << "Only a main bar can create an overflow bar!"; 199 << "Only a main bar can create an overflow bar!";
192 return make_scoped_ptr(new BrowserActionTestUtil(browser_, this)); 200 return make_scoped_ptr(new BrowserActionTestUtil(browser_, this));
193 } 201 }
194 202
195 // static 203 // static
196 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { 204 gfx::Size BrowserActionTestUtil::GetMinPopupSize() {
197 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize])); 205 return gfx::Size(NSSizeToCGSize([ExtensionPopupController minPopupSize]));
198 } 206 }
199 207
200 // static 208 // static
201 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { 209 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() {
202 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize])); 210 return gfx::Size(NSSizeToCGSize([ExtensionPopupController maxPopupSize]));
203 } 211 }
204 212
205 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser, 213 BrowserActionTestUtil::BrowserActionTestUtil(Browser* browser,
206 BrowserActionTestUtil* main_bar) 214 BrowserActionTestUtil* main_bar)
207 : browser_(browser), 215 : browser_(browser),
208 test_helper_(new TestToolbarActionsBarHelperCocoa( 216 test_helper_(new TestToolbarActionsBarHelperCocoa(
209 browser_, GetController(browser_, main_bar->test_helper_.get()))) { 217 browser_, GetController(browser_, main_bar->test_helper_.get()))) {
210 } 218 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/browser_action_test_util.h ('k') | chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698