| 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 // TODO(mtomasz): Move these test cases to operations/unmount_unittest.cc. | 5 // TODO(mtomasz): Move these test cases to operations/unmount_unittest.cc. |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" | 7 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 namespace chromeos { | 26 namespace chromeos { |
| 27 namespace file_system_provider { | 27 namespace file_system_provider { |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; | 31 const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; |
| 32 const int kExpectedRequestId = 1; | 32 const int kExpectedRequestId = 1; |
| 33 const char kFileSystemId[] = "camera-pictures"; | 33 const char kFileSystemId[] = "camera-pictures"; |
| 34 const char kFileSystemName[] = "Camera Pictures"; | 34 const char kDisplayName[] = "Camera Pictures"; |
| 35 | 35 |
| 36 class FakeEventRouter : public extensions::EventRouter { | 36 class FakeEventRouter : public extensions::EventRouter { |
| 37 public: | 37 public: |
| 38 explicit FakeEventRouter(Profile* profile) : EventRouter(profile, NULL) {} | 38 explicit FakeEventRouter(Profile* profile) : EventRouter(profile, NULL) {} |
| 39 virtual ~FakeEventRouter() {} | 39 virtual ~FakeEventRouter() {} |
| 40 | 40 |
| 41 virtual void DispatchEventToExtension(const std::string& extension_id, | 41 virtual void DispatchEventToExtension(const std::string& extension_id, |
| 42 scoped_ptr<extensions::Event> event) | 42 scoped_ptr<extensions::Event> event) |
| 43 OVERRIDE { | 43 OVERRIDE { |
| 44 extension_id_ = extension_id; | 44 extension_id_ = extension_id; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 profile_.reset(new TestingProfile); | 83 profile_.reset(new TestingProfile); |
| 84 event_router_.reset(new FakeEventRouter(profile_.get())); | 84 event_router_.reset(new FakeEventRouter(profile_.get())); |
| 85 event_router_->AddEventListener( | 85 event_router_->AddEventListener( |
| 86 extensions::api::file_system_provider::OnUnmountRequested::kEventName, | 86 extensions::api::file_system_provider::OnUnmountRequested::kEventName, |
| 87 NULL, | 87 NULL, |
| 88 kExtensionId); | 88 kExtensionId); |
| 89 | 89 |
| 90 const base::FilePath mount_path = | 90 const base::FilePath mount_path = |
| 91 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); | 91 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); |
| 92 file_system_info_.reset(new ProvidedFileSystemInfo( | 92 file_system_info_.reset(new ProvidedFileSystemInfo( |
| 93 kExtensionId, kFileSystemId, kFileSystemName, mount_path)); | 93 kExtensionId, kFileSystemId, kDisplayName, mount_path)); |
| 94 provided_file_system_.reset( | 94 provided_file_system_.reset( |
| 95 new ProvidedFileSystem(event_router_.get(), *file_system_info_.get())); | 95 new ProvidedFileSystem(event_router_.get(), *file_system_info_.get())); |
| 96 } | 96 } |
| 97 | 97 |
| 98 content::TestBrowserThreadBundle thread_bundle_; | 98 content::TestBrowserThreadBundle thread_bundle_; |
| 99 scoped_ptr<TestingProfile> profile_; | 99 scoped_ptr<TestingProfile> profile_; |
| 100 scoped_ptr<FakeEventRouter> event_router_; | 100 scoped_ptr<FakeEventRouter> event_router_; |
| 101 scoped_ptr<ProvidedFileSystemInfo> file_system_info_; | 101 scoped_ptr<ProvidedFileSystemInfo> file_system_info_; |
| 102 scoped_ptr<ProvidedFileSystemInterface> provided_file_system_; | 102 scoped_ptr<ProvidedFileSystemInterface> provided_file_system_; |
| 103 }; | 103 }; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 request_id, base::File::FILE_ERROR_NOT_FOUND); | 171 request_id, base::File::FILE_ERROR_NOT_FOUND); |
| 172 EXPECT_TRUE(reply_result); | 172 EXPECT_TRUE(reply_result); |
| 173 | 173 |
| 174 // Callback should be called. Verify the error code. | 174 // Callback should be called. Verify the error code. |
| 175 ASSERT_TRUE(logger.error()); | 175 ASSERT_TRUE(logger.error()); |
| 176 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error()); | 176 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, *logger.error()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace file_system_provider | 179 } // namespace file_system_provider |
| 180 } // namespace chromeos | 180 } // namespace chromeos |
| OLD | NEW |