| OLD | NEW |
| 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/unmount.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/unmount.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 "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 namespace file_system_provider { | 22 namespace file_system_provider { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 Unmount unmount(NULL, | 100 Unmount unmount(NULL, |
| 101 file_system_info_, | 101 file_system_info_, |
| 102 base::Bind(&util::LogStatusCallback, &callback_log)); | 102 base::Bind(&util::LogStatusCallback, &callback_log)); |
| 103 unmount.SetDispatchEventImplForTesting( | 103 unmount.SetDispatchEventImplForTesting( |
| 104 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, | 104 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, |
| 105 base::Unretained(&dispatcher))); | 105 base::Unretained(&dispatcher))); |
| 106 | 106 |
| 107 EXPECT_TRUE(unmount.Execute(kRequestId)); | 107 EXPECT_TRUE(unmount.Execute(kRequestId)); |
| 108 | 108 |
| 109 unmount.OnSuccess(kRequestId, | 109 unmount.OnSuccess(kRequestId, |
| 110 scoped_ptr<RequestValue>(new RequestValue()), | 110 std::unique_ptr<RequestValue>(new RequestValue()), |
| 111 false /* has_more */); | 111 false /* has_more */); |
| 112 ASSERT_EQ(1u, callback_log.size()); | 112 ASSERT_EQ(1u, callback_log.size()); |
| 113 base::File::Error event_result = callback_log[0]; | 113 base::File::Error event_result = callback_log[0]; |
| 114 EXPECT_EQ(base::File::FILE_OK, event_result); | 114 EXPECT_EQ(base::File::FILE_OK, event_result); |
| 115 } | 115 } |
| 116 | 116 |
| 117 TEST_F(FileSystemProviderOperationsUnmountTest, OnError) { | 117 TEST_F(FileSystemProviderOperationsUnmountTest, OnError) { |
| 118 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); | 118 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); |
| 119 util::StatusCallbackLog callback_log; | 119 util::StatusCallbackLog callback_log; |
| 120 | 120 |
| 121 Unmount unmount(NULL, | 121 Unmount unmount(NULL, |
| 122 file_system_info_, | 122 file_system_info_, |
| 123 base::Bind(&util::LogStatusCallback, &callback_log)); | 123 base::Bind(&util::LogStatusCallback, &callback_log)); |
| 124 unmount.SetDispatchEventImplForTesting( | 124 unmount.SetDispatchEventImplForTesting( |
| 125 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, | 125 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, |
| 126 base::Unretained(&dispatcher))); | 126 base::Unretained(&dispatcher))); |
| 127 | 127 |
| 128 EXPECT_TRUE(unmount.Execute(kRequestId)); | 128 EXPECT_TRUE(unmount.Execute(kRequestId)); |
| 129 | 129 |
| 130 unmount.OnError(kRequestId, | 130 unmount.OnError(kRequestId, std::unique_ptr<RequestValue>(new RequestValue()), |
| 131 scoped_ptr<RequestValue>(new RequestValue()), | |
| 132 base::File::FILE_ERROR_NOT_FOUND); | 131 base::File::FILE_ERROR_NOT_FOUND); |
| 133 ASSERT_EQ(1u, callback_log.size()); | 132 ASSERT_EQ(1u, callback_log.size()); |
| 134 base::File::Error event_result = callback_log[0]; | 133 base::File::Error event_result = callback_log[0]; |
| 135 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, event_result); | 134 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, event_result); |
| 136 } | 135 } |
| 137 | 136 |
| 138 } // namespace operations | 137 } // namespace operations |
| 139 } // namespace file_system_provider | 138 } // namespace file_system_provider |
| 140 } // namespace chromeos | 139 } // namespace chromeos |
| OLD | NEW |