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

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

Issue 2458833005: Move printing defines to buildflag system. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « chrome/test/base/testing_browser_process.cc ('k') | chrome/utility/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/web_ui_browser_test.h" 5 #include "chrome/test/base/web_ui_browser_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 18 matching lines...) Expand all
29 #include "chrome/test/base/ui_test_utils.h" 29 #include "chrome/test/base/ui_test_utils.h"
30 #include "content/public/browser/url_data_source.h" 30 #include "content/public/browser/url_data_source.h"
31 #include "content/public/browser/web_contents.h" 31 #include "content/public/browser/web_contents.h"
32 #include "content/public/browser/web_contents_observer.h" 32 #include "content/public/browser/web_contents_observer.h"
33 #include "content/public/browser/web_ui_controller.h" 33 #include "content/public/browser/web_ui_controller.h"
34 #include "content/public/browser/web_ui_message_handler.h" 34 #include "content/public/browser/web_ui_message_handler.h"
35 #include "content/public/common/url_constants.h" 35 #include "content/public/common/url_constants.h"
36 #include "content/public/test/browser_test_utils.h" 36 #include "content/public/test/browser_test_utils.h"
37 #include "content/public/test/test_navigation_observer.h" 37 #include "content/public/test/test_navigation_observer.h"
38 #include "net/base/filename_util.h" 38 #include "net/base/filename_util.h"
39 #include "printing/features/features.h"
39 #include "ui/base/resource/resource_handle.h" 40 #include "ui/base/resource/resource_handle.h"
40 41
41 #if defined(ENABLE_PRINT_PREVIEW) 42 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
42 #include "chrome/browser/printing/print_preview_dialog_controller.h" 43 #include "chrome/browser/printing/print_preview_dialog_controller.h"
43 #endif 44 #endif
44 45
45 using content::RenderViewHost; 46 using content::RenderViewHost;
46 using content::WebContents; 47 using content::WebContents;
47 using content::WebUIController; 48 using content::WebUIController;
48 using content::WebUIMessageHandler; 49 using content::WebUIMessageHandler;
49 50
50 namespace { 51 namespace {
51 52
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // widget cannot be focused without window activation. browser_tests can be 231 // widget cannot be focused without window activation. browser_tests can be
231 // sharded, so there is no way to enforce that a given window is activated. 232 // sharded, so there is no way to enforce that a given window is activated.
232 // Focus tests should be interactive_ui_tests, and they should explicitly 233 // Focus tests should be interactive_ui_tests, and they should explicitly
233 // activate the window. https://crbug.com/642467. 234 // activate the window. https://crbug.com/642467.
234 params.window_action = chrome::NavigateParams::SHOW_WINDOW; 235 params.window_action = chrome::NavigateParams::SHOW_WINDOW;
235 236
236 chrome::Navigate(&params); 237 chrome::Navigate(&params);
237 navigation_observer.Wait(); 238 navigation_observer.Wait();
238 } 239 }
239 240
240 #if defined(ENABLE_PRINT_PREVIEW) 241 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
241 242
242 // This custom ContentBrowserClient is used to get notified when a WebContents 243 // This custom ContentBrowserClient is used to get notified when a WebContents
243 // for the print preview dialog gets created. 244 // for the print preview dialog gets created.
244 class PrintContentBrowserClient : public ChromeContentBrowserClient { 245 class PrintContentBrowserClient : public ChromeContentBrowserClient {
245 public: 246 public:
246 PrintContentBrowserClient(WebUIBrowserTest* browser_test, 247 PrintContentBrowserClient(WebUIBrowserTest* browser_test,
247 const std::string& preload_test_fixture, 248 const std::string& preload_test_fixture,
248 const std::string& preload_test_name) 249 const std::string& preload_test_name)
249 : browser_test_(browser_test), 250 : browser_test_(browser_test),
250 preload_test_fixture_(preload_test_fixture), 251 preload_test_fixture_(preload_test_fixture),
(...skipping 22 matching lines...) Expand all
273 WebUIBrowserTest* browser_test_; 274 WebUIBrowserTest* browser_test_;
274 std::unique_ptr<WebUIJsInjectionReadyObserver> observer_; 275 std::unique_ptr<WebUIJsInjectionReadyObserver> observer_;
275 std::string preload_test_fixture_; 276 std::string preload_test_fixture_;
276 std::string preload_test_name_; 277 std::string preload_test_name_;
277 content::WebContents* preview_dialog_; 278 content::WebContents* preview_dialog_;
278 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; 279 scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
279 }; 280 };
280 #endif 281 #endif
281 282
282 void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) { 283 void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) {
283 #if defined(ENABLE_PRINT_PREVIEW) 284 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
284 ui_test_utils::NavigateToURL(browser(), browse_to); 285 ui_test_utils::NavigateToURL(browser(), browse_to);
285 286
286 PrintContentBrowserClient new_client( 287 PrintContentBrowserClient new_client(
287 this, preload_test_fixture_, preload_test_name_); 288 this, preload_test_fixture_, preload_test_name_);
288 content::ContentBrowserClient* old_client = 289 content::ContentBrowserClient* old_client =
289 SetBrowserClientForTesting(&new_client); 290 SetBrowserClientForTesting(&new_client);
290 291
291 chrome::Print(browser()); 292 chrome::Print(browser());
292 new_client.Wait(); 293 new_client.Wait();
293 294
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 499 }
499 500
500 GURL WebUIBrowserTest::WebUITestDataPathToURL( 501 GURL WebUIBrowserTest::WebUITestDataPathToURL(
501 const base::FilePath::StringType& path) { 502 const base::FilePath::StringType& path) {
502 base::FilePath dir_test_data; 503 base::FilePath dir_test_data;
503 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); 504 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data));
504 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); 505 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path));
505 EXPECT_TRUE(base::PathExists(test_path)); 506 EXPECT_TRUE(base::PathExists(test_path));
506 return net::FilePathToFileURL(test_path); 507 return net::FilePathToFileURL(test_path);
507 } 508 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_browser_process.cc ('k') | chrome/utility/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698