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

Side by Side Diff: components/captive_portal/captive_portal_detector_unittest.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 "components/captive_portal/captive_portal_detector.h" 5 #include "components/captive_portal/captive_portal_detector.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "components/captive_portal/captive_portal_testing_utils.h" 14 #include "components/captive_portal/captive_portal_testing_utils.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/url_request/url_request_test_util.h" 16 #include "net/url_request/url_request_test_util.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 namespace captive_portal { 20 namespace captive_portal {
21 21
22 namespace { 22 namespace {
(...skipping 25 matching lines...) Expand all
48 48
49 } // namespace 49 } // namespace
50 50
51 class CaptivePortalDetectorTest : public testing::Test, 51 class CaptivePortalDetectorTest : public testing::Test,
52 public CaptivePortalDetectorTestBase { 52 public CaptivePortalDetectorTestBase {
53 public: 53 public:
54 CaptivePortalDetectorTest() {} 54 CaptivePortalDetectorTest() {}
55 ~CaptivePortalDetectorTest() override {} 55 ~CaptivePortalDetectorTest() override {}
56 56
57 void SetUp() override { 57 void SetUp() override {
58 CHECK(base::MessageLoopProxy::current().get());
59 scoped_refptr<net::URLRequestContextGetter> request_context_getter( 58 scoped_refptr<net::URLRequestContextGetter> request_context_getter(
60 new net::TestURLRequestContextGetter( 59 new net::TestURLRequestContextGetter(
61 base::MessageLoopProxy::current())); 60 base::ThreadTaskRunnerHandle::Get()));
62 61
63 detector_.reset(new CaptivePortalDetector(request_context_getter.get())); 62 detector_.reset(new CaptivePortalDetector(request_context_getter.get()));
64 set_detector(detector_.get()); 63 set_detector(detector_.get());
65 } 64 }
66 65
67 void TearDown() override { detector_.reset(); } 66 void TearDown() override { detector_.reset(); }
68 67
69 void RunTest(const CaptivePortalDetector::Results& expected_results, 68 void RunTest(const CaptivePortalDetector::Results& expected_results,
70 int net_error, 69 int net_error,
71 int status_code, 70 int status_code,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 202
204 TEST_F(CaptivePortalDetectorTest, Cancel) { 203 TEST_F(CaptivePortalDetectorTest, Cancel) {
205 RunCancelTest(); 204 RunCancelTest();
206 CaptivePortalDetector::Results results; 205 CaptivePortalDetector::Results results;
207 results.result = captive_portal::RESULT_INTERNET_CONNECTED; 206 results.result = captive_portal::RESULT_INTERNET_CONNECTED;
208 results.response_code = 204; 207 results.response_code = 204;
209 RunTest(results, net::OK, 204, NULL); 208 RunTest(results, net::OK, 204, NULL);
210 } 209 }
211 210
212 } // namespace captive_portal 211 } // namespace captive_portal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698