| 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 | 5 |
| 6 #import <Foundation/Foundation.h> | 6 #import <Foundation/Foundation.h> |
| 7 #import <ImageCaptureCore/ImageCaptureCore.h> | 7 #import <ImageCaptureCore/ImageCaptureCore.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 base::MessageLoopForUI message_loop_; | 279 base::MessageLoopForUI message_loop_; |
| 280 scoped_ptr<content::TestBrowserThread> ui_thread_; | 280 scoped_ptr<content::TestBrowserThread> ui_thread_; |
| 281 chrome::test::TestStorageMonitor monitor_; | 281 chrome::test::TestStorageMonitor monitor_; |
| 282 TestCameraListener listener_; | 282 TestCameraListener listener_; |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 TEST_F(ImageCaptureDeviceManagerTest, TestAttachDetach) { | 285 TEST_F(ImageCaptureDeviceManagerTest, TestAttachDetach) { |
| 286 chrome::ImageCaptureDeviceManager manager; | 286 chrome::ImageCaptureDeviceManager manager; |
| 287 manager.SetNotifications(monitor_.receiver()); | 287 manager.SetNotifications(monitor_.receiver()); |
| 288 ICCameraDevice* device = AttachDevice(&manager); | 288 ICCameraDevice* device = AttachDevice(&manager); |
| 289 std::vector<chrome::StorageInfo> devices = monitor_.GetAttachedStorage(); | 289 std::vector<chrome::StorageInfo> devices = |
| 290 monitor_.GetAttachedRemovableStorages(); |
| 290 | 291 |
| 291 ASSERT_EQ(1U, devices.size()); | 292 ASSERT_EQ(1U, devices.size()); |
| 292 EXPECT_EQ(std::string("ic:") + kDeviceId, devices[0].device_id()); | 293 EXPECT_EQ(std::string("ic:") + kDeviceId, devices[0].device_id()); |
| 293 | 294 |
| 294 DetachDevice(&manager, device); | 295 DetachDevice(&manager, device); |
| 295 devices = monitor_.GetAttachedStorage(); | 296 devices = monitor_.GetAttachedRemovableStorages(); |
| 296 ASSERT_EQ(0U, devices.size()); | 297 ASSERT_EQ(0U, devices.size()); |
| 297 }; | 298 }; |
| 298 | 299 |
| 299 TEST_F(ImageCaptureDeviceManagerTest, OpenCamera) { | 300 TEST_F(ImageCaptureDeviceManagerTest, OpenCamera) { |
| 300 chrome::ImageCaptureDeviceManager manager; | 301 chrome::ImageCaptureDeviceManager manager; |
| 301 manager.SetNotifications(monitor_.receiver()); | 302 manager.SetNotifications(monitor_.receiver()); |
| 302 ICCameraDevice* device = AttachDevice(&manager); | 303 ICCameraDevice* device = AttachDevice(&manager); |
| 303 | 304 |
| 304 EXPECT_FALSE(chrome::ImageCaptureDeviceManager::deviceForUUID( | 305 EXPECT_FALSE(chrome::ImageCaptureDeviceManager::deviceForUUID( |
| 305 "nonexistent")); | 306 "nonexistent")); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 message_loop_.RunUntilIdle(); | 440 message_loop_.RunUntilIdle(); |
| 440 | 441 |
| 441 char file_contents[5]; | 442 char file_contents[5]; |
| 442 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, | 443 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, |
| 443 strlen(kTestFileContents))); | 444 strlen(kTestFileContents))); |
| 444 EXPECT_EQ(kTestFileContents, | 445 EXPECT_EQ(kTestFileContents, |
| 445 std::string(file_contents, strlen(kTestFileContents))); | 446 std::string(file_contents, strlen(kTestFileContents))); |
| 446 | 447 |
| 447 [camera didRemoveDevice:device]; | 448 [camera didRemoveDevice:device]; |
| 448 } | 449 } |
| OLD | NEW |