EMMA Coverage Report (generated Tue Aug 20 10:07:21 PDT 2013)
[all classes][org.chromium.chrome.browser.input]

COVERAGE SUMMARY FOR SOURCE FILE [SelectPopupOtherContentViewTest.java]

nameclass, %method, %block, %line, %
SelectPopupOtherContentViewTest.java0%   (0/3)0%   (0/8)0%   (0/89)0%   (0/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SelectPopupOtherContentViewTest0%   (0/1)0%   (0/3)0%   (0/51)0%   (0/13)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/1)
SelectPopupOtherContentViewTest (): void 0%   (0/1)0%   (0/3)0%   (0/2)
testPopupNotClosedByOtherContentView (): void 0%   (0/1)0%   (0/44)0%   (0/10)
     
class SelectPopupOtherContentViewTest$10%   (0/1)0%   (0/2)0%   (0/26)0%   (0/6)
SelectPopupOtherContentViewTest$1 (SelectPopupOtherContentViewTest): void 0%   (0/1)0%   (0/6)0%   (0/1)
run (): void 0%   (0/1)0%   (0/20)0%   (0/5)
     
class SelectPopupOtherContentViewTest$PopupShowingCriteria0%   (0/1)0%   (0/3)0%   (0/12)0%   (0/2)
SelectPopupOtherContentViewTest$PopupShowingCriteria (): void 0%   (0/1)0%   (0/3)0%   (0/1)
SelectPopupOtherContentViewTest$PopupShowingCriteria (SelectPopupOtherContent... 0%   (0/1)0%   (0/3)0%   (0/1)
isSatisfied (): boolean 0%   (0/1)0%   (0/6)0%   (0/1)

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.chrome.browser.input;
6 
7import android.test.suitebuilder.annotation.LargeTest;
8 
9import org.chromium.base.test.util.DisabledTest;
10import org.chromium.base.test.util.Feature;
11import org.chromium.base.test.util.UrlUtils;
12import org.chromium.content.browser.ContentView;
13import org.chromium.content.browser.input.SelectPopupDialog;
14import org.chromium.content.browser.test.util.Criteria;
15import org.chromium.content.browser.test.util.CriteriaHelper;
16import org.chromium.content.browser.test.util.DOMUtils;
17import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
18import org.chromium.content.browser.test.util.UiUtils;
19import org.chromium.chrome.browser.ContentViewUtil;
20import org.chromium.chrome.testshell.ChromiumTestShellTestBase;
21import org.chromium.ui.WindowAndroid;
22 
23import java.util.concurrent.TimeUnit;
24 
25public class SelectPopupOtherContentViewTest extends ChromiumTestShellTestBase {
26    private static final int WAIT_TIMEOUT_SECONDS = 2;
27    private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri(
28            "<html><body>" +
29            "Which animal is the strongest:<br/>" +
30            "<select id=\"select\">" +
31            "<option>Black bear</option>" +
32            "<option>Polar bear</option>" +
33            "<option>Grizzly</option>" +
34            "<option>Tiger</option>" +
35            "<option>Lion</option>" +
36            "<option>Gorilla</option>" +
37            "<option>Chipmunk</option>" +
38            "</select>" +
39            "</body></html>");
40 
41    private static class PopupShowingCriteria implements Criteria {
42        @Override
43        public boolean isSatisfied() {
44            return SelectPopupDialog.getCurrent() != null;
45        }
46    }
47 
48    public SelectPopupOtherContentViewTest() {
49    }
50 
51    /**
52     * Tests that the showing select popup does not get closed because an unrelated ContentView
53     * gets destroyed.
54     *
55     * @LargeTest
56     * @Feature({"Browser"})
57     * BUG 172967
58    */
59    @DisabledTest
60    public void testPopupNotClosedByOtherContentView()
61            throws InterruptedException, Exception, Throwable {
62        // Load the test page.
63        launchChromiumTestShellWithUrl(SELECT_URL);
64        assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading());
65 
66        final ContentView view = getActivity().getActiveContentView();
67        final TestCallbackHelperContainer viewClient =
68                new TestCallbackHelperContainer(view);
69 
70        // Once clicked, the popup should show up.
71        DOMUtils.clickNode(this, view, viewClient, "select");
72        assertTrue("The select popup did not show up on click.",
73                CriteriaHelper.pollForCriteria(new PopupShowingCriteria()));
74 
75        // Now create and destroy a different ContentView.
76        UiUtils.runOnUiThread(getActivity(), new Runnable() {
77            @Override
78            public void run() {
79                int nativeWebContents = ContentViewUtil.createNativeWebContents(false);
80                WindowAndroid windowAndroid = new WindowAndroid(getActivity());
81                ContentView contentView = ContentView.newInstance(
82                        getActivity(), nativeWebContents, windowAndroid);
83                contentView.destroy();
84            }
85        });
86 
87        // Process some more events to give a chance to the dialog to hide if it were to.
88        getInstrumentation().waitForIdleSync();
89 
90        // The popup should still be shown.
91        assertNotNull("The select popup got hidden by destroying of unrelated ContentViewCore.",
92                SelectPopupDialog.getCurrent());
93    }
94}

[all classes][org.chromium.chrome.browser.input]
EMMA 2.0.5312 (C) Vladimir Roubtsov