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

Side by Side Diff: device/hid/hid_connection_unittest.cc

Issue 771393002: Migrate HidServiceLinux and HidConnectionLinux to BrowserThread::UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switched to an embedded thread checker. Created 6 years 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/hid/hid_connection_linux.cc ('k') | device/hid/hid_device_info.h » ('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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 }; 91 };
92 92
93 } // namespace 93 } // namespace
94 94
95 class HidConnectionTest : public testing::Test { 95 class HidConnectionTest : public testing::Test {
96 protected: 96 protected:
97 void SetUp() override { 97 void SetUp() override {
98 if (!UsbTestGadget::IsTestEnabled()) return; 98 if (!UsbTestGadget::IsTestEnabled()) return;
99 99
100 message_loop_.reset(new base::MessageLoopForIO()); 100 message_loop_.reset(new base::MessageLoopForIO());
101 service_ = HidService::GetInstance( 101 service_ = HidService::GetInstance(message_loop_->message_loop_proxy());
102 message_loop_->message_loop_proxy(),
103 message_loop_->message_loop_proxy());
104 ASSERT_TRUE(service_); 102 ASSERT_TRUE(service_);
105 103
106 test_gadget_ = UsbTestGadget::Claim(); 104 test_gadget_ = UsbTestGadget::Claim();
107 ASSERT_TRUE(test_gadget_); 105 ASSERT_TRUE(test_gadget_);
108 ASSERT_TRUE(test_gadget_->SetType(UsbTestGadget::HID_ECHO)); 106 ASSERT_TRUE(test_gadget_->SetType(UsbTestGadget::HID_ECHO));
109 107
110 device_id_ = kInvalidHidDeviceId; 108 device_id_ = kInvalidHidDeviceId;
111 109
112 base::RunLoop run_loop; 110 base::RunLoop run_loop;
113 message_loop_->PostDelayedTask( 111 message_loop_->PostDelayedTask(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ASSERT_EQ(0, read_callback.buffer()->data()[0]); 175 ASSERT_EQ(0, read_callback.buffer()->data()[0]);
178 for (unsigned char j = 1; j < kBufferSize; ++j) { 176 for (unsigned char j = 1; j < kBufferSize; ++j) {
179 ASSERT_EQ(i + j - 1, read_callback.buffer()->data()[j]); 177 ASSERT_EQ(i + j - 1, read_callback.buffer()->data()[j]);
180 } 178 }
181 } 179 }
182 180
183 conn->Close(); 181 conn->Close();
184 } 182 }
185 183
186 } // namespace device 184 } // namespace device
OLDNEW
« no previous file with comments | « device/hid/hid_connection_linux.cc ('k') | device/hid/hid_device_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698