OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 WebMouseEventBuilder mouse(0, 0, *event); | 89 WebMouseEventBuilder mouse(0, 0, *event); |
90 EXPECT_EQ(WebInputEvent::Undefined, mouse.type); | 90 EXPECT_EQ(WebInputEvent::Undefined, mouse.type); |
91 } | 91 } |
92 | 92 |
93 TEST(WebInputEventConversionTest, InputEventsScaling) | 93 TEST(WebInputEventConversionTest, InputEventsScaling) |
94 { | 94 { |
95 const std::string baseURL("http://www.test.com/"); | 95 const std::string baseURL("http://www.test.com/"); |
96 const std::string fileName("fixed_layout.html"); | 96 const std::string fileName("fixed_layout.html"); |
97 | 97 |
98 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 98 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
99 WebViewImpl* webViewImpl = toWebViewImpl(FrameTestHelpers::createWebViewAndL
oad(baseURL + fileName, true)); | 99 FrameTestHelpers::WebViewHelper webViewHelper; |
| 100 WebViewImpl* webViewImpl = toWebViewImpl(webViewHelper.initializeAndLoad(bas
eURL + fileName, true)); |
100 webViewImpl->enableFixedLayoutMode(true); | 101 webViewImpl->enableFixedLayoutMode(true); |
101 webViewImpl->settings()->setViewportEnabled(true); | 102 webViewImpl->settings()->setViewportEnabled(true); |
102 int pageWidth = 640; | 103 int pageWidth = 640; |
103 int pageHeight = 480; | 104 int pageHeight = 480; |
104 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 105 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
105 webViewImpl->layout(); | 106 webViewImpl->layout(); |
106 | 107 |
107 webViewImpl->setPageScaleFactor(2, WebPoint()); | 108 webViewImpl->setPageScaleFactor(2, WebPoint()); |
108 | 109 |
109 FrameView* view = webViewImpl->page()->mainFrame()->view(); | 110 FrameView* view = webViewImpl->page()->mainFrame()->view(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 271 |
271 WebTouchEventBuilder webTouchBuilder(view, docRenderer, *touchEvent); | 272 WebTouchEventBuilder webTouchBuilder(view, docRenderer, *touchEvent); |
272 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 273 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
273 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); | 274 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); |
274 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.y); | 275 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.y); |
275 EXPECT_EQ(10, webTouchBuilder.touches[0].position.x); | 276 EXPECT_EQ(10, webTouchBuilder.touches[0].position.x); |
276 EXPECT_EQ(10, webTouchBuilder.touches[0].position.y); | 277 EXPECT_EQ(10, webTouchBuilder.touches[0].position.y); |
277 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusX); | 278 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusX); |
278 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusY); | 279 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusY); |
279 } | 280 } |
280 | |
281 webViewImpl->close(); | |
282 } | 281 } |
283 | 282 |
284 } // anonymous namespace | 283 } // anonymous namespace |
OLD | NEW |