Chromium Code Reviews| Index: third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp |
| diff --git a/third_party/WebKit/Source/core/frame/LocalFrameTest.cpp b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp |
| similarity index 65% |
| rename from third_party/WebKit/Source/core/frame/LocalFrameTest.cpp |
| rename to third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp |
| index 7d0b8418e367e16ee281c2af8add411bea4a89eb..1659660326547fab89f6e0ec1a7058da62509f80 100644 |
| --- a/third_party/WebKit/Source/core/frame/LocalFrameTest.cpp |
| +++ b/third_party/WebKit/Source/core/clipboard/DataTransferTest.cpp |
| @@ -1,14 +1,12 @@ |
| -// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
|
tkent
2017/06/19 00:12:45
You don't need to update the year.
https://chromi
tanvir
2017/06/19 07:01:33
Done.
|
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "core/frame/LocalFrame.h" |
| +#include "core/clipboard/DataTransfer.h" |
| -#include "core/editing/FrameSelection.h" |
| +#include "core/frame/LocalFrame.h" |
| #include "core/frame/LocalFrameView.h" |
| #include "core/frame/PerformanceMonitor.h" |
| -#include "core/frame/VisualViewport.h" |
| -#include "core/html/HTMLElement.h" |
| #include "core/layout/LayoutObject.h" |
| #include "core/testing/DummyPageHolder.h" |
| #include "core/timing/Performance.h" |
| @@ -17,10 +15,10 @@ |
| namespace blink { |
| -class LocalFrameTest : public ::testing::Test { |
| +class DataTransferTest : public ::testing::Test { |
| protected: |
| - LocalFrameTest() = default; |
| - ~LocalFrameTest() override = default; |
| + DataTransferTest() = default; |
| + ~DataTransferTest() override = default; |
| Document& GetDocument() const { return dummy_page_holder_->GetDocument(); } |
| LocalFrame& GetFrame() const { return *GetDocument().GetFrame(); } |
| @@ -45,18 +43,19 @@ class LocalFrameTest : public ::testing::Test { |
| Persistent<Performance> performance_; |
| }; |
| -TEST_F(LocalFrameTest, nodeImage) { |
| +TEST_F(DataTransferTest, nodeImage) { |
| SetBodyContent( |
| "<style>" |
| "#sample { width: 100px; height: 100px; }" |
| "</style>" |
| "<div id=sample></div>"); |
| Element* sample = GetDocument().getElementById("sample"); |
| - const std::unique_ptr<DragImage> image = GetFrame().NodeImage(*sample); |
| + const std::unique_ptr<DragImage> image = |
| + DataTransfer::NodeImage(GetFrame(), *sample); |
| EXPECT_EQ(IntSize(100, 100), image->Size()); |
| } |
| -TEST_F(LocalFrameTest, nodeImageWithNestedElement) { |
| +TEST_F(DataTransferTest, nodeImageWithNestedElement) { |
| SetBodyContent( |
| "<style>" |
| "div { -webkit-user-drag: element }" |
| @@ -64,14 +63,15 @@ TEST_F(LocalFrameTest, nodeImageWithNestedElement) { |
| "</style>" |
| "<div id=sample><span>Green when dragged</span></div>"); |
| Element* sample = GetDocument().getElementById("sample"); |
| - const std::unique_ptr<DragImage> image = GetFrame().NodeImage(*sample); |
| + const std::unique_ptr<DragImage> image = |
| + DataTransfer::NodeImage(GetFrame(), *sample); |
| EXPECT_EQ( |
| Color(0, 255, 0), |
| sample->firstChild()->GetLayoutObject()->ResolveColor(CSSPropertyColor)) |
| << "Descendants node should have :-webkit-drag."; |
| } |
| -TEST_F(LocalFrameTest, nodeImageWithPsuedoClassWebKitDrag) { |
| +TEST_F(DataTransferTest, nodeImageWithPsuedoClassWebKitDrag) { |
| SetBodyContent( |
| "<style>" |
| "#sample { width: 100px; height: 100px; }" |
| @@ -79,12 +79,13 @@ TEST_F(LocalFrameTest, nodeImageWithPsuedoClassWebKitDrag) { |
| "</style>" |
| "<div id=sample></div>"); |
| Element* sample = GetDocument().getElementById("sample"); |
| - const std::unique_ptr<DragImage> image = GetFrame().NodeImage(*sample); |
| + const std::unique_ptr<DragImage> image = |
| + DataTransfer::NodeImage(GetFrame(), *sample); |
| EXPECT_EQ(IntSize(200, 200), image->Size()) |
| << ":-webkit-drag should affect dragged image."; |
| } |
| -TEST_F(LocalFrameTest, nodeImageWithoutDraggedLayoutObject) { |
| +TEST_F(DataTransferTest, nodeImageWithoutDraggedLayoutObject) { |
| SetBodyContent( |
| "<style>" |
| "#sample { width: 100px; height: 100px; }" |
| @@ -92,11 +93,12 @@ TEST_F(LocalFrameTest, nodeImageWithoutDraggedLayoutObject) { |
| "</style>" |
| "<div id=sample></div>"); |
| Element* sample = GetDocument().getElementById("sample"); |
| - const std::unique_ptr<DragImage> image = GetFrame().NodeImage(*sample); |
| + const std::unique_ptr<DragImage> image = |
| + DataTransfer::NodeImage(GetFrame(), *sample); |
| EXPECT_EQ(nullptr, image.get()) << ":-webkit-drag blows away layout object"; |
| } |
| -TEST_F(LocalFrameTest, nodeImageWithChangingLayoutObject) { |
| +TEST_F(DataTransferTest, nodeImageWithChangingLayoutObject) { |
| SetBodyContent( |
| "<style>" |
| "#sample { color: blue; }" |
| @@ -106,7 +108,8 @@ TEST_F(LocalFrameTest, nodeImageWithChangingLayoutObject) { |
| Element* sample = GetDocument().getElementById("sample"); |
| UpdateAllLifecyclePhases(); |
| LayoutObject* before_layout_object = sample->GetLayoutObject(); |
| - const std::unique_ptr<DragImage> image = GetFrame().NodeImage(*sample); |
| + const std::unique_ptr<DragImage> image = |
| + DataTransfer::NodeImage(GetFrame(), *sample); |
| EXPECT_TRUE(sample->GetLayoutObject() != before_layout_object) |
| << ":-webkit-drag causes sample to have different layout object."; |
| @@ -122,25 +125,4 @@ TEST_F(LocalFrameTest, nodeImageWithChangingLayoutObject) { |
| << "#sample doesn't have :-webkit-drag."; |
| } |
| -TEST_F(LocalFrameTest, dragImageForSelectionUsesPageScaleFactor) { |
| - SetBodyContent( |
| - "<div>Hello world! This tests that the bitmap for drag image is scaled " |
| - "by page scale factor</div>"); |
| - GetFrame().GetPage()->GetVisualViewport().SetScale(1); |
| - GetFrame().Selection().SelectAll(); |
| - UpdateAllLifecyclePhases(); |
| - const std::unique_ptr<DragImage> image1( |
| - GetFrame().DragImageForSelection(0.75f)); |
| - GetFrame().GetPage()->GetVisualViewport().SetScale(2); |
| - GetFrame().Selection().SelectAll(); |
| - UpdateAllLifecyclePhases(); |
| - const std::unique_ptr<DragImage> image2( |
| - GetFrame().DragImageForSelection(0.75f)); |
| - |
| - EXPECT_GT(image1->Size().Width(), 0); |
| - EXPECT_GT(image1->Size().Height(), 0); |
| - EXPECT_EQ(image1->Size().Width() * 2, image2->Size().Width()); |
| - EXPECT_EQ(image1->Size().Height() * 2, image2->Size().Height()); |
| -} |
| - |
| } // namespace blink |