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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/truncate_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/truncate.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/files/file.h" 13 #include "base/files/file.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" 15 #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h"
16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
17 #include "chrome/common/extensions/api/file_system_provider.h" 17 #include "chrome/common/extensions/api/file_system_provider.h"
18 #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_capabilities/file_sy stem_provider_capabilities_handler.h"
19 #include "chrome/common/extensions/api/file_system_provider_internal.h" 19 #include "chrome/common/extensions/api/file_system_provider_internal.h"
20 #include "extensions/browser/event_router.h" 20 #include "extensions/browser/event_router.h"
21 #include "storage/browser/fileapi/async_file_util.h" 21 #include "storage/browser/fileapi/async_file_util.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 namespace chromeos { 24 namespace chromeos {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 Truncate truncate(NULL, file_system_info_, base::FilePath(kFilePath), 125 Truncate truncate(NULL, file_system_info_, base::FilePath(kFilePath),
126 kTruncateLength, 126 kTruncateLength,
127 base::Bind(&util::LogStatusCallback, &callback_log)); 127 base::Bind(&util::LogStatusCallback, &callback_log));
128 truncate.SetDispatchEventImplForTesting( 128 truncate.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(truncate.Execute(kRequestId)); 132 EXPECT_TRUE(truncate.Execute(kRequestId));
133 133
134 truncate.OnSuccess(kRequestId, 134 truncate.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(FileSystemProviderOperationsTruncateTest, OnError) { 141 TEST_F(FileSystemProviderOperationsTruncateTest, 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 Truncate truncate(NULL, file_system_info_, base::FilePath(kFilePath), 145 Truncate truncate(NULL, file_system_info_, base::FilePath(kFilePath),
146 kTruncateLength, 146 kTruncateLength,
147 base::Bind(&util::LogStatusCallback, &callback_log)); 147 base::Bind(&util::LogStatusCallback, &callback_log));
148 truncate.SetDispatchEventImplForTesting( 148 truncate.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(truncate.Execute(kRequestId)); 152 EXPECT_TRUE(truncate.Execute(kRequestId));
153 153
154 truncate.OnError(kRequestId, 154 truncate.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