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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDocumentTest.cpp

Issue 2562323002: Devirtualize Frame::domWindow(). (Closed)
Patch Set: Created 4 years 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/html/ImageDocument.h" 5 #include "core/html/ImageDocument.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/DocumentParser.h" 8 #include "core/dom/DocumentParser.h"
9 #include "core/loader/EmptyClients.h" 9 #include "core/loader/EmptyClients.h"
10 #include "core/testing/DummyPageHolder.h" 10 #include "core/testing/DummyPageHolder.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Page::PageClients pageClients; 91 Page::PageClients pageClients;
92 fillWithEmptyClients(pageClients); 92 fillWithEmptyClients(pageClients);
93 m_chromeClient = new WindowToViewportScalingChromeClient(); 93 m_chromeClient = new WindowToViewportScalingChromeClient();
94 pageClients.chromeClient = m_chromeClient; 94 pageClients.chromeClient = m_chromeClient;
95 m_dummyPageHolder = 95 m_dummyPageHolder =
96 DummyPageHolder::create(IntSize(viewWidth, viewHeight), &pageClients); 96 DummyPageHolder::create(IntSize(viewWidth, viewHeight), &pageClients);
97 97
98 LocalFrame& frame = m_dummyPageHolder->frame(); 98 LocalFrame& frame = m_dummyPageHolder->frame();
99 frame.document()->shutdown(); 99 frame.document()->shutdown();
100 DocumentInit init(KURL(), &frame); 100 DocumentInit init(KURL(), &frame);
101 frame.localDOMWindow()->installNewDocument("image/jpeg", init); 101 frame.domWindow()->installNewDocument("image/jpeg", init);
102 } 102 }
103 103
104 void ImageDocumentTest::createDocument(int viewWidth, int viewHeight) { 104 void ImageDocumentTest::createDocument(int viewWidth, int viewHeight) {
105 createDocumentWithoutLoadingImage(viewWidth, viewHeight); 105 createDocumentWithoutLoadingImage(viewWidth, viewHeight);
106 loadImage(); 106 loadImage();
107 } 107 }
108 108
109 ImageDocument& ImageDocumentTest::document() const { 109 ImageDocument& ImageDocumentTest::document() const {
110 Document* document = m_dummyPageHolder->frame().domWindow()->document(); 110 Document* document = m_dummyPageHolder->frame().domWindow()->document();
111 ImageDocument* imageDocument = static_cast<ImageDocument*>(document); 111 ImageDocument* imageDocument = static_cast<ImageDocument*>(document);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 TEST_F(ImageDocumentTest, ImageScalesDownWithDsf) { 177 TEST_F(ImageDocumentTest, ImageScalesDownWithDsf) {
178 createDocumentWithoutLoadingImage(20, 30); 178 createDocumentWithoutLoadingImage(20, 30);
179 setWindowToViewportScalingFactor(2.f); 179 setWindowToViewportScalingFactor(2.f);
180 loadImage(); 180 loadImage();
181 EXPECT_EQ(10, imageWidth()); 181 EXPECT_EQ(10, imageWidth());
182 EXPECT_EQ(10, imageHeight()); 182 EXPECT_EQ(10, imageHeight());
183 } 183 }
184 184
185 } // namespace blink 185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698