Chromium Code Reviews| 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 "core/loader/resource/MockImageResourceObserver.h" | 5 #include "core/loader/resource/MockImageResourceObserver.h" |
| 6 | 6 |
| 7 #include "core/loader/resource/ImageResource.h" | 7 #include "core/loader/resource/ImageResource.h" |
| 8 #include "core/loader/resource/ImageResourceContent.h" | 8 #include "core/loader/resource/ImageResourceContent.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 void MockImageResourceObserver::imageChanged(ImageResourceContent* image, | 34 void MockImageResourceObserver::imageChanged(ImageResourceContent* image, |
| 35 const IntRect*) { | 35 const IntRect*) { |
| 36 m_imageChangedCount++; | 36 m_imageChangedCount++; |
| 37 m_imageWidthOnLastImageChanged = | 37 m_imageWidthOnLastImageChanged = |
| 38 m_content->hasImage() ? m_content->getImage()->width() : 0; | 38 m_content->hasImage() ? m_content->getImage()->width() : 0; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void MockImageResourceObserver::imageNotifyFinished( | 41 void MockImageResourceObserver::imageNotifyFinished( |
| 42 ImageResourceContent* image) { | 42 ImageResourceContent* image) { |
| 43 ASSERT_EQ(0, m_imageNotifyFinishedCount); | 43 ASSERT_EQ(0, m_imageNotifyFinishedCount); |
| 44 DCHECK(image->isLoaded()); | |
|
hiroshige
2017/03/15 00:22:58
This CL enables this DCHECK().
(Previously this fa
| |
| 44 m_imageNotifyFinishedCount++; | 45 m_imageNotifyFinishedCount++; |
| 45 m_imageWidthOnImageNotifyFinished = | 46 m_imageWidthOnImageNotifyFinished = |
| 46 m_content->hasImage() ? m_content->getImage()->width() : 0; | 47 m_content->hasImage() ? m_content->getImage()->width() : 0; |
| 47 m_statusOnImageNotifyFinished = m_content->getStatus(); | 48 m_statusOnImageNotifyFinished = m_content->getStatus(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 bool MockImageResourceObserver::imageNotifyFinishedCalled() const { | 51 bool MockImageResourceObserver::imageNotifyFinishedCalled() const { |
| 51 DCHECK_LE(m_imageNotifyFinishedCount, 1); | 52 DCHECK_LE(m_imageNotifyFinishedCount, 1); |
| 52 return m_imageNotifyFinishedCount; | 53 return m_imageNotifyFinishedCount; |
| 53 } | 54 } |
| 54 | 55 |
| 55 } // namespace blink | 56 } // namespace blink |
| OLD | NEW |