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

COVERAGE SUMMARY FOR SOURCE FILE [MockGrantCredentialsPermissionActivity.java]

nameclass, %method, %block, %line, %
MockGrantCredentialsPermissionActivity.java0%   (0/2)0%   (0/5)0%   (0/85)0%   (0/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MockGrantCredentialsPermissionActivity0%   (0/1)0%   (0/3)0%   (0/64)0%   (0/14)
MockGrantCredentialsPermissionActivity (): void 0%   (0/1)0%   (0/3)0%   (0/1)
onCreate (Bundle): void 0%   (0/1)0%   (0/46)0%   (0/9)
onResume (): void 0%   (0/1)0%   (0/15)0%   (0/4)
     
class MockGrantCredentialsPermissionActivity$10%   (0/1)0%   (0/2)0%   (0/21)0%   (0/5)
MockGrantCredentialsPermissionActivity$1 (MockGrantCredentialsPermissionActiv... 0%   (0/1)0%   (0/6)0%   (0/1)
run (): void 0%   (0/1)0%   (0/15)0%   (0/4)

1// Copyright 2013 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.sync.test.util;
6 
7import android.accounts.Account;
8import android.app.Activity;
9import android.content.Intent;
10import android.os.Bundle;
11import android.os.Handler;
12import android.os.Looper;
13import android.util.Log;
14import android.widget.TextView;
15 
16/**
17 * A dummy implementation of the Android {@link GrantCredentialsPermissionActivity} that is used
18 * when displaying the Allow/Deny dialog when an application asks for an auth token
19 * for a given auth token type and that app has never gotten the permission.
20 *
21 * Currently this activity just starts up, broadcasts an intent, and finishes.
22 *
23 * This class is used by {@link MockAccountManager}.
24 */
25public class MockGrantCredentialsPermissionActivity extends Activity {
26 
27    private static final String TAG = "MockGrantCredentialsPermissionActivity";
28 
29    static final String ACCOUNT = "account";
30 
31    static final String AUTH_TOKEN_TYPE = "authTokenType";
32 
33    @Override
34    protected void onCreate(Bundle savedInstanceState) {
35        super.onCreate(savedInstanceState);
36        TextView textView = new TextView(this);
37        Account account = (Account) getIntent().getParcelableExtra(ACCOUNT);
38        String authTokenType = getIntent().getStringExtra(AUTH_TOKEN_TYPE);
39        String accountName = account == null ? null : account.name;
40        String message = "account = " + accountName + ", authTokenType = " + authTokenType;
41        textView.setText(message);
42        setContentView(textView);
43    }
44 
45    @Override
46    protected void onResume() {
47        super.onResume();
48        // Send out the broadcast after the Activity has completely started up.
49        Handler handler = new Handler(Looper.getMainLooper());
50        handler.post(new Runnable() {
51            @Override
52            public void run() {
53                Log.d(TAG, "Broadcasting " + MockAccountManager.MUTEX_WAIT_ACTION);
54                sendBroadcast(new Intent(MockAccountManager.MUTEX_WAIT_ACTION));
55                finish();
56            }
57        });
58    }
59}

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