| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 private: | 88 private: |
| 89 int m_actionSetCount; | 89 int m_actionSetCount; |
| 90 WebTouchAction m_action; | 90 WebTouchAction m_action; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 const int kfakeTouchId = 7; | 93 const int kfakeTouchId = 7; |
| 94 | 94 |
| 95 class TouchActionTest : public ::testing::Test { | 95 class TouchActionTest : public ::testing::Test { |
| 96 public: | 96 public: |
| 97 TouchActionTest() : m_baseURL("http://www.test.com/") { | 97 TouchActionTest() : m_baseURL("http://www.test.com/") { |
| 98 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), | 98 URLTestHelpers::registerMockedURLLoadFromBase( |
| 99 "touch-action-tests.css"); | 99 WebString::fromUTF8(m_baseURL), testing::webTestDataPath(), |
| 100 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), | 100 "touch-action-tests.css"); |
| 101 "touch-action-tests.js"); | 101 URLTestHelpers::registerMockedURLLoadFromBase( |
| 102 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), | 102 WebString::fromUTF8(m_baseURL), testing::webTestDataPath(), |
| 103 "white-1x1.png"); | 103 "touch-action-tests.js"); |
| 104 URLTestHelpers::registerMockedURLLoadFromBase( |
| 105 WebString::fromUTF8(m_baseURL), testing::webTestDataPath(), |
| 106 "white-1x1.png"); |
| 104 } | 107 } |
| 105 | 108 |
| 106 void TearDown() override { | 109 void TearDown() override { |
| 107 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 110 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 108 WebCache::clear(); | 111 WebCache::clear(); |
| 109 } | 112 } |
| 110 | 113 |
| 111 protected: | 114 protected: |
| 112 void runTouchActionTest(std::string file); | 115 void runTouchActionTest(std::string file); |
| 113 void runShadowDOMTest(std::string file); | 116 void runShadowDOMTest(std::string file); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 runTestOnTree(contentDoc.get(), webView, client); | 191 runTestOnTree(contentDoc.get(), webView, client); |
| 189 } | 192 } |
| 190 | 193 |
| 191 // Explicitly reset to break dependency on locally scoped client. | 194 // Explicitly reset to break dependency on locally scoped client. |
| 192 m_webViewHelper.reset(); | 195 m_webViewHelper.reset(); |
| 193 } | 196 } |
| 194 | 197 |
| 195 WebView* TouchActionTest::setupTest( | 198 WebView* TouchActionTest::setupTest( |
| 196 std::string file, | 199 std::string file, |
| 197 TouchActionTrackingWebWidgetClient& client) { | 200 TouchActionTrackingWebWidgetClient& client) { |
| 198 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL), | 201 URLTestHelpers::registerMockedURLLoadFromBase(WebString::fromUTF8(m_baseURL), |
| 199 WebString::fromUTF8(file)); | 202 testing::webTestDataPath(), |
| 203 WebString::fromUTF8(file)); |
| 200 // Note that JavaScript must be enabled for shadow DOM tests. | 204 // Note that JavaScript must be enabled for shadow DOM tests. |
| 201 WebView* webView = | 205 WebView* webView = |
| 202 m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, 0, &client); | 206 m_webViewHelper.initializeAndLoad(m_baseURL + file, true, 0, 0, &client); |
| 203 | 207 |
| 204 // Set size to enable hit testing, and avoid line wrapping for consistency | 208 // Set size to enable hit testing, and avoid line wrapping for consistency |
| 205 // with browser. | 209 // with browser. |
| 206 webView->resize(WebSize(800, 1200)); | 210 webView->resize(WebSize(800, 1200)); |
| 207 | 211 |
| 208 // Scroll to verify the code properly transforms windows to client co-ords. | 212 // Scroll to verify the code properly transforms windows to client co-ords. |
| 209 const int kScrollOffset = 100; | 213 const int kScrollOffset = 100; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 412 |
| 409 TEST_F(TouchActionTest, ShadowDOM) { | 413 TEST_F(TouchActionTest, ShadowDOM) { |
| 410 runShadowDOMTest("touch-action-shadow-dom.html"); | 414 runShadowDOMTest("touch-action-shadow-dom.html"); |
| 411 } | 415 } |
| 412 | 416 |
| 413 TEST_F(TouchActionTest, Pan) { | 417 TEST_F(TouchActionTest, Pan) { |
| 414 runTouchActionTest("touch-action-pan.html"); | 418 runTouchActionTest("touch-action-pan.html"); |
| 415 } | 419 } |
| 416 | 420 |
| 417 } // namespace blink | 421 } // namespace blink |
| OLD | NEW |