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

Side by Side Diff: chrome/browser/extensions/api/usb/usb_api.h

Issue 10824298: Adding tests for USB extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/extensions/api/api_function.h" 10 #include "chrome/browser/extensions/api/api_function.h"
11 #include "chrome/browser/extensions/api/api_resource_manager.h" 11 #include "chrome/browser/extensions/api/api_resource_manager.h"
12 #include "chrome/common/extensions/api/experimental_usb.h" 12 #include "chrome/common/extensions/api/experimental_usb.h"
13 13
14 class UsbDevice;
15
14 namespace extensions { 16 namespace extensions {
15 17
16 class ApiResourceEventNotifier; 18 class ApiResourceEventNotifier;
17 class UsbDeviceResource; 19 class UsbDeviceResource;
18 20
19 class UsbAsyncApiFunction : public AsyncApiFunction { 21 class UsbAsyncApiFunction : public AsyncApiFunction {
20 public: 22 public:
21 UsbAsyncApiFunction(); 23 UsbAsyncApiFunction();
22 24
23 protected: 25 protected:
24 virtual ~UsbAsyncApiFunction(); 26 virtual ~UsbAsyncApiFunction();
25 27
26 virtual bool PrePrepare() OVERRIDE; 28 virtual bool PrePrepare() OVERRIDE;
27 29
28 ApiResourceManager<UsbDeviceResource>* manager_; 30 ApiResourceManager<UsbDeviceResource>* manager_;
29 }; 31 };
30 32
31 class UsbFindDeviceFunction : public UsbAsyncApiFunction { 33 class UsbFindDeviceFunction : public UsbAsyncApiFunction {
32 public: 34 public:
33 DECLARE_EXTENSION_FUNCTION_NAME("experimental.usb.findDevice"); 35 DECLARE_EXTENSION_FUNCTION_NAME("experimental.usb.findDevice");
34 36
35 UsbFindDeviceFunction(); 37 UsbFindDeviceFunction();
36 38
39 static void SetDeviceForTest(UsbDevice* device);
40
37 protected: 41 protected:
38 virtual ~UsbFindDeviceFunction(); 42 virtual ~UsbFindDeviceFunction();
39 virtual bool Prepare() OVERRIDE; 43 virtual bool Prepare() OVERRIDE;
40 virtual void Work() OVERRIDE; 44 virtual void Work() OVERRIDE;
41 virtual bool Respond() OVERRIDE; 45 virtual bool Respond() OVERRIDE;
42 46
43 private: 47 private:
48 static UsbDevice* device_for_test_;
asargent_no_longer_on_chrome 2012/08/14 22:31:06 nit: can this just be declared/defined in the .cc
49
44 scoped_ptr<extensions::api::experimental_usb::FindDevice::Params> parameters_; 50 scoped_ptr<extensions::api::experimental_usb::FindDevice::Params> parameters_;
45 ApiResourceEventNotifier* event_notifier_; 51 ApiResourceEventNotifier* event_notifier_;
46 }; 52 };
47 53
48 class UsbCloseDeviceFunction : public UsbAsyncApiFunction { 54 class UsbCloseDeviceFunction : public UsbAsyncApiFunction {
49 public: 55 public:
50 DECLARE_EXTENSION_FUNCTION_NAME("experimental.usb.closeDevice"); 56 DECLARE_EXTENSION_FUNCTION_NAME("experimental.usb.closeDevice");
51 57
52 UsbCloseDeviceFunction(); 58 UsbCloseDeviceFunction();
53 59
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 virtual bool Respond() OVERRIDE; 132 virtual bool Respond() OVERRIDE;
127 133
128 private: 134 private:
129 scoped_ptr<extensions::api::experimental_usb::IsochronousTransfer::Params> 135 scoped_ptr<extensions::api::experimental_usb::IsochronousTransfer::Params>
130 parameters_; 136 parameters_;
131 }; 137 };
132 138
133 } // namespace extensions 139 } // namespace extensions
134 140
135 #endif // CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ 141 #endif // CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/usb/usb_api.cc » ('j') | chrome/browser/extensions/api/usb/usb_api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698