| 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/truncate.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <string> | 9 #include <string> |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/files/file.h" | 12 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/chromeos/file_system_provider/operations/test_util.h" | 15 #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" | 16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
| 15 #include "chrome/common/extensions/api/file_system_provider.h" | 17 #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" | 18 #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" | 19 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
| 18 #include "extensions/browser/event_router.h" | 20 #include "extensions/browser/event_router.h" |
| 19 #include "storage/browser/fileapi/async_file_util.h" | 21 #include "storage/browser/fileapi/async_file_util.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 23 |
| 22 namespace chromeos { | 24 namespace chromeos { |
| 23 namespace file_system_provider { | 25 namespace file_system_provider { |
| 24 namespace operations { | 26 namespace operations { |
| 25 namespace { | 27 namespace { |
| 26 | 28 |
| 27 const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; | 29 const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; |
| 28 const char kFileSystemId[] = "testing-file-system"; | 30 const char kFileSystemId[] = "testing-file-system"; |
| 29 const int kRequestId = 2; | 31 const int kRequestId = 2; |
| 30 const base::FilePath::CharType kFilePath[] = | 32 const base::FilePath::CharType kFilePath[] = |
| 31 FILE_PATH_LITERAL("/kitty/and/puppy/happy"); | 33 FILE_PATH_LITERAL("/kitty/and/puppy/happy"); |
| 32 const int64 kTruncateLength = 64; | 34 const int64_t kTruncateLength = 64; |
| 33 | 35 |
| 34 } // namespace | 36 } // namespace |
| 35 | 37 |
| 36 class FileSystemProviderOperationsTruncateTest : public testing::Test { | 38 class FileSystemProviderOperationsTruncateTest : public testing::Test { |
| 37 protected: | 39 protected: |
| 38 FileSystemProviderOperationsTruncateTest() {} | 40 FileSystemProviderOperationsTruncateTest() {} |
| 39 ~FileSystemProviderOperationsTruncateTest() override {} | 41 ~FileSystemProviderOperationsTruncateTest() override {} |
| 40 | 42 |
| 41 void SetUp() override { | 43 void SetUp() override { |
| 42 MountOptions mount_options(kFileSystemId, "" /* display_name */); | 44 MountOptions mount_options(kFileSystemId, "" /* display_name */); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 truncate.OnError(kRequestId, | 154 truncate.OnError(kRequestId, |
| 153 scoped_ptr<RequestValue>(new RequestValue()), | 155 scoped_ptr<RequestValue>(new RequestValue()), |
| 154 base::File::FILE_ERROR_TOO_MANY_OPENED); | 156 base::File::FILE_ERROR_TOO_MANY_OPENED); |
| 155 ASSERT_EQ(1u, callback_log.size()); | 157 ASSERT_EQ(1u, callback_log.size()); |
| 156 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]); |
| 157 } | 159 } |
| 158 | 160 |
| 159 } // namespace operations | 161 } // namespace operations |
| 160 } // namespace file_system_provider | 162 } // namespace file_system_provider |
| 161 } // namespace chromeos | 163 } // namespace chromeos |
| OLD | NEW |