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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/create_file_unittest.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iwyu fixes Created 4 years, 8 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 "chrome/browser/chromeos/file_system_provider/operations/create_file.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/create_file.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/files/file.h" 11 #include "base/files/file.h"
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" 13 #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h"
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
15 #include "chrome/common/extensions/api/file_system_provider.h" 15 #include "chrome/common/extensions/api/file_system_provider.h"
16 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy stem_provider_capabilities_handler.h" 16 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy stem_provider_capabilities_handler.h"
17 #include "chrome/common/extensions/api/file_system_provider_internal.h" 17 #include "chrome/common/extensions/api/file_system_provider_internal.h"
18 #include "extensions/browser/event_router.h" 18 #include "extensions/browser/event_router.h"
19 #include "storage/browser/fileapi/async_file_util.h" 19 #include "storage/browser/fileapi/async_file_util.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 namespace chromeos { 22 namespace chromeos {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 CreateFile create_file(NULL, file_system_info_, base::FilePath(kFilePath), 120 CreateFile create_file(NULL, file_system_info_, base::FilePath(kFilePath),
121 base::Bind(&util::LogStatusCallback, &callback_log)); 121 base::Bind(&util::LogStatusCallback, &callback_log));
122 create_file.SetDispatchEventImplForTesting( 122 create_file.SetDispatchEventImplForTesting(
123 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 123 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
124 base::Unretained(&dispatcher))); 124 base::Unretained(&dispatcher)));
125 125
126 EXPECT_TRUE(create_file.Execute(kRequestId)); 126 EXPECT_TRUE(create_file.Execute(kRequestId));
127 127
128 create_file.OnSuccess(kRequestId, 128 create_file.OnSuccess(kRequestId,
129 scoped_ptr<RequestValue>(new RequestValue()), 129 std::unique_ptr<RequestValue>(new RequestValue()),
130 false /* has_more */); 130 false /* has_more */);
131 ASSERT_EQ(1u, callback_log.size()); 131 ASSERT_EQ(1u, callback_log.size());
132 EXPECT_EQ(base::File::FILE_OK, callback_log[0]); 132 EXPECT_EQ(base::File::FILE_OK, callback_log[0]);
133 } 133 }
134 134
135 TEST_F(FileSystemProviderOperationsCreateFileTest, OnError) { 135 TEST_F(FileSystemProviderOperationsCreateFileTest, OnError) {
136 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); 136 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
137 util::StatusCallbackLog callback_log; 137 util::StatusCallbackLog callback_log;
138 138
139 CreateFile create_file(NULL, file_system_info_, base::FilePath(kFilePath), 139 CreateFile create_file(NULL, file_system_info_, base::FilePath(kFilePath),
140 base::Bind(&util::LogStatusCallback, &callback_log)); 140 base::Bind(&util::LogStatusCallback, &callback_log));
141 create_file.SetDispatchEventImplForTesting( 141 create_file.SetDispatchEventImplForTesting(
142 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 142 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
143 base::Unretained(&dispatcher))); 143 base::Unretained(&dispatcher)));
144 144
145 EXPECT_TRUE(create_file.Execute(kRequestId)); 145 EXPECT_TRUE(create_file.Execute(kRequestId));
146 146
147 create_file.OnError(kRequestId, 147 create_file.OnError(kRequestId,
148 scoped_ptr<RequestValue>(new RequestValue()), 148 std::unique_ptr<RequestValue>(new RequestValue()),
149 base::File::FILE_ERROR_TOO_MANY_OPENED); 149 base::File::FILE_ERROR_TOO_MANY_OPENED);
150 ASSERT_EQ(1u, callback_log.size()); 150 ASSERT_EQ(1u, callback_log.size());
151 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 151 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
152 } 152 }
153 153
154 } // namespace operations 154 } // namespace operations
155 } // namespace file_system_provider 155 } // namespace file_system_provider
156 } // namespace chromeos 156 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698