| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "FrameTestHelpers.h" | 33 #include "FrameTestHelpers.h" |
| 34 #include "URLTestHelpers.h" | 34 #include "URLTestHelpers.h" |
| 35 #include "WebConsoleMessage.h" | 35 #include "WebConsoleMessage.h" |
| 36 #include "WebFrame.h" | 36 #include "WebFrame.h" |
| 37 #include "WebScriptSource.h" | 37 #include "WebScriptSource.h" |
| 38 #include "WebSettings.h" | 38 #include "WebSettings.h" |
| 39 #include "WebViewClient.h" | 39 #include "WebViewClient.h" |
| 40 #include "core/dom/ViewportDescription.h" | |
| 41 #include "core/frame/FrameView.h" | 40 #include "core/frame/FrameView.h" |
| 42 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 42 #include "core/page/InjectedStyleSheets.h" |
| 43 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
| 44 #include "core/page/PageScaleConstraints.h" | 44 #include "core/page/PageScaleConstraints.h" |
| 45 #include "core/frame/Settings.h" | 45 #include "core/frame/Settings.h" |
| 46 #include "platform/Length.h" |
| 46 #include "platform/geometry/IntPoint.h" | 47 #include "platform/geometry/IntPoint.h" |
| 47 #include "platform/geometry/IntRect.h" | 48 #include "platform/geometry/IntRect.h" |
| 48 #include "platform/geometry/IntSize.h" | 49 #include "platform/geometry/IntSize.h" |
| 49 #include "platform/scroll/ScrollbarTheme.h" | 50 #include "platform/scroll/ScrollbarTheme.h" |
| 50 #include "public/platform/Platform.h" | 51 #include "public/platform/Platform.h" |
| 51 #include "public/platform/WebUnitTestSupport.h" | 52 #include "public/platform/WebUnitTestSupport.h" |
| 52 #include <gmock/gmock.h> | 53 #include <gmock/gmock.h> |
| 53 #include <gtest/gtest.h> | 54 #include <gtest/gtest.h> |
| 54 | 55 |
| 55 #include <vector> | 56 #include <vector> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 { | 121 { |
| 121 settings->setViewportEnabled(true); | 122 settings->setViewportEnabled(true); |
| 122 settings->setViewportMetaEnabled(true); | 123 settings->setViewportMetaEnabled(true); |
| 123 settings->setMainFrameResizesAreOrientationChanges(true); | 124 settings->setMainFrameResizesAreOrientationChanges(true); |
| 124 } | 125 } |
| 125 | 126 |
| 126 static PageScaleConstraints runViewportTest(Page* page, int initialWidth, int in
itialHeight) | 127 static PageScaleConstraints runViewportTest(Page* page, int initialWidth, int in
itialHeight) |
| 127 { | 128 { |
| 128 IntSize initialViewportSize(initialWidth, initialHeight); | 129 IntSize initialViewportSize(initialWidth, initialHeight); |
| 129 page->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero(), initialVie
wportSize)); | 130 page->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero(), initialVie
wportSize)); |
| 130 | |
| 131 ViewportDescription description = page->viewportDescription(); | 131 ViewportDescription description = page->viewportDescription(); |
| 132 PageScaleConstraints constraints = description.resolve(initialViewportSize); | 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; |
| 141 registerMockedHttpURLLoad("viewport/viewport-1.html"); | 141 registerMockedHttpURLLoad("viewport/viewport-1.html"); |
| 142 | 142 |
| (...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3119 FrameTestHelpers::WebViewHelper webViewHelper; | 3119 FrameTestHelpers::WebViewHelper webViewHelper; |
| 3120 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht
ml", true, 0, &webViewClient, setViewportSettings); | 3120 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht
ml", true, 0, &webViewClient, setViewportSettings); |
| 3121 | 3121 |
| 3122 Page* page = webViewHelper.webViewImpl()->page(); | 3122 Page* page = webViewHelper.webViewImpl()->page(); |
| 3123 runViewportTest(page, 320, 352); | 3123 runViewportTest(page, 320, 352); |
| 3124 | 3124 |
| 3125 EXPECT_EQ(0U, webViewClient.messages.size()); | 3125 EXPECT_EQ(0U, webViewClient.messages.size()); |
| 3126 } | 3126 } |
| 3127 | 3127 |
| 3128 } // namespace | 3128 } // namespace |
| OLD | NEW |