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

Unified Diff: device/hid/hid_service.cc

Issue 690473002: Add API tests for the chrome.hid API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid_service.h ('k') | extensions/browser/api/hid/hid_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_service.cc
diff --git a/device/hid/hid_service.cc b/device/hid/hid_service.cc
index d2ccaa379f0c6fa3a67588a2380b5d2274236303..071b3968bcd7fdcd21079e58c5226695eb84d72a 100644
--- a/device/hid/hid_service.cc
+++ b/device/hid/hid_service.cc
@@ -55,7 +55,7 @@ HidService* HidService::GetInstance(
#elif defined(OS_WIN)
g_service = new HidServiceWin();
#endif
- if (g_service != NULL) {
+ if (g_service != nullptr) {
Destroyer* destroyer = new Destroyer(g_service);
base::MessageLoop::current()->AddDestructionObserver(destroyer);
}
@@ -63,6 +63,13 @@ HidService* HidService::GetInstance(
return g_service;
}
+void HidService::SetInstanceForTest(HidService* instance) {
+ DCHECK(!g_service);
+ g_service = instance;
+ Destroyer* destroyer = new Destroyer(g_service);
+ base::MessageLoop::current()->AddDestructionObserver(destroyer);
+}
+
HidService::~HidService() {
DCHECK(thread_checker_.CalledOnValidThread());
}
« no previous file with comments | « device/hid/hid_service.h ('k') | extensions/browser/api/hid/hid_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698