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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/abort_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/abort.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/abort.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 Abort abort(NULL, 101 Abort abort(NULL,
102 file_system_info_, 102 file_system_info_,
103 kOperationRequestId, 103 kOperationRequestId,
104 base::Bind(&util::LogStatusCallback, &callback_log)); 104 base::Bind(&util::LogStatusCallback, &callback_log));
105 abort.SetDispatchEventImplForTesting( 105 abort.SetDispatchEventImplForTesting(
106 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 106 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
107 base::Unretained(&dispatcher))); 107 base::Unretained(&dispatcher)));
108 108
109 EXPECT_TRUE(abort.Execute(kRequestId)); 109 EXPECT_TRUE(abort.Execute(kRequestId));
110 110
111 abort.OnSuccess(kRequestId, 111 abort.OnSuccess(kRequestId, std::unique_ptr<RequestValue>(new RequestValue()),
112 scoped_ptr<RequestValue>(new RequestValue()),
113 false /* has_more */); 112 false /* has_more */);
114 ASSERT_EQ(1u, callback_log.size()); 113 ASSERT_EQ(1u, callback_log.size());
115 EXPECT_EQ(base::File::FILE_OK, callback_log[0]); 114 EXPECT_EQ(base::File::FILE_OK, callback_log[0]);
116 } 115 }
117 116
118 TEST_F(FileSystemProviderOperationsAbortTest, OnError) { 117 TEST_F(FileSystemProviderOperationsAbortTest, OnError) {
119 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); 118 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
120 util::StatusCallbackLog callback_log; 119 util::StatusCallbackLog callback_log;
121 120
122 Abort abort(NULL, 121 Abort abort(NULL,
123 file_system_info_, 122 file_system_info_,
124 kOperationRequestId, 123 kOperationRequestId,
125 base::Bind(&util::LogStatusCallback, &callback_log)); 124 base::Bind(&util::LogStatusCallback, &callback_log));
126 abort.SetDispatchEventImplForTesting( 125 abort.SetDispatchEventImplForTesting(
127 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 126 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
128 base::Unretained(&dispatcher))); 127 base::Unretained(&dispatcher)));
129 128
130 EXPECT_TRUE(abort.Execute(kRequestId)); 129 EXPECT_TRUE(abort.Execute(kRequestId));
131 130
132 abort.OnError(kRequestId, 131 abort.OnError(kRequestId, std::unique_ptr<RequestValue>(new RequestValue()),
133 scoped_ptr<RequestValue>(new RequestValue()),
134 base::File::FILE_ERROR_TOO_MANY_OPENED); 132 base::File::FILE_ERROR_TOO_MANY_OPENED);
135 ASSERT_EQ(1u, callback_log.size()); 133 ASSERT_EQ(1u, callback_log.size());
136 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 134 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
137 } 135 }
138 136
139 } // namespace operations 137 } // namespace operations
140 } // namespace file_system_provider 138 } // namespace file_system_provider
141 } // namespace chromeos 139 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698