| Index: third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| diff --git a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp b/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| similarity index 53%
|
| rename from third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp
|
| rename to third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| index b3d9d156539d3ea2816a4465c3533e45c41f6b6a..1894dab1aa6f2e8d149d53199923d44486ea26e3 100644
|
| --- a/third_party/WebKit/Source/core/fetch/MockImageResourceClient.cpp
|
| +++ b/third_party/WebKit/Source/core/fetch/MockResourceClients.cpp
|
| @@ -2,37 +2,59 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "core/fetch/MockImageResourceClient.h"
|
| +#include "core/fetch/MockResourceClients.h"
|
|
|
| #include "core/fetch/ImageResource.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace blink {
|
|
|
| -MockImageResourceClient::MockImageResourceClient(PassRefPtrWillBeRawPtr<Resource> resource)
|
| +MockResourceClient::MockResourceClient(PassRefPtrWillBeRawPtr<Resource> resource)
|
| : m_resource(resource.get())
|
| - , m_imageChangedCount(0)
|
| , m_notifyFinishedCalled(false)
|
| {
|
| m_resource->addClient(this);
|
| }
|
|
|
| -MockImageResourceClient::~MockImageResourceClient()
|
| +MockResourceClient::~MockResourceClient()
|
| {
|
| if (m_resource)
|
| m_resource->removeClient(this);
|
| }
|
| -
|
| -void MockImageResourceClient::notifyFinished(Resource*)
|
| +void MockResourceClient::notifyFinished(Resource*)
|
| {
|
| ASSERT_FALSE(m_notifyFinishedCalled);
|
| m_notifyFinishedCalled = true;
|
| }
|
|
|
| -void MockImageResourceClient::removeAsClient()
|
| +void MockResourceClient::removeAsClient()
|
| {
|
| m_resource->removeClient(this);
|
| m_resource = nullptr;
|
| }
|
|
|
| +MockImageResourceClient::MockImageResourceClient(PassRefPtrWillBeRawPtr<ImageResource> resource)
|
| + : MockResourceClient(resource)
|
| + , m_imageChangedCount(0)
|
| +{
|
| + toImageResource(m_resource.get())->addObserver(this);
|
| +}
|
| +
|
| +MockImageResourceClient::~MockImageResourceClient()
|
| +{
|
| + if (m_resource)
|
| + toImageResource(m_resource.get())->removeObserver(this);
|
| +}
|
| +
|
| +void MockImageResourceClient::removeAsClient()
|
| +{
|
| + toImageResource(m_resource.get())->removeObserver(this);
|
| + MockResourceClient::removeAsClient();
|
| +}
|
| +
|
| +void MockImageResourceClient::imageChanged(ImageResource*, const IntRect*)
|
| +{
|
| + m_imageChangedCount++;
|
| +}
|
| +
|
| } // namespace blink
|
|
|