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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/time.h" | 6 #include "base/time.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 122 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
123 tab->GetRenderViewHost(), std::wstring(), | 123 tab->GetRenderViewHost(), std::wstring(), |
124 L"window.domAutomationController.send(IsWorkerFinished());", | 124 L"window.domAutomationController.send(IsWorkerFinished());", |
125 &workerFinished)); | 125 &workerFinished)); |
126 | 126 |
127 if (workerFinished) | 127 if (workerFinished) |
128 break; | 128 break; |
129 | 129 |
130 // Wait a bit. | 130 // Wait a bit. |
131 MessageLoop::current()->PostDelayedTask( | 131 MessageLoop::current()->PostDelayedTask( |
132 FROM_HERE, MessageLoop::QuitClosure(), timeout_ms); | 132 FROM_HERE, |
| 133 MessageLoop::QuitClosure(), |
| 134 base::TimeDelta::FromMilliseconds(timeout_ms)); |
133 ui_test_utils::RunMessageLoop(); | 135 ui_test_utils::RunMessageLoop(); |
134 } | 136 } |
135 | 137 |
136 bool actuallyLoadedContent = false; | 138 bool actuallyLoadedContent = false; |
137 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 139 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
138 tab->GetRenderViewHost(), std::wstring(), | 140 tab->GetRenderViewHost(), std::wstring(), |
139 L"window.domAutomationController.send(IsContentLoaded());", | 141 L"window.domAutomationController.send(IsContentLoaded());", |
140 &actuallyLoadedContent)); | 142 &actuallyLoadedContent)); |
141 EXPECT_EQ(expectLoaded, actuallyLoadedContent); | 143 EXPECT_EQ(expectLoaded, actuallyLoadedContent); |
142 } | 144 } |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 | 886 |
885 ui_test_utils::NavigateToURL(browser(), | 887 ui_test_utils::NavigateToURL(browser(), |
886 test_server()->GetURL(replacement_path)); | 888 test_server()->GetURL(replacement_path)); |
887 | 889 |
888 WebContents* tab1 = browser()->GetSelectedWebContents(); | 890 WebContents* tab1 = browser()->GetSelectedWebContents(); |
889 // It is probably overkill to add a notification for a popup-opening, let's | 891 // It is probably overkill to add a notification for a popup-opening, let's |
890 // just poll. | 892 // just poll. |
891 for (int i = 0; i < 10; i++) { | 893 for (int i = 0; i < 10; i++) { |
892 if (GetConstrainedWindowCount() > 0) | 894 if (GetConstrainedWindowCount() > 0) |
893 break; | 895 break; |
894 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 896 MessageLoop::current()->PostDelayedTask( |
895 MessageLoop::QuitClosure(), 1000); | 897 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); |
896 ui_test_utils::RunMessageLoop(); | 898 ui_test_utils::RunMessageLoop(); |
897 } | 899 } |
898 ASSERT_EQ(1, GetConstrainedWindowCount()); | 900 ASSERT_EQ(1, GetConstrainedWindowCount()); |
899 | 901 |
900 // Let's add another tab to make sure the browser does not exit when we close | 902 // Let's add another tab to make sure the browser does not exit when we close |
901 // the first tab. | 903 // the first tab. |
902 GURL url = test_server()->GetURL("files/ssl/google.html"); | 904 GURL url = test_server()->GetURL("files/ssl/google.html"); |
903 ui_test_utils::WindowedNotificationObserver observer( | 905 ui_test_utils::WindowedNotificationObserver observer( |
904 content::NOTIFICATION_LOAD_STOP, | 906 content::NOTIFICATION_LOAD_STOP, |
905 content::NotificationService::AllSources()); | 907 content::NotificationService::AllSources()); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 | 1330 |
1329 // Visit a page over https that contains a frame with a redirect. | 1331 // Visit a page over https that contains a frame with a redirect. |
1330 | 1332 |
1331 // XMLHttpRequest insecure content in synchronous mode. | 1333 // XMLHttpRequest insecure content in synchronous mode. |
1332 | 1334 |
1333 // XMLHttpRequest insecure content in asynchronous mode. | 1335 // XMLHttpRequest insecure content in asynchronous mode. |
1334 | 1336 |
1335 // XMLHttpRequest over bad ssl in synchronous mode. | 1337 // XMLHttpRequest over bad ssl in synchronous mode. |
1336 | 1338 |
1337 // XMLHttpRequest over OK ssl in synchronous mode. | 1339 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |