Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: webkit/fileapi/file_system_operation_write_unittest.cc

Issue 7470037: [Refactor] to rename and re-layer the file_util stack layers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased on the svn tree. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit)
6 // rather than as part of test_shell_tests because they rely on being able 6 // rather than as part of test_shell_tests because they rely on being able
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses
8 // TYPE_UI, which URLRequest doesn't allow. 8 // TYPE_UI, which URLRequest doesn't allow.
9 // 9 //
10 10
(...skipping 10 matching lines...) Expand all
21 #include "webkit/blob/blob_data.h" 21 #include "webkit/blob/blob_data.h"
22 #include "webkit/blob/blob_storage_controller.h" 22 #include "webkit/blob/blob_storage_controller.h"
23 #include "webkit/blob/blob_url_request_job.h" 23 #include "webkit/blob/blob_url_request_job.h"
24 #include "webkit/fileapi/file_system_callback_dispatcher.h" 24 #include "webkit/fileapi/file_system_callback_dispatcher.h"
25 #include "webkit/fileapi/file_system_context.h" 25 #include "webkit/fileapi/file_system_context.h"
26 #include "webkit/fileapi/file_system_file_util.h" 26 #include "webkit/fileapi/file_system_file_util.h"
27 #include "webkit/fileapi/file_system_operation.h" 27 #include "webkit/fileapi/file_system_operation.h"
28 #include "webkit/fileapi/file_system_path_manager.h" 28 #include "webkit/fileapi/file_system_path_manager.h"
29 #include "webkit/fileapi/file_system_test_helper.h" 29 #include "webkit/fileapi/file_system_test_helper.h"
30 #include "webkit/fileapi/file_system_util.h" 30 #include "webkit/fileapi/file_system_util.h"
31 #include "webkit/fileapi/local_file_system_file_util.h" 31 #include "webkit/fileapi/local_file_util.h"
32 #include "webkit/fileapi/quota_file_util.h" 32 #include "webkit/fileapi/quota_file_util.h"
33 #include "webkit/quota/quota_manager.h" 33 #include "webkit/quota/quota_manager.h"
34 34
35 using quota::QuotaManager; 35 using quota::QuotaManager;
36 36
37 namespace fileapi { 37 namespace fileapi {
38 38
39 namespace { 39 namespace {
40 40
41 class MockQuotaManager : public QuotaManager { 41 class MockQuotaManager : public QuotaManager {
(...skipping 18 matching lines...) Expand all
60 private: 60 private:
61 int64 usage_; 61 int64 usage_;
62 int64 quota_; 62 int64 quota_;
63 }; 63 };
64 64
65 } // namespace (anonymous) 65 } // namespace (anonymous)
66 66
67 class FileSystemOperationWriteTest : public testing::Test { 67 class FileSystemOperationWriteTest : public testing::Test {
68 public: 68 public:
69 FileSystemOperationWriteTest() 69 FileSystemOperationWriteTest()
70 : local_file_util_( 70 : local_file_util_(new LocalFileUtil(QuotaFileUtil::CreateDefault())),
71 new LocalFileSystemFileUtil(QuotaFileUtil::CreateDefault())),
72 loop_(MessageLoop::TYPE_IO), 71 loop_(MessageLoop::TYPE_IO),
73 status_(base::PLATFORM_FILE_OK), 72 status_(base::PLATFORM_FILE_OK),
74 bytes_written_(0), 73 bytes_written_(0),
75 complete_(false) {} 74 complete_(false) {}
76 75
77 FileSystemOperation* operation(); 76 FileSystemOperation* operation();
78 77
79 void set_failure_status(base::PlatformFileError status) { 78 void set_failure_status(base::PlatformFileError status) {
80 EXPECT_FALSE(complete_); 79 EXPECT_FALSE(complete_);
81 EXPECT_EQ(status_, base::PLATFORM_FILE_OK); 80 EXPECT_EQ(status_, base::PLATFORM_FILE_OK);
(...skipping 11 matching lines...) Expand all
93 bool complete() const { return complete_; } 92 bool complete() const { return complete_; }
94 93
95 virtual void SetUp(); 94 virtual void SetUp();
96 virtual void TearDown(); 95 virtual void TearDown();
97 96
98 protected: 97 protected:
99 GURL URLForPath(const FilePath& path) const { 98 GURL URLForPath(const FilePath& path) const {
100 return test_helper_.GetURLForPath(path); 99 return test_helper_.GetURLForPath(path);
101 } 100 }
102 101
103 scoped_ptr<LocalFileSystemFileUtil> local_file_util_; 102 scoped_ptr<LocalFileUtil> local_file_util_;
104 scoped_refptr<MockQuotaManager> quota_manager_; 103 scoped_refptr<MockQuotaManager> quota_manager_;
105 FileSystemTestOriginHelper test_helper_; 104 FileSystemTestOriginHelper test_helper_;
106 105
107 MessageLoop loop_; 106 MessageLoop loop_;
108 107
109 ScopedTempDir dir_; 108 ScopedTempDir dir_;
110 FilePath filesystem_dir_; 109 FilePath filesystem_dir_;
111 FilePath file_; 110 FilePath file_;
112 FilePath virtual_path_; 111 FilePath virtual_path_;
113 112
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 url_request_context->blob_storage_controller()->UnregisterBlobUrl(blob_url); 338 url_request_context->blob_storage_controller()->UnregisterBlobUrl(blob_url);
340 339
341 EXPECT_EQ(10, bytes_written()); 340 EXPECT_EQ(10, bytes_written());
342 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); 341 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
343 EXPECT_TRUE(complete()); 342 EXPECT_TRUE(complete());
344 } 343 }
345 344
346 // TODO(ericu,dmikurube): Add tests for Cancel. 345 // TODO(ericu,dmikurube): Add tests for Cancel.
347 346
348 } // namespace fileapi 347 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_operation_unittest.cc ('k') | webkit/fileapi/file_system_path_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698