OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/file_system_provider/fileapi/file_stream_reade
r.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reade
r.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 extensions::ExtensionRegistry::Get(context)); | 77 extensions::ExtensionRegistry::Get(context)); |
78 } | 78 } |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 class FileSystemProviderFileStreamReader : public testing::Test { | 82 class FileSystemProviderFileStreamReader : public testing::Test { |
83 protected: | 83 protected: |
84 FileSystemProviderFileStreamReader() : profile_(NULL), fake_file_(NULL) {} | 84 FileSystemProviderFileStreamReader() : profile_(NULL), fake_file_(NULL) {} |
85 virtual ~FileSystemProviderFileStreamReader() {} | 85 virtual ~FileSystemProviderFileStreamReader() {} |
86 | 86 |
87 virtual void SetUp() OVERRIDE { | 87 virtual void SetUp() override { |
88 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 88 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
89 profile_manager_.reset( | 89 profile_manager_.reset( |
90 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 90 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
91 ASSERT_TRUE(profile_manager_->SetUp()); | 91 ASSERT_TRUE(profile_manager_->SetUp()); |
92 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); | 92 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); |
93 | 93 |
94 ServiceFactory::GetInstance()->SetTestingFactory(profile_, &CreateService); | 94 ServiceFactory::GetInstance()->SetTestingFactory(profile_, &CreateService); |
95 Service* service = Service::Get(profile_); // Owned by its factory. | 95 Service* service = Service::Get(profile_); // Owned by its factory. |
96 service->SetFileSystemFactoryForTesting( | 96 service->SetFileSystemFactoryForTesting( |
97 base::Bind(&FakeProvidedFileSystem::Create)); | 97 base::Bind(&FakeProvidedFileSystem::Create)); |
(...skipping 17 matching lines...) Expand all Loading... |
115 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); | 115 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); |
116 | 116 |
117 file_url_ = CreateFileSystemURL( | 117 file_url_ = CreateFileSystemURL( |
118 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); | 118 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); |
119 ASSERT_TRUE(file_url_.is_valid()); | 119 ASSERT_TRUE(file_url_.is_valid()); |
120 wrong_file_url_ = CreateFileSystemURL( | 120 wrong_file_url_ = CreateFileSystemURL( |
121 mount_point_name, base::FilePath::FromUTF8Unsafe("im-not-here.txt")); | 121 mount_point_name, base::FilePath::FromUTF8Unsafe("im-not-here.txt")); |
122 ASSERT_TRUE(wrong_file_url_.is_valid()); | 122 ASSERT_TRUE(wrong_file_url_.is_valid()); |
123 } | 123 } |
124 | 124 |
125 virtual void TearDown() OVERRIDE { | 125 virtual void TearDown() override { |
126 // Setting the testing factory to NULL will destroy the created service | 126 // Setting the testing factory to NULL will destroy the created service |
127 // associated with the testing profile. | 127 // associated with the testing profile. |
128 ServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL); | 128 ServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL); |
129 } | 129 } |
130 | 130 |
131 content::TestBrowserThreadBundle thread_bundle_; | 131 content::TestBrowserThreadBundle thread_bundle_; |
132 base::ScopedTempDir data_dir_; | 132 base::ScopedTempDir data_dir_; |
133 scoped_ptr<TestingProfileManager> profile_manager_; | 133 scoped_ptr<TestingProfileManager> profile_manager_; |
134 TestingProfile* profile_; // Owned by TestingProfileManager. | 134 TestingProfile* profile_; // Owned by TestingProfileManager. |
135 const FakeEntry* fake_file_; // Owned by FakePRovidedFileSystem. | 135 const FakeEntry* fake_file_; // Owned by FakePRovidedFileSystem. |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 EXPECT_EQ(net::ERR_IO_PENDING, result); | 364 EXPECT_EQ(net::ERR_IO_PENDING, result); |
365 base::RunLoop().RunUntilIdle(); | 365 base::RunLoop().RunUntilIdle(); |
366 | 366 |
367 ASSERT_EQ(1u, logger.results().size()); | 367 ASSERT_EQ(1u, logger.results().size()); |
368 EXPECT_LT(0, logger.results()[0]); | 368 EXPECT_LT(0, logger.results()[0]); |
369 EXPECT_EQ(fake_file_->metadata->size, logger.results()[0]); | 369 EXPECT_EQ(fake_file_->metadata->size, logger.results()[0]); |
370 } | 370 } |
371 | 371 |
372 } // namespace file_system_provider | 372 } // namespace file_system_provider |
373 } // namespace chromeos | 373 } // namespace chromeos |
OLD | NEW |