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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/create_directory_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: rebase 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_directo ry.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo ry.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 NULL, file_system_info_, base::FilePath(kDirectoryPath), 127 NULL, file_system_info_, base::FilePath(kDirectoryPath),
128 true /* recursive */, 128 true /* recursive */,
129 base::Bind(&util::LogStatusCallback, &callback_log)); 129 base::Bind(&util::LogStatusCallback, &callback_log));
130 create_directory.SetDispatchEventImplForTesting( 130 create_directory.SetDispatchEventImplForTesting(
131 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 131 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
132 base::Unretained(&dispatcher))); 132 base::Unretained(&dispatcher)));
133 133
134 EXPECT_TRUE(create_directory.Execute(kRequestId)); 134 EXPECT_TRUE(create_directory.Execute(kRequestId));
135 135
136 create_directory.OnSuccess(kRequestId, 136 create_directory.OnSuccess(kRequestId,
137 scoped_ptr<RequestValue>(new RequestValue()), 137 std::unique_ptr<RequestValue>(new RequestValue()),
138 false /* has_more */); 138 false /* has_more */);
139 ASSERT_EQ(1u, callback_log.size()); 139 ASSERT_EQ(1u, callback_log.size());
140 EXPECT_EQ(base::File::FILE_OK, callback_log[0]); 140 EXPECT_EQ(base::File::FILE_OK, callback_log[0]);
141 } 141 }
142 142
143 TEST_F(FileSystemProviderOperationsCreateDirectoryTest, OnError) { 143 TEST_F(FileSystemProviderOperationsCreateDirectoryTest, OnError) {
144 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); 144 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
145 util::StatusCallbackLog callback_log; 145 util::StatusCallbackLog callback_log;
146 146
147 CreateDirectory create_directory( 147 CreateDirectory create_directory(
148 NULL, file_system_info_, base::FilePath(kDirectoryPath), 148 NULL, file_system_info_, base::FilePath(kDirectoryPath),
149 true /* recursive */, 149 true /* recursive */,
150 base::Bind(&util::LogStatusCallback, &callback_log)); 150 base::Bind(&util::LogStatusCallback, &callback_log));
151 create_directory.SetDispatchEventImplForTesting( 151 create_directory.SetDispatchEventImplForTesting(
152 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 152 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
153 base::Unretained(&dispatcher))); 153 base::Unretained(&dispatcher)));
154 154
155 EXPECT_TRUE(create_directory.Execute(kRequestId)); 155 EXPECT_TRUE(create_directory.Execute(kRequestId));
156 156
157 create_directory.OnError(kRequestId, 157 create_directory.OnError(kRequestId,
158 scoped_ptr<RequestValue>(new RequestValue()), 158 std::unique_ptr<RequestValue>(new RequestValue()),
159 base::File::FILE_ERROR_TOO_MANY_OPENED); 159 base::File::FILE_ERROR_TOO_MANY_OPENED);
160 ASSERT_EQ(1u, callback_log.size()); 160 ASSERT_EQ(1u, callback_log.size());
161 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 161 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
162 } 162 }
163 163
164 } // namespace operations 164 } // namespace operations
165 } // namespace file_system_provider 165 } // namespace file_system_provider
166 } // namespace chromeos 166 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698