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

Side by Side Diff: extensions/browser/api/hid/hid_apitest.cc

Issue 800963005: Add browser tests for USB device add/remove events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjusted JavaScript style. Created 5 years, 11 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 | « device/usb/usb_service_impl.cc ('k') | extensions/browser/api/usb/usb_apitest.cc » ('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/bind.h" 5 #include "base/bind.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "device/hid/hid_collection_info.h" 8 #include "device/hid/hid_collection_info.h"
9 #include "device/hid/hid_connection.h" 9 #include "device/hid/hid_connection.h"
10 #include "device/hid/hid_device_info.h" 10 #include "device/hid/hid_device_info.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 IN_PROC_BROWSER_TEST_F(HidApiTest, OnDeviceRemoved) { 199 IN_PROC_BROWSER_TEST_F(HidApiTest, OnDeviceRemoved) {
200 ExtensionTestMessageListener load_listener("loaded", false); 200 ExtensionTestMessageListener load_listener("loaded", false);
201 ExtensionTestMessageListener result_listener("success", false); 201 ExtensionTestMessageListener result_listener("success", false);
202 result_listener.set_failure_message("failure"); 202 result_listener.set_failure_message("failure");
203 203
204 ASSERT_TRUE(LoadApp("api_test/hid/remove_event")); 204 ASSERT_TRUE(LoadApp("api_test/hid/remove_event"));
205 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); 205 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
206 206
207 // Device C was not returned by chrome.usb.getDevices, the app will not get 207 // Device C was not returned by chrome.hid.getDevices, the app will not get
208 // a notification. 208 // a notification.
209 hid_service_->RemoveDevice("C"); 209 hid_service_->RemoveDevice("C");
210 // Device A was returned, the app will get a notification. 210 // Device A was returned, the app will get a notification.
211 hid_service_->RemoveDevice("A"); 211 hid_service_->RemoveDevice("A");
212 ASSERT_TRUE(result_listener.WaitUntilSatisfied()); 212 ASSERT_TRUE(result_listener.WaitUntilSatisfied());
213 EXPECT_EQ("success", result_listener.message()); 213 EXPECT_EQ("success", result_listener.message());
214 } 214 }
215 215
216 } // namespace extensions 216 } // namespace extensions
OLDNEW
« no previous file with comments | « device/usb/usb_service_impl.cc ('k') | extensions/browser/api/usb/usb_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698