Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(870)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialogTest.java

Issue 1000793002: [Android] Incorporate findbugs into android builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.app.AlertDialog; 7 import android.app.AlertDialog;
8 import android.content.DialogInterface; 8 import android.content.DialogInterface;
9 import android.test.suitebuilder.annotation.SmallTest; 9 import android.test.suitebuilder.annotation.SmallTest;
10 10
11 import org.chromium.base.ThreadUtils; 11 import org.chromium.base.ThreadUtils;
12 import org.chromium.base.annotations.SuppressFBWarnings;
12 import org.chromium.base.test.util.Feature; 13 import org.chromium.base.test.util.Feature;
13 import org.chromium.chrome.R; 14 import org.chromium.chrome.R;
14 import org.chromium.chrome.shell.ChromeShellActivity; 15 import org.chromium.chrome.shell.ChromeShellActivity;
15 import org.chromium.chrome.shell.ChromeShellApplication; 16 import org.chromium.chrome.shell.ChromeShellApplication;
16 import org.chromium.chrome.shell.ChromeShellTestBase; 17 import org.chromium.chrome.shell.ChromeShellTestBase;
17 18
18 /** 19 /**
19 * Tests org.chromium.chrome.browser.webapps.AddToHomescreenDialog by verifying 20 * Tests org.chromium.chrome.browser.webapps.AddToHomescreenDialog by verifying
20 * that the calling the show() method actually shows the dialog and checks that 21 * that the calling the show() method actually shows the dialog and checks that
21 * some expected elements inside the dialog are present. 22 * some expected elements inside the dialog are present.
22 * 23 *
23 * This is mostly intended as a smoke test because the dialog isn't used in 24 * This is mostly intended as a smoke test because the dialog isn't used in
24 * Chromium for the moment. 25 * Chromium for the moment.
25 */ 26 */
26 public class AddToHomescreenDialogTest extends ChromeShellTestBase { 27 public class AddToHomescreenDialogTest extends ChromeShellTestBase {
27 private ChromeShellActivity mActivity; 28 private ChromeShellActivity mActivity;
28 29
30 @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
29 @Override 31 @Override
30 public void setUp() throws Exception { 32 public void setUp() throws Exception {
31 super.setUp(); 33 super.setUp();
32 mActivity = launchChromeShellWithBlankPage(); 34 mActivity = launchChromeShellWithBlankPage();
33 ChromeShellApplication application = 35 ChromeShellApplication application =
Yaron 2015/03/23 19:13:16 I'd prefer it if you just deleted this line as opp
jbudorick 2015/03/23 19:49:21 done + verified that test passed locally without i
34 (ChromeShellApplication) mActivity.getApplication(); 36 (ChromeShellApplication) mActivity.getApplication();
35 } 37 }
36 38
37 @SmallTest 39 @SmallTest
38 @Feature("{Webapp}") 40 @Feature("{Webapp}")
39 public void testSmoke() throws InterruptedException { 41 public void testSmoke() throws InterruptedException {
40 assertTrue(waitForActiveShellToBeDoneLoading()); 42 assertTrue(waitForActiveShellToBeDoneLoading());
41 43
42 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 44 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
43 @Override 45 @Override
44 public void run() { 46 public void run() {
45 assertNull(AddToHomescreenDialog.getCurrentDialogForTest()); 47 assertNull(AddToHomescreenDialog.getCurrentDialogForTest());
46 48
47 AddToHomescreenDialog.show(mActivity, mActivity.getActiveTab()); 49 AddToHomescreenDialog.show(mActivity, mActivity.getActiveTab());
48 AlertDialog dialog = AddToHomescreenDialog.getCurrentDialogForTe st(); 50 AlertDialog dialog = AddToHomescreenDialog.getCurrentDialogForTe st();
49 assertNotNull(dialog); 51 assertNotNull(dialog);
50 52
51 assertTrue(dialog.isShowing()); 53 assertTrue(dialog.isShowing());
52 54
53 assertNotNull(dialog.findViewById(R.id.title)); 55 assertNotNull(dialog.findViewById(R.id.title));
54 assertNotNull(dialog.findViewById(R.id.text)); 56 assertNotNull(dialog.findViewById(R.id.text));
55 assertNotNull(dialog.getButton(DialogInterface.BUTTON_POSITIVE)) ; 57 assertNotNull(dialog.getButton(DialogInterface.BUTTON_POSITIVE)) ;
56 assertNotNull(dialog.getButton(DialogInterface.BUTTON_NEGATIVE)) ; 58 assertNotNull(dialog.getButton(DialogInterface.BUTTON_NEGATIVE)) ;
57 } 59 }
58 }); 60 });
59 } 61 }
60 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698