| 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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
| 6 #import <ImageCaptureCore/ImageCaptureCore.h> | 6 #import <ImageCaptureCore/ImageCaptureCore.h> |
| 7 | 7 |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/mac/cocoa_protocols.h" | 11 #include "base/mac/cocoa_protocols.h" |
| 12 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
| 13 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 14 #include "base/mac/sdk_forward_declarations.h" |
| 14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 16 #include "base/strings/sys_string_conversions.h" | 17 #include "base/strings/sys_string_conversions.h" |
| 17 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/test/sequenced_worker_pool_owner.h" | 19 #include "base/test/sequenced_worker_pool_owner.h" |
| 19 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
| 20 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h" | 21 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h" |
| 21 #include "components/storage_monitor/image_capture_device_manager.h" | 22 #include "components/storage_monitor/image_capture_device_manager.h" |
| 22 #include "components/storage_monitor/test_storage_monitor.h" | 23 #include "components/storage_monitor/test_storage_monitor.h" |
| 23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/test/test_browser_thread.h" | 25 #include "content/public/test/test_browser_thread.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 27 |
| 27 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
| 28 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
| 29 | |
| 30 @interface NSObject (ICCameraDeviceDelegateLionAPI) | |
| 31 - (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device; | |
| 32 - (void)didDownloadFile:(ICCameraFile*)file | |
| 33 error:(NSError*)error | |
| 34 options:(NSDictionary*)options | |
| 35 contextInfo:(void*)contextInfo; | |
| 36 @end | |
| 37 | |
| 38 #endif // 10.6 | |
| 39 | |
| 40 namespace { | 28 namespace { |
| 41 | 29 |
| 42 const char kDeviceId[] = "id"; | 30 const char kDeviceId[] = "id"; |
| 43 const char kDevicePath[] = "/ic:id"; | 31 const char kDevicePath[] = "/ic:id"; |
| 44 const char kTestFileContents[] = "test"; | 32 const char kTestFileContents[] = "test"; |
| 45 | 33 |
| 46 } // namespace | 34 } // namespace |
| 47 | 35 |
| 48 @interface MockMTPICCameraDevice : ICCameraDevice { | 36 @interface MockMTPICCameraDevice : ICCameraDevice { |
| 49 @private | 37 @private |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 temp_dir_.path().Append("target"))); | 543 temp_dir_.path().Append("target"))); |
| 556 | 544 |
| 557 EXPECT_EQ(base::File::FILE_OK, | 545 EXPECT_EQ(base::File::FILE_OK, |
| 558 DownloadFile(base::FilePath("/ic:id/filename"), | 546 DownloadFile(base::FilePath("/ic:id/filename"), |
| 559 temp_dir_.path().Append("target"))); | 547 temp_dir_.path().Append("target"))); |
| 560 std::string contents; | 548 std::string contents; |
| 561 EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"), | 549 EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"), |
| 562 &contents)); | 550 &contents)); |
| 563 EXPECT_EQ(kTestFileContents, contents); | 551 EXPECT_EQ(kTestFileContents, contents); |
| 564 } | 552 } |
| OLD | NEW |