OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "chromeos/dbus/fake_cros_disks_client.h" | 7 #include "chromeos/dbus/fake_cros_disks_client.h" |
8 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 8 #include "chromeos/dbus/fake_dbus_thread_manager.h" |
9 #include "chromeos/disks/disk_mount_manager.h" | 9 #include "chromeos/disks/disk_mount_manager.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 class DiskMountManagerTest : public testing::Test { | 115 class DiskMountManagerTest : public testing::Test { |
116 public: | 116 public: |
117 DiskMountManagerTest() {} | 117 DiskMountManagerTest() {} |
118 virtual ~DiskMountManagerTest() {} | 118 virtual ~DiskMountManagerTest() {} |
119 | 119 |
120 // Sets up test dbus tread manager and disks mount manager. | 120 // Sets up test dbus tread manager and disks mount manager. |
121 // Initializes disk mount manager disks and mount points. | 121 // Initializes disk mount manager disks and mount points. |
122 // Adds a test observer to the disk mount manager. | 122 // Adds a test observer to the disk mount manager. |
123 virtual void SetUp() { | 123 virtual void SetUp() { |
124 FakeDBusThreadManager* fake_thread_manager = new FakeDBusThreadManager(); | 124 FakeDBusThreadManager* fake_thread_manager = new FakeDBusThreadManager(); |
| 125 fake_cros_disks_client_ = new FakeCrosDisksClient; |
| 126 fake_thread_manager->SetCrosDisksClient( |
| 127 scoped_ptr<CrosDisksClient>(fake_cros_disks_client_)); |
| 128 |
125 DBusThreadManager::InitializeForTesting(fake_thread_manager); | 129 DBusThreadManager::InitializeForTesting(fake_thread_manager); |
126 | 130 |
127 fake_cros_disks_client_ = fake_thread_manager->fake_cros_disks_client(); | |
128 | |
129 DiskMountManager::Initialize(); | 131 DiskMountManager::Initialize(); |
130 | 132 |
131 InitDisksAndMountPoints(); | 133 InitDisksAndMountPoints(); |
132 | 134 |
133 DiskMountManager::GetInstance()->AddObserver(&observer_); | 135 DiskMountManager::GetInstance()->AddObserver(&observer_); |
134 } | 136 } |
135 | 137 |
136 // Shuts down dbus thread manager and disk moutn manager used in the test. | 138 // Shuts down dbus thread manager and disk moutn manager used in the test. |
137 virtual void TearDown() { | 139 virtual void TearDown() { |
138 DiskMountManager::GetInstance()->RemoveObserver(&observer_); | 140 DiskMountManager::GetInstance()->RemoveObserver(&observer_); |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 fake_cros_disks_client_->last_format_device_device_path()); | 625 fake_cros_disks_client_->last_format_device_device_path()); |
624 EXPECT_EQ("vfat", | 626 EXPECT_EQ("vfat", |
625 fake_cros_disks_client_->last_format_device_filesystem()); | 627 fake_cros_disks_client_->last_format_device_filesystem()); |
626 | 628 |
627 // Simulate cros_disks reporting success. | 629 // Simulate cros_disks reporting success. |
628 fake_cros_disks_client_->SendMountEvent( | 630 fake_cros_disks_client_->SendMountEvent( |
629 chromeos::CROS_DISKS_FORMATTING_FINISHED, "/device/source_path"); | 631 chromeos::CROS_DISKS_FORMATTING_FINISHED, "/device/source_path"); |
630 } | 632 } |
631 | 633 |
632 } // namespace | 634 } // namespace |
OLD | NEW |