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

Unified Diff: device/usb/mojo/mock_permission_provider.h

Issue 1847183002: Use interface associations to check function permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit and fixed Windows build. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/usb/mojo/fake_permission_provider.cc ('k') | device/usb/mojo/mock_permission_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/mojo/mock_permission_provider.h
diff --git a/device/usb/mojo/mock_permission_provider.h b/device/usb/mojo/mock_permission_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..3e819df0b6947a30c3644857b5d6be4a5e83ba70
--- /dev/null
+++ b/device/usb/mojo/mock_permission_provider.h
@@ -0,0 +1,39 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_USB_MOJO_MOCK_PERMISSION_PROVIDER_H_
+#define DEVICE_USB_MOJO_MOCK_PERMISSION_PROVIDER_H_
+
+#include <stdint.h>
+
+#include "base/memory/weak_ptr.h"
+#include "device/usb/mojo/permission_provider.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace device {
+namespace usb {
+
+class MockPermissionProvider : public PermissionProvider {
+ public:
+ MockPermissionProvider();
+ ~MockPermissionProvider() override;
+
+ base::WeakPtr<PermissionProvider> GetWeakPtr();
+ MOCK_CONST_METHOD1(HasDevicePermission, bool(const DeviceInfo& device_info));
+ MOCK_CONST_METHOD2(HasConfigurationPermission,
+ bool(uint8_t requested_configuration,
+ const DeviceInfo& device_info));
+ MOCK_CONST_METHOD3(HasFunctionPermission,
+ bool(uint8_t requested_function,
+ uint8_t configuration_value,
+ const DeviceInfo& device_info));
+
+ private:
+ base::WeakPtrFactory<PermissionProvider> weak_factory_;
+};
+
+} // namespace usb
+} // namespace device
+
+#endif // DEVICE_USB_MOCK_MOJO_PERMISSION_PROVIDER_H_
« no previous file with comments | « device/usb/mojo/fake_permission_provider.cc ('k') | device/usb/mojo/mock_permission_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698