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 // RemovableDeviceNotificationsLinux unit tests. | 5 // RemovableDeviceNotificationsLinux unit tests. |
6 | 6 |
7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" | 7 #include "chrome/browser/system_monitor/removable_device_notifications_linux.h" |
8 | 8 |
9 #include <mntent.h> | 9 #include <mntent.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/files/scoped_temp_dir.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
18 #include "base/scoped_temp_dir.h" | |
19 #include "base/system_monitor/system_monitor.h" | 19 #include "base/system_monitor/system_monitor.h" |
20 #include "base/test/mock_devices_changed_observer.h" | 20 #include "base/test/mock_devices_changed_observer.h" |
21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
22 #include "chrome/browser/system_monitor/media_storage_util.h" | 22 #include "chrome/browser/system_monitor/media_storage_util.h" |
23 #include "chrome/browser/system_monitor/removable_device_constants.h" | 23 #include "chrome/browser/system_monitor/removable_device_constants.h" |
24 #include "content/public/test/test_browser_thread.h" | 24 #include "content/public/test/test_browser_thread.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 namespace chrome { | 27 namespace chrome { |
28 | 28 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 // The message loop and file thread to run tests on. | 289 // The message loop and file thread to run tests on. |
290 MessageLoop message_loop_; | 290 MessageLoop message_loop_; |
291 content::TestBrowserThread file_thread_; | 291 content::TestBrowserThread file_thread_; |
292 | 292 |
293 // SystemMonitor and DevicesChangedObserver to hook together to test. | 293 // SystemMonitor and DevicesChangedObserver to hook together to test. |
294 base::SystemMonitor system_monitor_; | 294 base::SystemMonitor system_monitor_; |
295 scoped_ptr<base::MockDevicesChangedObserver> mock_devices_changed_observer_; | 295 scoped_ptr<base::MockDevicesChangedObserver> mock_devices_changed_observer_; |
296 | 296 |
297 // Temporary directory for created test data. | 297 // Temporary directory for created test data. |
298 ScopedTempDir scoped_temp_dir_; | 298 base::ScopedTempDir scoped_temp_dir_; |
299 // Path to the test mtab file. | 299 // Path to the test mtab file. |
300 FilePath mtab_file_; | 300 FilePath mtab_file_; |
301 | 301 |
302 scoped_refptr<RemovableDeviceNotificationsLinuxTestWrapper> notifications_; | 302 scoped_refptr<RemovableDeviceNotificationsLinuxTestWrapper> notifications_; |
303 | 303 |
304 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationLinuxTest); | 304 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationLinuxTest); |
305 }; | 305 }; |
306 | 306 |
307 // Simple test case where we attach and detach a media device. | 307 // Simple test case where we attach and detach a media device. |
308 TEST_F(RemovableDeviceNotificationLinuxTest, BasicAttachDetach) { | 308 TEST_F(RemovableDeviceNotificationLinuxTest, BasicAttachDetach) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 EXPECT_TRUE(notifier()->GetDeviceInfoForPath(test_path_b, &device_info)); | 630 EXPECT_TRUE(notifier()->GetDeviceInfoForPath(test_path_b, &device_info)); |
631 EXPECT_EQ(GetDeviceId(kDeviceFixed), device_info.device_id); | 631 EXPECT_EQ(GetDeviceId(kDeviceFixed), device_info.device_id); |
632 | 632 |
633 EXPECT_TRUE(notifier()->GetDeviceInfoForPath(test_path_c, &device_info)); | 633 EXPECT_TRUE(notifier()->GetDeviceInfoForPath(test_path_c, &device_info)); |
634 EXPECT_EQ(GetDeviceId(kDeviceFixed), device_info.device_id); | 634 EXPECT_EQ(GetDeviceId(kDeviceFixed), device_info.device_id); |
635 } | 635 } |
636 | 636 |
637 } // namespace | 637 } // namespace |
638 | 638 |
639 } // namespace chrome | 639 } // namespace chrome |
OLD | NEW |