Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/path_service.h" 6 #include "base/path_service.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 virtual void DidFailProvisionalLoad( 75 virtual void DidFailProvisionalLoad(
76 int64 frame_id, 76 int64 frame_id,
77 bool is_main_frame, 77 bool is_main_frame,
78 const GURL& validated_url, 78 const GURL& validated_url,
79 int error_code, 79 int error_code,
80 const string16& error_description, 80 const string16& error_description,
81 content::RenderViewHost* render_view_host) OVERRIDE { 81 content::RenderViewHost* render_view_host) OVERRIDE {
82 seen_ = true; 82 seen_ = true;
83 if (waiting_) 83 if (waiting_)
84 MessageLoopForUI::current()->Quit(); 84 base::MessageLoopForUI::current()->Quit();
85 } 85 }
86 86
87 private: 87 private:
88 bool waiting_; 88 bool waiting_;
89 bool seen_; 89 bool seen_;
90 }; 90 };
91 91
92 } // namespace 92 } // namespace
93 93
94 class SSLUITest : public InProcessBrowserTest { 94 class SSLUITest : public InProcessBrowserTest {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 bool workerFinished = false; 183 bool workerFinished = false;
184 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 184 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
185 tab, 185 tab,
186 "window.domAutomationController.send(IsWorkerFinished());", 186 "window.domAutomationController.send(IsWorkerFinished());",
187 &workerFinished)); 187 &workerFinished));
188 188
189 if (workerFinished) 189 if (workerFinished)
190 break; 190 break;
191 191
192 // Wait a bit. 192 // Wait a bit.
193 MessageLoop::current()->PostDelayedTask( 193 base::MessageLoop::current()->PostDelayedTask(
194 FROM_HERE, 194 FROM_HERE,
195 MessageLoop::QuitClosure(), 195 base::MessageLoop::QuitClosure(),
196 base::TimeDelta::FromMilliseconds(timeout_ms)); 196 base::TimeDelta::FromMilliseconds(timeout_ms));
197 content::RunMessageLoop(); 197 content::RunMessageLoop();
198 } 198 }
199 199
200 bool actuallyLoadedContent = false; 200 bool actuallyLoadedContent = false;
201 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 201 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
202 tab, 202 tab,
203 "window.domAutomationController.send(IsContentLoaded());", 203 "window.domAutomationController.send(IsContentLoaded());",
204 &actuallyLoadedContent)); 204 &actuallyLoadedContent));
205 EXPECT_EQ(expectLoaded, actuallyLoadedContent); 205 EXPECT_EQ(expectLoaded, actuallyLoadedContent);
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 1147
1148 ui_test_utils::NavigateToURL(browser(), 1148 ui_test_utils::NavigateToURL(browser(),
1149 test_server()->GetURL(replacement_path)); 1149 test_server()->GetURL(replacement_path));
1150 1150
1151 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents(); 1151 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents();
1152 // It is probably overkill to add a notification for a popup-opening, let's 1152 // It is probably overkill to add a notification for a popup-opening, let's
1153 // just poll. 1153 // just poll.
1154 for (int i = 0; i < 10; i++) { 1154 for (int i = 0; i < 10; i++) {
1155 if (IsShowingWebContentsModalDialog()) 1155 if (IsShowingWebContentsModalDialog())
1156 break; 1156 break;
1157 MessageLoop::current()->PostDelayedTask( 1157 base::MessageLoop::current()->PostDelayedTask(
1158 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); 1158 FROM_HERE,
1159 base::MessageLoop::QuitClosure(),
1160 base::TimeDelta::FromSeconds(1));
1159 content::RunMessageLoop(); 1161 content::RunMessageLoop();
1160 } 1162 }
1161 ASSERT_TRUE(IsShowingWebContentsModalDialog()); 1163 ASSERT_TRUE(IsShowingWebContentsModalDialog());
1162 1164
1163 // Let's add another tab to make sure the browser does not exit when we close 1165 // Let's add another tab to make sure the browser does not exit when we close
1164 // the first tab. 1166 // the first tab.
1165 GURL url = test_server()->GetURL("files/ssl/google.html"); 1167 GURL url = test_server()->GetURL("files/ssl/google.html");
1166 content::WindowedNotificationObserver observer( 1168 content::WindowedNotificationObserver observer(
1167 content::NOTIFICATION_LOAD_STOP, 1169 content::NOTIFICATION_LOAD_STOP,
1168 content::NotificationService::AllSources()); 1170 content::NotificationService::AllSources());
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 1631
1630 // Visit a page over https that contains a frame with a redirect. 1632 // Visit a page over https that contains a frame with a redirect.
1631 1633
1632 // XMLHttpRequest insecure content in synchronous mode. 1634 // XMLHttpRequest insecure content in synchronous mode.
1633 1635
1634 // XMLHttpRequest insecure content in asynchronous mode. 1636 // XMLHttpRequest insecure content in asynchronous mode.
1635 1637
1636 // XMLHttpRequest over bad ssl in synchronous mode. 1638 // XMLHttpRequest over bad ssl in synchronous mode.
1637 1639
1638 // XMLHttpRequest over OK ssl in synchronous mode. 1640 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698