| 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/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/mac/cocoa_protocols.h" | 10 #include "base/mac/cocoa_protocols.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 virtual void SetUp() OVERRIDE { | 178 virtual void SetUp() OVERRIDE { |
| 179 ui_thread_.reset(new content::TestBrowserThread( | 179 ui_thread_.reset(new content::TestBrowserThread( |
| 180 content::BrowserThread::UI, &message_loop_)); | 180 content::BrowserThread::UI, &message_loop_)); |
| 181 file_thread_.reset(new content::TestBrowserThread( | 181 file_thread_.reset(new content::TestBrowserThread( |
| 182 content::BrowserThread::FILE, &message_loop_)); | 182 content::BrowserThread::FILE, &message_loop_)); |
| 183 io_thread_.reset(new content::TestBrowserThread( | 183 io_thread_.reset(new content::TestBrowserThread( |
| 184 content::BrowserThread::IO)); | 184 content::BrowserThread::IO)); |
| 185 ASSERT_TRUE(io_thread_->Start()); | 185 ASSERT_TRUE(io_thread_->Start()); |
| 186 | 186 |
| 187 manager_.SetNotifications(monitor_.receiver()); | 187 chrome::test::TestStorageMonitor* monitor = |
| 188 chrome::test::TestStorageMonitor::CreateAndInstall(); |
| 189 manager_.SetNotifications(monitor->receiver()); |
| 188 | 190 |
| 189 camera_ = [MockMTPICCameraDevice alloc]; | 191 camera_ = [MockMTPICCameraDevice alloc]; |
| 190 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); | 192 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); |
| 191 [delegate deviceBrowser:nil didAddDevice:camera_ moreComing:NO]; | 193 [delegate deviceBrowser:nil didAddDevice:camera_ moreComing:NO]; |
| 192 | 194 |
| 193 delegate_ = new chrome::MTPDeviceDelegateImplMac(kDeviceId, kDevicePath); | 195 delegate_ = new chrome::MTPDeviceDelegateImplMac(kDeviceId, kDevicePath); |
| 194 } | 196 } |
| 195 | 197 |
| 196 void OnError(base::WaitableEvent* event, base::PlatformFileError error) { | 198 void OnError(base::WaitableEvent* event, base::PlatformFileError error) { |
| 197 error_ = error; | 199 error_ = error; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 io_thread_->Stop(); | 299 io_thread_->Stop(); |
| 298 } | 300 } |
| 299 | 301 |
| 300 protected: | 302 protected: |
| 301 base::MessageLoopForUI message_loop_; | 303 base::MessageLoopForUI message_loop_; |
| 302 // Note: threads must be made in this order: UI > FILE > IO | 304 // Note: threads must be made in this order: UI > FILE > IO |
| 303 scoped_ptr<content::TestBrowserThread> ui_thread_; | 305 scoped_ptr<content::TestBrowserThread> ui_thread_; |
| 304 scoped_ptr<content::TestBrowserThread> file_thread_; | 306 scoped_ptr<content::TestBrowserThread> file_thread_; |
| 305 scoped_ptr<content::TestBrowserThread> io_thread_; | 307 scoped_ptr<content::TestBrowserThread> io_thread_; |
| 306 base::ScopedTempDir temp_dir_; | 308 base::ScopedTempDir temp_dir_; |
| 307 chrome::test::TestStorageMonitor monitor_; | |
| 308 chrome::ImageCaptureDeviceManager manager_; | 309 chrome::ImageCaptureDeviceManager manager_; |
| 309 MockMTPICCameraDevice* camera_; | 310 MockMTPICCameraDevice* camera_; |
| 310 | 311 |
| 311 // This object needs special deletion inside the above |task_runner_|. | 312 // This object needs special deletion inside the above |task_runner_|. |
| 312 chrome::MTPDeviceDelegateImplMac* delegate_; | 313 chrome::MTPDeviceDelegateImplMac* delegate_; |
| 313 | 314 |
| 314 base::PlatformFileError error_; | 315 base::PlatformFileError error_; |
| 315 base::PlatformFileInfo info_; | 316 base::PlatformFileInfo info_; |
| 316 fileapi::AsyncFileUtil::EntryList file_list_; | 317 fileapi::AsyncFileUtil::EntryList file_list_; |
| 317 | 318 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 temp_dir_.path().Append("target"))); | 563 temp_dir_.path().Append("target"))); |
| 563 | 564 |
| 564 EXPECT_EQ(base::PLATFORM_FILE_OK, | 565 EXPECT_EQ(base::PLATFORM_FILE_OK, |
| 565 DownloadFile(base::FilePath("/ic:id/filename"), | 566 DownloadFile(base::FilePath("/ic:id/filename"), |
| 566 temp_dir_.path().Append("target"))); | 567 temp_dir_.path().Append("target"))); |
| 567 std::string contents; | 568 std::string contents; |
| 568 EXPECT_TRUE(file_util::ReadFileToString(temp_dir_.path().Append("target"), | 569 EXPECT_TRUE(file_util::ReadFileToString(temp_dir_.path().Append("target"), |
| 569 &contents)); | 570 &contents)); |
| 570 EXPECT_EQ(kTestFileContents, contents); | 571 EXPECT_EQ(kTestFileContents, contents); |
| 571 } | 572 } |
| OLD | NEW |