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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 class FileWriterDelegateTest : public PlatformTest { | 75 class FileWriterDelegateTest : public PlatformTest { |
76 public: | 76 public: |
77 FileWriterDelegateTest() {} | 77 FileWriterDelegateTest() {} |
78 | 78 |
79 protected: | 79 protected: |
80 virtual void SetUp() OVERRIDE; | 80 virtual void SetUp() OVERRIDE; |
81 virtual void TearDown() OVERRIDE; | 81 virtual void TearDown() OVERRIDE; |
82 | 82 |
83 int64 usage() { | 83 int64 usage() { |
84 return file_system_context_->GetQuotaUtil(kFileSystemType) | 84 return file_system_context_->GetQuotaUtil(kFileSystemType) |
85 ->GetOriginUsageOnFileThread( | 85 ->GetOriginUsageOnFileTaskRunner( |
86 file_system_context_.get(), kOrigin, kFileSystemType); | 86 file_system_context_.get(), kOrigin, kFileSystemType); |
87 } | 87 } |
88 | 88 |
89 int64 GetFileSizeOnDisk(const char* test_file_path) { | 89 int64 GetFileSizeOnDisk(const char* test_file_path) { |
90 // There might be in-flight flush/write. | 90 // There might be in-flight flush/write. |
91 base::MessageLoop::current()->PostTask( | 91 base::MessageLoop::current()->PostTask( |
92 FROM_HERE, base::Bind(&base::DoNothing)); | 92 FROM_HERE, base::Bind(&base::DoNothing)); |
93 base::RunLoop().RunUntilIdle(); | 93 base::RunLoop().RunUntilIdle(); |
94 | 94 |
95 FileSystemURL url = GetFileSystemURL(test_file_path); | 95 FileSystemURL url = GetFileSystemURL(test_file_path); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 file_writer_delegate_.reset(); | 446 file_writer_delegate_.reset(); |
447 | 447 |
448 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); | 448 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); |
449 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); | 449 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); |
450 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); | 450 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); |
451 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result.status()); | 451 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result.status()); |
452 } | 452 } |
453 } | 453 } |
454 | 454 |
455 } // namespace fileapi | 455 } // namespace fileapi |
OLD | NEW |