Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp

Issue 1413513009: Use mocked scrollbar in webkit unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "core/loader/DocumentLoader.h" 5 #include "core/loader/DocumentLoader.h"
6 #include "core/loader/FrameLoader.h" 6 #include "core/loader/FrameLoader.h"
7 #include "platform/testing/URLTestHelpers.h" 7 #include "platform/testing/URLTestHelpers.h"
8 #include "public/platform/Platform.h" 8 #include "public/platform/Platform.h"
9 #include "public/platform/WebUnitTestSupport.h" 9 #include "public/platform/WebUnitTestSupport.h"
10 #include "public/web/WebFrame.h" 10 #include "public/web/WebFrame.h"
(...skipping 27 matching lines...) Expand all
38 38
39 protected: 39 protected:
40 40
41 void registerMockedHttpURLLoad(const std::string& fileName) 41 void registerMockedHttpURLLoad(const std::string& fileName)
42 { 42 {
43 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()));
44 } 44 }
45 45
46 std::string m_baseURL; 46 std::string m_baseURL;
47 MockWebFrameClient m_mockWebFrameClient; 47 MockWebFrameClient m_mockWebFrameClient;
48 FrameTestHelpers::UseMockScrollbarSettings m_mockScrollbarSettings;
48 }; 49 };
49 50
50 TEST_F(ProgrammaticScrollTest, RestoreScrollPositionAndViewStateWithScale) 51 TEST_F(ProgrammaticScrollTest, RestoreScrollPositionAndViewStateWithScale)
51 { 52 {
52 registerMockedHttpURLLoad("long_scroll.html"); 53 registerMockedHttpURLLoad("long_scroll.html");
53 54
54 FrameTestHelpers::WebViewHelper webViewHelper; 55 FrameTestHelpers::WebViewHelper webViewHelper;
55 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "long_scroll. html", true, 0, 0); 56 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "long_scroll. html", true, 0, 0);
56 webView->resize(WebSize(1000, 1000)); 57 webView->resize(WebSize(1000, 1000));
57 webView->layout(); 58 webView->layout();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 // FrameLoader::restoreScrollPositionAndViewState flows differently if scale is zero. 99 // FrameLoader::restoreScrollPositionAndViewState flows differently if scale is zero.
99 loader.restoreScrollPositionAndViewState(); 100 loader.restoreScrollPositionAndViewState();
100 101
101 // Expect that only the scroll position was restored. 102 // Expect that only the scroll position was restored.
102 EXPECT_EQ(3.0f, webViewImpl->pageScaleFactor()); 103 EXPECT_EQ(3.0f, webViewImpl->pageScaleFactor());
103 EXPECT_EQ(400, webViewImpl->mainFrameImpl()->scrollOffset().height); 104 EXPECT_EQ(400, webViewImpl->mainFrameImpl()->scrollOffset().height);
104 } 105 }
105 106
106 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698