| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return device.autorelease(); | 269 return device.autorelease(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void DetachDevice(chrome::ImageCaptureDeviceManager* manager, | 272 void DetachDevice(chrome::ImageCaptureDeviceManager* manager, |
| 273 ICCameraDevice* device) { | 273 ICCameraDevice* device) { |
| 274 id<ICDeviceBrowserDelegate> delegate = manager->device_browser(); | 274 id<ICDeviceBrowserDelegate> delegate = manager->device_browser(); |
| 275 [delegate deviceBrowser:nil didRemoveDevice:device moreGoing:NO]; | 275 [delegate deviceBrowser:nil didRemoveDevice:device moreGoing:NO]; |
| 276 } | 276 } |
| 277 | 277 |
| 278 protected: | 278 protected: |
| 279 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 = monitor_.GetAttachedStorage(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 message_loop_.RunUntilIdle(); | 439 message_loop_.RunUntilIdle(); |
| 440 | 440 |
| 441 char file_contents[5]; | 441 char file_contents[5]; |
| 442 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, | 442 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, |
| 443 strlen(kTestFileContents))); | 443 strlen(kTestFileContents))); |
| 444 EXPECT_EQ(kTestFileContents, | 444 EXPECT_EQ(kTestFileContents, |
| 445 std::string(file_contents, strlen(kTestFileContents))); | 445 std::string(file_contents, strlen(kTestFileContents))); |
| 446 | 446 |
| 447 [camera didRemoveDevice:device]; | 447 [camera didRemoveDevice:device]; |
| 448 } | 448 } |
| OLD | NEW |