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

COVERAGE SUMMARY FOR SOURCE FILE [AwBrowserProcess.java]

nameclass, %method, %block, %line, %
AwBrowserProcess.java100% (2/2)80%  (4/5)60%  (25/42)67%  (10/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AwBrowserProcess100% (1/1)67%  (2/3)52%  (11/21)67%  (6/9)
AwBrowserProcess (): void 0%   (0/1)0%   (0/3)0%   (0/1)
loadLibrary (): void 100% (1/1)42%  (5/12)67%  (4/6)
start (Context): void 100% (1/1)100% (6/6)100% (2/2)
     
class AwBrowserProcess$1100% (1/1)100% (2/2)67%  (14/21)71%  (5/7)
run (): void 100% (1/1)53%  (8/15)67%  (4/6)
AwBrowserProcess$1 (Context): void 100% (1/1)100% (6/6)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.android_webview;
6 
7import android.content.Context;
8import android.content.SharedPreferences;
9 
10import org.chromium.base.PathUtils;
11import org.chromium.base.ThreadUtils;
12import org.chromium.content.app.LibraryLoader;
13import org.chromium.content.browser.AndroidBrowserProcess;
14import org.chromium.content.common.ProcessInitException;
15 
16/**
17 * Wrapper for the steps needed to initialize the java and native sides of webview chromium.
18 */
19public abstract class AwBrowserProcess {
20    private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "webview";
21 
22    /**
23     * Loads the native library, and performs basic static construction of objects needed
24     * to run webview in this process. Does not create threads; safe to call from zygote.
25     * Note: it is up to the caller to ensure this is only called once.
26     */
27    public static void loadLibrary() {
28        PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
29        try {
30            LibraryLoader.loadNow();
31        } catch (ProcessInitException e) {
32            throw new RuntimeException("Cannot load WebView", e);
33        }
34    }
35 
36    /**
37     * Starts the chromium browser process running within this process. Creates threads
38     * and performs other per-app resource allocations; must not be called from zygote.
39     * Note: it is up to the caller to ensure this is only called once.
40     * @param context The Android application context
41     */
42    public static void start(final Context context) {
43        // We must post to the UI thread to cover the case that the user
44        // has invoked Chromium startup by using the (thread-safe)
45        // CookieManager rather than creating a WebView.
46        ThreadUtils.runOnUiThreadBlocking(new Runnable() {
47            @Override
48            public void run() {
49                try {
50                    LibraryLoader.ensureInitialized();
51                    AndroidBrowserProcess.init(context,
52                            AndroidBrowserProcess.MAX_RENDERERS_SINGLE_PROCESS);
53                } catch (ProcessInitException e) {
54                    throw new RuntimeException("Cannot initialize WebView", e);
55                }
56            }
57        });
58    }
59}

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