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

Side by Side Diff: chrome/browser/devtools/device/usb/android_usb_browsertest.cc

Issue 1265833005: Get all the UsbConfigDescriptor for the device configuration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated code to continue instead of return if error happens when getting config descriptor Created 5 years, 4 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 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/containers/scoped_ptr_hash_map.h" 7 #include "base/containers/scoped_ptr_hash_map.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "chrome/browser/devtools/device/adb/mock_adb_server.h" 12 #include "chrome/browser/devtools/device/adb/mock_adb_server.h"
13 #include "chrome/browser/devtools/device/devtools_android_bridge.h" 13 #include "chrome/browser/devtools/device/devtools_android_bridge.h"
14 #include "chrome/browser/devtools/device/usb/android_usb_device.h" 14 #include "chrome/browser/devtools/device/usb/android_usb_device.h"
15 #include "chrome/browser/devtools/device/usb/usb_device_provider.h" 15 #include "chrome/browser/devtools/device/usb/usb_device_provider.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/test/test_utils.h" 19 #include "content/public/test/test_utils.h"
20 #include "device/usb/usb_descriptors.h"
21 #include "device/usb/usb_device.h" 20 #include "device/usb/usb_device.h"
22 #include "device/usb/usb_device_handle.h" 21 #include "device/usb/usb_device_handle.h"
23 #include "device/usb/usb_service.h" 22 #include "device/usb/usb_service.h"
24 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
25 24
26 using content::BrowserThread; 25 using content::BrowserThread;
27 using device::UsbConfigDescriptor; 26 using device::UsbConfigDescriptor;
28 using device::UsbDevice; 27 using device::UsbDevice;
29 using device::UsbDeviceHandle; 28 using device::UsbDeviceHandle;
30 using device::UsbEndpointDescriptor; 29 using device::UsbEndpointDescriptor;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 407
409 config_desc_.interfaces.push_back(interface_desc); 408 config_desc_.interfaces.push_back(interface_desc);
410 } 409 }
411 410
412 void Open(const OpenCallback& callback) override { 411 void Open(const OpenCallback& callback) override {
413 base::ThreadTaskRunnerHandle::Get()->PostTask( 412 base::ThreadTaskRunnerHandle::Get()->PostTask(
414 FROM_HERE, base::Bind(callback, make_scoped_refptr( 413 FROM_HERE, base::Bind(callback, make_scoped_refptr(
415 new MockUsbDeviceHandle<T>(this)))); 414 new MockUsbDeviceHandle<T>(this))));
416 } 415 }
417 416
418 const UsbConfigDescriptor* GetConfiguration() override { 417 const UsbConfigDescriptor* GetActiveConfiguration() override {
419 return T::kConfigured ? &config_desc_ : nullptr; 418 return T::kConfigured ? &config_desc_ : nullptr;
420 } 419 }
421 420
422 bool Close(scoped_refptr<UsbDeviceHandle> handle) override { 421 bool Close(scoped_refptr<UsbDeviceHandle> handle) override {
423 return true; 422 return true;
424 } 423 }
425 424
426 std::set<int> claimed_interfaces_; 425 std::set<int> claimed_interfaces_;
427 426
428 protected: 427 protected:
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 EXPECT_EQ(2, listener.invoked_); 776 EXPECT_EQ(2, listener.invoked_);
778 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); 777 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_);
779 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); 778 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting());
780 } 779 }
781 780
782 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { 781 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) {
783 MockCountListenerForCheckingTraits listener(adb_bridge_); 782 MockCountListenerForCheckingTraits listener(adb_bridge_);
784 adb_bridge_->AddDeviceCountListener(&listener); 783 adb_bridge_->AddDeviceCountListener(&listener);
785 runner_->Run(); 784 runner_->Run();
786 } 785 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698