OLD | NEW |
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 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "chromeos/geolocation/simple_geolocation_provider.h" | 10 #include "chromeos/geolocation/simple_geolocation_provider.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 response_code = net::HTTP_OK; | 72 response_code = net::HTTP_OK; |
73 status = net::URLRequestStatus::SUCCESS; | 73 status = net::URLRequestStatus::SUCCESS; |
74 factory_->SetFakeResponse(url, response_, response_code, status); | 74 factory_->SetFakeResponse(url, response_, response_code, status); |
75 } | 75 } |
76 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( | 76 scoped_ptr<net::FakeURLFetcher> fetcher(new net::FakeURLFetcher( |
77 url, delegate, response_, response_code, status)); | 77 url, delegate, response_, response_code, status)); |
78 scoped_refptr<net::HttpResponseHeaders> download_headers = | 78 scoped_refptr<net::HttpResponseHeaders> download_headers = |
79 new net::HttpResponseHeaders(std::string()); | 79 new net::HttpResponseHeaders(std::string()); |
80 download_headers->AddHeader("Content-Type: application/json"); | 80 download_headers->AddHeader("Content-Type: application/json"); |
81 fetcher->set_response_headers(download_headers); | 81 fetcher->set_response_headers(download_headers); |
82 return fetcher.Pass(); | 82 return fetcher; |
83 } | 83 } |
84 | 84 |
85 void Initialize(net::FakeURLFetcherFactory* factory) { | 85 void Initialize(net::FakeURLFetcherFactory* factory) { |
86 factory_ = factory; | 86 factory_ = factory; |
87 factory_->SetFakeResponse(url_, | 87 factory_->SetFakeResponse(url_, |
88 std::string(), | 88 std::string(), |
89 net::HTTP_INTERNAL_SERVER_ERROR, | 89 net::HTTP_INTERNAL_SERVER_ERROR, |
90 net::URLRequestStatus::FAILED); | 90 net::URLRequestStatus::FAILED); |
91 } | 91 } |
92 | 92 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 246 } |
247 if (url_factory.attempts() < expected_retries - 1) { | 247 if (url_factory.attempts() < expected_retries - 1) { |
248 LOG(WARNING) | 248 LOG(WARNING) |
249 << "SimpleGeolocationTest::InvalidResponse: Too little attempts (" | 249 << "SimpleGeolocationTest::InvalidResponse: Too little attempts (" |
250 << url_factory.attempts() << "), greater then " << expected_retries - 1 | 250 << url_factory.attempts() << "), greater then " << expected_retries - 1 |
251 << " expected."; | 251 << " expected."; |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 } // namespace chromeos | 255 } // namespace chromeos |
OLD | NEW |