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

Side by Side Diff: chromeos/binder/test_service.cc

Issue 2318023002: //chrome/browser/chromeos: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Address comment and also remove non-trivial cases Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chromeos/binder/test_service.h" 5 #include "chromeos/binder/test_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 new binder::WritableTransactionData()); 42 new binder::WritableTransactionData());
43 reply->WriteInt32(arg + 1); 43 reply->WriteInt32(arg + 1);
44 return std::move(reply); 44 return std::move(reply);
45 } 45 }
46 case GET_FD_TRANSACTION: { 46 case GET_FD_TRANSACTION: {
47 // Prepare a file. 47 // Prepare a file.
48 std::string data = GetFileContents(); 48 std::string data = GetFileContents();
49 base::ScopedTempDir temp_dir; 49 base::ScopedTempDir temp_dir;
50 base::FilePath path; 50 base::FilePath path;
51 if (!temp_dir.CreateUniqueTempDir() || 51 if (!temp_dir.CreateUniqueTempDir() ||
52 !base::CreateTemporaryFileInDir(temp_dir.path(), &path) || 52 !base::CreateTemporaryFileInDir(temp_dir.GetPath(), &path) ||
53 !base::WriteFile(path, data.data(), data.size())) { 53 !base::WriteFile(path, data.data(), data.size())) {
54 LOG(ERROR) << "Failed to create a file"; 54 LOG(ERROR) << "Failed to create a file";
55 return std::unique_ptr<TransactionData>(); 55 return std::unique_ptr<TransactionData>();
56 } 56 }
57 // Open the file. 57 // Open the file.
58 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); 58 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
59 if (!file.IsValid()) { 59 if (!file.IsValid()) {
60 LOG(ERROR) << "Failed to open the file."; 60 LOG(ERROR) << "Failed to open the file.";
61 return std::unique_ptr<TransactionData>(); 61 return std::unique_ptr<TransactionData>();
62 } 62 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 void TestService::Initialize(bool* result) { 129 void TestService::Initialize(bool* result) {
130 // Add service. 130 // Add service.
131 scoped_refptr<LocalObject> object( 131 scoped_refptr<LocalObject> object(
132 new LocalObject(base::WrapUnique(new TestObject))); 132 new LocalObject(base::WrapUnique(new TestObject)));
133 *result = ServiceManagerProxy::AddService(main_thread_.command_broker(), 133 *result = ServiceManagerProxy::AddService(main_thread_.command_broker(),
134 service_name_, object, 0); 134 service_name_, object, 0);
135 } 135 }
136 136
137 } // namespace binder 137 } // namespace binder
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698