OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ | 5 #ifndef HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ |
6 #define HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ | 6 #define HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "content/public/test/browser_test_base.h" | 9 #include "content/public/test/browser_test_base.h" |
10 #include "headless/public/headless_browser.h" | 10 #include "headless/public/headless_browser.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 ~HeadlessBrowserTest() override; | 28 ~HeadlessBrowserTest() override; |
29 | 29 |
30 // BrowserTestBase: | 30 // BrowserTestBase: |
31 void RunTestOnMainThreadLoop() override; | 31 void RunTestOnMainThreadLoop() override; |
32 void SetUpOnMainThread() override; | 32 void SetUpOnMainThread() override; |
33 void TearDownOnMainThread() override; | 33 void TearDownOnMainThread() override; |
34 | 34 |
35 // Customize the options used in this test. Note that options which take | 35 // Customize the options used in this test. Note that options which take |
36 // effect before the message loop has been started (e.g., custom message | 36 // effect before the message loop has been started (e.g., custom message |
37 // pumps) cannot be set via this method. | 37 // pumps) cannot be set via this method. |
38 void SetBrowserOptions(const HeadlessBrowser::Options& options); | 38 void SetBrowserOptions(HeadlessBrowser::Options options); |
39 | 39 |
40 // Run an asynchronous test in a nested run loop. The caller should call | 40 // Run an asynchronous test in a nested run loop. The caller should call |
41 // FinishAsynchronousTest() to notify that the test should finish. | 41 // FinishAsynchronousTest() to notify that the test should finish. |
42 void RunAsynchronousTest(); | 42 void RunAsynchronousTest(); |
43 | 43 |
44 // Synchronously waits for a tab to finish loading. | 44 // Synchronously waits for a tab to finish loading. |
45 bool WaitForLoad(HeadlessWebContents* web_contents); | 45 bool WaitForLoad(HeadlessWebContents* web_contents); |
46 | 46 |
47 protected: | 47 protected: |
48 // Returns the browser for the test. | 48 // Returns the browser for the test. |
49 HeadlessBrowser* browser() const; | 49 HeadlessBrowser* browser() const; |
50 | 50 |
51 private: | 51 private: |
52 std::unique_ptr<base::RunLoop> run_loop_; | 52 std::unique_ptr<base::RunLoop> run_loop_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserTest); | 54 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserTest); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace headless | 57 } // namespace headless |
58 | 58 |
59 #endif // HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ | 59 #endif // HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ |
OLD | NEW |