OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.Manifest; | 7 import android.Manifest; |
8 import android.app.Dialog; | 8 import android.app.Dialog; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
11 import android.graphics.drawable.Drawable; | |
12 import android.location.LocationManager; | 11 import android.location.LocationManager; |
13 import android.support.test.filters.LargeTest; | 12 import android.support.test.filters.LargeTest; |
14 import android.test.MoreAsserts; | 13 import android.test.MoreAsserts; |
15 import android.view.View; | 14 import android.view.View; |
16 import android.widget.Button; | 15 import android.widget.Button; |
17 import android.widget.ListView; | 16 import android.widget.ListView; |
18 | 17 |
19 import org.chromium.base.ThreadUtils; | 18 import org.chromium.base.ThreadUtils; |
20 import org.chromium.base.test.util.RetryOnFailure; | 19 import org.chromium.base.test.util.RetryOnFailure; |
21 import org.chromium.chrome.R; | 20 import org.chromium.chrome.R; |
(...skipping 24 matching lines...) Expand all Loading... |
46 int mFinishedEventType = -1; | 45 int mFinishedEventType = -1; |
47 String mFinishedDeviceId; | 46 String mFinishedDeviceId; |
48 int mRestartSearchCount = 0; | 47 int mRestartSearchCount = 0; |
49 | 48 |
50 BluetoothChooserDialogWithFakeNatives(WindowAndroid windowAndroid, Strin
g origin, | 49 BluetoothChooserDialogWithFakeNatives(WindowAndroid windowAndroid, Strin
g origin, |
51 int securityLevel, long nativeBluetoothChooserDialogPtr) { | 50 int securityLevel, long nativeBluetoothChooserDialogPtr) { |
52 super(windowAndroid, origin, securityLevel, nativeBluetoothChooserDi
alogPtr); | 51 super(windowAndroid, origin, securityLevel, nativeBluetoothChooserDi
alogPtr); |
53 } | 52 } |
54 | 53 |
55 @Override | 54 @Override |
56 Drawable getConnectedIcon() { | |
57 return super.mConnectedIcon; | |
58 } | |
59 | |
60 @Override | |
61 void nativeOnDialogFinished( | 55 void nativeOnDialogFinished( |
62 long nativeBluetoothChooserAndroid, int eventType, String device
Id) { | 56 long nativeBluetoothChooserAndroid, int eventType, String device
Id) { |
63 assertEquals(nativeBluetoothChooserAndroid, mNativeBluetoothChooserD
ialogPtr); | 57 assertEquals(nativeBluetoothChooserAndroid, mNativeBluetoothChooserD
ialogPtr); |
64 assertEquals(mFinishedEventType, -1); | 58 assertEquals(mFinishedEventType, -1); |
65 mFinishedEventType = eventType; | 59 mFinishedEventType = eventType; |
66 mFinishedDeviceId = deviceId; | 60 mFinishedDeviceId = deviceId; |
67 // The native code calls closeDialog() when OnDialogFinished is call
ed. | 61 // The native code calls closeDialog() when OnDialogFinished is call
ed. |
68 closeDialog(); | 62 closeDialog(); |
69 } | 63 } |
70 | 64 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 statusView.getText().toString()); | 239 statusView.getText().toString()); |
246 assertFalse(button.isEnabled()); | 240 assertFalse(button.isEnabled()); |
247 assertEquals(View.VISIBLE, items.getVisibility()); | 241 assertEquals(View.VISIBLE, items.getVisibility()); |
248 assertEquals(View.GONE, progress.getVisibility()); | 242 assertEquals(View.GONE, progress.getVisibility()); |
249 | 243 |
250 ItemChooserDialog.ItemAdapter itemAdapter = | 244 ItemChooserDialog.ItemAdapter itemAdapter = |
251 mChooserDialog.mItemChooserDialog.getItemAdapterForTesting(); | 245 mChooserDialog.mItemChooserDialog.getItemAdapterForTesting(); |
252 assertTrue(itemAdapter.getItem(0).hasSameContents( | 246 assertTrue(itemAdapter.getItem(0).hasSameContents( |
253 "id-1", "Name 1", null /* icon */, null /* iconDescription */)); | 247 "id-1", "Name 1", null /* icon */, null /* iconDescription */)); |
254 assertTrue(itemAdapter.getItem(1).hasSameContents("id-2", "Name 2", | 248 assertTrue(itemAdapter.getItem(1).hasSameContents("id-2", "Name 2", |
255 mChooserDialog.getConnectedIcon(), mChooserDialog.mConnectedIcon
Description)); | 249 mChooserDialog.mConnectedIcon, mChooserDialog.mConnectedIconDesc
ription)); |
256 | 250 |
257 selectItem(mChooserDialog, 2); | 251 selectItem(mChooserDialog, 2); |
258 | 252 |
259 assertEquals( | 253 assertEquals( |
260 BluetoothChooserDialog.DIALOG_FINISHED_SELECTED, mChooserDialog.
mFinishedEventType); | 254 BluetoothChooserDialog.DIALOG_FINISHED_SELECTED, mChooserDialog.
mFinishedEventType); |
261 assertEquals("id-2", mChooserDialog.mFinishedDeviceId); | 255 assertEquals("id-2", mChooserDialog.mFinishedDeviceId); |
262 } | 256 } |
263 | 257 |
264 @LargeTest | 258 @LargeTest |
265 public void testNoLocationPermission() { | 259 public void testNoLocationPermission() { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 } | 470 } |
477 | 471 |
478 public boolean mSystemLocationSettingsEnabled = true; | 472 public boolean mSystemLocationSettingsEnabled = true; |
479 | 473 |
480 @Override | 474 @Override |
481 public boolean isSystemLocationSettingEnabled() { | 475 public boolean isSystemLocationSettingEnabled() { |
482 return mSystemLocationSettingsEnabled; | 476 return mSystemLocationSettingsEnabled; |
483 } | 477 } |
484 } | 478 } |
485 } | 479 } |
OLD | NEW |