OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/drive/file_system/truncate_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/truncate_operation.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
11 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 11 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
12 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" | 12 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
13 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace drive { | 16 namespace drive { |
17 namespace file_system { | 17 namespace file_system { |
18 | 18 |
19 class TruncateOperationTest : public OperationTestBase { | 19 class TruncateOperationTest : public OperationTestBase { |
20 protected: | 20 protected: |
21 virtual void SetUp() override { | 21 void SetUp() override { |
22 OperationTestBase::SetUp(); | 22 OperationTestBase::SetUp(); |
23 | 23 |
24 operation_.reset(new TruncateOperation( | 24 operation_.reset(new TruncateOperation( |
25 blocking_task_runner(), delegate(), scheduler(), | 25 blocking_task_runner(), delegate(), scheduler(), |
26 metadata(), cache(), temp_dir())); | 26 metadata(), cache(), temp_dir())); |
27 } | 27 } |
28 | 28 |
29 scoped_ptr<TruncateOperation> operation_; | 29 scoped_ptr<TruncateOperation> operation_; |
30 }; | 30 }; |
31 | 31 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 std::string content; | 125 std::string content; |
126 ASSERT_TRUE(base::ReadFileToString(local_path, &content)); | 126 ASSERT_TRUE(base::ReadFileToString(local_path, &content)); |
127 | 127 |
128 EXPECT_EQ(file_size + 10, static_cast<int64>(content.size())); | 128 EXPECT_EQ(file_size + 10, static_cast<int64>(content.size())); |
129 // All trailing 10 bytes should be '\0'. | 129 // All trailing 10 bytes should be '\0'. |
130 EXPECT_EQ(std::string(10, '\0'), content.substr(file_size)); | 130 EXPECT_EQ(std::string(10, '\0'), content.substr(file_size)); |
131 } | 131 } |
132 | 132 |
133 } // namespace file_system | 133 } // namespace file_system |
134 } // namespace drive | 134 } // namespace drive |
OLD | NEW |