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