OLD | NEW |
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 #include <deque> | 5 #include <deque> |
6 #include <limits> | 6 #include <limits> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_callback_factory.h" | 10 #include "base/memory/scoped_callback_factory.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
13 #include "base/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "webkit/plugins/ppapi/mock_plugin_delegate.h" | 15 #include "webkit/plugins/ppapi/mock_plugin_delegate.h" |
| 16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
16 #include "webkit/plugins/ppapi/ppapi_unittest.h" | 17 #include "webkit/plugins/ppapi/ppapi_unittest.h" |
17 #include "webkit/plugins/ppapi/quota_file_io.h" | 18 #include "webkit/plugins/ppapi/quota_file_io.h" |
18 | 19 |
19 using base::MessageLoopProxy; | 20 using base::MessageLoopProxy; |
20 using base::PlatformFile; | 21 using base::PlatformFile; |
21 using base::PlatformFileError; | 22 using base::PlatformFileError; |
22 | 23 |
23 namespace webkit { | 24 namespace webkit { |
24 namespace ppapi { | 25 namespace ppapi { |
25 | 26 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 base::PLATFORM_FILE_WRITE | | 95 base::PLATFORM_FILE_WRITE | |
95 base::PLATFORM_FILE_WRITE_ATTRIBUTES; | 96 base::PLATFORM_FILE_WRITE_ATTRIBUTES; |
96 bool created = false; | 97 bool created = false; |
97 file_ = base::kInvalidPlatformFileValue; | 98 file_ = base::kInvalidPlatformFileValue; |
98 PlatformFileError error = base::PLATFORM_FILE_OK; | 99 PlatformFileError error = base::PLATFORM_FILE_OK; |
99 file_ = base::CreatePlatformFile(path, file_flags, &created, &error); | 100 file_ = base::CreatePlatformFile(path, file_flags, &created, &error); |
100 ASSERT_EQ(base::PLATFORM_FILE_OK, error); | 101 ASSERT_EQ(base::PLATFORM_FILE_OK, error); |
101 ASSERT_NE(base::kInvalidPlatformFileValue, file_); | 102 ASSERT_NE(base::kInvalidPlatformFileValue, file_); |
102 ASSERT_FALSE(created); | 103 ASSERT_FALSE(created); |
103 quota_file_io_.reset(new QuotaFileIO( | 104 quota_file_io_.reset(new QuotaFileIO( |
104 instance(), file_, GURL(), PP_FILESYSTEMTYPE_LOCALTEMPORARY)); | 105 instance()->pp_instance(), file_, GURL(), |
| 106 PP_FILESYSTEMTYPE_LOCALTEMPORARY)); |
105 } | 107 } |
106 | 108 |
107 virtual void TearDown() OVERRIDE { | 109 virtual void TearDown() OVERRIDE { |
108 quota_file_io_.reset(); | 110 quota_file_io_.reset(); |
109 if (file_ != base::kInvalidPlatformFileValue) | 111 if (file_ != base::kInvalidPlatformFileValue) |
110 base::ClosePlatformFile(file_); | 112 base::ClosePlatformFile(file_); |
111 PpapiUnittest::TearDown(); | 113 PpapiUnittest::TearDown(); |
112 } | 114 } |
113 | 115 |
114 protected: | 116 protected: |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 pop_result(); | 493 pop_result(); |
492 | 494 |
493 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); | 495 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); |
494 EXPECT_EQ(15, GetPlatformFileSize()); | 496 EXPECT_EQ(15, GetPlatformFileSize()); |
495 ReadPlatformFile(&read_buffer); | 497 ReadPlatformFile(&read_buffer); |
496 EXPECT_EQ("123355559012345", read_buffer); | 498 EXPECT_EQ("123355559012345", read_buffer); |
497 } | 499 } |
498 | 500 |
499 } // namespace ppapi | 501 } // namespace ppapi |
500 } // namespace webkit | 502 } // namespace webkit |
OLD | NEW |