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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrameTest.cpp

Issue 2361653003: Fix the scale of Drag and Drop shadow image. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/frame/LocalFrame.h" 5 #include "core/frame/LocalFrame.h"
6 6
7 #include "core/editing/FrameSelection.h"
8 #include "core/frame/FrameHost.h"
7 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/VisualViewport.h"
8 #include "core/html/HTMLElement.h" 11 #include "core/html/HTMLElement.h"
9 #include "core/testing/DummyPageHolder.h" 12 #include "core/testing/DummyPageHolder.h"
10 #include "platform/DragImage.h" 13 #include "platform/DragImage.h"
11 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
12 15
13 namespace blink { 16 namespace blink {
14 17
15 class LocalFrameTest : public ::testing::Test { 18 class LocalFrameTest : public ::testing::Test {
16 protected: 19 protected:
17 LocalFrameTest() = default; 20 LocalFrameTest() = default;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 << "#sample has :-webkit-drag."; 118 << "#sample has :-webkit-drag.";
116 119
117 // Layout w/o :-webkit-drag 120 // Layout w/o :-webkit-drag
118 updateAllLifecyclePhases(); 121 updateAllLifecyclePhases();
119 122
120 EXPECT_EQ(Color(0, 0, 255), 123 EXPECT_EQ(Color(0, 0, 255),
121 sample->layoutObject()->resolveColor(CSSPropertyColor)) 124 sample->layoutObject()->resolveColor(CSSPropertyColor))
122 << "#sample doesn't have :-webkit-drag."; 125 << "#sample doesn't have :-webkit-drag.";
123 } 126 }
124 127
128 TEST_F(LocalFrameTest, dragImageForSelectionUsesPageScaleFactor)
129 {
130 setBodyContent(
131 "<div>Hello world! This tests that the bitmap for drag image is scaled b y page scale factor</div>");
132 frame().host()->visualViewport().setScale(1);
133 frame().selection().selectAll();
134 updateAllLifecyclePhases();
135 const std::unique_ptr<DragImage> image1(frame().dragImageForSelection(0.75f) );
136 frame().host()->visualViewport().setScale(2);
137 frame().selection().selectAll();
138 updateAllLifecyclePhases();
139 const std::unique_ptr<DragImage> image2(frame().dragImageForSelection(0.75f) );
140
141 EXPECT_GT(image1->size().width(), 0);
142 EXPECT_GT(image1->size().height(), 0);
143 EXPECT_EQ(image1->size().width() * 2, image2->size().width());
144 EXPECT_EQ(image1->size().height() * 2, image2->size().height());
145 }
146
125 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698