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

Side by Side Diff: Source/web/tests/ViewportTest.cpp

Issue 336553003: Change Page::m_mainFrame to be a Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/tests/PinchViewportTest.cpp ('k') | Source/web/tests/WebDocumentTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 static void setViewportSettings(WebSettings* settings) 120 static void setViewportSettings(WebSettings* settings)
121 { 121 {
122 settings->setViewportEnabled(true); 122 settings->setViewportEnabled(true);
123 settings->setViewportMetaEnabled(true); 123 settings->setViewportMetaEnabled(true);
124 settings->setMainFrameResizesAreOrientationChanges(true); 124 settings->setMainFrameResizesAreOrientationChanges(true);
125 } 125 }
126 126
127 static PageScaleConstraints runViewportTest(Page* page, int initialWidth, int in itialHeight) 127 static PageScaleConstraints runViewportTest(Page* page, int initialWidth, int in itialHeight)
128 { 128 {
129 IntSize initialViewportSize(initialWidth, initialHeight); 129 IntSize initialViewportSize(initialWidth, initialHeight);
130 page->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero(), initialVie wportSize)); 130 toLocalFrame(page->mainFrame())->view()->setFrameRect(IntRect(IntPoint::zero (), initialViewportSize));
131 ViewportDescription description = page->viewportDescription(); 131 ViewportDescription description = page->viewportDescription();
132 PageScaleConstraints constraints = description.resolve(initialViewportSize, WebCore::Length(980, WebCore::Fixed)); 132 PageScaleConstraints constraints = description.resolve(initialViewportSize, WebCore::Length(980, WebCore::Fixed));
133 133
134 constraints.fitToContentsWidth(constraints.layoutSize.width(), initialWidth) ; 134 constraints.fitToContentsWidth(constraints.layoutSize.width(), initialWidth) ;
135 return constraints; 135 return constraints;
136 } 136 }
137 137
138 TEST_F(ViewportTest, viewport1) 138 TEST_F(ViewportTest, viewport1)
139 { 139 {
140 UseMockScrollbarSettings mockScrollbarSettings; 140 UseMockScrollbarSettings mockScrollbarSettings;
(...skipping 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after
3197 FrameTestHelpers::WebViewHelper webViewHelper; 3197 FrameTestHelpers::WebViewHelper webViewHelper;
3198 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht ml", true, &webFrameClient, 0, setViewportSettings); 3198 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht ml", true, &webFrameClient, 0, setViewportSettings);
3199 3199
3200 Page* page = webViewHelper.webViewImpl()->page(); 3200 Page* page = webViewHelper.webViewImpl()->page();
3201 runViewportTest(page, 320, 352); 3201 runViewportTest(page, 320, 352);
3202 3202
3203 EXPECT_EQ(0U, webFrameClient.messages.size()); 3203 EXPECT_EQ(0U, webFrameClient.messages.size());
3204 } 3204 }
3205 3205
3206 } // namespace 3206 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/PinchViewportTest.cpp ('k') | Source/web/tests/WebDocumentTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698