ClickListenerTest.java revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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    /*
18    @MediumTest
19    @Feature({"ContentDetection", "TabContents"})
20    http://crbug.com/172786
21    */
22    @DisabledTest
23    public void testClickContentOnLink() throws Throwable {
24        startActivityWithTestUrl("content/content_detection/click_listeners.html");
25
26        // Clicks on addresses in links should change the url.
27        scrollAndTapNavigatingOut("linktest");
28        assertTrue(isCurrentTestUrl("content/content_detection/empty.html"));
29    }
30
31    /*
32    @MediumTest
33    @Feature({"ContentDetection", "TabContents"})
34    http://crbug.com/172786
35    */
36    @DisabledTest
37    public void testClickContentOnJSListener1() throws Throwable {
38        startActivityWithTestUrl("content/content_detection/click_listeners.html");
39
40        // Clicks on addresses in elements listening to click events should be
41        // processed normally without address detection.
42        scrollAndTapNavigatingOut("clicktest1");
43        assertTrue(isCurrentTestUrl("content/content_detection/empty.html"));
44    }
45
46    /*
47    @MediumTest
48    @Feature({"ContentDetection", "TabContents"})
49    http://crbug.com/172786
50    */
51    @DisabledTest
52    public void testClickContentOnJSListener2() throws Throwable {
53        startActivityWithTestUrl("content/content_detection/click_listeners.html");
54
55        // Same as previous test, but using addEventListener instead of onclick.
56        scrollAndTapNavigatingOut("clicktest2");
57        assertTrue(isCurrentTestUrl("content/content_detection/empty.html"));
58    }
59}
60