| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/layout/LayoutGeometryMap.h" | 31 #include "core/layout/LayoutGeometryMap.h" |
| 32 | 32 |
| 33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
| 34 #include "core/layout/LayoutBox.h" | 34 #include "core/layout/LayoutBox.h" |
| 35 #include "core/paint/PaintLayer.h" | 35 #include "core/paint/PaintLayer.h" |
| 36 #include "platform/testing/URLTestHelpers.h" | 36 #include "platform/testing/URLTestHelpers.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebUnitTestSupport.h" | 38 #include "public/platform/WebURLLoaderMockFactory.h" |
| 39 #include "public/web/WebCache.h" |
| 39 #include "public/web/WebFrameClient.h" | 40 #include "public/web/WebFrameClient.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 41 #include "web/WebLocalFrameImpl.h" | 42 #include "web/WebLocalFrameImpl.h" |
| 42 #include "web/tests/FrameTestHelpers.h" | 43 #include "web/tests/FrameTestHelpers.h" |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 class MockWebFrameClient : public WebFrameClient { | 47 class MockWebFrameClient : public WebFrameClient { |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 class LayoutGeometryMapTest : public testing::Test { | 50 class LayoutGeometryMapTest : public testing::Test { |
| 50 public: | 51 public: |
| 51 LayoutGeometryMapTest() | 52 LayoutGeometryMapTest() |
| 52 : m_baseURL("http://www.test.com/") | 53 : m_baseURL("http://www.test.com/") |
| 53 { | 54 { |
| 54 } | 55 } |
| 55 | 56 |
| 56 void TearDown() override | 57 void TearDown() override |
| 57 { | 58 { |
| 58 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 59 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 60 WebCache::clear(); |
| 59 } | 61 } |
| 60 | 62 |
| 61 protected: | 63 protected: |
| 62 static LayoutBox* getFrameElement(const char* iframeName, WebView* webView,
const WTF::AtomicString& elementId) | 64 static LayoutBox* getFrameElement(const char* iframeName, WebView* webView,
const WTF::AtomicString& elementId) |
| 63 { | 65 { |
| 64 WebLocalFrameImpl* iframe = toWebLocalFrameImpl(webView->findFrameByName
(WebString::fromUTF8(iframeName))); | 66 WebLocalFrameImpl* iframe = toWebLocalFrameImpl(webView->findFrameByName
(WebString::fromUTF8(iframeName))); |
| 65 if (!iframe) | 67 if (!iframe) |
| 66 return nullptr; | 68 return nullptr; |
| 67 LocalFrame* frame = iframe->frame(); | 69 LocalFrame* frame = iframe->frame(); |
| 68 Document* doc = frame->document(); | 70 Document* doc = frame->document(); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr)); | 335 rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr)); |
| 334 rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col3"), nullptr); | 336 rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col3"), nullptr); |
| 335 EXPECT_NEAR(8.0f + offset * 2.0f, rectFromQuad(rgm.mapToAncestor(rect, nullp
tr)).x(), 0.1f); | 337 EXPECT_NEAR(8.0f + offset * 2.0f, rectFromQuad(rgm.mapToAncestor(rect, nullp
tr)).x(), 0.1f); |
| 336 EXPECT_NEAR(8.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).y(), 0.1f); | 338 EXPECT_NEAR(8.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).y(), 0.1f); |
| 337 EXPECT_EQ(5.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).width()); | 339 EXPECT_EQ(5.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).width()); |
| 338 EXPECT_EQ(3.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).height()); | 340 EXPECT_EQ(3.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).height()); |
| 339 | 341 |
| 340 } | 342 } |
| 341 | 343 |
| 342 } // namespace blink | 344 } // namespace blink |
| OLD | NEW |