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_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // navigation leads to web_contents being destroyed. | 94 // navigation leads to web_contents being destroyed. |
95 void WaitForLoadStopWithoutSuccessCheck(WebContents* web_contents); | 95 void WaitForLoadStopWithoutSuccessCheck(WebContents* web_contents); |
96 | 96 |
97 // Waits for |web_contents| to stop loading. If |web_contents| is not loading | 97 // Waits for |web_contents| to stop loading. If |web_contents| is not loading |
98 // returns immediately. Returns true if the last navigation succeeded (resulted | 98 // returns immediately. Returns true if the last navigation succeeded (resulted |
99 // in a committed navigation entry of type PAGE_TYPE_NORMAL). | 99 // in a committed navigation entry of type PAGE_TYPE_NORMAL). |
100 // TODO(alexmos): tests that use this function to wait for successful | 100 // TODO(alexmos): tests that use this function to wait for successful |
101 // navigations should be refactored to do EXPECT_TRUE(WaitForLoadStop()). | 101 // navigations should be refactored to do EXPECT_TRUE(WaitForLoadStop()). |
102 bool WaitForLoadStop(WebContents* web_contents); | 102 bool WaitForLoadStop(WebContents* web_contents); |
103 | 103 |
| 104 // If a test uses a beforeunload dialog, it must be prepared to avoid flakes. |
| 105 // This function collects everything that needs to be done. |
| 106 void PrepContentsForBeforeUnloadTest(WebContents* web_contents); |
| 107 |
104 #if defined(USE_AURA) || defined(OS_ANDROID) | 108 #if defined(USE_AURA) || defined(OS_ANDROID) |
105 // If WebContent's view is currently being resized, this will wait for the ack | 109 // If WebContent's view is currently being resized, this will wait for the ack |
106 // from the renderer that the resize is complete and for the | 110 // from the renderer that the resize is complete and for the |
107 // WindowEventDispatcher to release the pointer moves. If there's no resize in | 111 // WindowEventDispatcher to release the pointer moves. If there's no resize in |
108 // progress, the method will return right away. | 112 // progress, the method will return right away. |
109 void WaitForResizeComplete(WebContents* web_contents); | 113 void WaitForResizeComplete(WebContents* web_contents); |
110 #endif // defined(USE_AURA) || defined(OS_ANDROID) | 114 #endif // defined(USE_AURA) || defined(OS_ANDROID) |
111 | 115 |
112 // Causes the specified web_contents to crash. Blocks until it is crashed. | 116 // Causes the specified web_contents to crash. Blocks until it is crashed. |
113 void CrashTab(WebContents* web_contents); | 117 void CrashTab(WebContents* web_contents); |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 846 |
843 private: | 847 private: |
844 PwnMessageHelper(); // Not instantiable. | 848 PwnMessageHelper(); // Not instantiable. |
845 | 849 |
846 DISALLOW_COPY_AND_ASSIGN(PwnMessageHelper); | 850 DISALLOW_COPY_AND_ASSIGN(PwnMessageHelper); |
847 }; | 851 }; |
848 | 852 |
849 } // namespace content | 853 } // namespace content |
850 | 854 |
851 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 855 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |