Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/MockImageResourceObserver.cpp

Issue 2746343002: Phase III Step 1: Make ImageResourceContent manage its own ResourceStatus (Closed)
Patch Set: Reflect comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698