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

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

Issue 967213004: Removed FrameView's windowToContents and contentsToWindow methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 9 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
« no previous file with comments | « Source/web/tests/WebPluginContainerTest.cpp ('k') | public/web/WebFrame.h » ('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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 }; 1188 };
1189 1189
1190 static bool tapElementById(WebView* webView, WebInputEvent::Type type, const Web String& id) 1190 static bool tapElementById(WebView* webView, WebInputEvent::Type type, const Web String& id)
1191 { 1191 {
1192 ASSERT(webView); 1192 ASSERT(webView);
1193 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele ment>>(webView->mainFrame()->document().getElementById(id)); 1193 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele ment>>(webView->mainFrame()->document().getElementById(id));
1194 if (!element) 1194 if (!element)
1195 return false; 1195 return false;
1196 1196
1197 element->scrollIntoViewIfNeeded(); 1197 element->scrollIntoViewIfNeeded();
1198
1199 // TODO(bokan): Technically incorrect, event positions should be in viewport space. crbug.com/371902.
1198 IntPoint center = element->screenRect().center(); 1200 IntPoint center = element->screenRect().center();
1199 1201
1200 // FIXME: This will be unnecessary since screenRect() will be fixed once crb ug.com/371902 lands.
1201 PinchViewport& pinchViewport = element->document().frameHost()->pinchViewpor t();
1202 IntPoint centerInViewport = center;
1203 centerInViewport.moveBy(-flooredIntPoint(pinchViewport.location()));
1204 centerInViewport.scale(pinchViewport.scale(), pinchViewport.scale());
1205
1206 WebGestureEvent event; 1202 WebGestureEvent event;
1207 event.type = type; 1203 event.type = type;
1208 event.x = centerInViewport.x(); 1204 event.x = center.x();
1209 event.y = centerInViewport.y(); 1205 event.y = center.y();
1210 1206
1211 webView->handleInputEvent(event); 1207 webView->handleInputEvent(event);
1212 runPendingTasks(); 1208 runPendingTasks();
1213 return true; 1209 return true;
1214 } 1210 }
1215 1211
1216 TEST_F(WebViewTest, DetectContentAroundPosition) 1212 TEST_F(WebViewTest, DetectContentAroundPosition)
1217 { 1213 {
1218 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("content_listeners.html")); 1214 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("content_listeners.html"));
1219 1215
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 // Test without any preventDefault. 2488 // Test without any preventDefault.
2493 client.reset(); 2489 client.reset();
2494 frame->executeScript(WebScriptSource("setTest('none');")); 2490 frame->executeScript(WebScriptSource("setTest('none');"));
2495 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2491 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2496 EXPECT_TRUE(client.getWasCalled()); 2492 EXPECT_TRUE(client.getWasCalled());
2497 2493
2498 m_webViewHelper.reset(); // Remove dependency on locally scoped client. 2494 m_webViewHelper.reset(); // Remove dependency on locally scoped client.
2499 } 2495 }
2500 2496
2501 } // namespace 2497 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/WebPluginContainerTest.cpp ('k') | public/web/WebFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698