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 // MediaDeviceNotificationsLinux unit tests. | 5 // MediaDeviceNotificationsLinux unit tests. |
6 | 6 |
7 #include "chrome/browser/media_gallery/media_device_notifications_linux.h" | 7 #include "chrome/browser/media_gallery/media_device_notifications_linux.h" |
8 | 8 |
9 #include <mntent.h> | 9 #include <mntent.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 OverwriteMtabAndRunLoop(test_data1, arraysize(test_data1)); | 335 OverwriteMtabAndRunLoop(test_data1, arraysize(test_data1)); |
336 | 336 |
337 // Detach all devices. | 337 // Detach all devices. |
338 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); | 338 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
339 EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(2); | 339 EXPECT_CALL(observer(), OnMediaDeviceDetached(_)).Times(2); |
340 WriteEmptyMtabAndRunLoop(); | 340 WriteEmptyMtabAndRunLoop(); |
341 } | 341 } |
342 | 342 |
343 // More complicated test case with multiple devices on one mount point. | 343 // More complicated test case with multiple devices on one mount point. |
344 TEST_F(MediaDeviceNotificationsLinuxTest, MultiDevicesOneMountPoint) { | 344 TEST_F(MediaDeviceNotificationsLinuxTest, MultiDevicesOneMountPoint) { |
345 testing::Sequence mock_sequence; | |
346 FilePath test_path_a = CreateMountPointWithDCIMDir(kMountPointA); | 345 FilePath test_path_a = CreateMountPointWithDCIMDir(kMountPointA); |
347 FilePath test_path_b = CreateMountPointWithDCIMDir(kMountPointB); | 346 FilePath test_path_b = CreateMountPointWithDCIMDir(kMountPointB); |
348 ASSERT_FALSE(test_path_a.empty()); | 347 ASSERT_FALSE(test_path_a.empty()); |
349 ASSERT_FALSE(test_path_b.empty()); | 348 ASSERT_FALSE(test_path_b.empty()); |
350 | 349 |
351 // |kDevice1| is most recently mounted at |kMountPointB|. | 350 // |kDevice1| is most recently mounted at |kMountPointB|. |
352 // kDevice1 -> kMountPointA | 351 // kDevice1 -> kMountPointA |
353 // kDevice2 -> kMountPointB | 352 // kDevice2 -> kMountPointB |
354 // kDevice1 -> kMountPointB | 353 // kDevice1 -> kMountPointB |
355 MtabTestData test_data1[] = { | 354 MtabTestData test_data1[] = { |
(...skipping 24 matching lines...) Expand all Loading... |
380 | 379 |
381 // Detach all devices. | 380 // Detach all devices. |
382 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); | 381 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); |
383 EXPECT_CALL(observer(), OnMediaDeviceDetached(1)).Times(1); | 382 EXPECT_CALL(observer(), OnMediaDeviceDetached(1)).Times(1); |
384 WriteEmptyMtabAndRunLoop(); | 383 WriteEmptyMtabAndRunLoop(); |
385 } | 384 } |
386 | 385 |
387 } // namespace | 386 } // namespace |
388 | 387 |
389 } // namespace chrome | 388 } // namespace chrome |
OLD | NEW |