| 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 CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class FilePath; | 13 class FilePath; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Rect; | 17 class Rect; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // A collections of functions designed for use with content_shell based browser | 20 // A collections of functions designed for use with content_shell based browser |
| 21 // tests. | 21 // tests. |
| 22 // Note: if a function here also works with browser_tests, it should be in | 22 // Note: if a function here also works with browser_tests, it should be in |
| 23 // content\public\test\browser_test_utils.h | 23 // content\public\test\browser_test_utils.h |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 class MessageLoopRunner; | 27 class MessageLoopRunner; |
| 28 class FrameTreeNode; |
| 28 class Shell; | 29 class Shell; |
| 29 | 30 |
| 30 // Generate the file path for testing a particular test. | 31 // Generate the file path for testing a particular test. |
| 31 // The file for the tests is all located in | 32 // The file for the tests is all located in |
| 32 // content/test/data/dir/<file> | 33 // content/test/data/dir/<file> |
| 33 // The returned path is FilePath format. | 34 // The returned path is FilePath format. |
| 34 base::FilePath GetTestFilePath(const char* dir, const char* file); | 35 base::FilePath GetTestFilePath(const char* dir, const char* file); |
| 35 | 36 |
| 36 // Generate the URL for testing a particular test. | 37 // Generate the URL for testing a particular test. |
| 37 // HTML for the tests is all located in | 38 // HTML for the tests is all located in |
| 38 // test_root_directory/dir/<file> | 39 // test_root_directory/dir/<file> |
| 39 // The returned path is GURL format. | 40 // The returned path is GURL format. |
| 40 GURL GetTestUrl(const char* dir, const char* file); | 41 GURL GetTestUrl(const char* dir, const char* file); |
| 41 | 42 |
| 42 // Navigates the selected tab of |window| to |url|, blocking until the | 43 // Navigates the selected tab of |window| to |url|, blocking until the |
| 43 // navigation finishes. | 44 // navigation finishes. |
| 44 void NavigateToURL(Shell* window, const GURL& url); | 45 void NavigateToURL(Shell* window, const GURL& url); |
| 45 void LoadDataWithBaseURL(Shell* window, | 46 void LoadDataWithBaseURL(Shell* window, |
| 46 const GURL& url, | 47 const GURL& url, |
| 47 const std::string data, | 48 const std::string data, |
| 48 const GURL& base_url); | 49 const GURL& base_url); |
| 49 | 50 |
| 51 // Navigates the frame represented by |node| to |url|, blocking until the |
| 52 // navigation finishes. |
| 53 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url); |
| 54 |
| 50 // Navigates the selected tab of |window| to |url|, blocking until the given | 55 // Navigates the selected tab of |window| to |url|, blocking until the given |
| 51 // number of navigations finishes. | 56 // number of navigations finishes. |
| 52 void NavigateToURLBlockUntilNavigationsComplete(Shell* window, | 57 void NavigateToURLBlockUntilNavigationsComplete(Shell* window, |
| 53 const GURL& url, | 58 const GURL& url, |
| 54 int number_of_navigations); | 59 int number_of_navigations); |
| 55 | 60 |
| 56 // Wait until an application modal dialog is requested. | 61 // Wait until an application modal dialog is requested. |
| 57 void WaitForAppModalDialog(Shell* window); | 62 void WaitForAppModalDialog(Shell* window); |
| 58 | 63 |
| 59 // Used to wait for a new Shell window to be created. Instantiate this object | 64 // Used to wait for a new Shell window to be created. Instantiate this object |
| (...skipping 16 matching lines...) Expand all Loading... |
| 76 DISALLOW_COPY_AND_ASSIGN(ShellAddedObserver); | 81 DISALLOW_COPY_AND_ASSIGN(ShellAddedObserver); |
| 77 }; | 82 }; |
| 78 | 83 |
| 79 #if defined OS_MACOSX | 84 #if defined OS_MACOSX |
| 80 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); | 85 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); |
| 81 #endif | 86 #endif |
| 82 | 87 |
| 83 } // namespace content | 88 } // namespace content |
| 84 | 89 |
| 85 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ | 90 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |