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 "net/base/upload_data_stream.h" | 5 #include "net/base/upload_data_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 ASSERT_EQ(OK, error_code); | 547 ASSERT_EQ(OK, error_code); |
548 } | 548 } |
549 | 549 |
550 TEST_F(UploadDataStreamTest, FileChanged) { | 550 TEST_F(UploadDataStreamTest, FileChanged) { |
551 base::FilePath temp_file_path; | 551 base::FilePath temp_file_path; |
552 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), | 552 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), |
553 &temp_file_path)); | 553 &temp_file_path)); |
554 ASSERT_EQ(static_cast<int>(kTestDataSize), | 554 ASSERT_EQ(static_cast<int>(kTestDataSize), |
555 file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); | 555 file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); |
556 | 556 |
557 base::PlatformFileInfo file_info; | 557 base::File::Info file_info; |
558 ASSERT_TRUE(base::GetFileInfo(temp_file_path, &file_info)); | 558 ASSERT_TRUE(base::GetFileInfo(temp_file_path, &file_info)); |
559 | 559 |
560 // Test file not changed. | 560 // Test file not changed. |
561 FileChangedHelper(temp_file_path, file_info.last_modified, false); | 561 FileChangedHelper(temp_file_path, file_info.last_modified, false); |
562 | 562 |
563 // Test file changed. | 563 // Test file changed. |
564 FileChangedHelper(temp_file_path, | 564 FileChangedHelper(temp_file_path, |
565 file_info.last_modified - base::TimeDelta::FromSeconds(1), | 565 file_info.last_modified - base::TimeDelta::FromSeconds(1), |
566 true); | 566 true); |
567 } | 567 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); | 811 wrapped_buffer2.get(), buf2.size(), read_callback2.callback())); |
812 EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); | 812 EXPECT_EQ(static_cast<int>(buf2.size()), read_callback2.WaitForResult()); |
813 EXPECT_EQ(expected_data, buf2); | 813 EXPECT_EQ(expected_data, buf2); |
814 EXPECT_TRUE(stream.IsEOF()); | 814 EXPECT_TRUE(stream.IsEOF()); |
815 | 815 |
816 // Make sure callbacks are not called for cancelled operations. | 816 // Make sure callbacks are not called for cancelled operations. |
817 EXPECT_FALSE(read_callback1.have_result()); | 817 EXPECT_FALSE(read_callback1.have_result()); |
818 } | 818 } |
819 | 819 |
820 } // namespace net | 820 } // namespace net |
OLD | NEW |