| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/test/mock_google_streaming_server.h" | 5 #include "content/test/mock_google_streaming_server.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 void MockGoogleStreamingServer::SimulateServerResponse( | 132 void MockGoogleStreamingServer::SimulateServerResponse( |
| 133 bool success, const std::string& http_response) { | 133 bool success, const std::string& http_response) { |
| 134 net::TestURLFetcher* fetcher = GetURLFetcher(true); | 134 net::TestURLFetcher* fetcher = GetURLFetcher(true); |
| 135 | 135 |
| 136 fetcher->set_status( | 136 fetcher->set_status( |
| 137 net::URLRequestStatus::FromError(success ? net::OK : net::ERR_FAILED)); | 137 net::URLRequestStatus::FromError(success ? net::OK : net::ERR_FAILED)); |
| 138 fetcher->set_response_code(success ? 200 : 500); | 138 fetcher->set_response_code(success ? 200 : 500); |
| 139 fetcher->SetResponseString(http_response); | 139 fetcher->SetResponseString(http_response); |
| 140 fetcher->delegate()->OnURLFetchDownloadProgress(fetcher, 0, 0); | 140 fetcher->delegate()->OnURLFetchDownloadProgress(fetcher, 0, 0, 0); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Can return NULL if the SpeechRecognizer has not requested the connection yet. | 143 // Can return NULL if the SpeechRecognizer has not requested the connection yet. |
| 144 net::TestURLFetcher* MockGoogleStreamingServer::GetURLFetcher( | 144 net::TestURLFetcher* MockGoogleStreamingServer::GetURLFetcher( |
| 145 bool downstream) const { | 145 bool downstream) const { |
| 146 return url_fetcher_factory_.GetFetcherByID( | 146 return url_fetcher_factory_.GetFetcherByID( |
| 147 downstream ? kDownstreamUrlFetcherId : kUpstreamUrlFetcherId); | 147 downstream ? kDownstreamUrlFetcherId : kUpstreamUrlFetcherId); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace content | 150 } // namespace content |
| OLD | NEW |