| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 CheckTitle("Title Of Awesomeness"); | 146 CheckTitle("Title Of Awesomeness"); |
| 147 ui_test_utils::NavigateToURL(browser(), url); | 147 ui_test_utils::NavigateToURL(browser(), url); |
| 148 CheckTitle("Title Of Awesomeness"); | 148 CheckTitle("Title Of Awesomeness"); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Navigates to a URL asynchronously, then again synchronously. The first | 151 // Navigates to a URL asynchronously, then again synchronously. The first |
| 152 // load is purposely async to test the case where the user loads another | 152 // load is purposely async to test the case where the user loads another |
| 153 // page without waiting for the first load to complete. | 153 // page without waiting for the first load to complete. |
| 154 void NavigateToNolistenersFileTwiceAsync() { | 154 void NavigateToNolistenersFileTwiceAsync() { |
| 155 GURL url(net::URLRequestMockHTTPJob::GetMockUrl("title2.html")); | 155 GURL url(net::URLRequestMockHTTPJob::GetMockUrl("title2.html")); |
| 156 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0); | 156 ui_test_utils::NavigateToURLWithDisposition( |
| 157 browser(), url, WindowOpenDisposition::CURRENT_TAB, 0); |
| 157 ui_test_utils::NavigateToURL(browser(), url); | 158 ui_test_utils::NavigateToURL(browser(), url); |
| 158 CheckTitle("Title Of Awesomeness"); | 159 CheckTitle("Title Of Awesomeness"); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void LoadUrlAndQuitBrowser(const std::string& html_content, | 162 void LoadUrlAndQuitBrowser(const std::string& html_content, |
| 162 const char* expected_title) { | 163 const char* expected_title) { |
| 163 NavigateToDataURL(html_content, expected_title); | 164 NavigateToDataURL(html_content, expected_title); |
| 164 content::WindowedNotificationObserver window_observer( | 165 content::WindowedNotificationObserver window_observer( |
| 165 chrome::NOTIFICATION_BROWSER_CLOSED, | 166 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 166 content::NotificationService::AllSources()); | 167 content::NotificationService::AllSources()); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 embedded_test_server()->GetURL("/fast_tab_close/" + name + ".html")); | 432 embedded_test_server()->GetURL("/fast_tab_close/" + name + ".html")); |
| 432 } | 433 } |
| 433 | 434 |
| 434 void NavigateToPage(const char* name) { | 435 void NavigateToPage(const char* name) { |
| 435 ui_test_utils::NavigateToURL(browser(), GetUrl(name)); | 436 ui_test_utils::NavigateToURL(browser(), GetUrl(name)); |
| 436 CheckTitle(name); | 437 CheckTitle(name); |
| 437 } | 438 } |
| 438 | 439 |
| 439 void NavigateToPageInNewTab(const char* name) { | 440 void NavigateToPageInNewTab(const char* name) { |
| 440 ui_test_utils::NavigateToURLWithDisposition( | 441 ui_test_utils::NavigateToURLWithDisposition( |
| 441 browser(), GetUrl(name), NEW_FOREGROUND_TAB, | 442 browser(), GetUrl(name), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 442 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 443 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 443 CheckTitle(name); | 444 CheckTitle(name); |
| 444 } | 445 } |
| 445 | 446 |
| 446 std::string GetCookies(const char* name) { | 447 std::string GetCookies(const char* name) { |
| 447 content::WebContents* contents = | 448 content::WebContents* contents = |
| 448 browser()->tab_strip_model()->GetActiveWebContents(); | 449 browser()->tab_strip_model()->GetActiveWebContents(); |
| 449 return content::GetCookies(contents->GetBrowserContext(), GetUrl(name)); | 450 return content::GetCookies(contents->GetBrowserContext(), GetUrl(name)); |
| 450 } | 451 } |
| 451 }; | 452 }; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 content::WindowedNotificationObserver window_observer( | 631 content::WindowedNotificationObserver window_observer( |
| 631 chrome::NOTIFICATION_BROWSER_CLOSED, | 632 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 632 content::NotificationService::AllSources()); | 633 content::NotificationService::AllSources()); |
| 633 chrome::CloseWindow(browser()); | 634 chrome::CloseWindow(browser()); |
| 634 CrashTab(beforeunload_contents); | 635 CrashTab(beforeunload_contents); |
| 635 window_observer.Wait(); | 636 window_observer.Wait(); |
| 636 } | 637 } |
| 637 | 638 |
| 638 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 639 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
| 639 // and multiple windows. | 640 // and multiple windows. |
| OLD | NEW |