| 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/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 - (off_t)fileSize { | 146 - (off_t)fileSize { |
| 147 return 1000; | 147 return 1000; |
| 148 } | 148 } |
| 149 | 149 |
| 150 @end | 150 @end |
| 151 | 151 |
| 152 class MTPDeviceDelegateImplMacTest : public testing::Test { | 152 class MTPDeviceDelegateImplMacTest : public testing::Test { |
| 153 public: | 153 public: |
| 154 MTPDeviceDelegateImplMacTest() : camera_(NULL), delegate_(NULL) {} | 154 MTPDeviceDelegateImplMacTest() : camera_(NULL), delegate_(NULL) {} |
| 155 | 155 |
| 156 virtual void SetUp() OVERRIDE { | 156 virtual void SetUp() override { |
| 157 ui_thread_.reset(new content::TestBrowserThread( | 157 ui_thread_.reset(new content::TestBrowserThread( |
| 158 content::BrowserThread::UI, &message_loop_)); | 158 content::BrowserThread::UI, &message_loop_)); |
| 159 file_thread_.reset(new content::TestBrowserThread( | 159 file_thread_.reset(new content::TestBrowserThread( |
| 160 content::BrowserThread::FILE, &message_loop_)); | 160 content::BrowserThread::FILE, &message_loop_)); |
| 161 io_thread_.reset(new content::TestBrowserThread( | 161 io_thread_.reset(new content::TestBrowserThread( |
| 162 content::BrowserThread::IO)); | 162 content::BrowserThread::IO)); |
| 163 ASSERT_TRUE(io_thread_->Start()); | 163 ASSERT_TRUE(io_thread_->Start()); |
| 164 | 164 |
| 165 storage_monitor::TestStorageMonitor* monitor = | 165 storage_monitor::TestStorageMonitor* monitor = |
| 166 storage_monitor::TestStorageMonitor::CreateAndInstall(); | 166 storage_monitor::TestStorageMonitor::CreateAndInstall(); |
| 167 manager_.SetNotifications(monitor->receiver()); | 167 manager_.SetNotifications(monitor->receiver()); |
| 168 | 168 |
| 169 camera_ = [MockMTPICCameraDevice alloc]; | 169 camera_ = [MockMTPICCameraDevice alloc]; |
| 170 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); | 170 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); |
| 171 [delegate deviceBrowser:nil didAddDevice:camera_ moreComing:NO]; | 171 [delegate deviceBrowser:nil didAddDevice:camera_ moreComing:NO]; |
| 172 | 172 |
| 173 delegate_ = new MTPDeviceDelegateImplMac(kDeviceId, kDevicePath); | 173 delegate_ = new MTPDeviceDelegateImplMac(kDeviceId, kDevicePath); |
| 174 } | 174 } |
| 175 | 175 |
| 176 virtual void TearDown() OVERRIDE { | 176 virtual void TearDown() override { |
| 177 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); | 177 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); |
| 178 [delegate deviceBrowser:nil didRemoveDevice:camera_ moreGoing:NO]; | 178 [delegate deviceBrowser:nil didRemoveDevice:camera_ moreGoing:NO]; |
| 179 | 179 |
| 180 delegate_->CancelPendingTasksAndDeleteDelegate(); | 180 delegate_->CancelPendingTasksAndDeleteDelegate(); |
| 181 | 181 |
| 182 storage_monitor::TestStorageMonitor::Destroy(); | 182 storage_monitor::TestStorageMonitor::Destroy(); |
| 183 | 183 |
| 184 io_thread_->Stop(); | 184 io_thread_->Stop(); |
| 185 } | 185 } |
| 186 | 186 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 temp_dir_.path().Append("target"))); | 543 temp_dir_.path().Append("target"))); |
| 544 | 544 |
| 545 EXPECT_EQ(base::File::FILE_OK, | 545 EXPECT_EQ(base::File::FILE_OK, |
| 546 DownloadFile(base::FilePath("/ic:id/filename"), | 546 DownloadFile(base::FilePath("/ic:id/filename"), |
| 547 temp_dir_.path().Append("target"))); | 547 temp_dir_.path().Append("target"))); |
| 548 std::string contents; | 548 std::string contents; |
| 549 EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"), | 549 EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"), |
| 550 &contents)); | 550 &contents)); |
| 551 EXPECT_EQ(kTestFileContents, contents); | 551 EXPECT_EQ(kTestFileContents, contents); |
| 552 } | 552 } |
| OLD | NEW |