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

Side by Side Diff: device/test/usb_test_gadget_impl.cc

Issue 2230083003: device: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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/nfc/nfc_tag_technology_chromeos.cc ('k') | device/usb/mojo/device_impl_unittest.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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 }; 86 };
87 87
88 bool ReadFile(const base::FilePath& file_path, std::string* content) { 88 bool ReadFile(const base::FilePath& file_path, std::string* content) {
89 base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ); 89 base::File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ);
90 if (!file.IsValid()) { 90 if (!file.IsValid()) {
91 LOG(ERROR) << "Cannot open " << file_path.MaybeAsASCII() << ": " 91 LOG(ERROR) << "Cannot open " << file_path.MaybeAsASCII() << ": "
92 << base::File::ErrorToString(file.error_details()); 92 << base::File::ErrorToString(file.error_details());
93 return false; 93 return false;
94 } 94 }
95 95
96 STLClearObject(content); 96 base::STLClearObject(content);
97 int rv; 97 int rv;
98 do { 98 do {
99 char buf[4096]; 99 char buf[4096];
100 rv = file.ReadAtCurrentPos(buf, sizeof buf); 100 rv = file.ReadAtCurrentPos(buf, sizeof buf);
101 if (rv == -1) { 101 if (rv == -1) {
102 LOG(ERROR) << "Cannot read " << file_path.MaybeAsASCII() << ": " 102 LOG(ERROR) << "Cannot read " << file_path.MaybeAsASCII() << ": "
103 << base::File::ErrorToString(file.error_details()); 103 << base::File::ErrorToString(file.error_details());
104 return false; 104 return false;
105 } 105 }
106 content->append(buf, rv); 106 content->append(buf, rv);
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 return false; 613 return false;
614 } 614 }
615 615
616 DeviceAddListener add_listener(usb_service_, device_address_, -1); 616 DeviceAddListener add_listener(usb_service_, device_address_, -1);
617 device_ = add_listener.WaitForAdd(); 617 device_ = add_listener.WaitForAdd();
618 DCHECK(device_.get()); 618 DCHECK(device_.get());
619 return true; 619 return true;
620 } 620 }
621 621
622 } // namespace device 622 } // namespace device
OLDNEW
« no previous file with comments | « device/nfc/nfc_tag_technology_chromeos.cc ('k') | device/usb/mojo/device_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698