| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
| 54 #include "net/base/mock_host_resolver.h" | 54 #include "net/base/mock_host_resolver.h" |
| 55 #include "net/test/test_server.h" | 55 #include "net/test/test_server.h" |
| 56 #include "ui/base/l10n/l10n_util.h" | 56 #include "ui/base/l10n/l10n_util.h" |
| 57 | 57 |
| 58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
| 59 #include "base/i18n/rtl.h" | 59 #include "base/i18n/rtl.h" |
| 60 #include "chrome/browser/browser_process.h" | 60 #include "chrome/browser/browser_process.h" |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 using content::WebContents; |
| 64 |
| 63 namespace { | 65 namespace { |
| 64 | 66 |
| 65 const char* kBeforeUnloadHTML = | 67 const char* kBeforeUnloadHTML = |
| 66 "<html><head><title>beforeunload</title></head><body>" | 68 "<html><head><title>beforeunload</title></head><body>" |
| 67 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" | 69 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" |
| 68 "</body></html>"; | 70 "</body></html>"; |
| 69 | 71 |
| 70 const char* kOpenNewBeforeUnloadPage = | 72 const char* kOpenNewBeforeUnloadPage = |
| 71 "w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; | 73 "w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; |
| 72 | 74 |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 783 |
| 782 std::string lang; | 784 std::string lang; |
| 783 | 785 |
| 784 // Open a new tab with a page in English. | 786 // Open a new tab with a page in English. |
| 785 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), | 787 AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), |
| 786 content::PAGE_TRANSITION_TYPED); | 788 content::PAGE_TRANSITION_TYPED); |
| 787 | 789 |
| 788 TabContents* current_tab = browser()->GetSelectedTabContents(); | 790 TabContents* current_tab = browser()->GetSelectedTabContents(); |
| 789 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); | 791 TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); |
| 790 TranslateTabHelper* helper = wrapper->translate_tab_helper(); | 792 TranslateTabHelper* helper = wrapper->translate_tab_helper(); |
| 791 content::Source<TabContents> source(current_tab); | 793 content::Source<WebContents> source(current_tab); |
| 792 | 794 |
| 793 ui_test_utils::WindowedNotificationObserverWithDetails<std::string> | 795 ui_test_utils::WindowedNotificationObserverWithDetails<std::string> |
| 794 en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, | 796 en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, |
| 795 source); | 797 source); |
| 796 EXPECT_EQ("", helper->language_state().original_language()); | 798 EXPECT_EQ("", helper->language_state().original_language()); |
| 797 en_language_detected_signal.Wait(); | 799 en_language_detected_signal.Wait(); |
| 798 EXPECT_TRUE(en_language_detected_signal.GetDetailsFor( | 800 EXPECT_TRUE(en_language_detected_signal.GetDetailsFor( |
| 799 source.map_key(), &lang)); | 801 source.map_key(), &lang)); |
| 800 EXPECT_EQ("en", lang); | 802 EXPECT_EQ("en", lang); |
| 801 EXPECT_EQ("en", helper->language_state().original_language()); | 803 EXPECT_EQ("en", helper->language_state().original_language()); |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 | 1452 |
| 1451 // The normal browser should now have four. | 1453 // The normal browser should now have four. |
| 1452 EXPECT_EQ(4, browser()->tab_count()); | 1454 EXPECT_EQ(4, browser()->tab_count()); |
| 1453 | 1455 |
| 1454 // Close the additional browsers. | 1456 // Close the additional browsers. |
| 1455 popup_browser->CloseAllTabs(); | 1457 popup_browser->CloseAllTabs(); |
| 1456 app_browser->CloseAllTabs(); | 1458 app_browser->CloseAllTabs(); |
| 1457 app_popup_browser->CloseAllTabs(); | 1459 app_popup_browser->CloseAllTabs(); |
| 1458 } | 1460 } |
| 1459 #endif | 1461 #endif |
| OLD | NEW |