| OLD | NEW |
| 1 #include "config.h" | 1 #include "config.h" |
| 2 | 2 |
| 3 #include "core/frame/FrameView.h" | 3 #include "core/frame/FrameView.h" |
| 4 #include "core/layout/LayoutView.h" | 4 #include "core/layout/LayoutView.h" |
| 5 #include "platform/testing/URLTestHelpers.h" | 5 #include "platform/testing/URLTestHelpers.h" |
| 6 #include "public/platform/Platform.h" | 6 #include "public/platform/Platform.h" |
| 7 #include "public/platform/WebUnitTestSupport.h" | 7 #include "public/platform/WebUnitTestSupport.h" |
| 8 #include "public/web/WebFrame.h" | 8 #include "public/web/WebFrame.h" |
| 9 #include "public/web/WebFrameClient.h" | 9 #include "public/web/WebFrameClient.h" |
| 10 #include "public/web/WebHistoryItem.h" | 10 #include "public/web/WebHistoryItem.h" |
| 11 #include "public/web/WebInputEvent.h" | 11 #include "public/web/WebInputEvent.h" |
| 12 #include "public/web/WebScriptSource.h" | 12 #include "public/web/WebScriptSource.h" |
| 13 #include "public/web/WebSettings.h" | 13 #include "public/web/WebSettings.h" |
| 14 #include "public/web/WebView.h" | 14 #include "public/web/WebView.h" |
| 15 #include "web/WebLocalFrameImpl.h" | 15 #include "web/WebLocalFrameImpl.h" |
| 16 #include "web/WebViewImpl.h" | 16 #include "web/WebViewImpl.h" |
| 17 #include "web/tests/FrameTestHelpers.h" | 17 #include "web/tests/FrameTestHelpers.h" |
| 18 #include <gtest/gtest.h> | 18 #include <gtest/gtest.h> |
| 19 | 19 |
| 20 using namespace blink; | 20 namespace blink { |
| 21 | |
| 22 namespace { | |
| 23 | 21 |
| 24 class MockWebFrameClient : public WebFrameClient { | 22 class MockWebFrameClient : public WebFrameClient { |
| 25 }; | 23 }; |
| 26 | 24 |
| 27 class ProgrammaticScrollTest : public testing::Test { | 25 class ProgrammaticScrollTest : public testing::Test { |
| 28 public: | 26 public: |
| 29 ProgrammaticScrollTest() | 27 ProgrammaticScrollTest() |
| 30 : m_baseURL("http://www.test.com/") | 28 : m_baseURL("http://www.test.com/") |
| 31 { | 29 { |
| 32 } | 30 } |
| 33 | 31 |
| 34 virtual void TearDown() | 32 void TearDown() override |
| 35 { | 33 { |
| 36 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 34 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 37 } | 35 } |
| 38 | 36 |
| 39 protected: | 37 protected: |
| 40 | 38 |
| 41 void registerMockedHttpURLLoad(const std::string& fileName) | 39 void registerMockedHttpURLLoad(const std::string& fileName) |
| 42 { | 40 { |
| 43 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); | 41 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); |
| 44 } | 42 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 frame->loader().currentItem()->setScrollPoint(WebPoint(0, 400)); | 94 frame->loader().currentItem()->setScrollPoint(WebPoint(0, 400)); |
| 97 | 95 |
| 98 // FrameLoader::restoreScrollPositionAndViewState flows differently if scale
is zero. | 96 // FrameLoader::restoreScrollPositionAndViewState flows differently if scale
is zero. |
| 99 frame->loader().restoreScrollPositionAndViewState(); | 97 frame->loader().restoreScrollPositionAndViewState(); |
| 100 | 98 |
| 101 // Expect that only the scroll position was restored. | 99 // Expect that only the scroll position was restored. |
| 102 EXPECT_EQ(3.0f, webViewImpl->pageScaleFactor()); | 100 EXPECT_EQ(3.0f, webViewImpl->pageScaleFactor()); |
| 103 EXPECT_EQ(400, webViewImpl->mainFrameImpl()->scrollOffset().height); | 101 EXPECT_EQ(400, webViewImpl->mainFrameImpl()->scrollOffset().height); |
| 104 } | 102 } |
| 105 | 103 |
| 106 } | 104 } // namespace blink |
| OLD | NEW |