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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ASSERT_TRUE(worker_thread_->Start()); | 53 ASSERT_TRUE(worker_thread_->Start()); |
54 file_reader_.reset( | 54 file_reader_.reset( |
55 new LocalFileReader(worker_thread_->message_loop_proxy())); | 55 new LocalFileReader(worker_thread_->message_loop_proxy())); |
56 } | 56 } |
57 | 57 |
58 virtual void TearDown() OVERRIDE { | 58 virtual void TearDown() OVERRIDE { |
59 file_reader_.reset(); | 59 file_reader_.reset(); |
60 worker_thread_.reset(); | 60 worker_thread_.reset(); |
61 } | 61 } |
62 | 62 |
63 MessageLoop message_loop_; | 63 base::MessageLoop message_loop_; |
64 base::ScopedTempDir temp_dir_; | 64 base::ScopedTempDir temp_dir_; |
65 scoped_ptr<base::Thread> worker_thread_; | 65 scoped_ptr<base::Thread> worker_thread_; |
66 scoped_ptr<LocalFileReader> file_reader_; | 66 scoped_ptr<LocalFileReader> file_reader_; |
67 }; | 67 }; |
68 | 68 |
69 TEST_F(LocalFileReaderTest, NonExistingFile) { | 69 TEST_F(LocalFileReaderTest, NonExistingFile) { |
70 const base::FilePath kTestFile = | 70 const base::FilePath kTestFile = |
71 temp_dir_.path().AppendASCII("non-existing"); | 71 temp_dir_.path().AppendASCII("non-existing"); |
72 | 72 |
73 net::TestCompletionCallback callback; | 73 net::TestCompletionCallback callback; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 ASSERT_EQ(net::OK, callback.WaitForResult()); | 106 ASSERT_EQ(net::OK, callback.WaitForResult()); |
107 | 107 |
108 LocalFileReaderAdapter adapter(file_reader_.get()); | 108 LocalFileReaderAdapter adapter(file_reader_.get()); |
109 std::string content; | 109 std::string content; |
110 ASSERT_EQ(net::OK, test_util::ReadAllData(&adapter, &content)); | 110 ASSERT_EQ(net::OK, test_util::ReadAllData(&adapter, &content)); |
111 EXPECT_EQ(expected_content, content); | 111 EXPECT_EQ(expected_content, content); |
112 } | 112 } |
113 | 113 |
114 } // namespace util | 114 } // namespace util |
115 } // namespace drive | 115 } // namespace drive |
OLD | NEW |