| 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" |
| 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/common/browser_side_navigation_policy.h" | 22 #include "content/public/common/browser_side_navigation_policy.h" |
| 23 #include "content/public/test/browser_side_navigation_test_utils.h" | 23 #include "content/public/test/browser_side_navigation_test_utils.h" |
| 24 #include "content/public/test/test_renderer_host.h" | 24 #include "content/public/test/test_renderer_host.h" |
| 25 #include "ui/base/page_transition_types.h" | 25 #include "ui/base/page_transition_types.h" |
| 26 | 26 #include "ui/views/test/test_views_delegate.h" |
| 27 #if defined(OS_CHROMEOS) | |
| 28 #include "ash/test/ash_test_helper.h" | |
| 29 #include "chrome/test/base/ash_test_environment_chrome.h" | |
| 30 #elif defined(TOOLKIT_VIEWS) | |
| 31 #include "ui/views/test/scoped_views_test_helper.h" | |
| 32 #endif | |
| 33 | 27 |
| 34 #if defined(TOOLKIT_VIEWS) | 28 #if defined(TOOLKIT_VIEWS) |
| 35 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" | 29 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" |
| 30 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 36 #include "components/constrained_window/constrained_window_views.h" | 31 #include "components/constrained_window/constrained_window_views.h" |
| 32 |
| 33 #if defined(OS_CHROMEOS) |
| 34 #include "chrome/test/base/ash_test_environment_chrome.h" |
| 35 #else |
| 36 #include "ui/views/test/test_views_delegate.h" |
| 37 #endif |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 39 using content::NavigationController; | 40 using content::NavigationController; |
| 40 using content::RenderFrameHost; | 41 using content::RenderFrameHost; |
| 41 using content::RenderFrameHostTester; | 42 using content::RenderFrameHostTester; |
| 42 using content::WebContents; | 43 using content::WebContents; |
| 43 | 44 |
| 44 BrowserWithTestWindowTest::BrowserWithTestWindowTest() | 45 BrowserWithTestWindowTest::BrowserWithTestWindowTest() |
| 45 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false) {} | 46 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false) {} |
| 46 | 47 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 // perhaps by AshTestHelper owning an AuraTestHelper. | 60 // perhaps by AshTestHelper owning an AuraTestHelper. |
| 60 ash_test_environment_ = base::MakeUnique<AshTestEnvironmentChrome>(); | 61 ash_test_environment_ = base::MakeUnique<AshTestEnvironmentChrome>(); |
| 61 ash_test_helper_.reset( | 62 ash_test_helper_.reset( |
| 62 new ash::test::AshTestHelper(ash_test_environment_.get())); | 63 new ash::test::AshTestHelper(ash_test_environment_.get())); |
| 63 ash_test_helper_->SetUp(true); | 64 ash_test_helper_->SetUp(true); |
| 64 #elif defined(TOOLKIT_VIEWS) | 65 #elif defined(TOOLKIT_VIEWS) |
| 65 views_test_helper_.reset(new views::ScopedViewsTestHelper()); | 66 views_test_helper_.reset(new views::ScopedViewsTestHelper()); |
| 66 #endif | 67 #endif |
| 67 #if defined(TOOLKIT_VIEWS) | 68 #if defined(TOOLKIT_VIEWS) |
| 68 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); | 69 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); |
| 70 |
| 71 test_views_delegate()->set_layout_provider( |
| 72 ChromeLayoutProvider::CreateLayoutProvider()); |
| 69 #endif | 73 #endif |
| 70 | 74 |
| 71 if (content::IsBrowserSideNavigationEnabled()) | 75 if (content::IsBrowserSideNavigationEnabled()) |
| 72 content::BrowserSideNavigationSetUp(); | 76 content::BrowserSideNavigationSetUp(); |
| 73 | 77 |
| 74 // Subclasses can provide their own Profile. | 78 // Subclasses can provide their own Profile. |
| 75 profile_ = CreateProfile(); | 79 profile_ = CreateProfile(); |
| 76 // Subclasses can provide their own test BrowserWindow. If they return NULL | 80 // Subclasses can provide their own test BrowserWindow. If they return NULL |
| 77 // then Browser will create the a production BrowserWindow and the subclass | 81 // then Browser will create the a production BrowserWindow and the subclass |
| 78 // is responsible for cleaning it up (usually by NativeWidget destruction). | 82 // is responsible for cleaning it up (usually by NativeWidget destruction). |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 Browser::CreateParams params(profile, true); | 198 Browser::CreateParams params(profile, true); |
| 195 if (hosted_app) { | 199 if (hosted_app) { |
| 196 params = Browser::CreateParams::CreateForApp( | 200 params = Browser::CreateParams::CreateForApp( |
| 197 "Test", true /* trusted_source */, gfx::Rect(), profile, true); | 201 "Test", true /* trusted_source */, gfx::Rect(), profile, true); |
| 198 } else { | 202 } else { |
| 199 params.type = browser_type; | 203 params.type = browser_type; |
| 200 } | 204 } |
| 201 params.window = browser_window; | 205 params.window = browser_window; |
| 202 return new Browser(params); | 206 return new Browser(params); |
| 203 } | 207 } |
| OLD | NEW |