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

Side by Side Diff: chrome/browser/extensions/api/device_permissions_manager_unittest.cc

Issue 1034333002: Check USB device path access when prompting users to select a device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move MockPermissionBrokerClient into its own header. Created 5 years, 8 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 | « chrome/browser/devtools/device/usb/android_usb_device.cc ('k') | chromeos/BUILD.gn » ('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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "base/test/values_test_util.h" 7 #include "base/test/values_test_util.h"
8 #include "chrome/browser/extensions/test_extension_environment.h" 8 #include "chrome/browser/extensions/test_extension_environment.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "device/core/device_client.h" 10 #include "device/core/device_client.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 EXPECT_CALL(*this, GetProduct(_)) 73 EXPECT_CALL(*this, GetProduct(_))
74 .WillRepeatedly( 74 .WillRepeatedly(
75 DoAll(SetArgPointee<0>(base::ASCIIToUTF16("Test Product")), 75 DoAll(SetArgPointee<0>(base::ASCIIToUTF16("Test Product")),
76 Return(true))); 76 Return(true)));
77 EXPECT_CALL(*this, GetManufacturer(_)) 77 EXPECT_CALL(*this, GetManufacturer(_))
78 .WillRepeatedly( 78 .WillRepeatedly(
79 DoAll(SetArgPointee<0>(base::ASCIIToUTF16("Test Manufacturer")), 79 DoAll(SetArgPointee<0>(base::ASCIIToUTF16("Test Manufacturer")),
80 Return(true))); 80 Return(true)));
81 } 81 }
82 82
83 MOCK_METHOD2(RequestUsbAccess, void(int, const base::Callback<void(bool)>&));
84 MOCK_METHOD0(Open, scoped_refptr<UsbDeviceHandle>()); 83 MOCK_METHOD0(Open, scoped_refptr<UsbDeviceHandle>());
85 MOCK_METHOD1(Close, bool(scoped_refptr<UsbDeviceHandle>)); 84 MOCK_METHOD1(Close, bool(scoped_refptr<UsbDeviceHandle>));
86 MOCK_METHOD0(GetConfiguration, const device::UsbConfigDescriptor*()); 85 MOCK_METHOD0(GetConfiguration, const device::UsbConfigDescriptor*());
87 MOCK_METHOD1(GetManufacturer, bool(base::string16*)); 86 MOCK_METHOD1(GetManufacturer, bool(base::string16*));
88 MOCK_METHOD1(GetProduct, bool(base::string16*)); 87 MOCK_METHOD1(GetProduct, bool(base::string16*));
89 MOCK_METHOD1(GetSerialNumber, bool(base::string16*)); 88 MOCK_METHOD1(GetSerialNumber, bool(base::string16*));
90 89
91 private: 90 private:
92 virtual ~MockUsbDevice() {} 91 virtual ~MockUsbDevice() {}
93 }; 92 };
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 DevicePermissionsManager::Get(env_.profile()); 322 DevicePermissionsManager::Get(env_.profile());
324 scoped_ptr<DevicePermissions> device_permissions = 323 scoped_ptr<DevicePermissions> device_permissions =
325 manager->GetForExtension(extension_->id()); 324 manager->GetForExtension(extension_->id());
326 ASSERT_TRUE(FindEntry(device_permissions.get(), device0_).get()); 325 ASSERT_TRUE(FindEntry(device_permissions.get(), device0_).get());
327 ASSERT_FALSE(FindEntry(device_permissions.get(), device1_).get()); 326 ASSERT_FALSE(FindEntry(device_permissions.get(), device1_).get());
328 ASSERT_FALSE(FindEntry(device_permissions.get(), device2_).get()); 327 ASSERT_FALSE(FindEntry(device_permissions.get(), device2_).get());
329 ASSERT_FALSE(FindEntry(device_permissions.get(), device3_).get()); 328 ASSERT_FALSE(FindEntry(device_permissions.get(), device3_).get());
330 } 329 }
331 330
332 } // namespace extensions 331 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/devtools/device/usb/android_usb_device.cc ('k') | chromeos/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698