| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return device.autorelease(); | 231 return device.autorelease(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void DetachDevice(chrome::ImageCaptureDeviceManager* manager, | 234 void DetachDevice(chrome::ImageCaptureDeviceManager* manager, |
| 235 ICCameraDevice* device) { | 235 ICCameraDevice* device) { |
| 236 id<ICDeviceBrowserDelegate> delegate = manager->device_browser(); | 236 id<ICDeviceBrowserDelegate> delegate = manager->device_browser(); |
| 237 [delegate deviceBrowser:nil didRemoveDevice:device moreGoing:NO]; | 237 [delegate deviceBrowser:nil didRemoveDevice:device moreGoing:NO]; |
| 238 } | 238 } |
| 239 | 239 |
| 240 protected: | 240 protected: |
| 241 MessageLoopForUI message_loop_; | 241 base::MessageLoopForUI message_loop_; |
| 242 scoped_ptr<content::TestBrowserThread> ui_thread_; | 242 scoped_ptr<content::TestBrowserThread> ui_thread_; |
| 243 chrome::test::TestStorageMonitor monitor_; | 243 chrome::test::TestStorageMonitor monitor_; |
| 244 TestCameraListener listener_; | 244 TestCameraListener listener_; |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 TEST_F(ImageCaptureDeviceManagerTest, TestAttachDetach) { | 247 TEST_F(ImageCaptureDeviceManagerTest, TestAttachDetach) { |
| 248 chrome::ImageCaptureDeviceManager manager; | 248 chrome::ImageCaptureDeviceManager manager; |
| 249 manager.SetNotifications(monitor_.receiver()); | 249 manager.SetNotifications(monitor_.receiver()); |
| 250 ICCameraDevice* device = AttachDevice(&manager); | 250 ICCameraDevice* device = AttachDevice(&manager); |
| 251 std::vector<chrome::StorageInfo> devices = monitor_.GetAttachedStorage(); | 251 std::vector<chrome::StorageInfo> devices = monitor_.GetAttachedStorage(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 EXPECT_EQ(kTestFileName, listener_.downloads()[1]); | 361 EXPECT_EQ(kTestFileName, listener_.downloads()[1]); |
| 362 ASSERT_EQ(base::PLATFORM_FILE_OK, listener_.last_error()); | 362 ASSERT_EQ(base::PLATFORM_FILE_OK, listener_.last_error()); |
| 363 char file_contents[5]; | 363 char file_contents[5]; |
| 364 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, | 364 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, |
| 365 strlen(kTestFileContents))); | 365 strlen(kTestFileContents))); |
| 366 EXPECT_EQ(kTestFileContents, | 366 EXPECT_EQ(kTestFileContents, |
| 367 std::string(file_contents, strlen(kTestFileContents))); | 367 std::string(file_contents, strlen(kTestFileContents))); |
| 368 | 368 |
| 369 [camera didRemoveDevice:device]; | 369 [camera didRemoveDevice:device]; |
| 370 } | 370 } |
| OLD | NEW |