| 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 "components/storage_monitor/storage_monitor_chromeos.h" | 5 #include "components/storage_monitor/storage_monitor_chromeos.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chromeos/disks/mock_disk_mount_manager.h" | 18 #include "chromeos/disks/mock_disk_mount_manager.h" |
| 19 #include "components/storage_monitor/mock_removable_storage_observer.h" | 19 #include "components/storage_monitor/mock_removable_storage_observer.h" |
| 20 #include "components/storage_monitor/removable_device_constants.h" | 20 #include "components/storage_monitor/removable_device_constants.h" |
| 21 #include "components/storage_monitor/storage_info.h" | 21 #include "components/storage_monitor/storage_info.h" |
| 22 #include "components/storage_monitor/test_media_transfer_protocol_manager_linux.
h" | 22 #include "components/storage_monitor/test_media_transfer_protocol_manager_chrome
os.h" |
| 23 #include "components/storage_monitor/test_storage_monitor.h" | 23 #include "components/storage_monitor/test_storage_monitor.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/test/test_browser_thread_bundle.h" | 25 #include "content/public/test/test_browser_thread_bundle.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 namespace storage_monitor { | 28 namespace storage_monitor { |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 using content::BrowserThread; | 32 using content::BrowserThread; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 61 | 61 |
| 62 // A test version of StorageMonitorCros that exposes protected methods to tests. | 62 // A test version of StorageMonitorCros that exposes protected methods to tests. |
| 63 class TestStorageMonitorCros : public StorageMonitorCros { | 63 class TestStorageMonitorCros : public StorageMonitorCros { |
| 64 public: | 64 public: |
| 65 TestStorageMonitorCros() {} | 65 TestStorageMonitorCros() {} |
| 66 | 66 |
| 67 ~TestStorageMonitorCros() override {} | 67 ~TestStorageMonitorCros() override {} |
| 68 | 68 |
| 69 void Init() override { | 69 void Init() override { |
| 70 SetMediaTransferProtocolManagerForTest( | 70 SetMediaTransferProtocolManagerForTest( |
| 71 new TestMediaTransferProtocolManagerLinux()); | 71 new TestMediaTransferProtocolManagerChromeOS()); |
| 72 StorageMonitorCros::Init(); | 72 StorageMonitorCros::Init(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void OnMountEvent( | 75 void OnMountEvent( |
| 76 DiskMountManager::MountEvent event, | 76 DiskMountManager::MountEvent event, |
| 77 chromeos::MountError error_code, | 77 chromeos::MountError error_code, |
| 78 const DiskMountManager::MountPointInfo& mount_info) override { | 78 const DiskMountManager::MountPointInfo& mount_info) override { |
| 79 StorageMonitorCros::OnMountEvent(event, error_code, mount_info); | 79 StorageMonitorCros::OnMountEvent(event, error_code, mount_info); |
| 80 } | 80 } |
| 81 | 81 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 base::Bind(&StorageMonitorCrosTest::EjectNotify, | 550 base::Bind(&StorageMonitorCrosTest::EjectNotify, |
| 551 base::Unretained(this))); | 551 base::Unretained(this))); |
| 552 base::RunLoop().RunUntilIdle(); | 552 base::RunLoop().RunUntilIdle(); |
| 553 | 553 |
| 554 EXPECT_EQ(StorageMonitor::EJECT_OK, status_); | 554 EXPECT_EQ(StorageMonitor::EJECT_OK, status_); |
| 555 } | 555 } |
| 556 | 556 |
| 557 } // namespace | 557 } // namespace |
| 558 | 558 |
| 559 } // namespace storage_monitor | 559 } // namespace storage_monitor |
| OLD | NEW |