Chromium Code Reviews| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 | 215 |
| 216 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { | 216 void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { |
| 217 content::WebContents* web_contents = | 217 content::WebContents* web_contents = |
| 218 browser()->tab_strip_model()->GetActiveWebContents(); | 218 browser()->tab_strip_model()->GetActiveWebContents(); |
| 219 WebUIJsInjectionReadyObserver injection_observer( | 219 WebUIJsInjectionReadyObserver injection_observer( |
| 220 web_contents, this, preload_test_fixture_, preload_test_name_); | 220 web_contents, this, preload_test_fixture_, preload_test_name_); |
| 221 content::TestNavigationObserver navigation_observer(web_contents); | 221 content::TestNavigationObserver navigation_observer(web_contents); |
| 222 chrome::NavigateParams params( | 222 chrome::NavigateParams params( |
| 223 browser(), GURL(browse_to), ui::PAGE_TRANSITION_TYPED); | 223 browser(), GURL(browse_to), ui::PAGE_TRANSITION_TYPED); |
| 224 params.disposition = CURRENT_TAB; | 224 params.disposition = CURRENT_TAB; |
| 225 | |
| 226 // This is needed to make the test | |
| 227 // MaterialHistoryBrowserTest.HistoryToolbarFocusTest pass on macOS. The test | |
| 228 // is fundamentally flawed, since it expects a particular widget to be | |
| 229 // focused. Chrome focus semantics are based on the Windows platform, where a | |
| 230 // widget cannot be focused without window activation. browser_tests can be | |
|
sky
2016/08/30 22:09:07
interactive_ui_tests aren't sharded and are used w
erikchen
2016/08/30 22:17:12
Yes. I filed a bug against the team that wrote thi
| |
| 231 // 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 // activate the window. https://crbug.com/642467. | |
| 234 params.window_action = chrome::NavigateParams::SHOW_WINDOW; | |
| 235 | |
| 225 chrome::Navigate(¶ms); | 236 chrome::Navigate(¶ms); |
| 226 navigation_observer.Wait(); | 237 navigation_observer.Wait(); |
| 227 } | 238 } |
| 228 | 239 |
| 229 #if defined(ENABLE_PRINT_PREVIEW) | 240 #if defined(ENABLE_PRINT_PREVIEW) |
| 230 | 241 |
| 231 // This custom ContentBrowserClient is used to get notified when a WebContents | 242 // This custom ContentBrowserClient is used to get notified when a WebContents |
| 232 // for the print preview dialog gets created. | 243 // for the print preview dialog gets created. |
| 233 class PrintContentBrowserClient : public ChromeContentBrowserClient { | 244 class PrintContentBrowserClient : public ChromeContentBrowserClient { |
| 234 public: | 245 public: |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 } | 499 } |
| 489 | 500 |
| 490 GURL WebUIBrowserTest::WebUITestDataPathToURL( | 501 GURL WebUIBrowserTest::WebUITestDataPathToURL( |
| 491 const base::FilePath::StringType& path) { | 502 const base::FilePath::StringType& path) { |
| 492 base::FilePath dir_test_data; | 503 base::FilePath dir_test_data; |
| 493 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); | 504 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); |
| 494 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); | 505 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); |
| 495 EXPECT_TRUE(base::PathExists(test_path)); | 506 EXPECT_TRUE(base::PathExists(test_path)); |
| 496 return net::FilePathToFileURL(test_path); | 507 return net::FilePathToFileURL(test_path); |
| 497 } | 508 } |
| OLD | NEW |