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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/move_entry_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/move_entry.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/move_entry.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_capabilities/file_sy stem_provider_capabilities_handler.h" 17 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy stem_provider_capabilities_handler.h"
18 #include "chrome/common/extensions/api/file_system_provider_internal.h" 18 #include "chrome/common/extensions/api/file_system_provider_internal.h"
19 #include "extensions/browser/event_router.h" 19 #include "extensions/browser/event_router.h"
20 #include "storage/browser/fileapi/async_file_util.h" 20 #include "storage/browser/fileapi/async_file_util.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 MoveEntry move_entry(NULL, file_system_info_, base::FilePath(kSourcePath), 125 MoveEntry move_entry(NULL, file_system_info_, base::FilePath(kSourcePath),
126 base::FilePath(kTargetPath), 126 base::FilePath(kTargetPath),
127 base::Bind(&util::LogStatusCallback, &callback_log)); 127 base::Bind(&util::LogStatusCallback, &callback_log));
128 move_entry.SetDispatchEventImplForTesting( 128 move_entry.SetDispatchEventImplForTesting(
129 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 129 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
130 base::Unretained(&dispatcher))); 130 base::Unretained(&dispatcher)));
131 131
132 EXPECT_TRUE(move_entry.Execute(kRequestId)); 132 EXPECT_TRUE(move_entry.Execute(kRequestId));
133 133
134 move_entry.OnSuccess(kRequestId, 134 move_entry.OnSuccess(kRequestId,
135 scoped_ptr<RequestValue>(new RequestValue()), 135 std::unique_ptr<RequestValue>(new RequestValue()),
136 false /* has_more */); 136 false /* has_more */);
137 ASSERT_EQ(1u, callback_log.size()); 137 ASSERT_EQ(1u, callback_log.size());
138 EXPECT_EQ(base::File::FILE_OK, callback_log[0]); 138 EXPECT_EQ(base::File::FILE_OK, callback_log[0]);
139 } 139 }
140 140
141 TEST_F(FileSystemProviderOperationsMoveEntryTest, OnError) { 141 TEST_F(FileSystemProviderOperationsMoveEntryTest, OnError) {
142 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); 142 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
143 util::StatusCallbackLog callback_log; 143 util::StatusCallbackLog callback_log;
144 144
145 MoveEntry move_entry(NULL, file_system_info_, base::FilePath(kSourcePath), 145 MoveEntry move_entry(NULL, file_system_info_, base::FilePath(kSourcePath),
146 base::FilePath(kTargetPath), 146 base::FilePath(kTargetPath),
147 base::Bind(&util::LogStatusCallback, &callback_log)); 147 base::Bind(&util::LogStatusCallback, &callback_log));
148 move_entry.SetDispatchEventImplForTesting( 148 move_entry.SetDispatchEventImplForTesting(
149 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 149 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
150 base::Unretained(&dispatcher))); 150 base::Unretained(&dispatcher)));
151 151
152 EXPECT_TRUE(move_entry.Execute(kRequestId)); 152 EXPECT_TRUE(move_entry.Execute(kRequestId));
153 153
154 move_entry.OnError(kRequestId, 154 move_entry.OnError(kRequestId,
155 scoped_ptr<RequestValue>(new RequestValue()), 155 std::unique_ptr<RequestValue>(new RequestValue()),
156 base::File::FILE_ERROR_TOO_MANY_OPENED); 156 base::File::FILE_ERROR_TOO_MANY_OPENED);
157 ASSERT_EQ(1u, callback_log.size()); 157 ASSERT_EQ(1u, callback_log.size());
158 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 158 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
159 } 159 }
160 160
161 } // namespace operations 161 } // namespace operations
162 } // namespace file_system_provider 162 } // namespace file_system_provider
163 } // namespace chromeos 163 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698