Chromium Code Reviews| 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_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_ |
| 6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_ | 6 #define CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.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 BrowserContext; | |
| 14 class Shell; | 15 class Shell; |
| 15 class ShellMainDelegate; | 16 class ShellMainDelegate; |
| 16 | 17 |
| 17 // Base class for browser tests which use content_shell. | 18 // Base class for browser tests which use content_shell. |
| 18 class ContentBrowserTest : public BrowserTestBase { | 19 class ContentBrowserTest : public BrowserTestBase { |
| 19 protected: | 20 protected: |
| 20 ContentBrowserTest(); | 21 ContentBrowserTest(); |
| 21 ~ContentBrowserTest() override; | 22 ~ContentBrowserTest() override; |
| 22 | 23 |
| 23 // testing::Test: | 24 // testing::Test: |
| 24 void SetUp() override; | 25 void SetUp() override; |
| 25 void TearDown() override; | 26 void TearDown() override; |
| 26 | 27 |
| 27 // BrowserTestBase: | 28 // BrowserTestBase: |
| 28 void RunTestOnMainThreadLoop() override; | 29 void RunTestOnMainThreadLoop() override; |
| 29 | 30 |
| 30 protected: | 31 protected: |
| 32 // Returns the browser context for this profile. | |
| 33 BrowserContext* GetBrowserContext() const; | |
|
jam
2016/03/03 16:32:11
no need to add, tests do
shell()->web_contents()->
| |
| 34 | |
| 31 // Creates a new window and loads about:blank. | 35 // Creates a new window and loads about:blank. |
| 32 Shell* CreateBrowser(); | 36 Shell* CreateBrowser(); |
| 33 | 37 |
| 34 // Creates an off-the-record window and loads about:blank. | 38 // Creates an off-the-record window and loads about:blank. |
| 35 Shell* CreateOffTheRecordBrowser(); | 39 Shell* CreateOffTheRecordBrowser(); |
| 36 | 40 |
| 37 // Returns the window for the test. | 41 // Returns the window for the test. |
| 38 Shell* shell() const { return shell_; } | 42 Shell* shell() const { return shell_; } |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 Shell* shell_; | 45 Shell* shell_; |
| 42 | 46 |
| 43 #if defined(OS_ANDROID) | 47 #if defined(OS_ANDROID) |
| 44 // For all other platforms, this is done automatically when calling into | 48 // For all other platforms, this is done automatically when calling into |
| 45 // ContentMain. For Android we set things up manually. | 49 // ContentMain. For Android we set things up manually. |
| 46 scoped_ptr<ShellMainDelegate> shell_main_delegate_; | 50 scoped_ptr<ShellMainDelegate> shell_main_delegate_; |
| 47 #endif | 51 #endif |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 } // namespace content | 54 } // namespace content |
| 51 | 55 |
| 52 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_ | 56 #endif // CONTENT_PUBLIC_TEST_CONTENT_BROWSER_TEST_H_ |
| OLD | NEW |