Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm

Issue 27094003: Remove fileapi::FileSystemFileUtil dependency in media gallery code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
12 #include "base/mac/scoped_nsobject.h" 12 #include "base/mac/scoped_nsobject.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
17 #include "base/test/sequenced_worker_pool_owner.h" 17 #include "base/test/sequenced_worker_pool_owner.h"
18 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
19 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h" 19 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h"
20 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" 20 #include "chrome/browser/storage_monitor/image_capture_device_manager.h"
21 #include "chrome/browser/storage_monitor/test_storage_monitor.h" 21 #include "chrome/browser/storage_monitor/test_storage_monitor.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "webkit/browser/fileapi/file_system_file_util.h"
26 25
27 #if !defined(MAC_OS_X_VERSION_10_7) || \ 26 #if !defined(MAC_OS_X_VERSION_10_7) || \
28 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 27 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
29 28
30 @interface NSObject (ICCameraDeviceDelegateLionAPI) 29 @interface NSObject (ICCameraDeviceDelegateLionAPI)
31 - (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device; 30 - (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device;
32 - (void)didDownloadFile:(ICCameraFile*)file 31 - (void)didDownloadFile:(ICCameraFile*)file
33 error:(NSError*)error 32 error:(NSError*)error
34 options:(NSDictionary*)options 33 options:(NSDictionary*)options
35 contextInfo:(void*)contextInfo; 34 contextInfo:(void*)contextInfo;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 - (NSDate*)creationDate { 153 - (NSDate*)creationDate {
155 return date_.get(); 154 return date_.get();
156 } 155 }
157 156
158 - (off_t)fileSize { 157 - (off_t)fileSize {
159 return 1000; 158 return 1000;
160 } 159 }
161 160
162 @end 161 @end
163 162
164 // Advances the enumerator. When the method returns, signals the waiting
165 // event.
166 void EnumerateAndSignal(
167 fileapi::FileSystemFileUtil::AbstractFileEnumerator* enumerator,
168 base::WaitableEvent* event,
169 base::FilePath* path) {
170 *path = enumerator->Next();
171 event->Signal();
172 }
173
174 class MTPDeviceDelegateImplMacTest : public testing::Test { 163 class MTPDeviceDelegateImplMacTest : public testing::Test {
175 public: 164 public:
176 MTPDeviceDelegateImplMacTest() : camera_(NULL), delegate_(NULL) {} 165 MTPDeviceDelegateImplMacTest() : camera_(NULL), delegate_(NULL) {}
177 166
178 virtual void SetUp() OVERRIDE { 167 virtual void SetUp() OVERRIDE {
179 ui_thread_.reset(new content::TestBrowserThread( 168 ui_thread_.reset(new content::TestBrowserThread(
180 content::BrowserThread::UI, &message_loop_)); 169 content::BrowserThread::UI, &message_loop_));
181 file_thread_.reset(new content::TestBrowserThread( 170 file_thread_.reset(new content::TestBrowserThread(
182 content::BrowserThread::FILE, &message_loop_)); 171 content::BrowserThread::FILE, &message_loop_));
183 io_thread_.reset(new content::TestBrowserThread( 172 io_thread_.reset(new content::TestBrowserThread(
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 temp_dir_.path().Append("target"))); 553 temp_dir_.path().Append("target")));
565 554
566 EXPECT_EQ(base::PLATFORM_FILE_OK, 555 EXPECT_EQ(base::PLATFORM_FILE_OK,
567 DownloadFile(base::FilePath("/ic:id/filename"), 556 DownloadFile(base::FilePath("/ic:id/filename"),
568 temp_dir_.path().Append("target"))); 557 temp_dir_.path().Append("target")));
569 std::string contents; 558 std::string contents;
570 EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"), 559 EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"),
571 &contents)); 560 &contents));
572 EXPECT_EQ(kTestFileContents, contents); 561 EXPECT_EQ(kTestFileContents, contents);
573 } 562 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698