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