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 image_changed_count_++; | 36 image_changed_count_++; |
37 image_width_on_last_image_changed_ = | 37 image_width_on_last_image_changed_ = |
38 content_->HasImage() ? content_->GetImage()->width() : 0; | 38 content_->HasImage() ? 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, image_notify_finished_count_); | 43 ASSERT_EQ(0, image_notify_finished_count_); |
| 44 DCHECK(image->IsLoaded()); |
44 image_notify_finished_count_++; | 45 image_notify_finished_count_++; |
45 image_width_on_image_notify_finished_ = | 46 image_width_on_image_notify_finished_ = |
46 content_->HasImage() ? content_->GetImage()->width() : 0; | 47 content_->HasImage() ? content_->GetImage()->width() : 0; |
47 status_on_image_notify_finished_ = content_->GetStatus(); | 48 status_on_image_notify_finished_ = content_->GetContentStatus(); |
48 } | 49 } |
49 | 50 |
50 bool MockImageResourceObserver::ImageNotifyFinishedCalled() const { | 51 bool MockImageResourceObserver::ImageNotifyFinishedCalled() const { |
51 DCHECK_LE(image_notify_finished_count_, 1); | 52 DCHECK_LE(image_notify_finished_count_, 1); |
52 return image_notify_finished_count_; | 53 return image_notify_finished_count_; |
53 } | 54 } |
54 | 55 |
55 } // namespace blink | 56 } // namespace blink |
OLD | NEW |