Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 { | 81 { |
| 82 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); | 82 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); |
| 83 EXPECT_FALSE(webViewImpl->bestTapNode(platformEvent)); | 83 EXPECT_FALSE(webViewImpl->bestTapNode(platformEvent)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 touchEvent.y = 20; | 86 touchEvent.y = 20; |
| 87 // Shouldn't crash. | 87 // Shouldn't crash. |
| 88 | 88 |
| 89 { | 89 { |
| 90 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); | 90 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); |
| 91 webViewImpl->enableTapHighlight(platformEvent); | 91 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 92 } | 92 } |
| 93 | 93 |
| 94 EXPECT_TRUE(webViewImpl->linkHighlight()); | 94 EXPECT_TRUE(webViewImpl->linkHighlight(0)); |
| 95 EXPECT_TRUE(webViewImpl->linkHighlight()->contentLayer()); | 95 EXPECT_TRUE(webViewImpl->linkHighlight(0)->contentLayer()); |
| 96 EXPECT_TRUE(webViewImpl->linkHighlight()->clipLayer()); | 96 EXPECT_TRUE(webViewImpl->linkHighlight(0)->clipLayer()); |
| 97 | 97 |
| 98 // Find a target inside a scrollable div | 98 // Find a target inside a scrollable div |
| 99 | 99 |
| 100 touchEvent.y = 100; | 100 touchEvent.y = 100; |
| 101 { | 101 { |
| 102 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); | 102 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); |
| 103 webViewImpl->enableTapHighlight(platformEvent); | 103 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 104 } | 104 } |
| 105 | 105 |
| 106 ASSERT_TRUE(webViewImpl->linkHighlight()); | 106 ASSERT_TRUE(webViewImpl->linkHighlight(0)); |
| 107 | 107 |
| 108 // Don't highlight if no "hand cursor" | 108 // Don't highlight if no "hand cursor" |
| 109 touchEvent.y = 220; // An A-link with cross-hair cursor. | 109 touchEvent.y = 220; // An A-link with cross-hair cursor. |
| 110 { | 110 { |
| 111 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); | 111 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); |
| 112 webViewImpl->enableTapHighlight(platformEvent); | 112 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 113 } | 113 } |
| 114 ASSERT_FALSE(webViewImpl->linkHighlight()); | 114 ASSERT_FALSE(webViewImpl->linkHighlight(0)); |
| 115 | 115 |
| 116 touchEvent.y = 260; // A text input box. | 116 touchEvent.y = 260; // A text input box. |
| 117 { | 117 { |
| 118 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); | 118 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()-> frameView(), touchEvent); |
| 119 webViewImpl->enableTapHighlight(platformEvent); | 119 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
| 120 } | 120 } |
| 121 ASSERT_FALSE(webViewImpl->linkHighlight()); | 121 ASSERT_FALSE(webViewImpl->linkHighlight(0)); |
| 122 | 122 |
| 123 webViewImpl->close(); | 123 webViewImpl->close(); |
| 124 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 124 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 class FakeWebFrameClient : public WebFrameClient { | 127 class FakeWebFrameClient : public WebFrameClient { |
| 128 // To make the destructor public. | 128 // To make the destructor public. |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 class FakeCompositingWebViewClient : public WebViewClient { | 131 class FakeCompositingWebViewClient : public WebViewClient { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 | 172 |
| 173 WebGestureEvent touchEvent; | 173 WebGestureEvent touchEvent; |
| 174 touchEvent.type = WebInputEvent::GestureTapDown; | 174 touchEvent.type = WebInputEvent::GestureTapDown; |
| 175 touchEvent.x = 20; | 175 touchEvent.x = 20; |
| 176 touchEvent.y = 20; | 176 touchEvent.y = 20; |
| 177 | 177 |
| 178 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram eView(), touchEvent); | 178 PlatformGestureEventBuilder platformEvent(webViewImpl->mainFrameImpl()->fram eView(), touchEvent); |
| 179 Node* touchNode = webViewImpl->bestTapNode(platformEvent); | 179 Node* touchNode = webViewImpl->bestTapNode(platformEvent); |
| 180 ASSERT_TRUE(touchNode); | 180 ASSERT_TRUE(touchNode); |
| 181 | 181 |
| 182 webViewImpl->enableTapHighlight(platformEvent); | 182 webViewImpl->enableTapHighlightAtPoint(platformEvent); |
|
wjmaclean
2013/06/12 15:09:06
We should add a test that verifies that multiple h
| |
| 183 ASSERT_TRUE(webViewImpl->linkHighlight()); | 183 ASSERT_TRUE(webViewImpl->linkHighlight(0)); |
| 184 | 184 |
| 185 GraphicsLayer* highlightLayer = webViewImpl->linkHighlight()->currentGraphic sLayerForTesting(); | 185 GraphicsLayer* highlightLayer = webViewImpl->linkHighlight(0)->currentGraphi csLayerForTesting(); |
| 186 ASSERT_TRUE(highlightLayer); | 186 ASSERT_TRUE(highlightLayer); |
| 187 EXPECT_TRUE(highlightLayer->linkHighlight()); | 187 EXPECT_TRUE(highlightLayer->linkHighlight(0)); |
| 188 | 188 |
| 189 touchNode->remove(IGNORE_EXCEPTION); | 189 touchNode->remove(IGNORE_EXCEPTION); |
| 190 webViewImpl->layout(); | 190 webViewImpl->layout(); |
| 191 EXPECT_FALSE(highlightLayer->linkHighlight()); | 191 EXPECT_FALSE(highlightLayer->linkHighlight(0)); |
| 192 | 192 |
| 193 webViewImpl->close(); | 193 webViewImpl->close(); |
| 194 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 194 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace | 197 } // namespace |
| OLD | NEW |