OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/drive_file_stream_reader.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_stream_reader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 class LocalReaderProxyTest : public ::testing::Test { | 42 class LocalReaderProxyTest : public ::testing::Test { |
43 protected: | 43 protected: |
44 LocalReaderProxyTest() | 44 LocalReaderProxyTest() |
45 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 45 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
46 } | 46 } |
47 | 47 |
48 virtual void SetUp() override { | 48 void SetUp() override { |
49 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 49 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
50 ASSERT_TRUE(google_apis::test_util::CreateFileOfSpecifiedSize( | 50 ASSERT_TRUE(google_apis::test_util::CreateFileOfSpecifiedSize( |
51 temp_dir_.path(), 1024, &file_path_, &file_content_)); | 51 temp_dir_.path(), 1024, &file_path_, &file_content_)); |
52 | 52 |
53 worker_thread_.reset(new base::Thread("ReaderProxyTest")); | 53 worker_thread_.reset(new base::Thread("ReaderProxyTest")); |
54 ASSERT_TRUE(worker_thread_->Start()); | 54 ASSERT_TRUE(worker_thread_->Start()); |
55 } | 55 } |
56 | 56 |
57 content::TestBrowserThreadBundle thread_bundle_; | 57 content::TestBrowserThreadBundle thread_bundle_; |
58 | 58 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 | 288 |
289 } // namespace internal | 289 } // namespace internal |
290 | 290 |
291 class DriveFileStreamReaderTest : public ::testing::Test { | 291 class DriveFileStreamReaderTest : public ::testing::Test { |
292 protected: | 292 protected: |
293 DriveFileStreamReaderTest() | 293 DriveFileStreamReaderTest() |
294 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 294 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
295 } | 295 } |
296 | 296 |
297 virtual void SetUp() override { | 297 void SetUp() override { |
298 worker_thread_.reset(new base::Thread("DriveFileStreamReaderTest")); | 298 worker_thread_.reset(new base::Thread("DriveFileStreamReaderTest")); |
299 ASSERT_TRUE(worker_thread_->Start()); | 299 ASSERT_TRUE(worker_thread_->Start()); |
300 | 300 |
301 // Initialize FakeDriveService. | 301 // Initialize FakeDriveService. |
302 fake_drive_service_.reset(new FakeDriveService); | 302 fake_drive_service_.reset(new FakeDriveService); |
303 ASSERT_TRUE(test_util::SetUpTestEntries(fake_drive_service_.get())); | 303 ASSERT_TRUE(test_util::SetUpTestEntries(fake_drive_service_.get())); |
304 | 304 |
305 // Create a testee instance. | 305 // Create a testee instance. |
306 fake_file_system_.reset( | 306 fake_file_system_.reset( |
307 new test_util::FakeFileSystem(fake_drive_service_.get())); | 307 new test_util::FakeFileSystem(fake_drive_service_.get())); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 ASSERT_TRUE(entry); | 560 ASSERT_TRUE(entry); |
561 EXPECT_TRUE(reader->IsInitialized()); | 561 EXPECT_TRUE(reader->IsInitialized()); |
562 | 562 |
563 // Read data from the reader, again. | 563 // Read data from the reader, again. |
564 std::string second_content; | 564 std::string second_content; |
565 ASSERT_EQ(net::OK, test_util::ReadAllData(reader.get(), &second_content)); | 565 ASSERT_EQ(net::OK, test_util::ReadAllData(reader.get(), &second_content)); |
566 EXPECT_EQ(0u, second_content.size()); | 566 EXPECT_EQ(0u, second_content.size()); |
567 } | 567 } |
568 | 568 |
569 } // namespace drive | 569 } // namespace drive |
OLD | NEW |