Fix build break
[chromium-blink-merge.git] / chrome / browser / captive_portal / testing_utils.h
blob85ea37eda1cb5da957ef7ef6d03976ea4f76c4d6
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_TESTING_UTILS_H_
6 #define CHROME_BROWSER_CAPTIVE_PORTAL_TESTING_UTILS_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "chrome/browser/captive_portal/captive_portal_detector.h"
12 #include "net/url_request/test_url_fetcher_factory.h"
14 namespace base {
15 class Time;
18 namespace net {
19 class URLFetcher;
22 namespace captive_portal {
24 class CaptivePortalDetectorTestBase {
25 public:
26 CaptivePortalDetectorTestBase();
27 virtual ~CaptivePortalDetectorTestBase();
29 // Sets test time for captive portal detector.
30 void SetTime(const base::Time& time);
32 // Advances test time for captive portal detector.
33 void AdvanceTime(const base::TimeDelta& time_delta);
35 bool FetchingURL();
37 // Sets URL fetcher state and notifies portal detector.
38 void CompleteURLFetch(int net_error,
39 int status_code,
40 const char* response_headers);
42 void set_detector(CaptivePortalDetector* detector) { detector_ = detector; }
44 CaptivePortalDetector* detector() { return detector_; }
46 net::TestURLFetcher* fetcher() { return factory_.GetFetcherByID(0); }
48 protected:
49 CaptivePortalDetector* detector_;
51 net::TestURLFetcherFactory factory_;
53 DISALLOW_COPY_AND_ASSIGN(CaptivePortalDetectorTestBase);
56 } // namespace captive_portal
58 #endif // CHROME_BROWSER_CAPTIVE_PORTAL_TESTING_UTILS_H_