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/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
13 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
14 #include "base/scoped_temp_dir.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_plugin_instance.h" |
17 #include "webkit/plugins/ppapi/ppapi_unittest.h" | 17 #include "webkit/plugins/ppapi/ppapi_unittest.h" |
18 #include "webkit/plugins/ppapi/quota_file_io.h" | 18 #include "webkit/plugins/ppapi/quota_file_io.h" |
19 | 19 |
20 using base::MessageLoopProxy; | 20 using base::MessageLoopProxy; |
21 using base::PlatformFile; | 21 using base::PlatformFile; |
22 using base::PlatformFileError; | 22 using base::PlatformFileError; |
23 | 23 |
24 namespace webkit { | 24 namespace webkit { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 base::PlatformFileInfo info; | 415 base::PlatformFileInfo info; |
416 EXPECT_TRUE(base::GetPlatformFileInfo(file_, &info)); | 416 EXPECT_TRUE(base::GetPlatformFileInfo(file_, &info)); |
417 return info.size; | 417 return info.size; |
418 } | 418 } |
419 | 419 |
420 void SetPlatformFileSize(int64_t length) { | 420 void SetPlatformFileSize(int64_t length) { |
421 EXPECT_TRUE(base::TruncatePlatformFile(file_, length)); | 421 EXPECT_TRUE(base::TruncatePlatformFile(file_, length)); |
422 } | 422 } |
423 | 423 |
424 private: | 424 private: |
425 ScopedTempDir dir_; | 425 base::ScopedTempDir dir_; |
426 PlatformFile file_; | 426 PlatformFile file_; |
427 scoped_ptr<QuotaFileIO> quota_file_io_; | 427 scoped_ptr<QuotaFileIO> quota_file_io_; |
428 std::deque<int> bytes_written_; | 428 std::deque<int> bytes_written_; |
429 std::deque<PlatformFileError> status_; | 429 std::deque<PlatformFileError> status_; |
430 base::WeakPtrFactory<QuotaFileIOTest> weak_factory_; | 430 base::WeakPtrFactory<QuotaFileIOTest> weak_factory_; |
431 }; | 431 }; |
432 | 432 |
433 TEST_F(QuotaFileIOTest, Write) { | 433 TEST_F(QuotaFileIOTest, Write) { |
434 WriteTestBody(false); | 434 WriteTestBody(false); |
435 } | 435 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 pop_result(); | 490 pop_result(); |
491 | 491 |
492 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); | 492 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); |
493 EXPECT_EQ(15, GetPlatformFileSize()); | 493 EXPECT_EQ(15, GetPlatformFileSize()); |
494 ReadPlatformFile(&read_buffer); | 494 ReadPlatformFile(&read_buffer); |
495 EXPECT_EQ("123355559012345", read_buffer); | 495 EXPECT_EQ("123355559012345", read_buffer); |
496 } | 496 } |
497 | 497 |
498 } // namespace ppapi | 498 } // namespace ppapi |
499 } // namespace webkit | 499 } // namespace webkit |
OLD | NEW |