| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 expected_description); | 40 expected_description); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void ExpectError(const std::string& expected_message) { | 43 void ExpectError(const std::string& expected_message) { |
| 44 error_cb_ = base::BindOnce(&DeviceDescriptionFetcherTest::OnError, | 44 error_cb_ = base::BindOnce(&DeviceDescriptionFetcherTest::OnError, |
| 45 base::Unretained(this), expected_message); | 45 base::Unretained(this), expected_message); |
| 46 } | 46 } |
| 47 | 47 |
| 48 net::TestURLFetcher* StartRequest() { | 48 net::TestURLFetcher* StartRequest() { |
| 49 fetcher_ = base::MakeUnique<DeviceDescriptionFetcher>( | 49 fetcher_ = base::MakeUnique<DeviceDescriptionFetcher>( |
| 50 url_, &profile_, std::move(success_cb_), std::move(error_cb_)); | 50 url_, profile_.GetRequestContext(), std::move(success_cb_), |
| 51 std::move(error_cb_)); |
| 51 fetcher_->Start(); | 52 fetcher_->Start(); |
| 52 return factory_.GetFetcherByID( | 53 return factory_.GetFetcherByID( |
| 53 DeviceDescriptionFetcher::kURLFetcherIDForTest); | 54 DeviceDescriptionFetcher::kURLFetcherIDForTest); |
| 54 } | 55 } |
| 55 | 56 |
| 56 protected: | 57 protected: |
| 57 const content::TestBrowserThreadBundle thread_bundle_; | 58 const content::TestBrowserThreadBundle thread_bundle_; |
| 58 TestingProfile profile_; | 59 TestingProfile profile_; |
| 59 const net::TestURLFetcherFactory factory_; | 60 const net::TestURLFetcherFactory factory_; |
| 60 const GURL url_; | 61 const GURL url_; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 new net::HttpResponseHeaders(""); | 170 new net::HttpResponseHeaders(""); |
| 170 headers->AddHeader("Application-URL: http://127.0.0.1/apps"); | 171 headers->AddHeader("Application-URL: http://127.0.0.1/apps"); |
| 171 test_fetcher->set_response_headers(headers); | 172 test_fetcher->set_response_headers(headers); |
| 172 test_fetcher->SetResponseString(std::string(262145, 'd')); | 173 test_fetcher->SetResponseString(std::string(262145, 'd')); |
| 173 test_fetcher->delegate()->OnURLFetchComplete(test_fetcher); | 174 test_fetcher->delegate()->OnURLFetchComplete(test_fetcher); |
| 174 } | 175 } |
| 175 | 176 |
| 176 } // namespace dial | 177 } // namespace dial |
| 177 } // namespace api | 178 } // namespace api |
| 178 } // namespace extensions | 179 } // namespace extensions |
| OLD | NEW |