OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 CHECK(!navigation_handle->HasCommitted()); | 363 CHECK(!navigation_handle->HasCommitted()); |
364 run_loop_.Quit(); | 364 run_loop_.Quit(); |
365 } | 365 } |
366 base::RunLoop run_loop_; | 366 base::RunLoop run_loop_; |
367 }; | 367 }; |
368 | 368 |
369 } // namespace | 369 } // namespace |
370 | 370 |
371 class BrowserTest : public ExtensionBrowserTest { | 371 class BrowserTest : public ExtensionBrowserTest { |
372 protected: | 372 protected: |
| 373 void SetUpOnMainThread() override { |
| 374 ExtensionBrowserTest::SetUpOnMainThread(); |
| 375 host_resolver()->AddRule("*", "127.0.0.1"); |
| 376 } |
| 377 |
373 // In RTL locales wrap the page title with RTL embedding characters so that it | 378 // In RTL locales wrap the page title with RTL embedding characters so that it |
374 // matches the value returned by GetWindowTitle(). | 379 // matches the value returned by GetWindowTitle(). |
375 base::string16 LocaleWindowCaptionFromPageTitle( | 380 base::string16 LocaleWindowCaptionFromPageTitle( |
376 const base::string16& expected_title) { | 381 const base::string16& expected_title) { |
377 base::string16 page_title = WindowCaptionFromPageTitle(expected_title); | 382 base::string16 page_title = WindowCaptionFromPageTitle(expected_title); |
378 #if defined(OS_WIN) | 383 #if defined(OS_WIN) |
379 std::string locale = g_browser_process->GetApplicationLocale(); | 384 std::string locale = g_browser_process->GetApplicationLocale(); |
380 if (base::i18n::GetTextDirectionForLocale(locale.c_str()) == | 385 if (base::i18n::GetTextDirectionForLocale(locale.c_str()) == |
381 base::i18n::RIGHT_TO_LEFT) { | 386 base::i18n::RIGHT_TO_LEFT) { |
382 base::i18n::WrapStringWithLTRFormatting(&page_title); | 387 base::i18n::WrapStringWithLTRFormatting(&page_title); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 EXPECT_FALSE(web_contents->GetController().GetPendingEntry()); | 586 EXPECT_FALSE(web_contents->GetController().GetPendingEntry()); |
582 EXPECT_EQ(real_url, web_contents->GetVisibleURL()); | 587 EXPECT_EQ(real_url, web_contents->GetVisibleURL()); |
583 } | 588 } |
584 } | 589 } |
585 | 590 |
586 // Test for crbug.com/297289. Ensure that modal dialogs are closed when a | 591 // Test for crbug.com/297289. Ensure that modal dialogs are closed when a |
587 // cross-process navigation is ready to commit. | 592 // cross-process navigation is ready to commit. |
588 // Flaky test, see https://crbug.com/445155. | 593 // Flaky test, see https://crbug.com/445155. |
589 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_CrossProcessNavCancelsDialogs) { | 594 IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_CrossProcessNavCancelsDialogs) { |
590 ASSERT_TRUE(embedded_test_server()->Start()); | 595 ASSERT_TRUE(embedded_test_server()->Start()); |
591 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
592 GURL url(embedded_test_server()->GetURL("/empty.html")); | 596 GURL url(embedded_test_server()->GetURL("/empty.html")); |
593 ui_test_utils::NavigateToURL(browser(), url); | 597 ui_test_utils::NavigateToURL(browser(), url); |
594 | 598 |
595 // Test this with multiple alert dialogs to ensure that we can navigate away | 599 // Test this with multiple alert dialogs to ensure that we can navigate away |
596 // even if the renderer tries to synchronously create more. | 600 // even if the renderer tries to synchronously create more. |
597 // See http://crbug.com/312490. | 601 // See http://crbug.com/312490. |
598 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 602 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
599 contents->GetMainFrame()->ExecuteJavaScriptForTests( | 603 contents->GetMainFrame()->ExecuteJavaScriptForTests( |
600 ASCIIToUTF16("alert('one'); alert('two');")); | 604 ASCIIToUTF16("alert('one'); alert('two');")); |
601 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 605 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
602 EXPECT_TRUE(alert->IsValid()); | 606 EXPECT_TRUE(alert->IsValid()); |
603 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); | 607 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); |
604 EXPECT_TRUE(dialog_queue->HasActiveDialog()); | 608 EXPECT_TRUE(dialog_queue->HasActiveDialog()); |
605 | 609 |
606 // A cross-site navigation should force the dialog to close. | 610 // A cross-site navigation should force the dialog to close. |
607 GURL url2("http://www.example.com/empty.html"); | 611 GURL url2("http://www.example.com/empty.html"); |
608 ui_test_utils::NavigateToURL(browser(), url2); | 612 ui_test_utils::NavigateToURL(browser(), url2); |
609 EXPECT_FALSE(dialog_queue->HasActiveDialog()); | 613 EXPECT_FALSE(dialog_queue->HasActiveDialog()); |
610 | 614 |
611 // Make sure input events still work in the renderer process. | 615 // Make sure input events still work in the renderer process. |
612 EXPECT_FALSE(contents->GetRenderProcessHost()->IgnoreInputEvents()); | 616 EXPECT_FALSE(contents->GetRenderProcessHost()->IgnoreInputEvents()); |
613 } | 617 } |
614 | 618 |
615 // Make sure that dialogs are closed after a renderer process dies, and that | 619 // Make sure that dialogs are closed after a renderer process dies, and that |
616 // subsequent navigations work. See http://crbug/com/343265. | 620 // subsequent navigations work. See http://crbug/com/343265. |
617 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsDialogs) { | 621 IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsDialogs) { |
618 ASSERT_TRUE(embedded_test_server()->Start()); | 622 ASSERT_TRUE(embedded_test_server()->Start()); |
619 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
620 GURL beforeunload_url(embedded_test_server()->GetURL("/beforeunload.html")); | 623 GURL beforeunload_url(embedded_test_server()->GetURL("/beforeunload.html")); |
621 ui_test_utils::NavigateToURL(browser(), beforeunload_url); | 624 ui_test_utils::NavigateToURL(browser(), beforeunload_url); |
622 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 625 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
623 // Disable the hang monitor, otherwise there will be a race between the | 626 // Disable the hang monitor, otherwise there will be a race between the |
624 // beforeunload dialog and the beforeunload hang timer. | 627 // beforeunload dialog and the beforeunload hang timer. |
625 contents->GetMainFrame()->DisableBeforeUnloadHangMonitorForTesting(); | 628 contents->GetMainFrame()->DisableBeforeUnloadHangMonitorForTesting(); |
626 | 629 |
627 // Start a navigation to trigger the beforeunload dialog. | 630 // Start a navigation to trigger the beforeunload dialog. |
628 contents->GetMainFrame()->ExecuteJavaScriptForTests( | 631 contents->GetMainFrame()->ExecuteJavaScriptForTests( |
629 ASCIIToUTF16("window.location.href = 'about:blank'")); | 632 ASCIIToUTF16("window.location.href = 'about:blank'")); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 #if defined(OS_WIN) | 1270 #if defined(OS_WIN) |
1268 #define MAYBE_TabClosingWhenRemovingExtension \ | 1271 #define MAYBE_TabClosingWhenRemovingExtension \ |
1269 DISABLED_TabClosingWhenRemovingExtension | 1272 DISABLED_TabClosingWhenRemovingExtension |
1270 #else | 1273 #else |
1271 #define MAYBE_TabClosingWhenRemovingExtension TabClosingWhenRemovingExtension | 1274 #define MAYBE_TabClosingWhenRemovingExtension TabClosingWhenRemovingExtension |
1272 #endif | 1275 #endif |
1273 // Makes sure TabClosing is sent when uninstalling an extension that is an app | 1276 // Makes sure TabClosing is sent when uninstalling an extension that is an app |
1274 // tab. | 1277 // tab. |
1275 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TabClosingWhenRemovingExtension) { | 1278 IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TabClosingWhenRemovingExtension) { |
1276 ASSERT_TRUE(embedded_test_server()->Start()); | 1279 ASSERT_TRUE(embedded_test_server()->Start()); |
1277 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
1278 GURL url(embedded_test_server()->GetURL("/empty.html")); | 1280 GURL url(embedded_test_server()->GetURL("/empty.html")); |
1279 TabStripModel* model = browser()->tab_strip_model(); | 1281 TabStripModel* model = browser()->tab_strip_model(); |
1280 | 1282 |
1281 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 1283 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
1282 | 1284 |
1283 const Extension* extension_app = GetExtension(); | 1285 const Extension* extension_app = GetExtension(); |
1284 | 1286 |
1285 ui_test_utils::NavigateToURL(browser(), url); | 1287 ui_test_utils::NavigateToURL(browser(), url); |
1286 | 1288 |
1287 WebContents* app_contents = WebContents::Create( | 1289 WebContents* app_contents = WebContents::Create( |
(...skipping 27 matching lines...) Expand all Loading... |
1315 } | 1317 } |
1316 | 1318 |
1317 // Open with --app-id=<id>, and see that an application tab opens by default. | 1319 // Open with --app-id=<id>, and see that an application tab opens by default. |
1318 IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) { | 1320 IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) { |
1319 ASSERT_TRUE(embedded_test_server()->Start()); | 1321 ASSERT_TRUE(embedded_test_server()->Start()); |
1320 | 1322 |
1321 // There should be one tab to start with. | 1323 // There should be one tab to start with. |
1322 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 1324 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
1323 | 1325 |
1324 // Load an app. | 1326 // Load an app. |
1325 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
1326 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 1327 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
1327 const Extension* extension_app = GetExtension(); | 1328 const Extension* extension_app = GetExtension(); |
1328 | 1329 |
1329 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 1330 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
1330 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 1331 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
1331 | 1332 |
1332 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 1333 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
1333 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 1334 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
1334 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); | 1335 StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); |
1335 | 1336 |
(...skipping 14 matching lines...) Expand all Loading... |
1350 EXPECT_EQ(expected_browsers, chrome::GetBrowserCount(browser()->profile())); | 1351 EXPECT_EQ(expected_browsers, chrome::GetBrowserCount(browser()->profile())); |
1351 EXPECT_EQ(expected_tabs, browser()->tab_strip_model()->count()); | 1352 EXPECT_EQ(expected_tabs, browser()->tab_strip_model()->count()); |
1352 } | 1353 } |
1353 | 1354 |
1354 // Open an app window and the dev tools window and ensure that the location | 1355 // Open an app window and the dev tools window and ensure that the location |
1355 // bar settings are correct. | 1356 // bar settings are correct. |
1356 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldShowLocationBar) { | 1357 IN_PROC_BROWSER_TEST_F(BrowserTest, ShouldShowLocationBar) { |
1357 ASSERT_TRUE(embedded_test_server()->Start()); | 1358 ASSERT_TRUE(embedded_test_server()->Start()); |
1358 | 1359 |
1359 // Load an app. | 1360 // Load an app. |
1360 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
1361 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 1361 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
1362 const Extension* extension_app = GetExtension(); | 1362 const Extension* extension_app = GetExtension(); |
1363 | 1363 |
1364 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. | 1364 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. |
1365 WebContents* app_window = OpenApplication(AppLaunchParams( | 1365 WebContents* app_window = OpenApplication(AppLaunchParams( |
1366 browser()->profile(), extension_app, extensions::LAUNCH_CONTAINER_WINDOW, | 1366 browser()->profile(), extension_app, extensions::LAUNCH_CONTAINER_WINDOW, |
1367 WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_TEST)); | 1367 WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_TEST)); |
1368 ASSERT_TRUE(app_window); | 1368 ASSERT_TRUE(app_window); |
1369 | 1369 |
1370 DevToolsWindow* devtools_window = | 1370 DevToolsWindow* devtools_window = |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 } | 1446 } |
1447 | 1447 |
1448 // Chromeos defaults to restoring the last session, so this test isn't | 1448 // Chromeos defaults to restoring the last session, so this test isn't |
1449 // applicable. | 1449 // applicable. |
1450 #if !defined(OS_CHROMEOS) | 1450 #if !defined(OS_CHROMEOS) |
1451 // Makes sure pinned tabs are restored correctly on start. | 1451 // Makes sure pinned tabs are restored correctly on start. |
1452 IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { | 1452 IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { |
1453 ASSERT_TRUE(embedded_test_server()->Start()); | 1453 ASSERT_TRUE(embedded_test_server()->Start()); |
1454 | 1454 |
1455 // Add a pinned tab. | 1455 // Add a pinned tab. |
1456 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
1457 GURL url(embedded_test_server()->GetURL("/empty.html")); | 1456 GURL url(embedded_test_server()->GetURL("/empty.html")); |
1458 TabStripModel* model = browser()->tab_strip_model(); | 1457 TabStripModel* model = browser()->tab_strip_model(); |
1459 ui_test_utils::NavigateToURL(browser(), url); | 1458 ui_test_utils::NavigateToURL(browser(), url); |
1460 model->SetTabPinned(0, true); | 1459 model->SetTabPinned(0, true); |
1461 | 1460 |
1462 // Add a non pinned tab. | 1461 // Add a non pinned tab. |
1463 chrome::NewTab(browser()); | 1462 chrome::NewTab(browser()); |
1464 ui_test_utils::NavigateToURL(browser(), url); | 1463 ui_test_utils::NavigateToURL(browser(), url); |
1465 | 1464 |
1466 // Add another pinned tab. | 1465 // Add another pinned tab. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 // We need a message loop running for menus on windows. | 1514 // We need a message loop running for menus on windows. |
1516 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1515 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1517 FROM_HERE, base::BindOnce(&RunCloseWithAppMenuCallback, browser())); | 1516 FROM_HERE, base::BindOnce(&RunCloseWithAppMenuCallback, browser())); |
1518 } | 1517 } |
1519 | 1518 |
1520 #if !defined(OS_MACOSX) | 1519 #if !defined(OS_MACOSX) |
1521 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { | 1520 IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { |
1522 ASSERT_TRUE(embedded_test_server()->Start()); | 1521 ASSERT_TRUE(embedded_test_server()->Start()); |
1523 | 1522 |
1524 // Load an app | 1523 // Load an app |
1525 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
1526 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 1524 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
1527 const Extension* extension_app = GetExtension(); | 1525 const Extension* extension_app = GetExtension(); |
1528 | 1526 |
1529 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. | 1527 // Launch it in a window, as AppLauncherHandler::HandleLaunchApp() would. |
1530 WebContents* app_window = OpenApplication(AppLaunchParams( | 1528 WebContents* app_window = OpenApplication(AppLaunchParams( |
1531 browser()->profile(), extension_app, extensions::LAUNCH_CONTAINER_WINDOW, | 1529 browser()->profile(), extension_app, extensions::LAUNCH_CONTAINER_WINDOW, |
1532 WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_TEST)); | 1530 WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_TEST)); |
1533 ASSERT_TRUE(app_window); | 1531 ASSERT_TRUE(app_window); |
1534 | 1532 |
1535 // Apps launched in a window from the NTP have an extensions tab helper but | 1533 // Apps launched in a window from the NTP have an extensions tab helper but |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 90); | 1836 EXPECT_EQ(GetZoomPercent(contents, &enable_plus, &enable_minus), 90); |
1839 EXPECT_TRUE(enable_plus); | 1837 EXPECT_TRUE(enable_plus); |
1840 EXPECT_TRUE(enable_minus); | 1838 EXPECT_TRUE(enable_minus); |
1841 } | 1839 } |
1842 | 1840 |
1843 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); | 1841 chrome::Zoom(browser(), content::PAGE_ZOOM_RESET); |
1844 } | 1842 } |
1845 | 1843 |
1846 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { | 1844 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { |
1847 ASSERT_TRUE(embedded_test_server()->Start()); | 1845 ASSERT_TRUE(embedded_test_server()->Start()); |
1848 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
1849 GURL url(embedded_test_server()->GetURL("/empty.html")); | 1846 GURL url(embedded_test_server()->GetURL("/empty.html")); |
1850 ui_test_utils::NavigateToURL(browser(), url); | 1847 ui_test_utils::NavigateToURL(browser(), url); |
1851 | 1848 |
1852 CommandUpdater* command_updater = | 1849 CommandUpdater* command_updater = |
1853 browser()->command_controller()->command_updater(); | 1850 browser()->command_controller()->command_updater(); |
1854 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); | 1851 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); |
1855 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); | 1852 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); |
1856 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); | 1853 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); |
1857 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); | 1854 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); |
1858 | 1855 |
(...skipping 19 matching lines...) Expand all Loading... |
1878 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); | 1875 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_VIEW_SOURCE)); |
1879 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); | 1876 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_PRINT)); |
1880 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); | 1877 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); |
1881 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); | 1878 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_DUPLICATE_TAB)); |
1882 } | 1879 } |
1883 | 1880 |
1884 // Ensure that creating an interstitial page closes any JavaScript dialogs | 1881 // Ensure that creating an interstitial page closes any JavaScript dialogs |
1885 // that were present on the previous page. See http://crbug.com/295695. | 1882 // that were present on the previous page. See http://crbug.com/295695. |
1886 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialClosesDialogs) { | 1883 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialClosesDialogs) { |
1887 ASSERT_TRUE(embedded_test_server()->Start()); | 1884 ASSERT_TRUE(embedded_test_server()->Start()); |
1888 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | |
1889 GURL url(embedded_test_server()->GetURL("/empty.html")); | 1885 GURL url(embedded_test_server()->GetURL("/empty.html")); |
1890 ui_test_utils::NavigateToURL(browser(), url); | 1886 ui_test_utils::NavigateToURL(browser(), url); |
1891 | 1887 |
1892 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 1888 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
1893 contents->GetMainFrame()->ExecuteJavaScriptForTests( | 1889 contents->GetMainFrame()->ExecuteJavaScriptForTests( |
1894 ASCIIToUTF16("alert('Dialog showing!');")); | 1890 ASCIIToUTF16("alert('Dialog showing!');")); |
1895 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 1891 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
1896 EXPECT_TRUE(alert->IsValid()); | 1892 EXPECT_TRUE(alert->IsValid()); |
1897 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); | 1893 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance(); |
1898 EXPECT_TRUE(dialog_queue->HasActiveDialog()); | 1894 EXPECT_TRUE(dialog_queue->HasActiveDialog()); |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 Browser* browser = new Browser(params); | 2870 Browser* browser = new Browser(params); |
2875 gfx::Rect bounds = browser->window()->GetBounds(); | 2871 gfx::Rect bounds = browser->window()->GetBounds(); |
2876 | 2872 |
2877 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2873 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
2878 // See https://crbug.com/567925. | 2874 // See https://crbug.com/567925. |
2879 EXPECT_GE(bounds.width(), 100); | 2875 EXPECT_GE(bounds.width(), 100); |
2880 EXPECT_EQ(122, bounds.height()); | 2876 EXPECT_EQ(122, bounds.height()); |
2881 browser->window()->Close(); | 2877 browser->window()->Close(); |
2882 } | 2878 } |
2883 } | 2879 } |
OLD | NEW |