| OLD | NEW | 
|     1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |     1 // Copyright (c) 2012 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 <algorithm> |     5 #include <algorithm> | 
|     6 #include <set> |     6 #include <set> | 
|     7 #include <string> |     7 #include <string> | 
|     8  |     8  | 
|     9 #include "base/bind.h" |     9 #include "base/bind.h" | 
|    10 #include "base/file_path.h" |    10 #include "base/file_path.h" | 
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   338     } |   338     } | 
|   339  |   339  | 
|   340    private: |   340    private: | 
|   341     void Check() { |   341     void Check() { | 
|   342       ASSERT_EQ(expected_usage_, |   342       ASSERT_EQ(expected_usage_, | 
|   343                 test_helper_->GetCachedOriginUsage()); |   343                 test_helper_->GetCachedOriginUsage()); | 
|   344     } |   344     } | 
|   345  |   345  | 
|   346     scoped_ptr<FileSystemOperationContext> context_; |   346     scoped_ptr<FileSystemOperationContext> context_; | 
|   347     FileSystemTestOriginHelper* test_helper_; |   347     FileSystemTestOriginHelper* test_helper_; | 
|   348     int64 growth_; |  | 
|   349     int64 expected_usage_; |   348     int64 expected_usage_; | 
|   350   }; |   349   }; | 
|   351  |   350  | 
|   352   scoped_ptr<UsageVerifyHelper> AllowUsageIncrease(int64 requested_growth) { |   351   scoped_ptr<UsageVerifyHelper> AllowUsageIncrease(int64 requested_growth) { | 
|   353     int64 usage = test_helper_.GetCachedOriginUsage(); |   352     int64 usage = test_helper_.GetCachedOriginUsage(); | 
|   354     return scoped_ptr<UsageVerifyHelper>(new UsageVerifyHelper( |   353     return scoped_ptr<UsageVerifyHelper>(new UsageVerifyHelper( | 
|   355         LimitedContext(requested_growth), |   354         LimitedContext(requested_growth), | 
|   356         &test_helper_, usage + requested_growth)); |   355         &test_helper_, usage + requested_growth)); | 
|   357   } |   356   } | 
|   358  |   357  | 
| (...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2188  |  2187  | 
|  2189   // Opening it with TRUNCATED flag, which should truncate the file size. |  2188   // Opening it with TRUNCATED flag, which should truncate the file size. | 
|  2190   ASSERT_EQ(base::PLATFORM_FILE_OK, |  2189   ASSERT_EQ(base::PLATFORM_FILE_OK, | 
|  2191             ofu()->CreateOrOpen( |  2190             ofu()->CreateOrOpen( | 
|  2192                 AllowUsageIncrease(-length)->context(), file, |  2191                 AllowUsageIncrease(-length)->context(), file, | 
|  2193                 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, |  2192                 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, | 
|  2194                 &file_handle, &created)); |  2193                 &file_handle, &created)); | 
|  2195   ASSERT_EQ(0, ComputeTotalFileSize()); |  2194   ASSERT_EQ(0, ComputeTotalFileSize()); | 
|  2196   EXPECT_TRUE(base::ClosePlatformFile(file_handle)); |  2195   EXPECT_TRUE(base::ClosePlatformFile(file_handle)); | 
|  2197 } |  2196 } | 
| OLD | NEW |