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

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: 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
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 191
192 IN_PROC_BROWSER_TEST_F(HidApiTest, OnDeviceRemoved) { 192 IN_PROC_BROWSER_TEST_F(HidApiTest, OnDeviceRemoved) {
193 ExtensionTestMessageListener load_listener("loaded", false); 193 ExtensionTestMessageListener load_listener("loaded", false);
194 ExtensionTestMessageListener result_listener("success", false); 194 ExtensionTestMessageListener result_listener("success", false);
195 result_listener.set_failure_message("failure"); 195 result_listener.set_failure_message("failure");
196 196
197 ASSERT_TRUE(LoadApp("api_test/hid/remove_event")); 197 ASSERT_TRUE(LoadApp("api_test/hid/remove_event"));
198 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); 198 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
199 199
200 // Device C was not returned by chrome.usb.getDevices, the app will not get 200 // Device C was not returned by chrome.hid.getDevices, the app will not get
201 // a notification. 201 // a notification.
202 hid_service_->RemoveDevice("C"); 202 hid_service_->RemoveDevice("C");
203 // Device A was returned, the app will get a notification. 203 // Device A was returned, the app will get a notification.
204 hid_service_->RemoveDevice("A"); 204 hid_service_->RemoveDevice("A");
205 ASSERT_TRUE(result_listener.WaitUntilSatisfied()); 205 ASSERT_TRUE(result_listener.WaitUntilSatisfied());
206 EXPECT_EQ("success", result_listener.message()); 206 EXPECT_EQ("success", result_listener.message());
207 } 207 }
208 208
209 } // namespace extensions 209 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698