| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "public/web/WebDocument.h" | 48 #include "public/web/WebDocument.h" |
| 49 #include "public/web/WebFrame.h" | 49 #include "public/web/WebFrame.h" |
| 50 #include "public/web/WebHitTestResult.h" | 50 #include "public/web/WebHitTestResult.h" |
| 51 #include "public/web/WebInputEvent.h" | 51 #include "public/web/WebInputEvent.h" |
| 52 #include "public/web/WebTouchAction.h" | 52 #include "public/web/WebTouchAction.h" |
| 53 #include "public/web/WebView.h" | 53 #include "public/web/WebView.h" |
| 54 #include "public/web/WebViewClient.h" | 54 #include "public/web/WebViewClient.h" |
| 55 #include "public/web/WebWidgetClient.h" | 55 #include "public/web/WebWidgetClient.h" |
| 56 #include "web/WebViewImpl.h" | 56 #include "web/WebViewImpl.h" |
| 57 #include "web/tests/FrameTestHelpers.h" | 57 #include "web/tests/FrameTestHelpers.h" |
| 58 | |
| 59 #include <gtest/gtest.h> | 58 #include <gtest/gtest.h> |
| 60 | 59 |
| 61 using namespace blink; | |
| 62 using blink::testing::runPendingTasks; | 60 using blink::testing::runPendingTasks; |
| 63 | 61 |
| 64 namespace { | 62 namespace blink { |
| 65 | 63 |
| 66 class TouchActionTrackingWebViewClient : public FrameTestHelpers::TestWebViewCli
ent { | 64 class TouchActionTrackingWebViewClient : public FrameTestHelpers::TestWebViewCli
ent { |
| 67 public: | 65 public: |
| 68 TouchActionTrackingWebViewClient() : | 66 TouchActionTrackingWebViewClient() : |
| 69 m_actionSetCount(0), | 67 m_actionSetCount(0), |
| 70 m_action(WebTouchActionAuto) | 68 m_action(WebTouchActionAuto) |
| 71 { | 69 { |
| 72 } | 70 } |
| 73 | 71 |
| 74 // WebWidgetClient methods | 72 // WebWidgetClient methods |
| 75 virtual void setTouchAction(WebTouchAction touchAction) | 73 void setTouchAction(WebTouchAction touchAction) override |
| 76 { | 74 { |
| 77 m_actionSetCount++; | 75 m_actionSetCount++; |
| 78 m_action = touchAction; | 76 m_action = touchAction; |
| 79 } | 77 } |
| 80 | 78 |
| 81 // Local methods | 79 // Local methods |
| 82 void reset() | 80 void reset() |
| 83 { | 81 { |
| 84 m_actionSetCount = 0; | 82 m_actionSetCount = 0; |
| 85 m_action = WebTouchActionAuto; | 83 m_action = WebTouchActionAuto; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 104 | 102 |
| 105 class TouchActionTest : public ::testing::Test { | 103 class TouchActionTest : public ::testing::Test { |
| 106 public: | 104 public: |
| 107 TouchActionTest() | 105 TouchActionTest() |
| 108 : m_baseURL("http://www.test.com/") | 106 : m_baseURL("http://www.test.com/") |
| 109 { | 107 { |
| 110 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL), "touch-action-tests.css"); | 108 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL), "touch-action-tests.css"); |
| 111 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL), "touch-action-tests.js"); | 109 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL), "touch-action-tests.js"); |
| 112 } | 110 } |
| 113 | 111 |
| 114 virtual void TearDown() | 112 void TearDown() override |
| 115 { | 113 { |
| 116 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 114 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 117 } | 115 } |
| 118 | 116 |
| 119 protected: | 117 protected: |
| 120 void runTouchActionTest(std::string file); | 118 void runTouchActionTest(std::string file); |
| 121 void runShadowDOMTest(std::string file); | 119 void runShadowDOMTest(std::string file); |
| 122 void sendTouchEvent(WebView*, WebInputEvent::Type, IntPoint clientPoint); | 120 void sendTouchEvent(WebView*, WebInputEvent::Type, IntPoint clientPoint); |
| 123 WebView* setupTest(std::string file, TouchActionTrackingWebViewClient&); | 121 WebView* setupTest(std::string file, TouchActionTrackingWebViewClient&); |
| 124 void runTestOnTree(ContainerNode* root, WebView*, TouchActionTrackingWebView
Client&); | 122 void runTestOnTree(ContainerNode* root, WebView*, TouchActionTrackingWebView
Client&); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 TEST_F(TouchActionTest, ShadowDOM) | 337 TEST_F(TouchActionTest, ShadowDOM) |
| 340 { | 338 { |
| 341 runShadowDOMTest("touch-action-shadow-dom.html"); | 339 runShadowDOMTest("touch-action-shadow-dom.html"); |
| 342 } | 340 } |
| 343 | 341 |
| 344 TEST_F(TouchActionTest, Pan) | 342 TEST_F(TouchActionTest, Pan) |
| 345 { | 343 { |
| 346 runTouchActionTest("touch-action-pan.html"); | 344 runTouchActionTest("touch-action-pan.html"); |
| 347 } | 345 } |
| 348 | 346 |
| 349 } | 347 } // namespace blink |
| OLD | NEW |