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

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

Issue 138743008: Make sure the root node of selector queries is a ContainerNode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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/WebNode.cpp ('k') | no next file » | 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) 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 virtual void TearDown() 114 virtual void TearDown()
115 { 115 {
116 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 116 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
117 } 117 }
118 118
119 protected: 119 protected:
120 void runTouchActionTest(std::string file); 120 void runTouchActionTest(std::string file);
121 void runShadowDOMTest(std::string file); 121 void runShadowDOMTest(std::string file);
122 void sendTouchEvent(WebView*, WebInputEvent::Type, WebCore::IntPoint clientP oint); 122 void sendTouchEvent(WebView*, WebInputEvent::Type, WebCore::IntPoint clientP oint);
123 WebView* setupTest(std::string file, TouchActionTrackingWebViewClient&); 123 WebView* setupTest(std::string file, TouchActionTrackingWebViewClient&);
124 void runTestOnTree(WebCore::Node* root, WebView*, TouchActionTrackingWebView Client&); 124 void runTestOnTree(WebCore::ContainerNode* root, WebView*, TouchActionTracki ngWebViewClient&);
125 125
126 std::string m_baseURL; 126 std::string m_baseURL;
127 FrameTestHelpers::WebViewHelper m_webViewHelper; 127 FrameTestHelpers::WebViewHelper m_webViewHelper;
128 }; 128 };
129 129
130 void TouchActionTest::runTouchActionTest(std::string file) 130 void TouchActionTest::runTouchActionTest(std::string file)
131 { 131 {
132 TouchActionTrackingWebViewClient client; 132 TouchActionTrackingWebViewClient client;
133 133
134 WebView* webView = setupTest(file, client); 134 WebView* webView = setupTest(file, client);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 webView->resize(WebSize(700, 1000)); 168 webView->resize(WebSize(700, 1000));
169 169
170 // Scroll to verify the code properly transforms windows to client co-ords. 170 // Scroll to verify the code properly transforms windows to client co-ords.
171 const int kScrollOffset = 100; 171 const int kScrollOffset = 100;
172 RefPtr<WebCore::Document> document = static_cast<PassRefPtr<WebCore::Documen t> >(webView->mainFrame()->document()); 172 RefPtr<WebCore::Document> document = static_cast<PassRefPtr<WebCore::Documen t> >(webView->mainFrame()->document());
173 document->frame()->view()->setScrollOffset(WebCore::IntPoint(0, kScrollOffse t)); 173 document->frame()->view()->setScrollOffset(WebCore::IntPoint(0, kScrollOffse t));
174 174
175 return webView; 175 return webView;
176 } 176 }
177 177
178 void TouchActionTest::runTestOnTree(WebCore::Node* root, WebView* webView, Touch ActionTrackingWebViewClient& client) 178 void TouchActionTest::runTestOnTree(WebCore::ContainerNode* root, WebView* webVi ew, TouchActionTrackingWebViewClient& client)
179 { 179 {
180 // Find all elements to test the touch-action of in the document. 180 // Find all elements to test the touch-action of in the document.
181 WebCore::TrackExceptionState es; 181 WebCore::TrackExceptionState es;
182 RefPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expected-action]" , es); 182 RefPtr<WebCore::NodeList> nodes = root->querySelectorAll("[expected-action]" , es);
183 ASSERT_FALSE(es.hadException()); 183 ASSERT_FALSE(es.hadException());
184 184
185 for (unsigned index = 0; index < nodes->length(); index++) { 185 for (unsigned index = 0; index < nodes->length(); index++) {
186 WebCore::Element* element = toElement(nodes->item(index)); 186 WebCore::Element* element = toElement(nodes->item(index));
187 element->scrollIntoViewIfNeeded(); 187 element->scrollIntoViewIfNeeded();
188 ASSERT_TRUE(nodes->item(index)->isElementNode()); 188 ASSERT_TRUE(nodes->item(index)->isElementNode());
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 { 318 {
319 runShadowDOMTest("touch-action-shadow-dom.html"); 319 runShadowDOMTest("touch-action-shadow-dom.html");
320 } 320 }
321 321
322 TEST_F(TouchActionTest, Pan) 322 TEST_F(TouchActionTest, Pan)
323 { 323 {
324 runTouchActionTest("touch-action-pan.html"); 324 runTouchActionTest("touch-action-pan.html");
325 } 325 }
326 326
327 } 327 }
OLDNEW
« no previous file with comments | « Source/web/WebNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698