OLD | NEW |
---|---|
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 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 8 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
9 #include "chrome/browser/devtools/device/usb/android_usb_device.h" | 9 #include "chrome/browser/devtools/device/usb/android_usb_device.h" |
10 #include "chrome/browser/devtools/device/usb/usb_device_provider.h" | 10 #include "chrome/browser/devtools/device/usb/usb_device_provider.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 }; | 36 }; |
37 | 37 |
38 const uint32 kMaxPayload = 4096; | 38 const uint32 kMaxPayload = 4096; |
39 const uint32 kVersion = 0x01000000; | 39 const uint32 kVersion = 0x01000000; |
40 | 40 |
41 const char kOpenedUnixSocketsCommand[] = "shell:cat /proc/net/unix"; | 41 const char kOpenedUnixSocketsCommand[] = "shell:cat /proc/net/unix"; |
42 const char kDeviceModelCommand[] = "shell:getprop ro.product.model"; | 42 const char kDeviceModelCommand[] = "shell:getprop ro.product.model"; |
43 const char kDumpsysCommand[] = "shell:dumpsys window policy"; | 43 const char kDumpsysCommand[] = "shell:dumpsys window policy"; |
44 const char kListProcessesCommand[] = "shell:ps"; | 44 const char kListProcessesCommand[] = "shell:ps"; |
45 const char kInstalledChromePackagesCommand[] = "shell:pm list packages"; | 45 const char kInstalledChromePackagesCommand[] = "shell:pm list packages"; |
46 const char kDeviceManufacturer[] = "Google Inc."; | |
dgozman
2014/08/14 02:57:58
I'd prefer "Test manufacturer".
| |
46 const char kDeviceModel[] = "Nexus 5"; | 47 const char kDeviceModel[] = "Nexus 5"; |
47 const char kDeviceSerial[] = "Sample serial"; | 48 const char kDeviceSerial[] = "Sample serial"; |
48 | 49 |
49 const char kSampleOpenedUnixSockets[] = | 50 const char kSampleOpenedUnixSockets[] = |
50 "Num RefCount Protocol Flags Type St Inode Path\n" | 51 "Num RefCount Protocol Flags Type St Inode Path\n" |
51 "00000000: 00000004 00000000" | 52 "00000000: 00000004 00000000" |
52 " 00000000 0002 01 3328 /dev/socket/wpa_wlan0\n" | 53 " 00000000 0002 01 3328 /dev/socket/wpa_wlan0\n" |
53 "00000000: 00000002 00000000" | 54 "00000000: 00000002 00000000" |
54 " 00010000 0001 01 5394 /dev/socket/vold\n"; | 55 " 00010000 0001 01 5394 /dev/socket/vold\n"; |
55 | 56 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 } | 248 } |
248 | 249 |
249 virtual bool SetInterfaceAlternateSetting( | 250 virtual bool SetInterfaceAlternateSetting( |
250 const int interface_number, | 251 const int interface_number, |
251 const int alternate_setting) OVERRIDE { | 252 const int alternate_setting) OVERRIDE { |
252 return true; | 253 return true; |
253 } | 254 } |
254 | 255 |
255 virtual bool ResetDevice() OVERRIDE { return true; } | 256 virtual bool ResetDevice() OVERRIDE { return true; } |
256 | 257 |
258 virtual bool GetManufacturer(base::string16* manufacturer) OVERRIDE { | |
259 *manufacturer = base::UTF8ToUTF16(kDeviceManufacturer); | |
260 return true; | |
261 } | |
262 | |
263 virtual bool GetProduct(base::string16* product) OVERRIDE { | |
264 *product = base::UTF8ToUTF16(kDeviceModel); | |
265 return true; | |
266 } | |
267 | |
257 virtual bool GetSerial(base::string16* serial) OVERRIDE { | 268 virtual bool GetSerial(base::string16* serial) OVERRIDE { |
258 *serial = base::UTF8ToUTF16(kDeviceSerial); | 269 *serial = base::UTF8ToUTF16(kDeviceSerial); |
259 return true; | 270 return true; |
260 } | 271 } |
261 | 272 |
262 // Async IO. Can be called on any thread. | 273 // Async IO. Can be called on any thread. |
263 virtual void ControlTransfer(const UsbEndpointDirection direction, | 274 virtual void ControlTransfer(const UsbEndpointDirection direction, |
264 const TransferRequestType request_type, | 275 const TransferRequestType request_type, |
265 const TransferRecipient recipient, | 276 const TransferRecipient recipient, |
266 const uint8 request, | 277 const uint8 request, |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
834 runner_->Run(); | 845 runner_->Run(); |
835 EXPECT_EQ(2, listener.invoked_); | 846 EXPECT_EQ(2, listener.invoked_); |
836 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 847 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
837 } | 848 } |
838 | 849 |
839 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 850 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
840 MockCountListenerForCheckingTraits listener(adb_bridge_); | 851 MockCountListenerForCheckingTraits listener(adb_bridge_); |
841 adb_bridge_->AddDeviceCountListener(&listener); | 852 adb_bridge_->AddDeviceCountListener(&listener); |
842 runner_->Run(); | 853 runner_->Run(); |
843 } | 854 } |
OLD | NEW |