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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_browsertest.cc

Issue 625113002: replace OVERRIDE and FINAL with override and final in chrome/browser/[a-i]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix newly added OVERRIDEs Created 6 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 <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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // captive portal. 109 // captive portal.
110 const char* const kInternetConnectedTitle = "Title Of Awesomeness"; 110 const char* const kInternetConnectedTitle = "Title Of Awesomeness";
111 111
112 // A URL request job that hangs until FailJobs() is called. Started jobs 112 // A URL request job that hangs until FailJobs() is called. Started jobs
113 // are stored in a static class variable containing a linked list so that 113 // are stored in a static class variable containing a linked list so that
114 // FailJobs() can locate them. 114 // FailJobs() can locate them.
115 class URLRequestTimeoutOnDemandJob : public net::URLRequestJob, 115 class URLRequestTimeoutOnDemandJob : public net::URLRequestJob,
116 public base::NonThreadSafe { 116 public base::NonThreadSafe {
117 public: 117 public:
118 // net::URLRequestJob: 118 // net::URLRequestJob:
119 virtual void Start() OVERRIDE; 119 virtual void Start() override;
120 120
121 // All the public static methods below can be called on any thread. 121 // All the public static methods below can be called on any thread.
122 122
123 // Waits for exactly |num_jobs|. 123 // Waits for exactly |num_jobs|.
124 static void WaitForJobs(int num_jobs); 124 static void WaitForJobs(int num_jobs);
125 125
126 // Fails all active URLRequestTimeoutOnDemandJobs with connection timeouts. 126 // Fails all active URLRequestTimeoutOnDemandJobs with connection timeouts.
127 // There are expected to be exactly |expected_num_jobs| waiting for 127 // There are expected to be exactly |expected_num_jobs| waiting for
128 // failure. The only way to gaurantee this is with an earlier call to 128 // failure. The only way to gaurantee this is with an earlier call to
129 // WaitForJobs, so makes sure there has been a matching WaitForJobs call. 129 // WaitForJobs, so makes sure there has been a matching WaitForJobs call.
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 int NumNavigationsForTab(WebContents* web_contents) const; 515 int NumNavigationsForTab(WebContents* web_contents) const;
516 516
517 // The number of LOAD_STOP events since |this| was created. 517 // The number of LOAD_STOP events since |this| was created.
518 int num_navigations() const { return num_navigations_; } 518 int num_navigations() const { return num_navigations_; }
519 519
520 private: 520 private:
521 typedef std::map<const WebContents*, int> TabNavigationMap; 521 typedef std::map<const WebContents*, int> TabNavigationMap;
522 522
523 // content::NotificationObserver: 523 // content::NotificationObserver:
524 virtual void Observe(int type, const content::NotificationSource& source, 524 virtual void Observe(int type, const content::NotificationSource& source,
525 const content::NotificationDetails& details) OVERRIDE; 525 const content::NotificationDetails& details) override;
526 526
527 int num_navigations_; 527 int num_navigations_;
528 528
529 // Map of how many times each tab has navigated since |this| was created. 529 // Map of how many times each tab has navigated since |this| was created.
530 TabNavigationMap tab_navigation_map_; 530 TabNavigationMap tab_navigation_map_;
531 531
532 // Total number of navigations to wait for. Value only matters when 532 // Total number of navigations to wait for. Value only matters when
533 // |waiting_for_navigation_| is true. 533 // |waiting_for_navigation_| is true.
534 int num_navigations_to_wait_for_; 534 int num_navigations_to_wait_for_;
535 535
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 FailLoadsAfterLoginObserver(); 605 FailLoadsAfterLoginObserver();
606 virtual ~FailLoadsAfterLoginObserver(); 606 virtual ~FailLoadsAfterLoginObserver();
607 607
608 void WaitForNavigations(); 608 void WaitForNavigations();
609 609
610 private: 610 private:
611 typedef std::set<const WebContents*> TabSet; 611 typedef std::set<const WebContents*> TabSet;
612 612
613 // content::NotificationObserver: 613 // content::NotificationObserver:
614 virtual void Observe(int type, const content::NotificationSource& source, 614 virtual void Observe(int type, const content::NotificationSource& source,
615 const content::NotificationDetails& details) OVERRIDE; 615 const content::NotificationDetails& details) override;
616 616
617 // The set of tabs that need to be navigated. This is the set of loading 617 // The set of tabs that need to be navigated. This is the set of loading
618 // tabs when the observer is created. 618 // tabs when the observer is created.
619 TabSet tabs_needing_navigation_; 619 TabSet tabs_needing_navigation_;
620 620
621 // Number of tabs that have stopped navigating with the expected title. These 621 // Number of tabs that have stopped navigating with the expected title. These
622 // are expected not to be navigated again. 622 // are expected not to be navigated again.
623 TabSet tabs_navigated_to_final_destination_; 623 TabSet tabs_navigated_to_final_destination_;
624 624
625 // True if WaitForNavigations has been called, until 625 // True if WaitForNavigations has been called, until
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 int num_results_received() const { return num_results_received_; } 695 int num_results_received() const { return num_results_received_; }
696 696
697 CaptivePortalResult captive_portal_result() const { 697 CaptivePortalResult captive_portal_result() const {
698 return captive_portal_result_; 698 return captive_portal_result_;
699 } 699 }
700 700
701 private: 701 private:
702 // Records results and exits the message loop, if needed. 702 // Records results and exits the message loop, if needed.
703 virtual void Observe(int type, 703 virtual void Observe(int type,
704 const content::NotificationSource& source, 704 const content::NotificationSource& source,
705 const content::NotificationDetails& details) OVERRIDE; 705 const content::NotificationDetails& details) override;
706 706
707 // Number of times OnPortalResult has been called since construction. 707 // Number of times OnPortalResult has been called since construction.
708 int num_results_received_; 708 int num_results_received_;
709 709
710 // If WaitForResults was called, the total number of updates for which to 710 // If WaitForResults was called, the total number of updates for which to
711 // wait. Value doesn't matter when |waiting_for_result_| is false. 711 // wait. Value doesn't matter when |waiting_for_result_| is false.
712 int num_results_to_wait_for_; 712 int num_results_to_wait_for_;
713 713
714 bool waiting_for_result_; 714 bool waiting_for_result_;
715 715
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 transport_security_state->AddHSTS(host, expiry, include_subdomains); 792 transport_security_state->AddHSTS(host, expiry, include_subdomains);
793 } 793 }
794 794
795 } // namespace 795 } // namespace
796 796
797 class CaptivePortalBrowserTest : public InProcessBrowserTest { 797 class CaptivePortalBrowserTest : public InProcessBrowserTest {
798 public: 798 public:
799 CaptivePortalBrowserTest(); 799 CaptivePortalBrowserTest();
800 800
801 // InProcessBrowserTest: 801 // InProcessBrowserTest:
802 virtual void SetUpOnMainThread() OVERRIDE; 802 virtual void SetUpOnMainThread() override;
803 virtual void TearDownOnMainThread() OVERRIDE; 803 virtual void TearDownOnMainThread() override;
804 804
805 // Sets the captive portal checking preference. Does not affect the command 805 // Sets the captive portal checking preference. Does not affect the command
806 // line flag, which is set in SetUpCommandLine. 806 // line flag, which is set in SetUpCommandLine.
807 void EnableCaptivePortalDetection(Profile* profile, bool enabled); 807 void EnableCaptivePortalDetection(Profile* profile, bool enabled);
808 808
809 // Sets up the captive portal service for the given profile so that 809 // Sets up the captive portal service for the given profile so that
810 // all checks go to |test_url|. Also disables all timers. 810 // all checks go to |test_url|. Also disables all timers.
811 void SetUpCaptivePortalService(Profile* profile, const GURL& test_url); 811 void SetUpCaptivePortalService(Profile* profile, const GURL& test_url);
812 812
813 // Returns true if |browser|'s profile is currently running a captive portal 813 // Returns true if |browser|'s profile is currently running a captive portal
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 content::BrowserThread::PostTask( 2204 content::BrowserThread::PostTask(
2205 content::BrowserThread::IO, FROM_HERE, 2205 content::BrowserThread::IO, FROM_HERE,
2206 base::Bind(&AddHstsHost, 2206 base::Bind(&AddHstsHost,
2207 make_scoped_refptr(browser()->profile()->GetRequestContext()), 2207 make_scoped_refptr(browser()->profile()->GetRequestContext()),
2208 http_timeout_url.host())); 2208 http_timeout_url.host()));
2209 2209
2210 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); 2210 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1);
2211 Login(browser(), 1, 0); 2211 Login(browser(), 1, 0);
2212 FailLoadsAfterLogin(browser(), 1); 2212 FailLoadsAfterLogin(browser(), 1);
2213 } 2213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698