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

COVERAGE SUMMARY FOR SOURCE FILE [ContentSettings.java]

nameclass, %method, %block, %line, %
ContentSettings.java100% (1/1)75%  (3/4)63%  (36/57)78%  (10.2/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ContentSettings100% (1/1)75%  (3/4)63%  (36/57)78%  (10.2/13)
getJavaScriptEnabled (): boolean 0%   (0/1)0%   (0/11)0%   (0/2)
onNativeContentSettingsDestroyed (int): void 100% (1/1)71%  (10/14)87%  (2.6/3)
<static initializer> 100% (1/1)75%  (6/8)75%  (0.8/1)
ContentSettings (ContentViewCore, int): void 100% (1/1)83%  (20/24)97%  (6.8/7)

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 org.chromium.base.CalledByNative;
8import org.chromium.base.JNINamespace;
9import org.chromium.base.ThreadUtils;
10 
11/**
12 * Manages settings state for a ContentView. A ContentSettings instance is obtained
13 * from ContentViewCore.getContentSettings().
14 */
15@JNINamespace("content")
16public class ContentSettings {
17 
18    private static final String TAG = "ContentSettings";
19 
20    // The native side of this object. Ownership is retained native-side by the WebContents
21    // instance that backs the associated ContentViewCore.
22    private int mNativeContentSettings = 0;
23 
24    private ContentViewCore mContentViewCore;
25 
26    /**
27     * Package constructor to prevent clients from creating a new settings
28     * instance. Must be called on the UI thread.
29     */
30    ContentSettings(ContentViewCore contentViewCore, int nativeContentView) {
31        ThreadUtils.assertOnUiThread();
32        mContentViewCore = contentViewCore;
33        mNativeContentSettings = nativeInit(nativeContentView);
34        assert mNativeContentSettings != 0;
35    }
36 
37    /**
38     * Notification from the native side that it is being destroyed.
39     * @param nativeContentSettings the native instance that is going away.
40     */
41    @CalledByNative
42    private void onNativeContentSettingsDestroyed(int nativeContentSettings) {
43        assert mNativeContentSettings == nativeContentSettings;
44        mNativeContentSettings = 0;
45    }
46 
47    /**
48     * Return true if JavaScript is enabled. Must be called on the UI thread.
49     *
50     * @return True if JavaScript is enabled.
51     */
52    public boolean getJavaScriptEnabled() {
53        ThreadUtils.assertOnUiThread();
54        return mNativeContentSettings != 0 ?
55                nativeGetJavaScriptEnabled(mNativeContentSettings) : false;
56    }
57 
58    // Initialize the ContentSettings native side.
59    private native int nativeInit(int contentViewPtr);
60 
61    private native boolean nativeGetJavaScriptEnabled(int nativeContentSettings);
62}

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