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

COVERAGE SUMMARY FOR SOURCE FILE [ClearHistoryTest.java]

nameclass, %method, %block, %line, %
ClearHistoryTest.java0%   (0/1)0%   (0/3)0%   (0/94)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ClearHistoryTest0%   (0/1)0%   (0/3)0%   (0/94)0%   (0/19)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/1)
ClearHistoryTest (): void 0%   (0/1)0%   (0/25)0%   (0/4)
testClearHistory (): void 0%   (0/1)0%   (0/65)0%   (0/14)

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.android_webview.test;
6 
7import android.test.suitebuilder.annotation.SmallTest;
8 
9import org.chromium.android_webview.AwContents;
10import org.chromium.base.test.util.DisabledTest;
11import org.chromium.base.test.util.Feature;
12import org.chromium.base.test.util.UrlUtils;
13import org.chromium.content.browser.ContentViewCore;
14import org.chromium.content.browser.test.util.HistoryUtils;
15import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
16 
17/**
18 * Tests for a wanted clearHistory method.
19 */
20public class ClearHistoryTest extends AwTestBase {
21 
22    private static final String[] URLS = new String[3];
23    {
24        for (int i = 0; i < URLS.length; i++) {
25            URLS[i] = UrlUtils.encodeHtmlDataUri(
26                    "<html><head></head><body>" + i + "</body></html>");
27        }
28    }
29 
30    /*
31    @SmallTest
32    @Feature({"History", "Main"})
33    This test is only failing on JellyBean bots.
34    See crbug.com/178762.
35    */
36    @DisabledTest
37    public void testClearHistory() throws Throwable {
38        final TestAwContentsClient contentsClient = new TestAwContentsClient();
39        final AwTestContainerView testContainerView =
40                createAwTestContainerViewOnMainSync(contentsClient);
41        final AwContents awContents = testContainerView.getAwContents();
42        final ContentViewCore contentViewCore = testContainerView.getContentViewCore();
43 
44        OnPageFinishedHelper onPageFinishedHelper = contentsClient.getOnPageFinishedHelper();
45        for (int i = 0; i < 3; i++) {
46            loadUrlSync(awContents, onPageFinishedHelper, URLS[i]);
47        }
48 
49        HistoryUtils.goBackSync(getInstrumentation(), contentViewCore, onPageFinishedHelper);
50        assertTrue("Should be able to go back",
51                   HistoryUtils.canGoBackOnUiThread(getInstrumentation(), contentViewCore));
52        assertTrue("Should be able to go forward",
53                   HistoryUtils.canGoForwardOnUiThread(getInstrumentation(), contentViewCore));
54 
55        HistoryUtils.clearHistoryOnUiThread(getInstrumentation(), contentViewCore);
56        assertFalse("Should not be able to go back",
57                    HistoryUtils.canGoBackOnUiThread(getInstrumentation(), contentViewCore));
58        assertFalse("Should not be able to go forward",
59                    HistoryUtils.canGoForwardOnUiThread(getInstrumentation(), contentViewCore));
60    }
61}

[all classes][org.chromium.android_webview.test]
EMMA 2.0.5312 (C) Vladimir Roubtsov