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

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

Issue 10822030: Move ui_test_utils::RunMessageLoop to test_utils so that it can be reused by content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/string_util.h" 7 #include "base/string_util.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class ProvisionalLoadWaiter : public content::WebContentsObserver { 48 class ProvisionalLoadWaiter : public content::WebContentsObserver {
49 public: 49 public:
50 explicit ProvisionalLoadWaiter(WebContents* tab) 50 explicit ProvisionalLoadWaiter(WebContents* tab)
51 : WebContentsObserver(tab), waiting_(false), seen_(false) {} 51 : WebContentsObserver(tab), waiting_(false), seen_(false) {}
52 52
53 void Wait() { 53 void Wait() {
54 if (seen_) 54 if (seen_)
55 return; 55 return;
56 56
57 waiting_ = true; 57 waiting_ = true;
58 ui_test_utils::RunMessageLoop(); 58 content::RunMessageLoop();
59 } 59 }
60 60
61 void DidFailProvisionalLoad( 61 void DidFailProvisionalLoad(
62 int64 frame_id, 62 int64 frame_id,
63 bool is_main_frame, 63 bool is_main_frame,
64 const GURL& validated_url, 64 const GURL& validated_url,
65 int error_code, 65 int error_code,
66 const string16& error_description, 66 const string16& error_description,
67 content::RenderViewHost* render_view_host) OVERRIDE { 67 content::RenderViewHost* render_view_host) OVERRIDE {
68 seen_ = true; 68 seen_ = true;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 &workerFinished)); 170 &workerFinished));
171 171
172 if (workerFinished) 172 if (workerFinished)
173 break; 173 break;
174 174
175 // Wait a bit. 175 // Wait a bit.
176 MessageLoop::current()->PostDelayedTask( 176 MessageLoop::current()->PostDelayedTask(
177 FROM_HERE, 177 FROM_HERE,
178 MessageLoop::QuitClosure(), 178 MessageLoop::QuitClosure(),
179 base::TimeDelta::FromMilliseconds(timeout_ms)); 179 base::TimeDelta::FromMilliseconds(timeout_ms));
180 ui_test_utils::RunMessageLoop(); 180 content::RunMessageLoop();
181 } 181 }
182 182
183 bool actuallyLoadedContent = false; 183 bool actuallyLoadedContent = false;
184 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( 184 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
185 tab->GetRenderViewHost(), std::wstring(), 185 tab->GetRenderViewHost(), std::wstring(),
186 L"window.domAutomationController.send(IsContentLoaded());", 186 L"window.domAutomationController.send(IsContentLoaded());",
187 &actuallyLoadedContent)); 187 &actuallyLoadedContent));
188 EXPECT_EQ(expectLoaded, actuallyLoadedContent); 188 EXPECT_EQ(expectLoaded, actuallyLoadedContent);
189 } 189 }
190 190
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 test_server()->GetURL(replacement_path)); 1012 test_server()->GetURL(replacement_path));
1013 1013
1014 WebContents* tab1 = chrome::GetActiveWebContents(browser()); 1014 WebContents* tab1 = chrome::GetActiveWebContents(browser());
1015 // It is probably overkill to add a notification for a popup-opening, let's 1015 // It is probably overkill to add a notification for a popup-opening, let's
1016 // just poll. 1016 // just poll.
1017 for (int i = 0; i < 10; i++) { 1017 for (int i = 0; i < 10; i++) {
1018 if (GetConstrainedWindowCount() > 0) 1018 if (GetConstrainedWindowCount() > 0)
1019 break; 1019 break;
1020 MessageLoop::current()->PostDelayedTask( 1020 MessageLoop::current()->PostDelayedTask(
1021 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1)); 1021 FROM_HERE, MessageLoop::QuitClosure(), base::TimeDelta::FromSeconds(1));
1022 ui_test_utils::RunMessageLoop(); 1022 content::RunMessageLoop();
1023 } 1023 }
1024 ASSERT_EQ(1, GetConstrainedWindowCount()); 1024 ASSERT_EQ(1, GetConstrainedWindowCount());
1025 1025
1026 // Let's add another tab to make sure the browser does not exit when we close 1026 // Let's add another tab to make sure the browser does not exit when we close
1027 // the first tab. 1027 // the first tab.
1028 GURL url = test_server()->GetURL("files/ssl/google.html"); 1028 GURL url = test_server()->GetURL("files/ssl/google.html");
1029 content::WindowedNotificationObserver observer( 1029 content::WindowedNotificationObserver observer(
1030 content::NOTIFICATION_LOAD_STOP, 1030 content::NOTIFICATION_LOAD_STOP,
1031 content::NotificationService::AllSources()); 1031 content::NotificationService::AllSources());
1032 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); 1032 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED);
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 1454
1455 // Visit a page over https that contains a frame with a redirect. 1455 // Visit a page over https that contains a frame with a redirect.
1456 1456
1457 // XMLHttpRequest insecure content in synchronous mode. 1457 // XMLHttpRequest insecure content in synchronous mode.
1458 1458
1459 // XMLHttpRequest insecure content in asynchronous mode. 1459 // XMLHttpRequest insecure content in asynchronous mode.
1460 1460
1461 // XMLHttpRequest over bad ssl in synchronous mode. 1461 // XMLHttpRequest over bad ssl in synchronous mode.
1462 1462
1463 // XMLHttpRequest over OK ssl in synchronous mode. 1463 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698