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/local_file_reader.h" | 5 #include "chrome/browser/chromeos/drive/local_file_reader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 class LocalFileReaderTest : public ::testing::Test { | 45 class LocalFileReaderTest : public ::testing::Test { |
46 protected: | 46 protected: |
47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() OVERRIDE { |
48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
49 worker_thread_.reset(new base::Thread("LocalFileReaderTest")); | 49 worker_thread_.reset(new base::Thread("LocalFileReaderTest")); |
50 ASSERT_TRUE(worker_thread_->Start()); | 50 ASSERT_TRUE(worker_thread_->Start()); |
51 file_reader_.reset( | 51 file_reader_.reset( |
52 new LocalFileReader(worker_thread_->message_loop_proxy())); | 52 new LocalFileReader(worker_thread_->message_loop_proxy().get())); |
53 } | 53 } |
54 | 54 |
55 base::MessageLoop message_loop_; | 55 base::MessageLoop message_loop_; |
56 base::ScopedTempDir temp_dir_; | 56 base::ScopedTempDir temp_dir_; |
57 scoped_ptr<base::Thread> worker_thread_; | 57 scoped_ptr<base::Thread> worker_thread_; |
58 scoped_ptr<LocalFileReader> file_reader_; | 58 scoped_ptr<LocalFileReader> file_reader_; |
59 }; | 59 }; |
60 | 60 |
61 TEST_F(LocalFileReaderTest, NonExistingFile) { | 61 TEST_F(LocalFileReaderTest, NonExistingFile) { |
62 const base::FilePath kTestFile = | 62 const base::FilePath kTestFile = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ASSERT_EQ(net::OK, callback.WaitForResult()); | 98 ASSERT_EQ(net::OK, callback.WaitForResult()); |
99 | 99 |
100 LocalFileReaderAdapter adapter(file_reader_.get()); | 100 LocalFileReaderAdapter adapter(file_reader_.get()); |
101 std::string content; | 101 std::string content; |
102 ASSERT_EQ(net::OK, test_util::ReadAllData(&adapter, &content)); | 102 ASSERT_EQ(net::OK, test_util::ReadAllData(&adapter, &content)); |
103 EXPECT_EQ(expected_content, content); | 103 EXPECT_EQ(expected_content, content); |
104 } | 104 } |
105 | 105 |
106 } // namespace util | 106 } // namespace util |
107 } // namespace drive | 107 } // namespace drive |
OLD | NEW |