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 "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "base/location.h" | 8 #include "base/location.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" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/profiles/profile_destroyer.h" | 13 #include "chrome/browser/profiles/profile_destroyer.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_navigator.h" | 15 #include "chrome/browser/ui/browser_navigator.h" |
16 #include "chrome/browser/ui/browser_navigator_params.h" | 16 #include "chrome/browser/ui/browser_navigator_params.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
19 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
20 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
22 #include "content/public/test/test_renderer_host.h" | 22 #include "content/public/test/test_renderer_host.h" |
23 #include "ui/base/page_transition_types.h" | 23 #include "ui/base/page_transition_types.h" |
24 | 24 |
25 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
26 #include "ash/test/ash_test_helper.h" | 26 #include "ash/test/ash_test_helper.h" |
| 27 #include "chrome/test/base/ash_test_environment_chrome.h" |
27 #elif defined(TOOLKIT_VIEWS) | 28 #elif defined(TOOLKIT_VIEWS) |
28 #include "ui/views/test/scoped_views_test_helper.h" | 29 #include "ui/views/test/scoped_views_test_helper.h" |
29 #endif | 30 #endif |
30 | 31 |
31 #if defined(TOOLKIT_VIEWS) | 32 #if defined(TOOLKIT_VIEWS) |
32 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 33 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
33 #include "components/constrained_window/constrained_window_views.h" | 34 #include "components/constrained_window/constrained_window_views.h" |
34 #endif | 35 #endif |
35 | 36 |
36 using content::NavigationController; | 37 using content::NavigationController; |
(...skipping 10 matching lines...) Expand all Loading... |
47 | 48 |
48 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { | 49 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { |
49 } | 50 } |
50 | 51 |
51 void BrowserWithTestWindowTest::SetUp() { | 52 void BrowserWithTestWindowTest::SetUp() { |
52 testing::Test::SetUp(); | 53 testing::Test::SetUp(); |
53 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
54 // TODO(jamescook): Windows Ash support. This will require refactoring | 55 // TODO(jamescook): Windows Ash support. This will require refactoring |
55 // AshTestHelper and AuraTestHelper so they can be used at the same time, | 56 // AshTestHelper and AuraTestHelper so they can be used at the same time, |
56 // perhaps by AshTestHelper owning an AuraTestHelper. | 57 // perhaps by AshTestHelper owning an AuraTestHelper. |
57 ash_test_helper_.reset(new ash::test::AshTestHelper( | 58 ash_test_environment_ = base::MakeUnique<AshTestEnvironmentChrome>(); |
58 base::MessageLoopForUI::current())); | 59 ash_test_helper_.reset( |
| 60 new ash::test::AshTestHelper(ash_test_environment_.get())); |
59 ash_test_helper_->SetUp(true, | 61 ash_test_helper_->SetUp(true, |
60 ash::MaterialDesignController::Mode::UNINITIALIZED); | 62 ash::MaterialDesignController::Mode::UNINITIALIZED); |
61 #elif defined(TOOLKIT_VIEWS) | 63 #elif defined(TOOLKIT_VIEWS) |
62 views_test_helper_.reset(new views::ScopedViewsTestHelper()); | 64 views_test_helper_.reset(new views::ScopedViewsTestHelper()); |
63 #endif | 65 #endif |
64 #if defined(TOOLKIT_VIEWS) | 66 #if defined(TOOLKIT_VIEWS) |
65 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); | 67 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
66 #endif | 68 #endif |
67 | 69 |
68 // Subclasses can provide their own Profile. | 70 // Subclasses can provide their own Profile. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 Browser::CreateParams params(profile); | 231 Browser::CreateParams params(profile); |
230 if (hosted_app) { | 232 if (hosted_app) { |
231 params = Browser::CreateParams::CreateForApp( | 233 params = Browser::CreateParams::CreateForApp( |
232 "Test", true /* trusted_source */, gfx::Rect(), profile); | 234 "Test", true /* trusted_source */, gfx::Rect(), profile); |
233 } else { | 235 } else { |
234 params.type = browser_type; | 236 params.type = browser_type; |
235 } | 237 } |
236 params.window = browser_window; | 238 params.window = browser_window; |
237 return new Browser(params); | 239 return new Browser(params); |
238 } | 240 } |
OLD | NEW |