Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: chrome/test/base/browser_with_test_window_test.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Changes due to feedback. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/views/test/test_views_delegate.h"
27
28 #if defined(TOOLKIT_VIEWS)
29 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
30 #include "chrome/browser/ui/views/harmony/chrome_layout_delegate.h"
31 #include "components/constrained_window/constrained_window_views.h"
26 32
27 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
28 #include "ash/test/ash_test_helper.h" 34 #include "ash/test/ash_test_helper.h"
35 #include "ash/test/ash_test_views_delegate.h"
29 #include "chrome/test/base/ash_test_environment_chrome.h" 36 #include "chrome/test/base/ash_test_environment_chrome.h"
30 #elif defined(TOOLKIT_VIEWS) 37 #else
31 #include "ui/views/test/scoped_views_test_helper.h" 38 #include "ui/views/test/scoped_views_test_helper.h"
39 #include "ui/views/test/test_views_delegate.h"
32 #endif 40 #endif
33
34 #if defined(TOOLKIT_VIEWS)
35 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
36 #include "components/constrained_window/constrained_window_views.h"
37 #endif 41 #endif
38 42
39 using content::NavigationController; 43 using content::NavigationController;
40 using content::RenderFrameHost; 44 using content::RenderFrameHost;
41 using content::RenderFrameHostTester; 45 using content::RenderFrameHostTester;
42 using content::WebContents; 46 using content::WebContents;
43 47
44 BrowserWithTestWindowTest::BrowserWithTestWindowTest() 48 BrowserWithTestWindowTest::BrowserWithTestWindowTest()
45 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false) {} 49 : BrowserWithTestWindowTest(Browser::TYPE_TABBED, false) {}
46 50
(...skipping 12 matching lines...) Expand all
59 // perhaps by AshTestHelper owning an AuraTestHelper. 63 // perhaps by AshTestHelper owning an AuraTestHelper.
60 ash_test_environment_ = base::MakeUnique<AshTestEnvironmentChrome>(); 64 ash_test_environment_ = base::MakeUnique<AshTestEnvironmentChrome>();
61 ash_test_helper_.reset( 65 ash_test_helper_.reset(
62 new ash::test::AshTestHelper(ash_test_environment_.get())); 66 new ash::test::AshTestHelper(ash_test_environment_.get()));
63 ash_test_helper_->SetUp(true); 67 ash_test_helper_->SetUp(true);
64 #elif defined(TOOLKIT_VIEWS) 68 #elif defined(TOOLKIT_VIEWS)
65 views_test_helper_.reset(new views::ScopedViewsTestHelper()); 69 views_test_helper_.reset(new views::ScopedViewsTestHelper());
66 #endif 70 #endif
67 #if defined(TOOLKIT_VIEWS) 71 #if defined(TOOLKIT_VIEWS)
68 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient()); 72 SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient());
73
74 test_views_delegate()->set_layout_delegate(
75 base::MakeUnique<ChromeLayoutDelegate>());
69 #endif 76 #endif
70 77
71 if (content::IsBrowserSideNavigationEnabled()) 78 if (content::IsBrowserSideNavigationEnabled())
72 content::BrowserSideNavigationSetUp(); 79 content::BrowserSideNavigationSetUp();
73 80
74 // Subclasses can provide their own Profile. 81 // Subclasses can provide their own Profile.
75 profile_ = CreateProfile(); 82 profile_ = CreateProfile();
76 // Subclasses can provide their own test BrowserWindow. If they return NULL 83 // Subclasses can provide their own test BrowserWindow. If they return NULL
77 // then Browser will create the a production BrowserWindow and the subclass 84 // then Browser will create the a production BrowserWindow and the subclass
78 // is responsible for cleaning it up (usually by NativeWidget destruction). 85 // is responsible for cleaning it up (usually by NativeWidget destruction).
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 Browser::CreateParams params(profile, true); 208 Browser::CreateParams params(profile, true);
202 if (hosted_app) { 209 if (hosted_app) {
203 params = Browser::CreateParams::CreateForApp( 210 params = Browser::CreateParams::CreateForApp(
204 "Test", true /* trusted_source */, gfx::Rect(), profile, true); 211 "Test", true /* trusted_source */, gfx::Rect(), profile, true);
205 } else { 212 } else {
206 params.type = browser_type; 213 params.type = browser_type;
207 } 214 }
208 params.window = browser_window; 215 params.window = browser_window;
209 return new Browser(params); 216 return new Browser(params);
210 } 217 }
218
219 #if defined(TOOLKIT_VIEWS)
220 views::TestViewsDelegate* BrowserWithTestWindowTest::test_views_delegate() {
221 #if defined(OS_CHROMEOS)
222 return ash_test_helper_->test_views_delegate();
223 #else
224 return views_test_helper_->test_views_delegate();
225 #endif
226 }
227 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698