| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |