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

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

Issue 1369643002: Add configuration and interface permission checks to DeviceImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new method ot Android USB mocks. Created 5 years, 2 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 broken_ ? device::USB_TRANSFER_ERROR : device::USB_TRANSFER_COMPLETED; 216 broken_ ? device::USB_TRANSFER_ERROR : device::USB_TRANSFER_COMPLETED;
217 base::ThreadTaskRunnerHandle::Get()->PostTask( 217 base::ThreadTaskRunnerHandle::Get()->PostTask(
218 FROM_HERE, base::Bind(callback, status, nullptr, 0)); 218 FROM_HERE, base::Bind(callback, status, nullptr, 0));
219 ProcessQueries(); 219 ProcessQueries();
220 } else if (direction == device::USB_DIRECTION_INBOUND) { 220 } else if (direction == device::USB_DIRECTION_INBOUND) {
221 queries_.push(Query(callback, buffer, length)); 221 queries_.push(Query(callback, buffer, length));
222 ProcessQueries(); 222 ProcessQueries();
223 } 223 }
224 } 224 }
225 225
226 bool FindInterfaceByEndpoint(uint8_t endpoint_address,
227 uint8_t* interface_number) {
228 NOTIMPLEMENTED();
229 return false;
230 }
231
226 template <class D> 232 template <class D>
227 void append(D data) { 233 void append(D data) {
228 std::copy(reinterpret_cast<char*>(&data), 234 std::copy(reinterpret_cast<char*>(&data),
229 (reinterpret_cast<char*>(&data)) + sizeof(D), 235 (reinterpret_cast<char*>(&data)) + sizeof(D),
230 std::back_inserter(output_buffer_)); 236 std::back_inserter(output_buffer_));
231 } 237 }
232 238
233 // Copied from AndroidUsbDevice::Checksum 239 // Copied from AndroidUsbDevice::Checksum
234 uint32 Checksum(const std::string& data) { 240 uint32 Checksum(const std::string& data) {
235 unsigned char* x = (unsigned char*)data.data(); 241 unsigned char* x = (unsigned char*)data.data();
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 EXPECT_EQ(2, listener.invoked_); 796 EXPECT_EQ(2, listener.invoked_);
791 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); 797 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_);
792 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); 798 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting());
793 } 799 }
794 800
795 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { 801 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) {
796 MockCountListenerForCheckingTraits listener(adb_bridge_); 802 MockCountListenerForCheckingTraits listener(adb_bridge_);
797 adb_bridge_->AddDeviceCountListener(&listener); 803 adb_bridge_->AddDeviceCountListener(&listener);
798 runner_->Run(); 804 runner_->Run();
799 } 805 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/usb/web_usb_permission_provider.h » ('j') | chrome/browser/usb/web_usb_permission_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698