| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/support/weburl_loader_mock.h" | 5 #include "webkit/support/weburl_loader_mock.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" | 8 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" |
| 9 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" |
| 10 #include "webkit/support/weburl_loader_mock_factory.h" | 10 #include "webkit/support/weburl_loader_mock_factory.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 void WebURLLoaderMock::ServeAsynchronousRequest( | 23 void WebURLLoaderMock::ServeAsynchronousRequest( |
| 24 const WebKit::WebURLResponse& response, | 24 const WebKit::WebURLResponse& response, |
| 25 const WebKit::WebData& data, | 25 const WebKit::WebData& data, |
| 26 const WebKit::WebURLError& error) { | 26 const WebKit::WebURLError& error) { |
| 27 DCHECK(!using_default_loader_); | 27 DCHECK(!using_default_loader_); |
| 28 if (!client_) | 28 if (!client_) |
| 29 return; | 29 return; |
| 30 | 30 |
| 31 client_->didReceiveResponse(this, response); | 31 client_->didReceiveResponse(this, response); |
| 32 client_->didReceiveData(this, data.data(), data.size()); | 32 client_->didReceiveData(this, data.data(), data.size()); |
| 33 client_->didFinishLoading(this); | 33 client_->didFinishLoading(this, 0); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void WebURLLoaderMock::loadSynchronously(const WebKit::WebURLRequest& request, | 36 void WebURLLoaderMock::loadSynchronously(const WebKit::WebURLRequest& request, |
| 37 WebKit::WebURLResponse& response, | 37 WebKit::WebURLResponse& response, |
| 38 WebKit::WebURLError& error, | 38 WebKit::WebURLError& error, |
| 39 WebKit::WebData& data) { | 39 WebKit::WebData& data) { |
| 40 if (factory_->IsMockedURL(request.url())) { | 40 if (factory_->IsMockedURL(request.url())) { |
| 41 factory_->LoadSynchronously(request, &response, &error, &data); | 41 factory_->LoadSynchronously(request, &response, &error, &data); |
| 42 return; | 42 return; |
| 43 } | 43 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 factory_->CancelLoad(this); | 65 factory_->CancelLoad(this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void WebURLLoaderMock::setDefersLoading(bool deferred) { | 68 void WebURLLoaderMock::setDefersLoading(bool deferred) { |
| 69 if (using_default_loader_) { | 69 if (using_default_loader_) { |
| 70 default_loader_->setDefersLoading(deferred); | 70 default_loader_->setDefersLoading(deferred); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 NOTIMPLEMENTED(); | 73 NOTIMPLEMENTED(); |
| 74 } | 74 } |
| OLD | NEW |