| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #if defined(OS_POSIX) | 5 #if defined(OS_POSIX) |
| 6 #include <signal.h> | 6 #include <signal.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 void NavigateToDataURL(const std::string& html_content, | 141 void NavigateToDataURL(const std::string& html_content, |
| 142 const char* expected_title) { | 142 const char* expected_title) { |
| 143 ui_test_utils::NavigateToURL(browser(), | 143 ui_test_utils::NavigateToURL(browser(), |
| 144 GURL("data:text/html," + html_content)); | 144 GURL("data:text/html," + html_content)); |
| 145 CheckTitle(expected_title); | 145 CheckTitle(expected_title); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void NavigateToNolistenersFileTwice() { | 148 void NavigateToNolistenersFileTwice() { |
| 149 GURL url(net::URLRequestMockHTTPJob::GetMockUrl( | 149 GURL url(net::URLRequestMockHTTPJob::GetMockUrl("title2.html")); |
| 150 base::FilePath(FILE_PATH_LITERAL("title2.html")))); | |
| 151 ui_test_utils::NavigateToURL(browser(), url); | 150 ui_test_utils::NavigateToURL(browser(), url); |
| 152 CheckTitle("Title Of Awesomeness"); | 151 CheckTitle("Title Of Awesomeness"); |
| 153 ui_test_utils::NavigateToURL(browser(), url); | 152 ui_test_utils::NavigateToURL(browser(), url); |
| 154 CheckTitle("Title Of Awesomeness"); | 153 CheckTitle("Title Of Awesomeness"); |
| 155 } | 154 } |
| 156 | 155 |
| 157 // Navigates to a URL asynchronously, then again synchronously. The first | 156 // Navigates to a URL asynchronously, then again synchronously. The first |
| 158 // load is purposely async to test the case where the user loads another | 157 // load is purposely async to test the case where the user loads another |
| 159 // page without waiting for the first load to complete. | 158 // page without waiting for the first load to complete. |
| 160 void NavigateToNolistenersFileTwiceAsync() { | 159 void NavigateToNolistenersFileTwiceAsync() { |
| 161 GURL url(net::URLRequestMockHTTPJob::GetMockUrl( | 160 GURL url(net::URLRequestMockHTTPJob::GetMockUrl("title2.html")); |
| 162 base::FilePath(FILE_PATH_LITERAL("title2.html")))); | |
| 163 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0); | 161 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0); |
| 164 ui_test_utils::NavigateToURL(browser(), url); | 162 ui_test_utils::NavigateToURL(browser(), url); |
| 165 CheckTitle("Title Of Awesomeness"); | 163 CheckTitle("Title Of Awesomeness"); |
| 166 } | 164 } |
| 167 | 165 |
| 168 void LoadUrlAndQuitBrowser(const std::string& html_content, | 166 void LoadUrlAndQuitBrowser(const std::string& html_content, |
| 169 const char* expected_title) { | 167 const char* expected_title) { |
| 170 NavigateToDataURL(html_content, expected_title); | 168 NavigateToDataURL(html_content, expected_title); |
| 171 content::WindowedNotificationObserver window_observer( | 169 content::WindowedNotificationObserver window_observer( |
| 172 chrome::NOTIFICATION_BROWSER_CLOSED, | 170 chrome::NOTIFICATION_BROWSER_CLOSED, |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 content::WindowedNotificationObserver window_observer( | 637 content::WindowedNotificationObserver window_observer( |
| 640 chrome::NOTIFICATION_BROWSER_CLOSED, | 638 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 641 content::NotificationService::AllSources()); | 639 content::NotificationService::AllSources()); |
| 642 chrome::CloseWindow(browser()); | 640 chrome::CloseWindow(browser()); |
| 643 CrashTab(beforeunload_contents); | 641 CrashTab(beforeunload_contents); |
| 644 window_observer.Wait(); | 642 window_observer.Wait(); |
| 645 } | 643 } |
| 646 | 644 |
| 647 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 645 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
| 648 // and multiple windows. | 646 // and multiple windows. |
| OLD | NEW |