| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
| 9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
| 10 #include "chrome/browser/app_modal_dialog.h" | 10 #include "chrome/browser/app_modal_dialog.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 alert->CloseModalDialog(); | 236 alert->CloseModalDialog(); |
| 237 EXPECT_FALSE(browser()->GetSelectedTabContents()->is_loading()); | 237 EXPECT_FALSE(browser()->GetSelectedTabContents()->is_loading()); |
| 238 | 238 |
| 239 // Clear the beforeunload handler so the test can easily exit. | 239 // Clear the beforeunload handler so the test can easily exit. |
| 240 browser()->GetSelectedTabContents()->render_view_host()-> | 240 browser()->GetSelectedTabContents()->render_view_host()-> |
| 241 ExecuteJavascriptInWebFrame(L"", L"onbeforeunload=null;"); | 241 ExecuteJavascriptInWebFrame(L"", L"onbeforeunload=null;"); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Test for crbug.com/11647. A page closed with window.close() should not have | 244 // Test for crbug.com/11647. A page closed with window.close() should not have |
| 245 // two beforeunload dialogs shown. | 245 // two beforeunload dialogs shown. |
| 246 // Flaky: see http://crbug.com/27039 |
| 246 IN_PROC_BROWSER_TEST_F(BrowserTest, FLAKY_SingleBeforeUnloadAfterWindowClose) { | 247 IN_PROC_BROWSER_TEST_F(BrowserTest, FLAKY_SingleBeforeUnloadAfterWindowClose) { |
| 247 browser()->GetSelectedTabContents()->render_view_host()-> | 248 browser()->GetSelectedTabContents()->render_view_host()-> |
| 248 ExecuteJavascriptInWebFrame(L"", OPEN_NEW_BEFOREUNLOAD_PAGE); | 249 ExecuteJavascriptInWebFrame(L"", OPEN_NEW_BEFOREUNLOAD_PAGE); |
| 249 | 250 |
| 250 // Close the new window with JavaScript, which should show a single | 251 // Close the new window with JavaScript, which should show a single |
| 251 // beforeunload dialog. Then show another alert, to make it easy to verify | 252 // beforeunload dialog. Then show another alert, to make it easy to verify |
| 252 // that a second beforeunload dialog isn't shown. | 253 // that a second beforeunload dialog isn't shown. |
| 253 browser()->GetTabContentsAt(0)->render_view_host()-> | 254 browser()->GetTabContentsAt(0)->render_view_host()-> |
| 254 ExecuteJavascriptInWebFrame(L"", L"w.close(); alert('bar');"); | 255 ExecuteJavascriptInWebFrame(L"", L"w.close(); alert('bar');"); |
| 255 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); | 256 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 EXPECT_EQ("en", current_tab->language_state().original_language()); | 443 EXPECT_EQ("en", current_tab->language_state().original_language()); |
| 443 | 444 |
| 444 // Now navigate to a page in French. | 445 // Now navigate to a page in French. |
| 445 ui_test_utils::NavigateToURL( | 446 ui_test_utils::NavigateToURL( |
| 446 browser(), GURL(server->TestServerPage("files/french_page.html"))); | 447 browser(), GURL(server->TestServerPage("files/french_page.html"))); |
| 447 EXPECT_TRUE(current_tab->language_state().original_language().empty()); | 448 EXPECT_TRUE(current_tab->language_state().original_language().empty()); |
| 448 lang = ui_test_utils::WaitForLanguageDetection(current_tab); | 449 lang = ui_test_utils::WaitForLanguageDetection(current_tab); |
| 449 EXPECT_EQ("fr", lang); | 450 EXPECT_EQ("fr", lang); |
| 450 EXPECT_EQ("fr", current_tab->language_state().original_language()); | 451 EXPECT_EQ("fr", current_tab->language_state().original_language()); |
| 451 } | 452 } |
| OLD | NEW |