| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "core/fetch/MockResourceClients.h" | 5 #include "core/fetch/MockResourceClients.h" |
| 6 | 6 |
| 7 #include "core/fetch/ImageResource.h" | 7 #include "core/fetch/ImageResource.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 { | 35 { |
| 36 if (m_resource) { | 36 if (m_resource) { |
| 37 m_resource->removeClient(this); | 37 m_resource->removeClient(this); |
| 38 m_resource = nullptr; | 38 m_resource = nullptr; |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 DEFINE_TRACE(MockResourceClient) | 42 DEFINE_TRACE(MockResourceClient) |
| 43 { | 43 { |
| 44 visitor->trace(m_resource); | 44 visitor->trace(m_resource); |
| 45 ResourceClient::trace(visitor); |
| 45 } | 46 } |
| 46 | 47 |
| 47 MockImageResourceClient::MockImageResourceClient(ImageResource* resource) | 48 MockImageResourceClient::MockImageResourceClient(ImageResource* resource) |
| 48 : MockResourceClient(resource) | 49 : MockResourceClient(resource) |
| 49 , m_imageChangedCount(0) | 50 , m_imageChangedCount(0) |
| 50 , m_imageNotifyFinishedCount(0) | 51 , m_imageNotifyFinishedCount(0) |
| 51 { | 52 { |
| 52 toImageResource(m_resource.get())->addObserver(this); | 53 toImageResource(m_resource.get())->addObserver(this); |
| 53 } | 54 } |
| 54 | 55 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 79 } | 80 } |
| 80 | 81 |
| 81 bool MockImageResourceClient::notifyFinishedCalled() const | 82 bool MockImageResourceClient::notifyFinishedCalled() const |
| 82 { | 83 { |
| 83 EXPECT_EQ(m_notifyFinishedCalled ? 1 : 0, m_imageNotifyFinishedCount); | 84 EXPECT_EQ(m_notifyFinishedCalled ? 1 : 0, m_imageNotifyFinishedCount); |
| 84 | 85 |
| 85 return m_notifyFinishedCalled; | 86 return m_notifyFinishedCalled; |
| 86 } | 87 } |
| 87 | 88 |
| 88 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |