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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/execute_action_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 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 "chrome/browser/chromeos/file_system_provider/operations/execute_action .h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/execute_action .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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ExecuteAction execute_action( 112 ExecuteAction execute_action(
113 NULL, file_system_info_, entry_paths_, kActionId, 113 NULL, file_system_info_, entry_paths_, kActionId,
114 base::Bind(&util::LogStatusCallback, &callback_log)); 114 base::Bind(&util::LogStatusCallback, &callback_log));
115 execute_action.SetDispatchEventImplForTesting( 115 execute_action.SetDispatchEventImplForTesting(
116 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 116 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
117 base::Unretained(&dispatcher))); 117 base::Unretained(&dispatcher)));
118 118
119 EXPECT_TRUE(execute_action.Execute(kRequestId)); 119 EXPECT_TRUE(execute_action.Execute(kRequestId));
120 120
121 execute_action.OnSuccess(kRequestId, 121 execute_action.OnSuccess(kRequestId,
122 scoped_ptr<RequestValue>(new RequestValue()), 122 std::unique_ptr<RequestValue>(new RequestValue()),
123 false /* has_more */); 123 false /* has_more */);
124 ASSERT_EQ(1u, callback_log.size()); 124 ASSERT_EQ(1u, callback_log.size());
125 EXPECT_EQ(base::File::FILE_OK, callback_log[0]); 125 EXPECT_EQ(base::File::FILE_OK, callback_log[0]);
126 } 126 }
127 127
128 TEST_F(FileSystemProviderOperationsExecuteActionTest, OnError) { 128 TEST_F(FileSystemProviderOperationsExecuteActionTest, OnError) {
129 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); 129 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
130 util::StatusCallbackLog callback_log; 130 util::StatusCallbackLog callback_log;
131 131
132 ExecuteAction execute_action( 132 ExecuteAction execute_action(
133 NULL, file_system_info_, entry_paths_, kActionId, 133 NULL, file_system_info_, entry_paths_, kActionId,
134 base::Bind(&util::LogStatusCallback, &callback_log)); 134 base::Bind(&util::LogStatusCallback, &callback_log));
135 execute_action.SetDispatchEventImplForTesting( 135 execute_action.SetDispatchEventImplForTesting(
136 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 136 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
137 base::Unretained(&dispatcher))); 137 base::Unretained(&dispatcher)));
138 138
139 EXPECT_TRUE(execute_action.Execute(kRequestId)); 139 EXPECT_TRUE(execute_action.Execute(kRequestId));
140 140
141 execute_action.OnError(kRequestId, 141 execute_action.OnError(kRequestId,
142 scoped_ptr<RequestValue>(new RequestValue()), 142 std::unique_ptr<RequestValue>(new RequestValue()),
143 base::File::FILE_ERROR_TOO_MANY_OPENED); 143 base::File::FILE_ERROR_TOO_MANY_OPENED);
144 ASSERT_EQ(1u, callback_log.size()); 144 ASSERT_EQ(1u, callback_log.size());
145 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 145 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
146 } 146 }
147 147
148 } // namespace operations 148 } // namespace operations
149 } // namespace file_system_provider 149 } // namespace file_system_provider
150 } // namespace chromeos 150 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698