OLD | NEW |
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 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 5 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 class ScopedTempDir; | 47 class ScopedTempDir; |
48 class SkBitmap; | 48 class SkBitmap; |
49 class TabContents; | 49 class TabContents; |
50 class TabContentsWrapper; | 50 class TabContentsWrapper; |
51 class TemplateURLService; | 51 class TemplateURLService; |
52 | 52 |
53 namespace browser { | 53 namespace browser { |
54 struct NavigateParams; | 54 struct NavigateParams; |
55 } | 55 } |
56 | 56 |
| 57 namespace content { |
| 58 class WebContents; |
| 59 } |
| 60 |
57 namespace gfx { | 61 namespace gfx { |
58 class Size; | 62 class Size; |
59 } | 63 } |
60 | 64 |
61 // A collections of functions designed for use with InProcessBrowserTest. | 65 // A collections of functions designed for use with InProcessBrowserTest. |
62 namespace ui_test_utils { | 66 namespace ui_test_utils { |
63 | 67 |
64 // Flags to indicate what to wait for in a navigation test. | 68 // Flags to indicate what to wait for in a navigation test. |
65 // They can be ORed together. | 69 // They can be ORed together. |
66 // The order in which the waits happen when more than one is selected, is: | 70 // The order in which the waits happen when more than one is selected, is: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Waits for a new tab to be added to |browser|. TODO(gbillock): remove this | 103 // Waits for a new tab to be added to |browser|. TODO(gbillock): remove this |
100 // race hazard. Use WindowedNotificationObserver instead. | 104 // race hazard. Use WindowedNotificationObserver instead. |
101 void WaitForNewTab(Browser* browser); | 105 void WaitForNewTab(Browser* browser); |
102 | 106 |
103 // Waits for a |browser_action| to be updated. TODO(gbillock): remove this race | 107 // Waits for a |browser_action| to be updated. TODO(gbillock): remove this race |
104 // hazard. Use WindowedNotificationObserver instead. | 108 // hazard. Use WindowedNotificationObserver instead. |
105 void WaitForBrowserActionUpdated(ExtensionAction* browser_action); | 109 void WaitForBrowserActionUpdated(ExtensionAction* browser_action); |
106 | 110 |
107 // Waits for a load stop for the specified |tab|'s controller, if the tab is | 111 // Waits for a load stop for the specified |tab|'s controller, if the tab is |
108 // currently loading. Otherwise returns immediately. | 112 // currently loading. Otherwise returns immediately. |
109 void WaitForLoadStop(TabContents* tab); | 113 void WaitForLoadStop(content::WebContents* tab); |
110 | 114 |
111 // Waits for a new browser to be created, returning the browser. | 115 // Waits for a new browser to be created, returning the browser. |
112 Browser* WaitForNewBrowser(); | 116 Browser* WaitForNewBrowser(); |
113 | 117 |
114 // Opens |url| in an incognito browser window with the incognito profile of | 118 // Opens |url| in an incognito browser window with the incognito profile of |
115 // |profile|, blocking until the navigation finishes. This will create a new | 119 // |profile|, blocking until the navigation finishes. This will create a new |
116 // browser if a browser with the incognito profile does not exist. | 120 // browser if a browser with the incognito profile does not exist. |
117 void OpenURLOffTheRecord(Profile* profile, const GURL& url); | 121 void OpenURLOffTheRecord(Profile* profile, const GURL& url); |
118 | 122 |
119 // Performs the provided navigation process, blocking until the navigation | 123 // Performs the provided navigation process, blocking until the navigation |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // The returned path is GURL format. | 189 // The returned path is GURL format. |
186 GURL GetTestUrl(const FilePath& dir, const FilePath& file); | 190 GURL GetTestUrl(const FilePath& dir, const FilePath& file); |
187 | 191 |
188 // Generate a URL for a file path including a query string. | 192 // Generate a URL for a file path including a query string. |
189 GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); | 193 GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); |
190 | 194 |
191 // Blocks until an application modal dialog is showns and returns it. | 195 // Blocks until an application modal dialog is showns and returns it. |
192 AppModalDialog* WaitForAppModalDialog(); | 196 AppModalDialog* WaitForAppModalDialog(); |
193 | 197 |
194 // Causes the specified tab to crash. Blocks until it is crashed. | 198 // Causes the specified tab to crash. Blocks until it is crashed. |
195 void CrashTab(TabContents* tab); | 199 void CrashTab(content::WebContents* tab); |
196 | 200 |
197 // Performs a find in the page of the specified tab. Returns the number of | 201 // Performs a find in the page of the specified tab. Returns the number of |
198 // matches found. |ordinal| is an optional parameter which is set to the index | 202 // matches found. |ordinal| is an optional parameter which is set to the index |
199 // of the current match. | 203 // of the current match. |
200 int FindInPage(TabContentsWrapper* tab, | 204 int FindInPage(TabContentsWrapper* tab, |
201 const string16& search_string, | 205 const string16& search_string, |
202 bool forward, | 206 bool forward, |
203 bool case_sensitive, | 207 bool case_sensitive, |
204 int* ordinal); | 208 int* ordinal); |
205 | 209 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 | 569 |
566 // Takes a snapshot of the entire page, according to the width and height | 570 // Takes a snapshot of the entire page, according to the width and height |
567 // properties of the DOM's document. Returns true on success. DOMAutomation | 571 // properties of the DOM's document. Returns true on success. DOMAutomation |
568 // must be enabled. | 572 // must be enabled. |
569 bool TakeEntirePageSnapshot(RenderViewHost* rvh, | 573 bool TakeEntirePageSnapshot(RenderViewHost* rvh, |
570 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 574 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
571 | 575 |
572 } // namespace ui_test_utils | 576 } // namespace ui_test_utils |
573 | 577 |
574 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 578 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
OLD | NEW |