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

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

Issue 2271413002: bluetooth: Implement RSSI indicator on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-impl-rssi-tx-power
Patch Set: Draft of LevelListDrawable and StateListDrawable Created 4 years, 2 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 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;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 TextViewWithClickableSpans statusView = 210 TextViewWithClickableSpans statusView =
211 (TextViewWithClickableSpans) dialog.findViewById(R.id.status); 211 (TextViewWithClickableSpans) dialog.findViewById(R.id.status);
212 final View items = dialog.findViewById(R.id.items); 212 final View items = dialog.findViewById(R.id.items);
213 final Button button = (Button) dialog.findViewById(R.id.positive); 213 final Button button = (Button) dialog.findViewById(R.id.positive);
214 final View progress = dialog.findViewById(R.id.progress); 214 final View progress = dialog.findViewById(R.id.progress);
215 215
216 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 216 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
217 @Override 217 @Override
218 public void run() { 218 public void run() {
219 mChooserDialog.addOrUpdateDevice("id-1", "Name 1"); 219 mChooserDialog.addOrUpdateDevice(
220 mChooserDialog.addOrUpdateDevice("id-2", "Name 2"); 220 "id-1", "Name 1", -1 /* No Signal Strength Level */);
221 mChooserDialog.addOrUpdateDevice(
222 "id-2", "Name 2", 1 /* Signal Strength Level: 1 */);
223 mChooserDialog.addOrUpdateDevice(
224 "id-3", "Name 3", 2 /* Signal Strength Level: 2 */);
221 } 225 }
222 }); 226 });
223 227
224 // After adding items to the dialog, the help message should be showing, 228 // After adding items to the dialog, the help message should be showing,
225 // the progress spinner should disappear, the Commit button should still 229 // the progress spinner should disappear, the Commit button should still
226 // be disabled (since nothing's selected), and the list view should 230 // be disabled (since nothing's selected), and the list view should
227 // show. 231 // show.
228 assertEquals(removeLinkTags(getActivity().getString(R.string.bluetooth_n ot_seeing_it)), 232 assertEquals(removeLinkTags(getActivity().getString(R.string.bluetooth_n ot_seeing_it)),
229 statusView.getText().toString()); 233 statusView.getText().toString());
230 assertFalse(button.isEnabled()); 234 assertFalse(button.isEnabled());
231 assertEquals(View.VISIBLE, items.getVisibility()); 235 assertEquals(View.VISIBLE, items.getVisibility());
232 assertEquals(View.GONE, progress.getVisibility()); 236 assertEquals(View.GONE, progress.getVisibility());
233 237
238 ItemChooserDialog.ItemAdapter itemAdapter =
239 mChooserDialog.mItemChooserDialog.getItemAdapterForTesting();
240
241 ItemChooserDialog.ItemChooserRow expectedItem1 =
242 new ItemChooserDialog.ItemChooserRow("id-1", "Name 1", null);
243 assertEquals(itemAdapter.getItem(0), expectedItem1);
244
245 ItemChooserDialog.ItemChooserRow expectedItem2 = new ItemChooserDialog.I temChooserRow(
246 "id-2", "Name 2", mChooserDialog.getSignalStrengthLevelRowIcons( )[1]);
247 assertEquals(itemAdapter.getItem(1), expectedItem2);
248
249 ItemChooserDialog.ItemChooserRow expectedItem3 = new ItemChooserDialog.I temChooserRow(
250 "id-3", "Name 3", mChooserDialog.getSignalStrengthLevelRowIcons( )[2]);
251 assertEquals(itemAdapter.getItem(2), expectedItem3);
252
234 selectItem(mChooserDialog, 2); 253 selectItem(mChooserDialog, 2);
235 254
236 assertEquals( 255 assertEquals(
237 BluetoothChooserDialog.DIALOG_FINISHED_SELECTED, mChooserDialog. mFinishedEventType); 256 BluetoothChooserDialog.DIALOG_FINISHED_SELECTED, mChooserDialog. mFinishedEventType);
238 assertEquals("id-2", mChooserDialog.mFinishedDeviceId); 257 assertEquals("id-2", mChooserDialog.mFinishedDeviceId);
239 } 258 }
240 259
241 @LargeTest 260 @LargeTest
242 public void testNoLocationPermission() throws InterruptedException { 261 public void testNoLocationPermission() throws InterruptedException {
243 ItemChooserDialog itemChooser = mChooserDialog.mItemChooserDialog; 262 ItemChooserDialog itemChooser = mChooserDialog.mItemChooserDialog;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 } 418 }
400 419
401 public boolean mSystemLocationSettingsEnabled = true; 420 public boolean mSystemLocationSettingsEnabled = true;
402 421
403 @Override 422 @Override
404 public boolean isSystemLocationSettingEnabled() { 423 public boolean isSystemLocationSettingEnabled() {
405 return mSystemLocationSettingsEnabled; 424 return mSystemLocationSettingsEnabled;
406 } 425 }
407 } 426 }
408 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698