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

Side by Side Diff: chromeos/timezone/timezone_unittest.cc

Issue 1556773002: Convert Pass()→std::move() in //chromeos (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « chromeos/timezone/timezone_request.cc ('k') | chromeos/tools/onc_validator/onc_validator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility>
6 7
7 #include "base/macros.h" 8 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 10 #include "base/run_loop.h"
10 #include "chromeos/geolocation/geoposition.h" 11 #include "chromeos/geolocation/geoposition.h"
11 #include "chromeos/timezone/timezone_provider.h" 12 #include "chromeos/timezone/timezone_provider.h"
12 #include "chromeos/timezone/timezone_resolver.h" 13 #include "chromeos/timezone/timezone_resolver.h"
13 #include "net/http/http_response_headers.h" 14 #include "net/http/http_response_headers.h"
14 #include "net/http/http_status_code.h" 15 #include "net/http/http_status_code.h"
15 #include "net/url_request/test_url_fetcher_factory.h" 16 #include "net/url_request/test_url_fetcher_factory.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 response_code = net::HTTP_OK; 112 response_code = net::HTTP_OK;
112 status = net::URLRequestStatus::SUCCESS; 113 status = net::URLRequestStatus::SUCCESS;
113 factory_->SetFakeResponse(url, response_, response_code, status); 114 factory_->SetFakeResponse(url, response_, response_code, status);
114 } 115 }
115 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( 116 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher(
116 url, delegate, response_, response_code, status)); 117 url, delegate, response_, response_code, status));
117 scoped_refptr<net::HttpResponseHeaders> download_headers = 118 scoped_refptr<net::HttpResponseHeaders> download_headers =
118 new net::HttpResponseHeaders(std::string()); 119 new net::HttpResponseHeaders(std::string());
119 download_headers->AddHeader("Content-Type: application/json"); 120 download_headers->AddHeader("Content-Type: application/json");
120 fetcher->set_response_headers(download_headers); 121 fetcher->set_response_headers(download_headers);
121 return fetcher.Pass(); 122 return fetcher;
122 } 123 }
123 124
124 void Initialize(net::FakeURLFetcherFactory* factory) { 125 void Initialize(net::FakeURLFetcherFactory* factory) {
125 factory_ = factory; 126 factory_ = factory;
126 factory_->SetFakeResponse(url_, 127 factory_->SetFakeResponse(url_,
127 std::string(), 128 std::string(),
128 net::HTTP_INTERNAL_SERVER_ERROR, 129 net::HTTP_INTERNAL_SERVER_ERROR,
129 net::URLRequestStatus::FAILED); 130 net::URLRequestStatus::FAILED);
130 } 131 }
131 132
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 171
171 DISALLOW_COPY_AND_ASSIGN(TimeZoneAPIFetcherFactory); 172 DISALLOW_COPY_AND_ASSIGN(TimeZoneAPIFetcherFactory);
172 }; 173 };
173 174
174 class TimeZoneReceiver { 175 class TimeZoneReceiver {
175 public: 176 public:
176 TimeZoneReceiver() : server_error_(false) {} 177 TimeZoneReceiver() : server_error_(false) {}
177 178
178 void OnRequestDone(scoped_ptr<TimeZoneResponseData> timezone, 179 void OnRequestDone(scoped_ptr<TimeZoneResponseData> timezone,
179 bool server_error) { 180 bool server_error) {
180 timezone_ = timezone.Pass(); 181 timezone_ = std::move(timezone);
181 server_error_ = server_error; 182 server_error_ = server_error;
182 183
183 message_loop_runner_->Quit(); 184 message_loop_runner_->Quit();
184 } 185 }
185 186
186 void WaitUntilRequestDone() { 187 void WaitUntilRequestDone() {
187 message_loop_runner_.reset(new base::RunLoop); 188 message_loop_runner_.reset(new base::RunLoop);
188 message_loop_runner_->Run(); 189 message_loop_runner_->Run();
189 } 190 }
190 191
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 TEST(TimeZoneResolverTest, CheckIntervals) { 292 TEST(TimeZoneResolverTest, CheckIntervals) {
292 for (int requests_count = 1; requests_count < 10; ++requests_count) { 293 for (int requests_count = 1; requests_count < 10; ++requests_count) {
293 EXPECT_EQ(requests_count, 294 EXPECT_EQ(requests_count,
294 TimeZoneResolver::MaxRequestsCountForIntervalForTesting( 295 TimeZoneResolver::MaxRequestsCountForIntervalForTesting(
295 TimeZoneResolver::IntervalForNextRequestForTesting( 296 TimeZoneResolver::IntervalForNextRequestForTesting(
296 requests_count))); 297 requests_count)));
297 } 298 }
298 } 299 }
299 300
300 } // namespace chromeos 301 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/timezone/timezone_request.cc ('k') | chromeos/tools/onc_validator/onc_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698