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

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

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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/base_switches.h" 5 #include "base/base_switches.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 void DidFailProvisionalLoad( 120 void DidFailProvisionalLoad(
121 content::RenderFrameHost* render_frame_host, 121 content::RenderFrameHost* render_frame_host,
122 const GURL& validated_url, 122 const GURL& validated_url,
123 int error_code, 123 int error_code,
124 const base::string16& error_description, 124 const base::string16& error_description,
125 bool was_ignored_by_handler) override { 125 bool was_ignored_by_handler) override {
126 seen_ = true; 126 seen_ = true;
127 if (waiting_) 127 if (waiting_)
128 base::MessageLoopForUI::current()->Quit(); 128 base::MessageLoopForUI::current()->QuitWhenIdle();
129 } 129 }
130 130
131 private: 131 private:
132 bool waiting_; 132 bool waiting_;
133 bool seen_; 133 bool seen_;
134 }; 134 };
135 135
136 namespace AuthState { 136 namespace AuthState {
137 137
138 enum AuthStateFlags { 138 enum AuthStateFlags {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 329 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
330 tab, 330 tab,
331 "window.domAutomationController.send(IsWorkerFinished());", 331 "window.domAutomationController.send(IsWorkerFinished());",
332 &worker_finished)); 332 &worker_finished));
333 333
334 if (worker_finished) 334 if (worker_finished)
335 break; 335 break;
336 336
337 // Wait a bit. 337 // Wait a bit.
338 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 338 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
339 FROM_HERE, base::MessageLoop::QuitClosure(), 339 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
340 base::TimeDelta::FromMilliseconds(kTimeoutMS)); 340 base::TimeDelta::FromMilliseconds(kTimeoutMS));
341 content::RunMessageLoop(); 341 content::RunMessageLoop();
342 } 342 }
343 343
344 bool actually_loaded_content = false; 344 bool actually_loaded_content = false;
345 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 345 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
346 tab, 346 tab,
347 "window.domAutomationController.send(IsContentLoaded());", 347 "window.domAutomationController.send(IsContentLoaded());",
348 &actually_loaded_content)); 348 &actually_loaded_content));
349 EXPECT_EQ(expected_load, actually_loaded_content); 349 EXPECT_EQ(expected_load, actually_loaded_content);
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 ui_test_utils::NavigateToURL(browser(), 1753 ui_test_utils::NavigateToURL(browser(),
1754 test_server()->GetURL(replacement_path)); 1754 test_server()->GetURL(replacement_path));
1755 1755
1756 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents(); 1756 WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents();
1757 // It is probably overkill to add a notification for a popup-opening, let's 1757 // It is probably overkill to add a notification for a popup-opening, let's
1758 // just poll. 1758 // just poll.
1759 for (int i = 0; i < 10; i++) { 1759 for (int i = 0; i < 10; i++) {
1760 if (IsShowingWebContentsModalDialog()) 1760 if (IsShowingWebContentsModalDialog())
1761 break; 1761 break;
1762 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1762 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1763 FROM_HERE, base::MessageLoop::QuitClosure(), 1763 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
1764 base::TimeDelta::FromSeconds(1)); 1764 base::TimeDelta::FromSeconds(1));
1765 content::RunMessageLoop(); 1765 content::RunMessageLoop();
1766 } 1766 }
1767 ASSERT_TRUE(IsShowingWebContentsModalDialog()); 1767 ASSERT_TRUE(IsShowingWebContentsModalDialog());
1768 1768
1769 // Let's add another tab to make sure the browser does not exit when we close 1769 // Let's add another tab to make sure the browser does not exit when we close
1770 // the first tab. 1770 // the first tab.
1771 GURL url = test_server()->GetURL("files/ssl/google.html"); 1771 GURL url = test_server()->GetURL("files/ssl/google.html");
1772 content::WindowedNotificationObserver observer( 1772 content::WindowedNotificationObserver observer(
1773 content::NOTIFICATION_LOAD_STOP, 1773 content::NOTIFICATION_LOAD_STOP,
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 2908
2909 // Visit a page over https that contains a frame with a redirect. 2909 // Visit a page over https that contains a frame with a redirect.
2910 2910
2911 // XMLHttpRequest insecure content in synchronous mode. 2911 // XMLHttpRequest insecure content in synchronous mode.
2912 2912
2913 // XMLHttpRequest insecure content in asynchronous mode. 2913 // XMLHttpRequest insecure content in asynchronous mode.
2914 2914
2915 // XMLHttpRequest over bad ssl in synchronous mode. 2915 // XMLHttpRequest over bad ssl in synchronous mode.
2916 2916
2917 // XMLHttpRequest over OK ssl in synchronous mode. 2917 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698