OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ | 5 #ifndef CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ |
6 #define CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ | 6 #define CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/public/test/browser_test.h" | 10 #include "content/public/test/browser_test.h" |
11 #include "content/public/test/browser_test_base.h" | 11 #include "content/public/test/browser_test_base.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } | 15 } |
16 | 16 |
17 namespace chromecast { | 17 namespace chromecast { |
18 class CastContentWindow; | 18 class CastContentWindow; |
19 | 19 |
20 namespace shell { | 20 namespace shell { |
21 | 21 |
22 // This test allows for running an entire browser-process lifecycle per unit | 22 // This test allows for running an entire browser-process lifecycle per unit |
23 // test, using Chromecast's cast_shell. This starts up the shell, runs a test | 23 // test, using Chromecast's cast_shell. This starts up the shell, runs a test |
24 // case, then shuts down the entire shell. | 24 // case, then shuts down the entire shell. |
25 // Note that this process takes 7-10 seconds per test case on Chromecast, so | 25 // Note that this process takes 7-10 seconds per test case on Chromecast, so |
26 // fewer test cases with more assertions are preferable. | 26 // fewer test cases with more assertions are preferable. |
27 class ChromecastBrowserTest : public content::BrowserTestBase { | 27 class ChromecastBrowserTest : public content::BrowserTestBase { |
28 protected: | 28 protected: |
29 ChromecastBrowserTest(); | 29 ChromecastBrowserTest(); |
30 virtual ~ChromecastBrowserTest(); | 30 ~ChromecastBrowserTest() override; |
31 | 31 |
32 // testing::Test implementation: | 32 // testing::Test implementation: |
33 virtual void SetUp() override; | 33 void SetUp() override; |
34 | 34 |
35 // BrowserTestBase implementation: | 35 // BrowserTestBase implementation: |
36 virtual void RunTestOnMainThreadLoop() override; | 36 void RunTestOnMainThreadLoop() override; |
37 | 37 |
38 protected: | 38 protected: |
39 void NavigateToURL(content::WebContents* window, const GURL& gurl); | 39 void NavigateToURL(content::WebContents* window, const GURL& gurl); |
40 | 40 |
41 // Creates a new window and loads about:blank. | 41 // Creates a new window and loads about:blank. |
42 content::WebContents* CreateBrowser(); | 42 content::WebContents* CreateBrowser(); |
43 | 43 |
44 // Returns the window for the test. | 44 // Returns the window for the test. |
45 content::WebContents* web_contents() const { return web_contents_.get(); } | 45 content::WebContents* web_contents() const { return web_contents_.get(); } |
46 | 46 |
47 private: | 47 private: |
48 scoped_ptr<content::WebContents> web_contents_; | 48 scoped_ptr<content::WebContents> web_contents_; |
49 scoped_ptr<CastContentWindow> window_; | 49 scoped_ptr<CastContentWindow> window_; |
50 | 50 |
51 bool setup_called_; | 51 bool setup_called_; |
52 | 52 |
53 DISALLOW_COPY_AND_ASSIGN(ChromecastBrowserTest); | 53 DISALLOW_COPY_AND_ASSIGN(ChromecastBrowserTest); |
54 }; | 54 }; |
55 | 55 |
56 } // namespace shell | 56 } // namespace shell |
57 } // namespace chromecast | 57 } // namespace chromecast |
58 | 58 |
59 #endif // CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ | 59 #endif // CHROMECAST_BROWSER_TEST_CHROMECAST_BROWSER_TEST_H_ |
OLD | NEW |