| 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/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 Loading... |
| 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 |
| OLD | NEW |