| 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 25 matching lines...) Expand all Loading... |
| 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/WebUnitTestSupport.h" |
| 39 #include "public/web/WebFrameClient.h" | 39 #include "public/web/WebFrameClient.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
| 41 #include "web/WebLocalFrameImpl.h" | 41 #include "web/WebLocalFrameImpl.h" |
| 42 #include "web/tests/FrameTestHelpers.h" | 42 #include "web/tests/FrameTestHelpers.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class MockWebFrameClient : public WebFrameClient { | |
| 47 }; | |
| 48 | |
| 49 class LayoutGeometryMapTest : public testing::Test { | 46 class LayoutGeometryMapTest : public testing::Test { |
| 50 public: | 47 public: |
| 51 LayoutGeometryMapTest() | 48 LayoutGeometryMapTest() |
| 52 : m_baseURL("http://www.test.com/") | 49 : m_baseURL("http://www.test.com/") |
| 53 { | 50 { |
| 54 } | 51 } |
| 55 | 52 |
| 56 void TearDown() override | 53 void TearDown() override |
| 57 { | 54 { |
| 58 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 55 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 rect.setHeight(std::max(quad.p1().y(), std::max(quad.p2().y(), std::max(
quad.p3().y(), quad.p4().y()))) - rect.y()); | 114 rect.setHeight(std::max(quad.p1().y(), std::max(quad.p2().y(), std::max(
quad.p3().y(), quad.p4().y()))) - rect.y()); |
| 118 return rect; | 115 return rect; |
| 119 } | 116 } |
| 120 | 117 |
| 121 void registerMockedHttpURLLoad(const std::string& fileName) | 118 void registerMockedHttpURLLoad(const std::string& fileName) |
| 122 { | 119 { |
| 123 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); | 120 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); |
| 124 } | 121 } |
| 125 | 122 |
| 126 const std::string m_baseURL; | 123 const std::string m_baseURL; |
| 127 MockWebFrameClient m_mockWebViewClient; | 124 FrameTestHelpers::TestWebFrameClient m_mockWebViewClient; |
| 128 }; | 125 }; |
| 129 | 126 |
| 130 TEST_F(LayoutGeometryMapTest, SimpleGeometryMapTest) | 127 TEST_F(LayoutGeometryMapTest, SimpleGeometryMapTest) |
| 131 { | 128 { |
| 132 registerMockedHttpURLLoad("rgm_test.html"); | 129 registerMockedHttpURLLoad("rgm_test.html"); |
| 133 FrameTestHelpers::WebViewHelper webViewHelper; | 130 FrameTestHelpers::WebViewHelper webViewHelper; |
| 134 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "rgm_test.htm
l", true, 0, 0); | 131 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "rgm_test.htm
l", true, 0, 0); |
| 135 webView->resize(WebSize(1000, 1000)); | 132 webView->resize(WebSize(1000, 1000)); |
| 136 webView->updateAllLifecyclePhases(); | 133 webView->updateAllLifecyclePhases(); |
| 137 | 134 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr)); | 330 rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr)); |
| 334 rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col3"), nullptr); | 331 rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col3"), nullptr); |
| 335 EXPECT_NEAR(8.0f + offset * 2.0f, rectFromQuad(rgm.mapToAncestor(rect, nullp
tr)).x(), 0.1f); | 332 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); | 333 EXPECT_NEAR(8.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).y(), 0.1f); |
| 337 EXPECT_EQ(5.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).width()); | 334 EXPECT_EQ(5.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).width()); |
| 338 EXPECT_EQ(3.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).height()); | 335 EXPECT_EQ(3.0f, rectFromQuad(rgm.mapToAncestor(rect, nullptr)).height()); |
| 339 | 336 |
| 340 } | 337 } |
| 341 | 338 |
| 342 } // namespace blink | 339 } // namespace blink |
| OLD | NEW |