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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #include "grit/generated_resources.h" | 55 #include "grit/generated_resources.h" |
56 #include "net/base/mock_host_resolver.h" | 56 #include "net/base/mock_host_resolver.h" |
57 #include "net/test/test_server.h" | 57 #include "net/test/test_server.h" |
58 #include "ui/base/l10n/l10n_util.h" | 58 #include "ui/base/l10n/l10n_util.h" |
59 | 59 |
60 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
61 #include "base/i18n/rtl.h" | 61 #include "base/i18n/rtl.h" |
62 #include "chrome/browser/browser_process.h" | 62 #include "chrome/browser/browser_process.h" |
63 #endif | 63 #endif |
64 | 64 |
| 65 using content::NavigationController; |
65 using content::NavigationEntry; | 66 using content::NavigationEntry; |
66 using content::OpenURLParams; | 67 using content::OpenURLParams; |
67 using content::Referrer; | 68 using content::Referrer; |
68 using content::WebContents; | 69 using content::WebContents; |
69 | 70 |
70 namespace { | 71 namespace { |
71 | 72 |
72 const char* kBeforeUnloadHTML = | 73 const char* kBeforeUnloadHTML = |
73 "<html><head><title>beforeunload</title></head><body>" | 74 "<html><head><title>beforeunload</title></head><body>" |
74 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" | 75 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" |
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { | 1152 IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { |
1152 GURL blank_url(chrome::kAboutBlankURL); | 1153 GURL blank_url(chrome::kAboutBlankURL); |
1153 ui_test_utils::NavigateToURL(browser(), blank_url); | 1154 ui_test_utils::NavigateToURL(browser(), blank_url); |
1154 | 1155 |
1155 ui_test_utils::NavigateToURL(browser(), | 1156 ui_test_utils::NavigateToURL(browser(), |
1156 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 1157 ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
1157 FilePath(kTitle1File))); | 1158 FilePath(kTitle1File))); |
1158 | 1159 |
1159 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( | 1160 ui_test_utils::WindowedNotificationObserver back_nav_load_observer( |
1160 content::NOTIFICATION_LOAD_STOP, | 1161 content::NOTIFICATION_LOAD_STOP, |
1161 content::Source<content::NavigationController>( | 1162 content::Source<NavigationController>( |
1162 &browser()->GetSelectedWebContents()->GetController())); | 1163 &browser()->GetSelectedWebContents()->GetController())); |
1163 browser()->GoBack(CURRENT_TAB); | 1164 browser()->GoBack(CURRENT_TAB); |
1164 back_nav_load_observer.Wait(); | 1165 back_nav_load_observer.Wait(); |
1165 EXPECT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); | 1166 EXPECT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); |
1166 | 1167 |
1167 ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( | 1168 ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( |
1168 content::NOTIFICATION_LOAD_STOP, | 1169 content::NOTIFICATION_LOAD_STOP, |
1169 content::Source<content::NavigationController>( | 1170 content::Source<NavigationController>( |
1170 &browser()->GetSelectedWebContents()->GetController())); | 1171 &browser()->GetSelectedWebContents()->GetController())); |
1171 browser()->GoForward(CURRENT_TAB); | 1172 browser()->GoForward(CURRENT_TAB); |
1172 // This check will happen before the navigation completes, since the browser | 1173 // This check will happen before the navigation completes, since the browser |
1173 // won't process the renderer's response until the Wait() call below. | 1174 // won't process the renderer's response until the Wait() call below. |
1174 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); | 1175 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); |
1175 forward_nav_load_observer.Wait(); | 1176 forward_nav_load_observer.Wait(); |
1176 } | 1177 } |
1177 | 1178 |
1178 #if defined(OS_WIN) | 1179 #if defined(OS_WIN) |
1179 // see http://crbug.com/105306 | 1180 // see http://crbug.com/105306 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1459 |
1459 // The normal browser should now have four. | 1460 // The normal browser should now have four. |
1460 EXPECT_EQ(4, browser()->tab_count()); | 1461 EXPECT_EQ(4, browser()->tab_count()); |
1461 | 1462 |
1462 // Close the additional browsers. | 1463 // Close the additional browsers. |
1463 popup_browser->CloseAllTabs(); | 1464 popup_browser->CloseAllTabs(); |
1464 app_browser->CloseAllTabs(); | 1465 app_browser->CloseAllTabs(); |
1465 app_popup_browser->CloseAllTabs(); | 1466 app_popup_browser->CloseAllTabs(); |
1466 } | 1467 } |
1467 #endif | 1468 #endif |
OLD | NEW |