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

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 chromeos related code again 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"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 config_desc_.interfaces.push_back(interface_desc); 409 config_desc_.interfaces.push_back(interface_desc);
410 } 410 }
411 411
412 void Open(const OpenCallback& callback) override { 412 void Open(const OpenCallback& callback) override {
413 base::ThreadTaskRunnerHandle::Get()->PostTask( 413 base::ThreadTaskRunnerHandle::Get()->PostTask(
414 FROM_HERE, base::Bind(callback, make_scoped_refptr( 414 FROM_HERE, base::Bind(callback, make_scoped_refptr(
415 new MockUsbDeviceHandle<T>(this)))); 415 new MockUsbDeviceHandle<T>(this))));
416 } 416 }
417 417
418 const UsbConfigDescriptor* GetConfiguration() override { 418 const UsbConfigDescriptor* GetCurrentConfiguration() override {
419 return T::kConfigured ? &config_desc_ : nullptr; 419 return T::kConfigured ? &config_desc_ : nullptr;
420 } 420 }
421 421
422 const std::vector<UsbConfigDescriptor>& configurations() const override {
423 return configurations_;
424 }
425
422 bool Close(scoped_refptr<UsbDeviceHandle> handle) override { 426 bool Close(scoped_refptr<UsbDeviceHandle> handle) override {
423 return true; 427 return true;
424 } 428 }
425 429
426 std::set<int> claimed_interfaces_; 430 std::set<int> claimed_interfaces_;
427 431
428 protected: 432 protected:
429 virtual ~MockUsbDevice() {} 433 virtual ~MockUsbDevice() {}
430 434
431 private: 435 private:
432 UsbConfigDescriptor config_desc_; 436 UsbConfigDescriptor config_desc_;
437 std::vector<UsbConfigDescriptor> configurations_;
433 }; 438 };
434 439
435 class MockUsbService : public UsbService { 440 class MockUsbService : public UsbService {
436 public: 441 public:
437 MockUsbService() { 442 MockUsbService() {
438 devices_.push_back(new MockUsbDevice<AndroidTraits>()); 443 devices_.push_back(new MockUsbDevice<AndroidTraits>());
439 } 444 }
440 445
441 scoped_refptr<UsbDevice> GetDevice(const std::string& guid) override { 446 scoped_refptr<UsbDevice> GetDevice(const std::string& guid) override {
442 NOTIMPLEMENTED(); 447 NOTIMPLEMENTED();
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 EXPECT_EQ(2, listener.invoked_); 782 EXPECT_EQ(2, listener.invoked_);
778 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); 783 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_);
779 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); 784 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting());
780 } 785 }
781 786
782 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { 787 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) {
783 MockCountListenerForCheckingTraits listener(adb_bridge_); 788 MockCountListenerForCheckingTraits listener(adb_bridge_);
784 adb_bridge_->AddDeviceCountListener(&listener); 789 adb_bridge_->AddDeviceCountListener(&listener);
785 runner_->Run(); 790 runner_->Run();
786 } 791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698