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

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

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 <memory>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/run_loop.h" 12 #include "base/run_loop.h"
12 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "components/captive_portal/captive_portal_testing_utils.h" 15 #include "components/captive_portal/captive_portal_testing_utils.h"
15 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
16 #include "net/url_request/url_request_test_util.h" 17 #include "net/url_request/url_request_test_util.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 namespace captive_portal { 21 namespace captive_portal {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 base::RunLoop().RunUntilIdle(); 107 base::RunLoop().RunUntilIdle();
107 108
108 detector()->Cancel(); 109 detector()->Cancel();
109 110
110 ASSERT_FALSE(FetchingURL()); 111 ASSERT_FALSE(FetchingURL());
111 EXPECT_EQ(0, client.num_results_received()); 112 EXPECT_EQ(0, client.num_results_received());
112 } 113 }
113 114
114 private: 115 private:
115 base::MessageLoop message_loop_; 116 base::MessageLoop message_loop_;
116 scoped_ptr<CaptivePortalDetector> detector_; 117 std::unique_ptr<CaptivePortalDetector> detector_;
117 }; 118 };
118 119
119 // Test that the CaptivePortalDetector returns the expected result 120 // Test that the CaptivePortalDetector returns the expected result
120 // codes in response to a variety of probe results. 121 // codes in response to a variety of probe results.
121 TEST_F(CaptivePortalDetectorTest, CaptivePortalResultCodes) { 122 TEST_F(CaptivePortalDetectorTest, CaptivePortalResultCodes) {
122 CaptivePortalDetector::Results results; 123 CaptivePortalDetector::Results results;
123 results.result = captive_portal::RESULT_INTERNET_CONNECTED; 124 results.result = captive_portal::RESULT_INTERNET_CONNECTED;
124 results.response_code = 204; 125 results.response_code = 204;
125 126
126 RunTest(results, net::OK, 204, NULL); 127 RunTest(results, net::OK, 204, NULL);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 203
203 TEST_F(CaptivePortalDetectorTest, Cancel) { 204 TEST_F(CaptivePortalDetectorTest, Cancel) {
204 RunCancelTest(); 205 RunCancelTest();
205 CaptivePortalDetector::Results results; 206 CaptivePortalDetector::Results results;
206 results.result = captive_portal::RESULT_INTERNET_CONNECTED; 207 results.result = captive_portal::RESULT_INTERNET_CONNECTED;
207 results.response_code = 204; 208 results.response_code = 204;
208 RunTest(results, net::OK, 204, NULL); 209 RunTest(results, net::OK, 204, NULL);
209 } 210 }
210 211
211 } // namespace captive_portal 212 } // namespace captive_portal
OLDNEW
« no previous file with comments | « components/captive_portal/captive_portal_detector.h ('k') | components/certificate_reporting/error_report.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698