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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 class BlobURLRequestJobFactory; | 78 class BlobURLRequestJobFactory; |
79 | 79 |
80 } // namespace (anonymous) | 80 } // namespace (anonymous) |
81 | 81 |
82 class FileWriterDelegateTest : public PlatformTest { | 82 class FileWriterDelegateTest : public PlatformTest { |
83 public: | 83 public: |
84 FileWriterDelegateTest() {} | 84 FileWriterDelegateTest() {} |
85 | 85 |
86 protected: | 86 protected: |
87 virtual void SetUp() override; | 87 void SetUp() override; |
88 virtual void TearDown() override; | 88 void TearDown() override; |
89 | 89 |
90 int64 usage() { | 90 int64 usage() { |
91 return file_system_context_->GetQuotaUtil(kFileSystemType) | 91 return file_system_context_->GetQuotaUtil(kFileSystemType) |
92 ->GetOriginUsageOnFileTaskRunner( | 92 ->GetOriginUsageOnFileTaskRunner( |
93 file_system_context_.get(), kOrigin, kFileSystemType); | 93 file_system_context_.get(), kOrigin, kFileSystemType); |
94 } | 94 } |
95 | 95 |
96 int64 GetFileSizeOnDisk(const char* test_file_path) { | 96 int64 GetFileSizeOnDisk(const char* test_file_path) { |
97 // There might be in-flight flush/write. | 97 // There might be in-flight flush/write. |
98 base::MessageLoop::current()->PostTask( | 98 base::MessageLoop::current()->PostTask( |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 file_writer_delegate_.reset(); | 473 file_writer_delegate_.reset(); |
474 | 474 |
475 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); | 475 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); |
476 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); | 476 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); |
477 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); | 477 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); |
478 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); | 478 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
482 } // namespace content | 482 } // namespace content |
OLD | NEW |