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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Synchronously evaluates a script and returns the result. | 74 // Synchronously evaluates a script and returns the result. |
75 std::unique_ptr<runtime::EvaluateResult> EvaluateScript( | 75 std::unique_ptr<runtime::EvaluateResult> EvaluateScript( |
76 HeadlessWebContents* web_contents, | 76 HeadlessWebContents* web_contents, |
77 const std::string& script); | 77 const std::string& script); |
78 | 78 |
79 protected: | 79 protected: |
80 // Returns the browser for the test. | 80 // Returns the browser for the test. |
81 HeadlessBrowser* browser() const; | 81 HeadlessBrowser* browser() const; |
82 | 82 |
| 83 // Returns the options used by the browser. Modify with caution, since some |
| 84 // options only take effect if they were set before browser creation. |
| 85 HeadlessBrowser::Options* options() const; |
| 86 |
83 private: | 87 private: |
84 std::unique_ptr<base::RunLoop> run_loop_; | 88 std::unique_ptr<base::RunLoop> run_loop_; |
85 | 89 |
86 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserTest); | 90 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserTest); |
87 }; | 91 }; |
88 | 92 |
89 #define HEADLESS_ASYNC_DEVTOOLED_TEST_F(TEST_FIXTURE_NAME) \ | 93 #define HEADLESS_ASYNC_DEVTOOLED_TEST_F(TEST_FIXTURE_NAME) \ |
90 IN_PROC_BROWSER_TEST_F(TEST_FIXTURE_NAME, RunAsyncTest) { RunTest(); } \ | 94 IN_PROC_BROWSER_TEST_F(TEST_FIXTURE_NAME, RunAsyncTest) { RunTest(); } \ |
91 class AsyncHeadlessBrowserTestNeedsSemicolon##TEST_FIXTURE_NAME {} | 95 class AsyncHeadlessBrowserTestNeedsSemicolon##TEST_FIXTURE_NAME {} |
92 | 96 |
(...skipping 18 matching lines...) Expand all Loading... |
111 void RunTest(); | 115 void RunTest(); |
112 | 116 |
113 HeadlessBrowserContext* browser_context_; // Not owned. | 117 HeadlessBrowserContext* browser_context_; // Not owned. |
114 HeadlessWebContents* web_contents_; | 118 HeadlessWebContents* web_contents_; |
115 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; | 119 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; |
116 }; | 120 }; |
117 | 121 |
118 } // namespace headless | 122 } // namespace headless |
119 | 123 |
120 #endif // HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ | 124 #endif // HEADLESS_TEST_HEADLESS_BROWSER_TEST_H_ |
OLD | NEW |