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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 settings->setViewportEnabled(true); | 94 settings->setViewportEnabled(true); |
95 settings->setViewportMetaEnabled(true); | 95 settings->setViewportMetaEnabled(true); |
96 settings->setMainFrameResizesAreOrientationChanges(true); | 96 settings->setMainFrameResizesAreOrientationChanges(true); |
97 } | 97 } |
98 | 98 |
99 static PageScaleConstraints runViewportTest(Page* page, int initialWidth, int in
itialHeight) | 99 static PageScaleConstraints runViewportTest(Page* page, int initialWidth, int in
itialHeight) |
100 { | 100 { |
101 IntSize initialViewportSize(initialWidth, initialHeight); | 101 IntSize initialViewportSize(initialWidth, initialHeight); |
102 toLocalFrame(page->mainFrame())->view()->setFrameRect(IntRect(IntPoint::zero
(), initialViewportSize)); | 102 toLocalFrame(page->mainFrame())->view()->setFrameRect(IntRect(IntPoint::zero
(), initialViewportSize)); |
103 ViewportDescription description = page->viewportDescription(); | 103 ViewportDescription description = page->viewportDescription(); |
104 PageScaleConstraints constraints = description.resolve(initialViewportSize,
Length(980, blink::Fixed)); | 104 PageScaleConstraints constraints = description.resolve(FloatSize(initialView
portSize), Length(980, blink::Fixed)); |
105 | 105 |
106 constraints.fitToContentsWidth(constraints.layoutSize.width(), initialWidth)
; | 106 constraints.fitToContentsWidth(constraints.layoutSize.width(), initialWidth)
; |
107 constraints.resolveAutoInitialScale(); | 107 constraints.resolveAutoInitialScale(); |
108 return constraints; | 108 return constraints; |
109 } | 109 } |
110 | 110 |
111 TEST_F(ViewportTest, viewport1) | 111 TEST_F(ViewportTest, viewport1) |
112 { | 112 { |
113 registerMockedHttpURLLoad("viewport/viewport-1.html"); | 113 registerMockedHttpURLLoad("viewport/viewport-1.html"); |
114 | 114 |
(...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3000 FrameTestHelpers::WebViewHelper webViewHelper; | 3000 FrameTestHelpers::WebViewHelper webViewHelper; |
3001 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht
ml", true, &webFrameClient, 0, setViewportSettings); | 3001 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht
ml", true, &webFrameClient, 0, setViewportSettings); |
3002 | 3002 |
3003 Page* page = webViewHelper.webViewImpl()->page(); | 3003 Page* page = webViewHelper.webViewImpl()->page(); |
3004 runViewportTest(page, 320, 352); | 3004 runViewportTest(page, 320, 352); |
3005 | 3005 |
3006 EXPECT_EQ(0U, webFrameClient.messages.size()); | 3006 EXPECT_EQ(0U, webFrameClient.messages.size()); |
3007 } | 3007 } |
3008 | 3008 |
3009 } // namespace blink | 3009 } // namespace blink |
OLD | NEW |