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 "core/fetch/MockImageResourceClient.h" | |
6 | |
7 #include "core/fetch/ImageResource.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 | |
10 namespace blink { | |
11 | |
12 MockImageResourceClient::MockImageResourceClient(PassRefPtrWillBeRawPtr<Resource
> resource) | |
13 : m_resource(resource.get()) | |
14 , m_imageChangedCount(0) | |
15 , m_notifyFinishedCalled(false) | |
16 { | |
17 m_resource->addClient(this); | |
18 } | |
19 | |
20 MockImageResourceClient::~MockImageResourceClient() | |
21 { | |
22 if (m_resource) | |
23 m_resource->removeClient(this); | |
24 } | |
25 | |
26 void MockImageResourceClient::notifyFinished(Resource*) | |
27 { | |
28 ASSERT_FALSE(m_notifyFinishedCalled); | |
29 m_notifyFinishedCalled = true; | |
30 } | |
31 | |
32 void MockImageResourceClient::removeAsClient() | |
33 { | |
34 m_resource->removeClient(this); | |
35 m_resource = nullptr; | |
36 } | |
37 | |
38 } // namespace blink | |
OLD | NEW |