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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_browsertest.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, 4 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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // |num_jobs_to_wait_for_| is 0. 192 // |num_jobs_to_wait_for_| is 0.
193 MaybeStopWaitingForJobsOnIOThread(); 193 MaybeStopWaitingForJobsOnIOThread();
194 } 194 }
195 195
196 // static 196 // static
197 void URLRequestTimeoutOnDemandJob::WaitForJobs(int num_jobs) { 197 void URLRequestTimeoutOnDemandJob::WaitForJobs(int num_jobs) {
198 content::BrowserThread::PostTask( 198 content::BrowserThread::PostTask(
199 content::BrowserThread::IO, FROM_HERE, 199 content::BrowserThread::IO, FROM_HERE,
200 base::Bind(&URLRequestTimeoutOnDemandJob::WaitForJobsOnIOThread, 200 base::Bind(&URLRequestTimeoutOnDemandJob::WaitForJobsOnIOThread,
201 num_jobs)); 201 num_jobs));
202 ui_test_utils::RunMessageLoop(); 202 content::RunMessageLoop();
203 } 203 }
204 204
205 // static 205 // static
206 void URLRequestTimeoutOnDemandJob::FailJobs(int expected_num_jobs) { 206 void URLRequestTimeoutOnDemandJob::FailJobs(int expected_num_jobs) {
207 content::BrowserThread::PostTask( 207 content::BrowserThread::PostTask(
208 content::BrowserThread::IO, FROM_HERE, 208 content::BrowserThread::IO, FROM_HERE,
209 base::Bind(&URLRequestTimeoutOnDemandJob::FailOrAbandonJobsOnIOThread, 209 base::Bind(&URLRequestTimeoutOnDemandJob::FailOrAbandonJobsOnIOThread,
210 expected_num_jobs, 210 expected_num_jobs,
211 FAIL_JOBS)); 211 FAIL_JOBS));
212 } 212 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 512 }
513 513
514 void MultiNavigationObserver::WaitForNavigations( 514 void MultiNavigationObserver::WaitForNavigations(
515 int num_navigations_to_wait_for) { 515 int num_navigations_to_wait_for) {
516 // Shouldn't already be waiting for navigations. 516 // Shouldn't already be waiting for navigations.
517 EXPECT_FALSE(waiting_for_navigation_); 517 EXPECT_FALSE(waiting_for_navigation_);
518 EXPECT_LT(0, num_navigations_to_wait_for); 518 EXPECT_LT(0, num_navigations_to_wait_for);
519 if (num_navigations_ < num_navigations_to_wait_for) { 519 if (num_navigations_ < num_navigations_to_wait_for) {
520 num_navigations_to_wait_for_ = num_navigations_to_wait_for; 520 num_navigations_to_wait_for_ = num_navigations_to_wait_for;
521 waiting_for_navigation_ = true; 521 waiting_for_navigation_ = true;
522 ui_test_utils::RunMessageLoop(); 522 content::RunMessageLoop();
523 EXPECT_FALSE(waiting_for_navigation_); 523 EXPECT_FALSE(waiting_for_navigation_);
524 } 524 }
525 EXPECT_EQ(num_navigations_, num_navigations_to_wait_for); 525 EXPECT_EQ(num_navigations_, num_navigations_to_wait_for);
526 } 526 }
527 527
528 int MultiNavigationObserver::NumNavigationsForTab( 528 int MultiNavigationObserver::NumNavigationsForTab(
529 content::WebContents* web_contents) const { 529 content::WebContents* web_contents) const {
530 TabNavigationMap::const_iterator tab_navigations = 530 TabNavigationMap::const_iterator tab_navigations =
531 tab_navigation_map_.find(web_contents); 531 tab_navigation_map_.find(web_contents);
532 if (tab_navigations == tab_navigation_map_.end()) 532 if (tab_navigations == tab_navigation_map_.end())
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 FailLoadsAfterLoginObserver::~FailLoadsAfterLoginObserver() { 604 FailLoadsAfterLoginObserver::~FailLoadsAfterLoginObserver() {
605 } 605 }
606 606
607 void FailLoadsAfterLoginObserver::WaitForNavigations() { 607 void FailLoadsAfterLoginObserver::WaitForNavigations() {
608 // Shouldn't already be waiting for navigations. 608 // Shouldn't already be waiting for navigations.
609 EXPECT_FALSE(waiting_for_navigation_); 609 EXPECT_FALSE(waiting_for_navigation_);
610 if (tabs_needing_navigation_.size() != 610 if (tabs_needing_navigation_.size() !=
611 tabs_navigated_to_final_destination_.size()) { 611 tabs_navigated_to_final_destination_.size()) {
612 waiting_for_navigation_ = true; 612 waiting_for_navigation_ = true;
613 ui_test_utils::RunMessageLoop(); 613 content::RunMessageLoop();
614 EXPECT_FALSE(waiting_for_navigation_); 614 EXPECT_FALSE(waiting_for_navigation_);
615 } 615 }
616 EXPECT_EQ(tabs_needing_navigation_.size(), 616 EXPECT_EQ(tabs_needing_navigation_.size(),
617 tabs_navigated_to_final_destination_.size()); 617 tabs_navigated_to_final_destination_.size());
618 } 618 }
619 619
620 void FailLoadsAfterLoginObserver::Observe( 620 void FailLoadsAfterLoginObserver::Observe(
621 int type, 621 int type,
622 const content::NotificationSource& source, 622 const content::NotificationSource& source,
623 const content::NotificationDetails& details) { 623 const content::NotificationDetails& details) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, 698 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT,
699 content::Source<Profile>(profile_)); 699 content::Source<Profile>(profile_));
700 } 700 }
701 701
702 void CaptivePortalObserver::WaitForResults(int num_results_to_wait_for) { 702 void CaptivePortalObserver::WaitForResults(int num_results_to_wait_for) {
703 EXPECT_LT(0, num_results_to_wait_for); 703 EXPECT_LT(0, num_results_to_wait_for);
704 EXPECT_FALSE(waiting_for_result_); 704 EXPECT_FALSE(waiting_for_result_);
705 if (num_results_received_ < num_results_to_wait_for) { 705 if (num_results_received_ < num_results_to_wait_for) {
706 num_results_to_wait_for_ = num_results_to_wait_for; 706 num_results_to_wait_for_ = num_results_to_wait_for;
707 waiting_for_result_ = true; 707 waiting_for_result_ = true;
708 ui_test_utils::RunMessageLoop(); 708 content::RunMessageLoop();
709 EXPECT_FALSE(waiting_for_result_); 709 EXPECT_FALSE(waiting_for_result_);
710 } 710 }
711 EXPECT_EQ(num_results_received_, num_results_to_wait_for); 711 EXPECT_EQ(num_results_received_, num_results_to_wait_for);
712 } 712 }
713 713
714 void CaptivePortalObserver::Observe( 714 void CaptivePortalObserver::Observe(
715 int type, 715 int type,
716 const content::NotificationSource& source, 716 const content::NotificationSource& source,
717 const content::NotificationDetails& details) { 717 const content::NotificationDetails& details) {
718 ASSERT_EQ(type, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT); 718 ASSERT_EQ(type, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT);
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 base::Bind(&AddHstsHost, 1997 base::Bind(&AddHstsHost,
1998 make_scoped_refptr(browser()->profile()->GetRequestContext()), 1998 make_scoped_refptr(browser()->profile()->GetRequestContext()),
1999 http_timeout_url.host())); 1999 http_timeout_url.host()));
2000 2000
2001 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url); 2001 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url);
2002 Login(browser(), 1, 0); 2002 Login(browser(), 1, 0);
2003 FailLoadsAfterLogin(browser(), 1); 2003 FailLoadsAfterLogin(browser(), 1);
2004 } 2004 }
2005 2005
2006 } // namespace captive_portal 2006 } // namespace captive_portal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698