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

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

Issue 2290233007: Move convertViewportToWindow and convertWindowToViewport from (Closed)
Patch Set: add client to WebSharedWorkerImpl Created 4 years, 3 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/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 class WindowToViewportScalingChromeClient : public EmptyChromeClient { 51 class WindowToViewportScalingChromeClient : public EmptyChromeClient {
52 public: 52 public:
53 WindowToViewportScalingChromeClient() 53 WindowToViewportScalingChromeClient()
54 : EmptyChromeClient() 54 : EmptyChromeClient()
55 , m_scaleFactor(1.f) 55 , m_scaleFactor(1.f)
56 { 56 {
57 } 57 }
58 58
59 void setScalingFactor(float s) { m_scaleFactor = s; } 59 void setScalingFactor(float s) { m_scaleFactor = s; }
60 float windowToViewportScalar(const float s) const override { return s * m_sc aleFactor; } 60 float windowToViewportScalar(const Widget&, const float s) const override { return s * m_scaleFactor; }
61 61
62 private: 62 private:
63 float m_scaleFactor; 63 float m_scaleFactor;
64 }; 64 };
65 65
66 class ImageDocumentTest : public ::testing::Test { 66 class ImageDocumentTest : public ::testing::Test {
67 protected: 67 protected:
68 void TearDown() override 68 void TearDown() override
69 { 69 {
70 ThreadState::current()->collectAllGarbage(); 70 ThreadState::current()->collectAllGarbage();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 TEST_F(ImageDocumentTest, ImageScalesDownWithDsf) 186 TEST_F(ImageDocumentTest, ImageScalesDownWithDsf)
187 { 187 {
188 createDocumentWithoutLoadingImage(20, 30); 188 createDocumentWithoutLoadingImage(20, 30);
189 setWindowToViewportScalingFactor(2.f); 189 setWindowToViewportScalingFactor(2.f);
190 loadImage(); 190 loadImage();
191 EXPECT_EQ(10, imageWidth()); 191 EXPECT_EQ(10, imageWidth());
192 EXPECT_EQ(10, imageHeight()); 192 EXPECT_EQ(10, imageHeight());
193 } 193 }
194 194
195 } // namespace blink 195 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageDocument.cpp ('k') | third_party/WebKit/Source/core/inspector/DevToolsHost.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698