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/browser_action_test_util_views.cc

Issue 8772068: Add PyAuto tests for triggering browser/page action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « chrome/browser/extensions/browser_action_test_util.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/views/browser_actions_container.h" 10 #include "chrome/browser/ui/views/browser_actions_container.h"
11 #include "chrome/browser/ui/views/extensions/extension_popup.h" 11 #include "chrome/browser/ui/views/extensions/extension_popup.h"
12 #include "chrome/browser/ui/views/toolbar_view.h" 12 #include "chrome/browser/ui/views/toolbar_view.h"
13
14 #ifdef UNIT_TEST
13 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
17 #endif // UNIT_TEST
18
15 #include "ui/gfx/rect.h" 19 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 20 #include "ui/gfx/size.h"
17 21
18 namespace { 22 namespace {
19 23
20 BrowserActionsContainer* GetContainer(Browser* browser) { 24 BrowserActionsContainer* GetContainer(Browser* browser) {
21 BrowserActionsContainer* container = 25 BrowserActionsContainer* container =
22 browser->window()->GetBrowserWindowTesting()->GetToolbarView()-> 26 browser->window()->GetBrowserWindowTesting()->GetToolbarView()->
23 browser_actions(); 27 browser_actions();
24 return container; 28 return container;
25 } 29 }
26 30
27 } // namespace 31 } // namespace
28 32
29 int BrowserActionTestUtil::NumberOfBrowserActions() { 33 int BrowserActionTestUtil::NumberOfBrowserActions() {
30 return GetContainer(browser_)->num_browser_actions(); 34 return GetContainer(browser_)->num_browser_actions();
31 } 35 }
32 36
33 int BrowserActionTestUtil::VisibleBrowserActions() { 37 int BrowserActionTestUtil::VisibleBrowserActions() {
34 return GetContainer(browser_)->VisibleBrowserActions(); 38 return GetContainer(browser_)->VisibleBrowserActions();
35 } 39 }
36 40
41 #ifdef UNIT_TEST
37 void BrowserActionTestUtil::WaitForBrowserActionUpdated(int index) { 42 void BrowserActionTestUtil::WaitForBrowserActionUpdated(int index) {
38 ui_test_utils::WaitForBrowserActionUpdated( 43 ui_test_utils::WaitForBrowserActionUpdated(
39 GetContainer(browser_)->GetBrowserActionViewAt(index)-> 44 GetContainer(browser_)->GetBrowserActionViewAt(index)->
40 button()->extension()->browser_action()); 45 button()->extension()->browser_action());
41 } 46 }
47 #endif // UNIT_TEST
42 48
43 bool BrowserActionTestUtil::HasIcon(int index) { 49 bool BrowserActionTestUtil::HasIcon(int index) {
44 return GetContainer(browser_)->GetBrowserActionViewAt(index)->button()-> 50 return GetContainer(browser_)->GetBrowserActionViewAt(index)->button()->
45 HasIcon(); 51 HasIcon();
46 } 52 }
47 53
48 void BrowserActionTestUtil::Press(int index) { 54 void BrowserActionTestUtil::Press(int index) {
49 GetContainer(browser_)->TestExecuteBrowserAction(index); 55 GetContainer(browser_)->TestExecuteBrowserAction(index);
50 } 56 }
51 57
(...skipping 28 matching lines...) Expand all
80 GetContainer(browser_)->TestSetIconVisibilityCount(icons); 86 GetContainer(browser_)->TestSetIconVisibilityCount(icons);
81 } 87 }
82 88
83 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { 89 gfx::Size BrowserActionTestUtil::GetMinPopupSize() {
84 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight); 90 return gfx::Size(ExtensionPopup::kMinWidth, ExtensionPopup::kMinHeight);
85 } 91 }
86 92
87 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { 93 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() {
88 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight); 94 return gfx::Size(ExtensionPopup::kMaxWidth, ExtensionPopup::kMaxHeight);
89 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/browser_action_test_util.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698