| OLD | NEW |
| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
| 23 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 #include "ui/base/keycodes/keyboard_codes.h" | 25 #include "ui/base/keycodes/keyboard_codes.h" |
| 26 #include "ui/base/window_open_disposition.h" | 26 #include "ui/base/window_open_disposition.h" |
| 27 #include "ui/gfx/native_widget_types.h" | 27 #include "ui/gfx/native_widget_types.h" |
| 28 | 28 |
| 29 class AppModalDialog; | 29 class AppModalDialog; |
| 30 class BookmarkModel; | 30 class BookmarkModel; |
| 31 class Browser; | 31 class Browser; |
| 32 class FilePath; | |
| 33 class LocationBar; | 32 class LocationBar; |
| 34 class Profile; | 33 class Profile; |
| 35 class SkBitmap; | 34 class SkBitmap; |
| 36 class TemplateURLService; | 35 class TemplateURLService; |
| 37 | 36 |
| 37 namespace base { |
| 38 class FilePath; |
| 39 } |
| 40 |
| 38 namespace chrome { | 41 namespace chrome { |
| 39 struct NavigateParams; | 42 struct NavigateParams; |
| 40 } | 43 } |
| 41 | 44 |
| 42 namespace content { | 45 namespace content { |
| 43 class MessageLoopRunner; | 46 class MessageLoopRunner; |
| 44 class RenderViewHost; | 47 class RenderViewHost; |
| 45 class RenderWidgetHost; | 48 class RenderWidgetHost; |
| 46 class WebContents; | 49 class WebContents; |
| 47 } | 50 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 103 |
| 101 // Navigates the selected tab of |browser| to |url|, blocking until the | 104 // Navigates the selected tab of |browser| to |url|, blocking until the |
| 102 // number of navigations specified complete. | 105 // number of navigations specified complete. |
| 103 void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, | 106 void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, |
| 104 const GURL& url, | 107 const GURL& url, |
| 105 int number_of_navigations); | 108 int number_of_navigations); |
| 106 | 109 |
| 107 // Generate the file path for testing a particular test. | 110 // Generate the file path for testing a particular test. |
| 108 // The file for the tests is all located in | 111 // The file for the tests is all located in |
| 109 // test_root_directory/dir/<file> | 112 // test_root_directory/dir/<file> |
| 110 // The returned path is FilePath format. | 113 // The returned path is base::FilePath format. |
| 111 FilePath GetTestFilePath(const FilePath& dir, const FilePath& file); | 114 base::FilePath GetTestFilePath(const base::FilePath& dir, |
| 115 const base::FilePath& file); |
| 112 | 116 |
| 113 // Generate the URL for testing a particular test. | 117 // Generate the URL for testing a particular test. |
| 114 // HTML for the tests is all located in | 118 // HTML for the tests is all located in |
| 115 // test_root_directory/dir/<file> | 119 // test_root_directory/dir/<file> |
| 116 // The returned path is GURL format. | 120 // The returned path is GURL format. |
| 117 GURL GetTestUrl(const FilePath& dir, const FilePath& file); | 121 GURL GetTestUrl(const base::FilePath& dir, const base::FilePath& file); |
| 118 | 122 |
| 119 // Generate the path of the build directory, relative to the source root. | 123 // Generate the path of the build directory, relative to the source root. |
| 120 bool GetRelativeBuildDirectory(FilePath* build_dir); | 124 bool GetRelativeBuildDirectory(base::FilePath* build_dir); |
| 121 | 125 |
| 122 // Blocks until an application modal dialog is showns and returns it. | 126 // Blocks until an application modal dialog is showns and returns it. |
| 123 AppModalDialog* WaitForAppModalDialog(); | 127 AppModalDialog* WaitForAppModalDialog(); |
| 124 | 128 |
| 125 // Performs a find in the page of the specified tab. Returns the number of | 129 // Performs a find in the page of the specified tab. Returns the number of |
| 126 // matches found. |ordinal| is an optional parameter which is set to the index | 130 // matches found. |ordinal| is an optional parameter which is set to the index |
| 127 // of the current match. |selection_rect| is an optional parameter which is set | 131 // of the current match. |selection_rect| is an optional parameter which is set |
| 128 // to the location of the current match. | 132 // to the location of the current match. |
| 129 int FindInPage(content::WebContents* tab, | 133 int FindInPage(content::WebContents* tab, |
| 130 const string16& search_string, | 134 const string16& search_string, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // Takes a snapshot of the entire page, according to the width and height | 272 // Takes a snapshot of the entire page, according to the width and height |
| 269 // properties of the DOM's document. Returns true on success. DOMAutomation | 273 // properties of the DOM's document. Returns true on success. DOMAutomation |
| 270 // must be enabled. | 274 // must be enabled. |
| 271 bool TakeEntirePageSnapshot(content::RenderViewHost* rvh, | 275 bool TakeEntirePageSnapshot(content::RenderViewHost* rvh, |
| 272 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 276 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
| 273 | 277 |
| 274 #if defined(OS_WIN) | 278 #if defined(OS_WIN) |
| 275 // Saves a snapshot of the entire screen to a file named | 279 // Saves a snapshot of the entire screen to a file named |
| 276 // ChromiumSnapshotYYYYMMDDHHMMSS.png to |directory|, returning true on success. | 280 // ChromiumSnapshotYYYYMMDDHHMMSS.png to |directory|, returning true on success. |
| 277 // The path to the file produced is returned in |screenshot_path| if non-NULL. | 281 // The path to the file produced is returned in |screenshot_path| if non-NULL. |
| 278 bool SaveScreenSnapshotToDirectory(const FilePath& directory, | 282 bool SaveScreenSnapshotToDirectory(const base::FilePath& directory, |
| 279 FilePath* screenshot_path); | 283 base::FilePath* screenshot_path); |
| 280 | 284 |
| 281 // Saves a snapshot of the entire screen as above to the current user's desktop. | 285 // Saves a snapshot of the entire screen as above to the current user's desktop. |
| 282 // The Chrome path provider must be registered prior to calling this function. | 286 // The Chrome path provider must be registered prior to calling this function. |
| 283 bool SaveScreenSnapshotToDesktop(FilePath* screenshot_path); | 287 bool SaveScreenSnapshotToDesktop(base::FilePath* screenshot_path); |
| 284 #endif | 288 #endif |
| 285 | 289 |
| 286 // Configures the geolocation provider to always return the given position. | 290 // Configures the geolocation provider to always return the given position. |
| 287 void OverrideGeolocation(double latitude, double longitude); | 291 void OverrideGeolocation(double latitude, double longitude); |
| 288 | 292 |
| 289 // Enumerates all history contents on the backend thread. Returns them in | 293 // Enumerates all history contents on the backend thread. Returns them in |
| 290 // descending order by time. | 294 // descending order by time. |
| 291 class HistoryEnumerator { | 295 class HistoryEnumerator { |
| 292 public: | 296 public: |
| 293 explicit HistoryEnumerator(Profile* profile); | 297 explicit HistoryEnumerator(Profile* profile); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 304 std::vector<GURL> urls_; | 308 std::vector<GURL> urls_; |
| 305 | 309 |
| 306 CancelableRequestConsumer consumer_; | 310 CancelableRequestConsumer consumer_; |
| 307 | 311 |
| 308 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); | 312 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); |
| 309 }; | 313 }; |
| 310 | 314 |
| 311 } // namespace ui_test_utils | 315 } // namespace ui_test_utils |
| 312 | 316 |
| 313 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 317 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| OLD | NEW |