OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/fetch/MockImageResourceClient.h" |
| 7 |
| 8 #include "core/fetch/ImageResource.h" |
| 9 #include "core/fetch/ResourcePtr.h" |
| 10 |
| 11 #include <gtest/gtest.h> |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 MockImageResourceClient::MockImageResourceClient(const ResourcePtr<Resource>& re
source) |
| 16 : m_resource(resource.get()) |
| 17 , m_imageChangedCount(0) |
| 18 , m_notifyFinishedCalled(false) |
| 19 { |
| 20 m_resource->addClient(this); |
| 21 } |
| 22 |
| 23 MockImageResourceClient::~MockImageResourceClient() |
| 24 { |
| 25 if (m_resource) |
| 26 m_resource->removeClient(this); |
| 27 } |
| 28 |
| 29 void MockImageResourceClient::notifyFinished(Resource*) |
| 30 { |
| 31 ASSERT_FALSE(m_notifyFinishedCalled); |
| 32 m_notifyFinishedCalled = true; |
| 33 } |
| 34 |
| 35 void MockImageResourceClient::removeAsClient() |
| 36 { |
| 37 m_resource->removeClient(this); |
| 38 m_resource = nullptr; |
| 39 } |
| 40 |
| 41 } // namespace blink |
OLD | NEW |