| OLD | NEW |
| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { | 217 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { |
| 218 content::WebContents* web_contents = | 218 content::WebContents* web_contents = |
| 219 browser()->tab_strip_model()->GetActiveWebContents(); | 219 browser()->tab_strip_model()->GetActiveWebContents(); |
| 220 WebUIJsInjectionReadyObserver injection_observer( | 220 WebUIJsInjectionReadyObserver injection_observer( |
| 221 web_contents, this, preload_test_fixture_, preload_test_name_); | 221 web_contents, this, preload_test_fixture_, preload_test_name_); |
| 222 content::TestNavigationObserver navigation_observer(web_contents); | 222 content::TestNavigationObserver navigation_observer(web_contents); |
| 223 chrome::NavigateParams params( | 223 chrome::NavigateParams params( |
| 224 browser(), GURL(browse_to), ui::PAGE_TRANSITION_TYPED); | 224 browser(), GURL(browse_to), ui::PAGE_TRANSITION_TYPED); |
| 225 params.disposition = WindowOpenDisposition::CURRENT_TAB; | 225 params.disposition = WindowOpenDisposition::CURRENT_TAB; |
| 226 | 226 |
| 227 // This is needed to make the test | |
| 228 // MaterialHistoryBrowserTest.HistoryToolbarFocusTest pass on macOS. The test | |
| 229 // is fundamentally flawed, since it expects a particular widget to be | |
| 230 // focused. Chrome focus semantics are based on the Windows platform, where a | |
| 231 // widget cannot be focused without window activation. browser_tests can be | |
| 232 // sharded, so there is no way to enforce that a given window is activated. | |
| 233 // Focus tests should be interactive_ui_tests, and they should explicitly | |
| 234 // activate the window. https://crbug.com/642467. | |
| 235 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | |
| 236 | |
| 237 chrome::Navigate(¶ms); | 227 chrome::Navigate(¶ms); |
| 238 navigation_observer.Wait(); | 228 navigation_observer.Wait(); |
| 239 } | 229 } |
| 240 | 230 |
| 241 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 231 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 242 | 232 |
| 243 // This custom ContentBrowserClient is used to get notified when a WebContents | 233 // This custom ContentBrowserClient is used to get notified when a WebContents |
| 244 // for the print preview dialog gets created. | 234 // for the print preview dialog gets created. |
| 245 class PrintContentBrowserClient : public ChromeContentBrowserClient { | 235 class PrintContentBrowserClient : public ChromeContentBrowserClient { |
| 246 public: | 236 public: |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 489 } |
| 500 | 490 |
| 501 GURL WebUIBrowserTest::WebUITestDataPathToURL( | 491 GURL WebUIBrowserTest::WebUITestDataPathToURL( |
| 502 const base::FilePath::StringType& path) { | 492 const base::FilePath::StringType& path) { |
| 503 base::FilePath dir_test_data; | 493 base::FilePath dir_test_data; |
| 504 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); | 494 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); |
| 505 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); | 495 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); |
| 506 EXPECT_TRUE(base::PathExists(test_path)); | 496 EXPECT_TRUE(base::PathExists(test_path)); |
| 507 return net::FilePathToFileURL(test_path); | 497 return net::FilePathToFileURL(test_path); |
| 508 } | 498 } |
| OLD | NEW |