| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |