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

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

Issue 664983002: [gcc 4.x] Fix the build failure due to -Werror=char-subscripts (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 TestConnectCallback connect_callback; 156 TestConnectCallback connect_callback;
157 service_->Connect(device_id_, connect_callback.callback()); 157 service_->Connect(device_id_, connect_callback.callback());
158 scoped_refptr<HidConnection> conn = connect_callback.WaitForConnection(); 158 scoped_refptr<HidConnection> conn = connect_callback.WaitForConnection();
159 ASSERT_TRUE(conn.get()); 159 ASSERT_TRUE(conn.get());
160 160
161 const char kBufferSize = 9; 161 const char kBufferSize = 9;
162 for (char i = 0; i < 8; ++i) { 162 for (char i = 0; i < 8; ++i) {
163 scoped_refptr<IOBufferWithSize> buffer(new IOBufferWithSize(kBufferSize)); 163 scoped_refptr<IOBufferWithSize> buffer(new IOBufferWithSize(kBufferSize));
164 buffer->data()[0] = 0; 164 buffer->data()[0] = 0;
165 for (char j = 1; j < kBufferSize; ++j) { 165 for (unsigned char j = 1; j < kBufferSize; ++j) {
166 buffer->data()[j] = i + j - 1; 166 buffer->data()[j] = i + j - 1;
167 } 167 }
168 168
169 TestIoCallback write_callback; 169 TestIoCallback write_callback;
170 conn->Write(buffer, buffer->size(), write_callback.write_callback()); 170 conn->Write(buffer, buffer->size(), write_callback.write_callback());
171 ASSERT_TRUE(write_callback.WaitForResult()); 171 ASSERT_TRUE(write_callback.WaitForResult());
172 172
173 TestIoCallback read_callback; 173 TestIoCallback read_callback;
174 conn->Read(read_callback.read_callback()); 174 conn->Read(read_callback.read_callback());
175 ASSERT_TRUE(read_callback.WaitForResult()); 175 ASSERT_TRUE(read_callback.WaitForResult());
176 ASSERT_EQ(9UL, read_callback.size()); 176 ASSERT_EQ(9UL, read_callback.size());
177 ASSERT_EQ(0, read_callback.buffer()->data()[0]); 177 ASSERT_EQ(0, read_callback.buffer()->data()[0]);
178 for (char j = 1; j < kBufferSize; ++j) { 178 for (unsigned char j = 1; j < kBufferSize; ++j) {
179 ASSERT_EQ(i + j - 1, read_callback.buffer()->data()[j]); 179 ASSERT_EQ(i + j - 1, read_callback.buffer()->data()[j]);
180 } 180 }
181 } 181 }
182 182
183 conn->Close(); 183 conn->Close();
184 } 184 }
185 185
186 } // namespace device 186 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698