| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "platform/testing/weburl_loader_mock.h" | 5 #include "platform/testing/weburl_loader_mock.h" |
| 6 | 6 |
| 7 #include "platform/testing/weburl_loader_mock_factory_impl.h" | 7 #include "platform/testing/weburl_loader_mock_factory_impl.h" |
| 8 #include "public/platform/URLConversion.h" | 8 #include "public/platform/URLConversion.h" |
| 9 #include "public/platform/WebData.h" | 9 #include "public/platform/WebData.h" |
| 10 #include "public/platform/WebURLError.h" | 10 #include "public/platform/WebURLError.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // didReceiveResponse() and didReceiveData() might end up getting ::cancel() | 43 // didReceiveResponse() and didReceiveData() might end up getting ::cancel() |
| 44 // to be called which will make the ResourceLoader to delete |this|. | 44 // to be called which will make the ResourceLoader to delete |this|. |
| 45 WeakPtr<WebURLLoaderMock> self = weak_factory_.createWeakPtr(); | 45 WeakPtr<WebURLLoaderMock> self = weak_factory_.createWeakPtr(); |
| 46 | 46 |
| 47 delegate->didReceiveResponse(client_, this, response); | 47 delegate->didReceiveResponse(client_, this, response); |
| 48 if (!self) | 48 if (!self) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 if (error.reason) { | 51 if (error.reason) { |
| 52 delegate->didFail(client_, this, error); | 52 delegate->didFail(client_, this, error, data.size()); |
| 53 return; | 53 return; |
| 54 } | 54 } |
| 55 delegate->didReceiveData(client_, this, data.data(), data.size(), | 55 delegate->didReceiveData(client_, this, data.data(), data.size(), |
| 56 data.size()); | 56 data.size()); |
| 57 if (!self) | 57 if (!self) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 delegate->didFinishLoading(client_, this, 0, data.size()); | 60 delegate->didFinishLoading(client_, this, 0, data.size()); |
| 61 } | 61 } |
| 62 | 62 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods | 157 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods |
| 158 // the console during webkit unit tests, so we leave the function empty. | 158 // the console during webkit unit tests, so we leave the function empty. |
| 159 DCHECK(runner); | 159 DCHECK(runner); |
| 160 } | 160 } |
| 161 | 161 |
| 162 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() { | 162 WeakPtr<WebURLLoaderMock> WebURLLoaderMock::GetWeakPtr() { |
| 163 return weak_factory_.createWeakPtr(); | 163 return weak_factory_.createWeakPtr(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |