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

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

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: LayoutDelegate -> LayoutProvider 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 #ifndef CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ 5 #ifndef CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_
6 #define CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ 6 #define CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_
7 7
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/test/base/test_browser_window.h" 13 #include "chrome/test/base/test_browser_window.h"
14 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/test/test_browser_thread_bundle.h" 15 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "content/public/test/test_renderer_host.h" 16 #include "content/public/test/test_renderer_host.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 #if defined(TOOLKIT_VIEWS)
19 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
21 #include "ash/test/ash_test_helper.h"
22 #include "ash/test/ash_test_views_delegate.h"
20 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" 23 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
21 #include "chrome/browser/chromeos/settings/cros_settings.h" 24 #include "chrome/browser/chromeos/settings/cros_settings.h"
22 #include "chrome/browser/chromeos/settings/device_settings_service.h" 25 #include "chrome/browser/chromeos/settings/device_settings_service.h"
26 #else
27 #include "ui/views/test/scoped_views_test_helper.h"
28 #endif
23 #endif 29 #endif
24 30
25 #if defined(OS_WIN) 31 #if defined(OS_WIN)
26 #include "ui/base/win/scoped_ole_initializer.h" 32 #include "ui/base/win/scoped_ole_initializer.h"
27 #endif 33 #endif
28 34
29 class GURL; 35 class GURL;
30 36
37 #if defined(TOOLKIT_VIEWS)
38
Peter Kasting 2017/04/12 21:37:44 Nit: Either remove this blank line or add one abov
kylix_rd 2017/04/13 16:45:42 Done.
31 #if defined(OS_CHROMEOS) 39 #if defined(OS_CHROMEOS)
32 namespace ash { 40 namespace ash {
33 namespace test { 41 namespace test {
34 class AshTestEnvironment; 42 class AshTestEnvironment;
35 class AshTestHelper;
36 } 43 }
37 } 44 }
38 #elif defined(TOOLKIT_VIEWS)
39 namespace views {
40 class ScopedViewsTestHelper;
41 }
42 #endif 45 #endif
43 46
47 namespace views {
Peter Kasting 2017/04/12 21:37:44 Nit: I suggest placing this stuff above the nested
kylix_rd 2017/04/13 16:45:42 Done.
48 class TestViewsDelegate;
49 }
50 #endif
51
44 namespace content { 52 namespace content {
45 class NavigationController; 53 class NavigationController;
46 } 54 }
47 55
48 // Base class for browser based unit tests. BrowserWithTestWindowTest creates a 56 // Base class for browser based unit tests. BrowserWithTestWindowTest creates a
49 // Browser with a TestingProfile and TestBrowserWindow. To add a tab use 57 // Browser with a TestingProfile and TestBrowserWindow. To add a tab use
50 // AddTab. For example, the following adds a tab and navigates to 58 // AddTab. For example, the following adds a tab and navigates to
51 // two URLs that target the TestWebContents: 59 // two URLs that target the TestWebContents:
52 // 60 //
53 // // Add a new tab and navigate it. This will be at index 0. 61 // // Add a new tab and navigate it. This will be at index 0.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // value. Can return NULL to use the default window created by Browser. 145 // value. Can return NULL to use the default window created by Browser.
138 virtual BrowserWindow* CreateBrowserWindow(); 146 virtual BrowserWindow* CreateBrowserWindow();
139 147
140 // Creates the browser given |profile|, |browser_type|, |hosted_app|, and 148 // Creates the browser given |profile|, |browser_type|, |hosted_app|, and
141 // |browser_window|. The caller owns the return value. 149 // |browser_window|. The caller owns the return value.
142 virtual Browser* CreateBrowser(Profile* profile, 150 virtual Browser* CreateBrowser(Profile* profile,
143 Browser::Type browser_type, 151 Browser::Type browser_type,
144 bool hosted_app, 152 bool hosted_app,
145 BrowserWindow* browser_window); 153 BrowserWindow* browser_window);
146 154
155 #if defined(TOOLKIT_VIEWS)
156 views::TestViewsDelegate* test_views_delegate() {
157 #if defined(OS_CHROMEOS)
158 return ash_test_helper_->test_views_delegate();
159 #else
160 return views_test_helper_->test_views_delegate();
161 #endif
162 }
163 #endif
164
147 private: 165 private:
148 // We need to create a MessageLoop, otherwise a bunch of things fails. 166 // We need to create a MessageLoop, otherwise a bunch of things fails.
149 content::TestBrowserThreadBundle thread_bundle_; 167 content::TestBrowserThreadBundle thread_bundle_;
150 base::ShadowingAtExitManager at_exit_manager_; 168 base::ShadowingAtExitManager at_exit_manager_;
151 169
152 #if defined(OS_CHROMEOS) 170 #if defined(OS_CHROMEOS)
153 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 171 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
154 chromeos::ScopedTestCrosSettings test_cros_settings_; 172 chromeos::ScopedTestCrosSettings test_cros_settings_;
155 chromeos::ScopedTestUserManager test_user_manager_; 173 chromeos::ScopedTestUserManager test_user_manager_;
156 #endif 174 #endif
(...skipping 23 matching lines...) Expand all
180 // The type of browser to create (tabbed or popup). 198 // The type of browser to create (tabbed or popup).
181 Browser::Type browser_type_; 199 Browser::Type browser_type_;
182 200
183 // Whether the browser is part of a hosted app. 201 // Whether the browser is part of a hosted app.
184 bool hosted_app_; 202 bool hosted_app_;
185 203
186 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); 204 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest);
187 }; 205 };
188 206
189 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ 207 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698