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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 void NavigateToDataURL(const std::string& html_content, | 136 void NavigateToDataURL(const std::string& html_content, |
137 const char* expected_title) { | 137 const char* expected_title) { |
138 ui_test_utils::NavigateToURL(browser(), | 138 ui_test_utils::NavigateToURL(browser(), |
139 GURL("data:text/html," + html_content)); | 139 GURL("data:text/html," + html_content)); |
140 CheckTitle(expected_title); | 140 CheckTitle(expected_title); |
141 } | 141 } |
142 | 142 |
143 void NavigateToNolistenersFileTwice() { | 143 void NavigateToNolistenersFileTwice() { |
144 GURL url(URLRequestMockHTTPJob::GetMockUrl( | 144 GURL url(content::URLRequestMockHTTPJob::GetMockUrl( |
145 FilePath(FILE_PATH_LITERAL("title2.html")))); | 145 FilePath(FILE_PATH_LITERAL("title2.html")))); |
146 ui_test_utils::NavigateToURL(browser(), url); | 146 ui_test_utils::NavigateToURL(browser(), url); |
147 CheckTitle("Title Of Awesomeness"); | 147 CheckTitle("Title Of Awesomeness"); |
148 ui_test_utils::NavigateToURL(browser(), url); | 148 ui_test_utils::NavigateToURL(browser(), url); |
149 CheckTitle("Title Of Awesomeness"); | 149 CheckTitle("Title Of Awesomeness"); |
150 } | 150 } |
151 | 151 |
152 // Navigates to a URL asynchronously, then again synchronously. The first | 152 // Navigates to a URL asynchronously, then again synchronously. The first |
153 // load is purposely async to test the case where the user loads another | 153 // load is purposely async to test the case where the user loads another |
154 // page without waiting for the first load to complete. | 154 // page without waiting for the first load to complete. |
155 void NavigateToNolistenersFileTwiceAsync() { | 155 void NavigateToNolistenersFileTwiceAsync() { |
156 GURL url(URLRequestMockHTTPJob::GetMockUrl( | 156 GURL url(content::URLRequestMockHTTPJob::GetMockUrl( |
157 FilePath(FILE_PATH_LITERAL("title2.html")))); | 157 FilePath(FILE_PATH_LITERAL("title2.html")))); |
158 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0); | 158 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0); |
159 ui_test_utils::NavigateToURL(browser(), url); | 159 ui_test_utils::NavigateToURL(browser(), url); |
160 CheckTitle("Title Of Awesomeness"); | 160 CheckTitle("Title Of Awesomeness"); |
161 } | 161 } |
162 | 162 |
163 void LoadUrlAndQuitBrowser(const std::string& html_content, | 163 void LoadUrlAndQuitBrowser(const std::string& html_content, |
164 const char* expected_title) { | 164 const char* expected_title) { |
165 NavigateToDataURL(html_content, expected_title); | 165 NavigateToDataURL(html_content, expected_title); |
166 content::WindowedNotificationObserver window_observer( | 166 content::WindowedNotificationObserver window_observer( |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 405 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
406 content::NotificationService::AllSources()); | 406 content::NotificationService::AllSources()); |
407 chrome::CloseTab(browser()); | 407 chrome::CloseTab(browser()); |
408 tab_close_observer.Wait(); | 408 tab_close_observer.Wait(); |
409 | 409 |
410 CheckTitle("only_one_unload"); | 410 CheckTitle("only_one_unload"); |
411 } | 411 } |
412 | 412 |
413 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 413 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
414 // and multiple windows. | 414 // and multiple windows. |
OLD | NEW |