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/fake_file_system.h" | 5 #include "chrome/browser/chromeos/drive/fake_file_system.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
10 #include "chrome/browser/drive/fake_drive_service.h" | 10 #include "chrome/browser/drive/fake_drive_service.h" |
11 #include "chrome/browser/google_apis/test_util.h" | 11 #include "chrome/browser/google_apis/test_util.h" |
12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace drive { | 15 namespace drive { |
16 namespace test_util { | 16 namespace test_util { |
17 | 17 |
18 class FakeFileSystemTest : public ::testing::Test { | 18 class FakeFileSystemTest : public ::testing::Test { |
19 protected: | 19 protected: |
20 virtual void SetUp() OVERRIDE { | 20 virtual void SetUp() OVERRIDE { |
21 // Initialize FakeDriveService. | 21 // Initialize FakeDriveService. |
22 fake_drive_service_.reset(new FakeDriveService); | 22 fake_drive_service_.reset(new FakeDriveService); |
23 fake_drive_service_->LoadResourceListForWapi( | 23 ASSERT_TRUE(fake_drive_service_->LoadResourceListForWapi( |
24 "gdata/root_feed.json"); | 24 "gdata/root_feed.json")); |
25 fake_drive_service_->LoadAccountMetadataForWapi( | 25 ASSERT_TRUE(fake_drive_service_->LoadAccountMetadataForWapi( |
26 "gdata/account_metadata.json"); | 26 "gdata/account_metadata.json")); |
27 | 27 |
28 // Create a testee instance. | 28 // Create a testee instance. |
29 fake_file_system_.reset(new FakeFileSystem(fake_drive_service_.get())); | 29 fake_file_system_.reset(new FakeFileSystem(fake_drive_service_.get())); |
30 ASSERT_TRUE(fake_file_system_->InitializeForTesting()); | |
31 } | 30 } |
32 | 31 |
33 content::TestBrowserThreadBundle thread_bundle_; | 32 content::TestBrowserThreadBundle thread_bundle_; |
34 scoped_ptr<FakeDriveService> fake_drive_service_; | 33 scoped_ptr<FakeDriveService> fake_drive_service_; |
35 scoped_ptr<FakeFileSystem> fake_file_system_; | 34 scoped_ptr<FakeFileSystem> fake_file_system_; |
36 }; | 35 }; |
37 | 36 |
38 TEST_F(FakeFileSystemTest, GetFileContentByPath) { | 37 TEST_F(FakeFileSystemTest, GetFileContentByPath) { |
39 FileError initialize_error = FILE_ERROR_FAILED; | 38 FileError initialize_error = FILE_ERROR_FAILED; |
40 scoped_ptr<ResourceEntry> entry; | 39 scoped_ptr<ResourceEntry> entry; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 util::GetDriveMyDriveRootPath().AppendASCII("Invalid File Name"), | 152 util::GetDriveMyDriveRootPath().AppendASCII("Invalid File Name"), |
154 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); | 153 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); |
155 base::RunLoop().RunUntilIdle(); | 154 base::RunLoop().RunUntilIdle(); |
156 | 155 |
157 ASSERT_EQ(FILE_ERROR_NOT_FOUND, error); | 156 ASSERT_EQ(FILE_ERROR_NOT_FOUND, error); |
158 ASSERT_FALSE(entry); | 157 ASSERT_FALSE(entry); |
159 } | 158 } |
160 | 159 |
161 } // namespace test_util | 160 } // namespace test_util |
162 } // namespace drive | 161 } // namespace drive |
OLD | NEW |