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

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

Issue 826283002: Add support for sending a USB SET_CONFIGURATION request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/devtools/device/usb/android_usb_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 last_local_socket_(0), 169 last_local_socket_(0),
170 broken_(false) { 170 broken_(false) {
171 } 171 }
172 172
173 virtual scoped_refptr<UsbDevice> GetDevice() const override { 173 virtual scoped_refptr<UsbDevice> GetDevice() const override {
174 return device_; 174 return device_;
175 } 175 }
176 176
177 virtual void Close() override { device_ = nullptr; } 177 virtual void Close() override { device_ = nullptr; }
178 178
179 bool SetConfiguration(int configuration_value) override { return true; }
180
179 bool ClaimInterface(int interface_number) override { 181 bool ClaimInterface(int interface_number) override {
180 if (device_->claimed_interfaces_.find(interface_number) != 182 if (device_->claimed_interfaces_.find(interface_number) !=
181 device_->claimed_interfaces_.end()) 183 device_->claimed_interfaces_.end())
182 return false; 184 return false;
183 185
184 device_->claimed_interfaces_.insert(interface_number); 186 device_->claimed_interfaces_.insert(interface_number);
185 return true; 187 return true;
186 } 188 }
187 189
188 bool ReleaseInterface(int interface_number) override { 190 bool ReleaseInterface(int interface_number) override {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 interface_desc.endpoints.push_back(bulk_in); 466 interface_desc.endpoints.push_back(bulk_in);
465 interface_desc.endpoints.push_back(bulk_out); 467 interface_desc.endpoints.push_back(bulk_out);
466 468
467 config_desc_.interfaces.push_back(interface_desc); 469 config_desc_.interfaces.push_back(interface_desc);
468 } 470 }
469 471
470 virtual scoped_refptr<UsbDeviceHandle> Open() override { 472 virtual scoped_refptr<UsbDeviceHandle> Open() override {
471 return new MockUsbDeviceHandle<T>(this); 473 return new MockUsbDeviceHandle<T>(this);
472 } 474 }
473 475
474 virtual const UsbConfigDescriptor& GetConfiguration() override { 476 virtual const UsbConfigDescriptor* GetConfiguration() override {
475 return config_desc_; 477 return &config_desc_;
476 } 478 }
477 479
478 virtual bool GetManufacturer(base::string16* manufacturer) override { 480 virtual bool GetManufacturer(base::string16* manufacturer) override {
479 *manufacturer = base::UTF8ToUTF16(kDeviceManufacturer); 481 *manufacturer = base::UTF8ToUTF16(kDeviceManufacturer);
480 return true; 482 return true;
481 } 483 }
482 484
483 virtual bool GetProduct(base::string16* product) override { 485 virtual bool GetProduct(base::string16* product) override {
484 *product = base::UTF8ToUTF16(kDeviceModel); 486 *product = base::UTF8ToUTF16(kDeviceModel);
485 return true; 487 return true;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 runner_->Run(); 894 runner_->Run();
893 EXPECT_EQ(2, listener.invoked_); 895 EXPECT_EQ(2, listener.invoked_);
894 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); 896 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_);
895 } 897 }
896 898
897 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { 899 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) {
898 MockCountListenerForCheckingTraits listener(adb_bridge_); 900 MockCountListenerForCheckingTraits listener(adb_bridge_);
899 adb_bridge_->AddDeviceCountListener(&listener); 901 adb_bridge_->AddDeviceCountListener(&listener);
900 runner_->Run(); 902 runner_->Run();
901 } 903 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/devtools/device/usb/android_usb_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698