ClickListenerTest.java revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.content.browser; 6 7import android.test.suitebuilder.annotation.MediumTest; 8 9import org.chromium.base.test.util.DisabledTest; 10import org.chromium.base.test.util.Feature; 11 12/** 13 * Test suite for click listener validation in content detection. 14 */ 15public class ClickListenerTest extends ContentDetectionTestBase { 16 17 @MediumTest 18 @Feature({"ContentDetection", "TabContents"}) 19 public void testClickContentOnLink() throws Throwable { 20 startActivityWithTestUrl("content/content_detection/click_listeners.html"); 21 22 // Clicks on addresses in links should change the url. 23 scrollAndTapNavigatingOut("linktest"); 24 assertTrue(isCurrentTestUrl("content/content_detection/empty.html")); 25 } 26 27 @MediumTest 28 @Feature({"ContentDetection", "TabContents"}) 29 public void testClickContentOnJSListener1() throws Throwable { 30 startActivityWithTestUrl("content/content_detection/click_listeners.html"); 31 32 // Clicks on addresses in elements listening to click events should be 33 // processed normally without address detection. 34 scrollAndTapNavigatingOut("clicktest1"); 35 assertTrue(isCurrentTestUrl("content/content_detection/empty.html")); 36 } 37 38 @MediumTest 39 @Feature({"ContentDetection", "TabContents"}) 40 public void testClickContentOnJSListener2() throws Throwable { 41 startActivityWithTestUrl("content/content_detection/click_listeners.html"); 42 43 // Same as previous test, but using addEventListener instead of onclick. 44 scrollAndTapNavigatingOut("clicktest2"); 45 assertTrue(isCurrentTestUrl("content/content_detection/empty.html")); 46 } 47} 48