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 // chromeos::RemovableDeviceNotificationsCros unit tests. | 5 // chromeos::RemovableDeviceNotificationsCros unit tests. |
6 | 6 |
7 #include "chrome/browser/system_monitor/removable_device_notifications_chromeos.
h" | 7 #include "chrome/browser/system_monitor/removable_device_notifications_chromeos.
h" |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
13 #include "base/scoped_temp_dir.h" | |
14 #include "base/system_monitor/system_monitor.h" | 14 #include "base/system_monitor/system_monitor.h" |
15 #include "base/test/mock_devices_changed_observer.h" | 15 #include "base/test/mock_devices_changed_observer.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/browser/system_monitor/media_storage_util.h" | 17 #include "chrome/browser/system_monitor/media_storage_util.h" |
18 #include "chrome/browser/system_monitor/removable_device_constants.h" | 18 #include "chrome/browser/system_monitor/removable_device_constants.h" |
19 #include "chromeos/disks/mock_disk_mount_manager.h" | 19 #include "chromeos/disks/mock_disk_mount_manager.h" |
20 #include "content/public/test/test_browser_thread.h" | 20 #include "content/public/test/test_browser_thread.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 MessageLoop::current()->Run(); | 159 MessageLoop::current()->Run(); |
160 } | 160 } |
161 | 161 |
162 private: | 162 private: |
163 // The message loops and threads to run tests on. | 163 // The message loops and threads to run tests on. |
164 MessageLoop ui_loop_; | 164 MessageLoop ui_loop_; |
165 content::TestBrowserThread ui_thread_; | 165 content::TestBrowserThread ui_thread_; |
166 content::TestBrowserThread file_thread_; | 166 content::TestBrowserThread file_thread_; |
167 | 167 |
168 // Temporary directory for created test data. | 168 // Temporary directory for created test data. |
169 ScopedTempDir scoped_temp_dir_; | 169 base::ScopedTempDir scoped_temp_dir_; |
170 | 170 |
171 // Objects that talks with RemovableDeviceNotificationsCros. | 171 // Objects that talks with RemovableDeviceNotificationsCros. |
172 base::SystemMonitor system_monitor_; | 172 base::SystemMonitor system_monitor_; |
173 scoped_ptr<base::MockDevicesChangedObserver> mock_devices_changed_observer_; | 173 scoped_ptr<base::MockDevicesChangedObserver> mock_devices_changed_observer_; |
174 // Owned by DiskMountManager. | 174 // Owned by DiskMountManager. |
175 disks::MockDiskMountManager* disk_mount_manager_mock_; | 175 disks::MockDiskMountManager* disk_mount_manager_mock_; |
176 | 176 |
177 scoped_refptr<RemovableDeviceNotificationsCros> notifications_; | 177 scoped_refptr<RemovableDeviceNotificationsCros> notifications_; |
178 | 178 |
179 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCrosTest); | 179 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsCrosTest); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 EXPECT_EQ(kDevice1SizeInBytes, GetDeviceStorageSize(mount_path1.value())); | 354 EXPECT_EQ(kDevice1SizeInBytes, GetDeviceStorageSize(mount_path1.value())); |
355 EXPECT_CALL(observer(), | 355 EXPECT_CALL(observer(), |
356 OnRemovableStorageDetached(GetDCIMDeviceId(kUniqueId1))) | 356 OnRemovableStorageDetached(GetDCIMDeviceId(kUniqueId1))) |
357 .InSequence(mock_sequence); | 357 .InSequence(mock_sequence); |
358 UnmountDevice(MOUNT_ERROR_NONE, mount_info); | 358 UnmountDevice(MOUNT_ERROR_NONE, mount_info); |
359 } | 359 } |
360 | 360 |
361 } // namespace | 361 } // namespace |
362 | 362 |
363 } // namespace chrome | 363 } // namespace chrome |
OLD | NEW |