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 #include "chrome/test/base/browser_with_test_window_test.h" | 5 #include "chrome/test/base/browser_with_test_window_test.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 using content::NavigationController; | 40 using content::NavigationController; |
41 using content::RenderFrameHost; | 41 using content::RenderFrameHost; |
42 using content::RenderFrameHostTester; | 42 using content::RenderFrameHostTester; |
43 using content::WebContents; | 43 using content::WebContents; |
44 | 44 |
45 BrowserWithTestWindowTest::BrowserWithTestWindowTest() | 45 BrowserWithTestWindowTest::BrowserWithTestWindowTest() |
46 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false) {} | 46 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false) {} |
47 | 47 |
48 BrowserWithTestWindowTest::BrowserWithTestWindowTest(Browser::Type browser_type, | 48 BrowserWithTestWindowTest::BrowserWithTestWindowTest(Browser::Type browser_type, |
49 bool hosted_app) | 49 bool hosted_app) |
50 : browser_type_(browser_type), hosted_app_(hosted_app) {} | 50 : browser_type_(browser_type), hosted_app_(hosted_app) { |
| 51 #if defined(OS_CHROMEOS) |
| 52 ash_test_environment_ = base::MakeUnique<AshTestEnvironmentChrome>(); |
| 53 ash_test_helper_ = |
| 54 base::MakeUnique<ash::test::AshTestHelper>(ash_test_environment_.get()); |
| 55 #endif |
| 56 } |
51 | 57 |
52 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { | 58 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() {} |
53 } | |
54 | 59 |
55 void BrowserWithTestWindowTest::SetUp() { | 60 void BrowserWithTestWindowTest::SetUp() { |
56 testing::Test::SetUp(); | 61 testing::Test::SetUp(); |
57 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
58 // TODO(jamescook): Windows Ash support. This will require refactoring | |
59 // AshTestHelper and AuraTestHelper so they can be used at the same time, | |
60 // perhaps by AshTestHelper owning an AuraTestHelper. | |
61 ash_test_environment_ = base::MakeUnique<AshTestEnvironmentChrome>(); | |
62 ash_test_helper_.reset( | |
63 new ash::test::AshTestHelper(ash_test_environment_.get())); | |
64 ash_test_helper_->SetUp(true); | 63 ash_test_helper_->SetUp(true); |
65 #elif defined(TOOLKIT_VIEWS) | 64 #elif defined(TOOLKIT_VIEWS) |
66 views_test_helper_.reset(new views::ScopedViewsTestHelper()); | 65 views_test_helper_.reset(new views::ScopedViewsTestHelper()); |
67 #endif | 66 #endif |
68 #if defined(TOOLKIT_VIEWS) | 67 #if defined(TOOLKIT_VIEWS) |
69 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); | 68 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
70 | 69 |
71 test_views_delegate()->set_layout_provider( | 70 test_views_delegate()->set_layout_provider( |
72 ChromeLayoutProvider::CreateLayoutProvider()); | 71 ChromeLayoutProvider::CreateLayoutProvider()); |
73 #endif | 72 #endif |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 Browser::CreateParams params(profile, true); | 197 Browser::CreateParams params(profile, true); |
199 if (hosted_app) { | 198 if (hosted_app) { |
200 params = Browser::CreateParams::CreateForApp( | 199 params = Browser::CreateParams::CreateForApp( |
201 "Test", true /* trusted_source */, gfx::Rect(), profile, true); | 200 "Test", true /* trusted_source */, gfx::Rect(), profile, true); |
202 } else { | 201 } else { |
203 params.type = browser_type; | 202 params.type = browser_type; |
204 } | 203 } |
205 params.window = browser_window; | 204 params.window = browser_window; |
206 return new Browser(params); | 205 return new Browser(params); |
207 } | 206 } |
OLD | NEW |