EMMA Coverage Report (generated Fri Aug 23 16:39:17 PDT 2013)
[all classes][org.chromium.content.browser.test.util]

COVERAGE SUMMARY FOR SOURCE FILE [TestWebContentsObserver.java]

nameclass, %method, %block, %line, %
TestWebContentsObserver.java100% (1/1)57%  (4/7)66%  (38/58)71%  (12/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TestWebContentsObserver100% (1/1)57%  (4/7)66%  (38/58)71%  (12/17)
didFailLoad (boolean, boolean, int, String, String): void 0%   (0/1)0%   (0/14)0%   (0/3)
getOnPageStartedHelper (): TestCallbackHelperContainer$OnPageStartedHelper 0%   (0/1)0%   (0/3)0%   (0/1)
getOnReceivedErrorHelper (): TestCallbackHelperContainer$OnReceivedErrorHelper 0%   (0/1)0%   (0/3)0%   (0/1)
TestWebContentsObserver (ContentViewCore): void 100% (1/1)100% (19/19)100% (5/5)
didStartLoading (String): void 100% (1/1)100% (8/8)100% (3/3)
didStopLoading (String): void 100% (1/1)100% (8/8)100% (3/3)
getOnPageFinishedHelper (): TestCallbackHelperContainer$OnPageFinishedHelper 100% (1/1)100% (3/3)100% (1/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.content.browser.test.util;
6 
7import org.chromium.content.browser.ContentViewCore;
8import org.chromium.content.browser.WebContentsObserverAndroid;
9import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
10import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageStartedHelper;
11import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnReceivedErrorHelper;
12 
13/**
14 * The default WebContentsObserverAndroid used by ContentView tests. The below callbacks can be
15 * accessed by using {@link TestCallbackHelperContainer} or extending this class.
16 */
17public class TestWebContentsObserver extends WebContentsObserverAndroid {
18 
19    private OnPageStartedHelper mOnPageStartedHelper;
20    private OnPageFinishedHelper mOnPageFinishedHelper;
21    private OnReceivedErrorHelper mOnReceivedErrorHelper;
22 
23    public TestWebContentsObserver(ContentViewCore contentViewCore) {
24        super(contentViewCore);
25        mOnPageStartedHelper = new OnPageStartedHelper();
26        mOnPageFinishedHelper = new OnPageFinishedHelper();
27        mOnReceivedErrorHelper = new OnReceivedErrorHelper();
28    }
29 
30    public OnPageStartedHelper getOnPageStartedHelper() {
31        return mOnPageStartedHelper;
32    }
33 
34    public OnPageFinishedHelper getOnPageFinishedHelper() {
35        return mOnPageFinishedHelper;
36    }
37 
38    public OnReceivedErrorHelper getOnReceivedErrorHelper() {
39        return mOnReceivedErrorHelper;
40    }
41 
42    /**
43     * ATTENTION!: When overriding the following methods, be sure to call
44     * the corresponding methods in the super class. Otherwise
45     * {@link CallbackHelper#waitForCallback()} methods will
46     * stop working!
47     */
48    @Override
49    public void didStartLoading(String url) {
50        super.didStartLoading(url);
51        mOnPageStartedHelper.notifyCalled(url);
52    }
53 
54    @Override
55    public void didStopLoading(String url) {
56        super.didStopLoading(url);
57        mOnPageFinishedHelper.notifyCalled(url);
58    }
59 
60    @Override
61    public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame,
62            int errorCode, String description, String failingUrl) {
63        super.didFailLoad(isProvisionalLoad, isMainFrame, errorCode, description, failingUrl);
64        mOnReceivedErrorHelper.notifyCalled(errorCode, description, failingUrl);
65    }
66}

[all classes][org.chromium.content.browser.test.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov