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

Side by Side Diff: chrome/test/ui_test_utils.h

Issue 150213: Add a ExtensionBrowserTest base class (Closed)
Patch Set: added timeouts fixed other tests Created 11 years, 5 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
« no previous file with comments | « chrome/test/in_process_browser_test.cc ('k') | chrome/test/ui_test_utils.cc » ('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) 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 #ifndef CHROME_TEST_UI_TEST_UTILS_H_ 5 #ifndef CHROME_TEST_UI_TEST_UTILS_H_
6 #define CHROME_TEST_UI_TEST_UTILS_H_ 6 #define CHROME_TEST_UI_TEST_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/common/notification_observer.h" 11 #include "chrome/common/notification_observer.h"
12 12
13 class Browser; 13 class Browser;
14 class DownloadManager; 14 class DownloadManager;
15 class GURL; 15 class GURL;
16 class NavigationController; 16 class NavigationController;
17 class RenderViewHost;
17 class Value; 18 class Value;
18 class TabContents;
19 19
20 // A collections of functions designed for use with InProcessBrowserTest. 20 // A collections of functions designed for use with InProcessBrowserTest.
21 namespace ui_test_utils { 21 namespace ui_test_utils {
22 22
23 // Turns on nestable tasks, runs the message loop, then resets nestable tasks 23 // Turns on nestable tasks, runs the message loop, then resets nestable tasks
24 // to what they were originally. Prefer this over MessageLoop::Run for in 24 // to what they were originally. Prefer this over MessageLoop::Run for in
25 // process browser tests that need to block until a condition is met. 25 // process browser tests that need to block until a condition is met.
26 void RunMessageLoop(); 26 void RunMessageLoop();
27 27
28 // Waits for |controller| to complete a navigation. This blocks until 28 // Waits for |controller| to complete a navigation. This blocks until
(...skipping 12 matching lines...) Expand all
41 // Navigates the selected tab of |browser| to |url|, blocking until the 41 // Navigates the selected tab of |browser| to |url|, blocking until the
42 // number of navigations specified complete. 42 // number of navigations specified complete.
43 void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, 43 void NavigateToURLBlockUntilNavigationsComplete(Browser* browser,
44 const GURL& url, 44 const GURL& url,
45 int number_of_navigations); 45 int number_of_navigations);
46 46
47 47
48 // Executes the passed |script| in the frame pointed to by |frame_xpath| (use 48 // Executes the passed |script| in the frame pointed to by |frame_xpath| (use
49 // empty string for main frame) and returns the value the evaluation of the 49 // empty string for main frame) and returns the value the evaluation of the
50 // script returned. The caller owns the returned value. 50 // script returned. The caller owns the returned value.
51 Value* ExecuteJavaScript(TabContents* tab_contents, 51 Value* ExecuteJavaScript(RenderViewHost* render_view_host,
52 const std::wstring& frame_xpath, 52 const std::wstring& frame_xpath,
53 const std::wstring& script); 53 const std::wstring& script);
54 54
55 // The following methods executes the passed |script| in the frame pointed to by 55 // The following methods executes the passed |script| in the frame pointed to by
56 // |frame_xpath| (use empty string for main frame) and sets |result| to the 56 // |frame_xpath| (use empty string for main frame) and sets |result| to the
57 // value returned by the script evaluation. 57 // value returned by the script evaluation.
58 // They return true on success, false if the script evaluation failed or did not 58 // They return true on success, false if the script evaluation failed or did not
59 // evaluate to the expected type. 59 // evaluate to the expected type.
60 // Note: In order for the domAutomationController to work, you must call 60 // Note: In order for the domAutomationController to work, you must call
61 // EnableDOMAutomation() in your test first. 61 // EnableDOMAutomation() in your test first.
62 bool ExecuteJavaScriptAndExtractInt(TabContents* tab_contents, 62 bool ExecuteJavaScriptAndExtractInt(RenderViewHost* render_view_host,
63 const std::wstring& frame_xpath, 63 const std::wstring& frame_xpath,
64 const std::wstring& script, 64 const std::wstring& script,
65 int* result); 65 int* result);
66 bool ExecuteJavaScriptAndExtractBool(TabContents* tab_contents, 66 bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host,
67 const std::wstring& frame_xpath, 67 const std::wstring& frame_xpath,
68 const std::wstring& script, 68 const std::wstring& script,
69 bool* result); 69 bool* result);
70 bool ExecuteJavaScriptAndExtractString(TabContents* tab_contents, 70 bool ExecuteJavaScriptAndExtractString(RenderViewHost* render_view_host,
71 const std::wstring& frame_xpath, 71 const std::wstring& frame_xpath,
72 const std::wstring& script, 72 const std::wstring& script,
73 std::string* result); 73 std::string* result);
74 74
75 GURL GetTestUrl(const std::wstring& dir, const std::wstring file); 75 GURL GetTestUrl(const std::wstring& dir, const std::wstring file);
76 76
77 // Creates an observer that waits for |download_manager| to report that it 77 // Creates an observer that waits for |download_manager| to report that it
78 // has a total of |count| downloads that have been handles 78 // has a total of |count| downloads that have been handles
79 void WaitForDownloadCount(DownloadManager* download_manager, size_t count); 79 void WaitForDownloadCount(DownloadManager* download_manager, size_t count);
80 } 80 }
81 81
82 #endif // CHROME_TEST_UI_TEST_UTILS_H_ 82 #endif // CHROME_TEST_UI_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/test/in_process_browser_test.cc ('k') | chrome/test/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698