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
3# found in the LICENSE file.
4
5import unittest
6
7from telemetry.core.platform import android_device
8from telemetry.unittest import system_stub
9
10
11class AndroidDeviceTest(unittest.TestCase):
12  def setUp(self):
13    self._android_device_stub = system_stub.Override(
14        android_device, ['adb_commands'])
15
16  def testGetAllAttachedAndroidDevices(self):
17    self._android_device_stub.adb_commands.attached_devices = [
18        '01', '02']
19    self.assertEquals(
20        set(['01', '02']),
21        set(device.device_id for device in
22            android_device.AndroidDevice.GetAllConnectedDevices()
23        ))
24
25  def tearDown(self):
26    self._android_device_stub.Restore()
27