| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/extensions/file_browser_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_event_rou
ter.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" | 8 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
| 9 #include "chrome/browser/chromeos/extensions/file_browser_private_api_factory.h" | 9 #include "chrome/browser/chromeos/extensions/file_browser_private_api_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "chromeos/disks/disk_mount_manager.h" | 14 #include "chromeos/disks/disk_mount_manager.h" |
| 15 #include "chromeos/disks/mock_disk_mount_manager.h" | 15 #include "chromeos/disks/mock_disk_mount_manager.h" |
| 16 | 16 |
| 17 using testing::_; | 17 using testing::_; |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 namespace disks { | 20 namespace disks { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class FileBrowserEventRouterBrowserTest : public InProcessBrowserTest { | 23 class FileManagerEventRouterBrowserTest : public InProcessBrowserTest { |
| 24 public: | 24 public: |
| 25 // ExtensionApiTest override | 25 // ExtensionApiTest override |
| 26 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 26 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 27 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 27 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 28 | 28 |
| 29 disk_mount_manager_mock_ = new MockDiskMountManager; | 29 disk_mount_manager_mock_ = new MockDiskMountManager; |
| 30 chromeos::disks::DiskMountManager::InitializeForTesting( | 30 chromeos::disks::DiskMountManager::InitializeForTesting( |
| 31 disk_mount_manager_mock_); | 31 disk_mount_manager_mock_); |
| 32 disk_mount_manager_mock_->SetupDefaultReplies(); | 32 disk_mount_manager_mock_->SetupDefaultReplies(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 MockDiskMountManager* disk_mount_manager_mock_; | 35 MockDiskMountManager* disk_mount_manager_mock_; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 IN_PROC_BROWSER_TEST_F(FileBrowserEventRouterBrowserTest, | 38 IN_PROC_BROWSER_TEST_F(FileManagerEventRouterBrowserTest, |
| 39 ExternalStoragePolicyTest) { | 39 ExternalStoragePolicyTest) { |
| 40 FileBrowserPrivateAPI* file_browser = | 40 FileBrowserPrivateAPI* file_browser = |
| 41 FileBrowserPrivateAPIFactory::GetForProfile(browser()->profile()); | 41 FileBrowserPrivateAPIFactory::GetForProfile(browser()->profile()); |
| 42 FileBrowserEventRouter* event_router = | 42 FileManagerEventRouter* event_router = |
| 43 file_browser->event_router(); | 43 file_browser->event_router(); |
| 44 | 44 |
| 45 DiskMountManager::DiskEvent event = DiskMountManager::DISK_ADDED; | 45 DiskMountManager::DiskEvent event = DiskMountManager::DISK_ADDED; |
| 46 // Prepare a fake disk. All that matters here is that the mount point is empty | 46 // Prepare a fake disk. All that matters here is that the mount point is empty |
| 47 // but the device path is not so that it will exercise the path we care about. | 47 // but the device path is not so that it will exercise the path we care about. |
| 48 DiskMountManager::Disk disk( | 48 DiskMountManager::Disk disk( |
| 49 "fake_path", "", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", | 49 "fake_path", "", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", |
| 50 chromeos::DEVICE_TYPE_USB, 1, false, false, true, false, false); | 50 chromeos::DEVICE_TYPE_USB, 1, false, false, true, false, false); |
| 51 | 51 |
| 52 // First we set the policy to prevent storage mounting and check that the | 52 // First we set the policy to prevent storage mounting and check that the |
| (...skipping 12 matching lines...) Expand all Loading... |
| 65 EXPECT_CALL(*disk_mount_manager_mock_, | 65 EXPECT_CALL(*disk_mount_manager_mock_, |
| 66 MountPath("fake_path", "", "", chromeos::MOUNT_TYPE_DEVICE)) | 66 MountPath("fake_path", "", "", chromeos::MOUNT_TYPE_DEVICE)) |
| 67 .Times(1); | 67 .Times(1); |
| 68 | 68 |
| 69 event_router->OnDiskEvent(event, &disk); | 69 event_router->OnDiskEvent(event, &disk); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 } // namespace disks | 73 } // namespace disks |
| 74 } // namespace chromeos | 74 } // namespace chromeos |
| OLD | NEW |