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 "chrome/browser/system_monitor/removable_device_notifications_mac.h" | 5 #include "chrome/browser/system_monitor/removable_device_notifications_mac.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/power_monitor/power_monitor.h" | |
10 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
11 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
12 #include "base/system_monitor/system_monitor.h" | 13 #include "base/system_monitor/system_monitor.h" |
13 #include "base/test/mock_devices_changed_observer.h" | 14 #include "base/test/mock_devices_changed_observer.h" |
14 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/system_monitor/media_storage_util.h" | 16 #include "chrome/browser/system_monitor/media_storage_util.h" |
16 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace chrome { | 20 namespace chrome { |
(...skipping 21 matching lines...) Expand all Loading... | |
41 } // namespace | 42 } // namespace |
42 | 43 |
43 class RemovableDeviceNotificationsMacTest : public testing::Test { | 44 class RemovableDeviceNotificationsMacTest : public testing::Test { |
44 public: | 45 public: |
45 RemovableDeviceNotificationsMacTest() | 46 RemovableDeviceNotificationsMacTest() |
46 : message_loop_(MessageLoop::TYPE_IO), | 47 : message_loop_(MessageLoop::TYPE_IO), |
47 file_thread_(content::BrowserThread::FILE, &message_loop_) { | 48 file_thread_(content::BrowserThread::FILE, &message_loop_) { |
48 } | 49 } |
49 | 50 |
50 virtual void SetUp() OVERRIDE { | 51 virtual void SetUp() OVERRIDE { |
51 base::SystemMonitor::AllocateSystemIOPorts(); | 52 base::PowerMonitor::AllocateSystemIOPorts(); |
vandebo (ex-Chrome)
2012/10/12 22:12:30
Just remove this line. This test doesn't use Powe
Hongbo Min
2012/10/13 06:36:07
Done.
| |
52 system_monitor_.reset(new base::SystemMonitor()); | 53 system_monitor_.reset(new base::SystemMonitor()); |
53 | 54 |
54 mock_devices_changed_observer_.reset(new base::MockDevicesChangedObserver); | 55 mock_devices_changed_observer_.reset(new base::MockDevicesChangedObserver); |
55 system_monitor_->AddDevicesChangedObserver( | 56 system_monitor_->AddDevicesChangedObserver( |
56 mock_devices_changed_observer_.get()); | 57 mock_devices_changed_observer_.get()); |
57 | 58 |
58 notifications_ = new RemovableDeviceNotificationsMac; | 59 notifications_ = new RemovableDeviceNotificationsMac; |
59 | 60 |
60 unique_id_ = "test_id"; | 61 unique_id_ = "test_id"; |
61 display_name_ = ASCIIToUTF16("Test Display Name"); | 62 display_name_ = ASCIIToUTF16("Test Display Name"); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 mount_point_.AppendASCII("foo"), &info)); | 169 mount_point_.AppendASCII("foo"), &info)); |
169 EXPECT_EQ(info.device_id, device_id_); | 170 EXPECT_EQ(info.device_id, device_id_); |
170 EXPECT_EQ(info.name, display_name_); | 171 EXPECT_EQ(info.name, display_name_); |
171 EXPECT_EQ(info.location, mount_point_.value()); | 172 EXPECT_EQ(info.location, mount_point_.value()); |
172 | 173 |
173 EXPECT_FALSE(notifications_->GetDeviceInfoForPath( | 174 EXPECT_FALSE(notifications_->GetDeviceInfoForPath( |
174 FilePath("/non/matching/path"), &info)); | 175 FilePath("/non/matching/path"), &info)); |
175 } | 176 } |
176 | 177 |
177 } // namespace chrome | 178 } // namespace chrome |
OLD | NEW |