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

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

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/test_html_dialog_observer.cc ('k') | chrome/test/base/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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 25 matching lines...) Expand all
36 36
37 class AppModalDialog; 37 class AppModalDialog;
38 class BookmarkModel; 38 class BookmarkModel;
39 class Browser; 39 class Browser;
40 class CommandLine; 40 class CommandLine;
41 class ExtensionAction; 41 class ExtensionAction;
42 class FilePath; 42 class FilePath;
43 class GURL; 43 class GURL;
44 class MessageLoop; 44 class MessageLoop;
45 class Profile; 45 class Profile;
46 class RenderViewHost;
47 class RenderWidgetHost;
48 class ScopedTempDir; 46 class ScopedTempDir;
49 class SkBitmap; 47 class SkBitmap;
50 class TabContents; 48 class TabContents;
51 class TabContentsWrapper; 49 class TabContentsWrapper;
52 class TemplateURLService; 50 class TemplateURLService;
53 51
54 namespace browser { 52 namespace browser {
55 struct NavigateParams; 53 struct NavigateParams;
56 } 54 }
57 55
58 namespace content { 56 namespace content {
57 class RenderViewHost;
58 class RenderWidgetHost;
59 class WebContents; 59 class WebContents;
60 } 60 }
61 61
62 namespace gfx { 62 namespace gfx {
63 class Point; 63 class Point;
64 class Size; 64 class Size;
65 } 65 }
66 66
67 // A collections of functions designed for use with InProcessBrowserTest. 67 // A collections of functions designed for use with InProcessBrowserTest.
68 namespace ui_test_utils { 68 namespace ui_test_utils {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 // Gets the DOMDocument for the active tab in |browser|. 149 // Gets the DOMDocument for the active tab in |browser|.
150 // Returns a NULL reference on failure. 150 // Returns a NULL reference on failure.
151 DOMElementProxyRef GetActiveDOMDocument(Browser* browser); 151 DOMElementProxyRef GetActiveDOMDocument(Browser* browser);
152 152
153 // Executes the passed |script| in the frame pointed to by |frame_xpath| (use 153 // Executes the passed |script| in the frame pointed to by |frame_xpath| (use
154 // empty string for main frame). The |script| should not invoke 154 // empty string for main frame). The |script| should not invoke
155 // domAutomationController.send(); otherwise, your test will hang or be flaky. 155 // domAutomationController.send(); otherwise, your test will hang or be flaky.
156 // If you want to extract a result, use one of the below functions. 156 // If you want to extract a result, use one of the below functions.
157 // Returns true on success. 157 // Returns true on success.
158 bool ExecuteJavaScript(RenderViewHost* render_view_host, 158 bool ExecuteJavaScript(content::RenderViewHost* render_view_host,
159 const std::wstring& frame_xpath, 159 const std::wstring& frame_xpath,
160 const std::wstring& script) WARN_UNUSED_RESULT; 160 const std::wstring& script) WARN_UNUSED_RESULT;
161 161
162 // The following methods executes the passed |script| in the frame pointed to by 162 // The following methods executes the passed |script| in the frame pointed to by
163 // |frame_xpath| (use empty string for main frame) and sets |result| to the 163 // |frame_xpath| (use empty string for main frame) and sets |result| to the
164 // value returned by the script evaluation. 164 // value returned by the script evaluation.
165 // They return true on success, false if the script evaluation failed or did not 165 // They return true on success, false if the script evaluation failed or did not
166 // evaluate to the expected type. 166 // evaluate to the expected type.
167 // Note: In order for the domAutomationController to work, you must call 167 // Note: In order for the domAutomationController to work, you must call
168 // EnableDOMAutomation() in your test first. 168 // EnableDOMAutomation() in your test first.
169 bool ExecuteJavaScriptAndExtractInt(RenderViewHost* render_view_host, 169 bool ExecuteJavaScriptAndExtractInt(content::RenderViewHost* render_view_host,
170 const std::wstring& frame_xpath, 170 const std::wstring& frame_xpath,
171 const std::wstring& script, 171 const std::wstring& script,
172 int* result) WARN_UNUSED_RESULT; 172 int* result) WARN_UNUSED_RESULT;
173 bool ExecuteJavaScriptAndExtractBool(RenderViewHost* render_view_host, 173 bool ExecuteJavaScriptAndExtractBool(content::RenderViewHost* render_view_host,
174 const std::wstring& frame_xpath, 174 const std::wstring& frame_xpath,
175 const std::wstring& script, 175 const std::wstring& script,
176 bool* result) WARN_UNUSED_RESULT; 176 bool* result) WARN_UNUSED_RESULT;
177 bool ExecuteJavaScriptAndExtractString(RenderViewHost* render_view_host, 177 bool ExecuteJavaScriptAndExtractString(
178 const std::wstring& frame_xpath, 178 content::RenderViewHost* render_view_host,
179 const std::wstring& script, 179 const std::wstring& frame_xpath,
180 std::string* result) WARN_UNUSED_RESULT; 180 const std::wstring& script,
181 std::string* result) WARN_UNUSED_RESULT;
181 182
182 // Generate the file path for testing a particular test. 183 // Generate the file path for testing a particular test.
183 // The file for the tests is all located in 184 // The file for the tests is all located in
184 // test_root_directory/dir/<file> 185 // test_root_directory/dir/<file>
185 // The returned path is FilePath format. 186 // The returned path is FilePath format.
186 FilePath GetTestFilePath(const FilePath& dir, const FilePath& file); 187 FilePath GetTestFilePath(const FilePath& dir, const FilePath& file);
187 188
188 // Generate the URL for testing a particular test. 189 // Generate the URL for testing a particular test.
189 // HTML for the tests is all located in 190 // HTML for the tests is all located in
190 // test_root_directory/dir/<file> 191 // test_root_directory/dir/<file>
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 private: 570 private:
570 content::NotificationRegistrar registrar_; 571 content::NotificationRegistrar registrar_;
571 std::queue<std::string> message_queue_; 572 std::queue<std::string> message_queue_;
572 bool waiting_for_message_; 573 bool waiting_for_message_;
573 574
574 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); 575 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue);
575 }; 576 };
576 577
577 // Takes a snapshot of the given render widget, rendered at |page_size|. The 578 // Takes a snapshot of the given render widget, rendered at |page_size|. The
578 // snapshot is set to |bitmap|. Returns true on success. 579 // snapshot is set to |bitmap|. Returns true on success.
579 bool TakeRenderWidgetSnapshot(RenderWidgetHost* rwh, 580 bool TakeRenderWidgetSnapshot(content::RenderWidgetHost* rwh,
580 const gfx::Size& page_size, 581 const gfx::Size& page_size,
581 SkBitmap* bitmap) WARN_UNUSED_RESULT; 582 SkBitmap* bitmap) WARN_UNUSED_RESULT;
582 583
583 // Takes a snapshot of the entire page, according to the width and height 584 // Takes a snapshot of the entire page, according to the width and height
584 // properties of the DOM's document. Returns true on success. DOMAutomation 585 // properties of the DOM's document. Returns true on success. DOMAutomation
585 // must be enabled. 586 // must be enabled.
586 bool TakeEntirePageSnapshot(RenderViewHost* rvh, 587 bool TakeEntirePageSnapshot(content::RenderViewHost* rvh,
587 SkBitmap* bitmap) WARN_UNUSED_RESULT; 588 SkBitmap* bitmap) WARN_UNUSED_RESULT;
588 589
589 } // namespace ui_test_utils 590 } // namespace ui_test_utils
590 591
591 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ 592 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/test/base/test_html_dialog_observer.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698