Chromium Code Reviews| 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 // MediaFileSystemRegistry unit tests. | 5 // MediaFileSystemRegistry unit tests. |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
| 41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
| 42 #include "content/public/test/mock_render_process_host.h" | 42 #include "content/public/test/mock_render_process_host.h" |
| 43 #include "content/public/test/test_browser_thread.h" | 43 #include "content/public/test/test_browser_thread.h" |
| 44 #include "content/public/test/web_contents_tester.h" | 44 #include "content/public/test/web_contents_tester.h" |
| 45 #include "sync/api/string_ordinal.h" | 45 #include "sync/api/string_ordinal.h" |
| 46 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
| 47 | 47 |
| 48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 49 #include "chrome/browser/storage_monitor/test_portable_device_watcher_win.h" | 49 #include "chrome/browser/storage_monitor/test_portable_device_watcher_win.h" |
| 50 #include "chrome/browser/storage_monitor/test_removable_device_notifications_win dow_win.h" | 50 #include "chrome/browser/storage_monitor/test_storage_monitor_win.h" |
| 51 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" | 51 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" |
| 52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 namespace chrome { | 55 namespace chrome { |
| 56 | 56 |
| 57 // Not anonymous so it can be friends with MediaFileSystemRegistry. | 57 // Not anonymous so it can be friends with MediaFileSystemRegistry. |
| 58 class TestMediaFileSystemContext : public MediaFileSystemContext { | 58 class TestMediaFileSystemContext : public MediaFileSystemContext { |
| 59 public: | 59 public: |
| 60 struct FSInfo { | 60 struct FSInfo { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 | 395 |
| 396 // MediaFileSystemRegistry owns this. | 396 // MediaFileSystemRegistry owns this. |
| 397 TestMediaFileSystemContext* test_file_system_context_; | 397 TestMediaFileSystemContext* test_file_system_context_; |
| 398 | 398 |
| 399 // Needed for extension service & friends to work. | 399 // Needed for extension service & friends to work. |
| 400 content::TestBrowserThread ui_thread_; | 400 content::TestBrowserThread ui_thread_; |
| 401 content::TestBrowserThread file_thread_; | 401 content::TestBrowserThread file_thread_; |
| 402 | 402 |
| 403 // TODO(gbillock): Eliminate windows-specific code from this test. | 403 // TODO(gbillock): Eliminate windows-specific code from this test. |
| 404 #if defined(OS_WIN) | 404 #if defined(OS_WIN) |
| 405 scoped_ptr<test::TestRemovableDeviceNotificationsWindowWin> window_; | 405 scoped_ptr<test::TestStorageMonitorWindowWin> window_; |
|
vandebo (ex-Chrome)
2013/03/01 19:47:39
TestStorageMonitorWin
| |
| 406 #else | 406 #else |
| 407 chrome::test::TestStorageMonitor monitor_; | 407 chrome::test::TestStorageMonitor monitor_; |
| 408 #endif | 408 #endif |
| 409 | 409 |
| 410 MockProfileSharedRenderProcessHostFactory rph_factory_; | 410 MockProfileSharedRenderProcessHostFactory rph_factory_; |
| 411 | 411 |
| 412 ScopedVector<ProfileState> profile_states_; | 412 ScopedVector<ProfileState> profile_states_; |
| 413 | 413 |
| 414 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistryTest); | 414 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistryTest); |
| 415 }; | 415 }; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 return result; | 770 return result; |
| 771 } | 771 } |
| 772 | 772 |
| 773 void MediaFileSystemRegistryTest::SetUp() { | 773 void MediaFileSystemRegistryTest::SetUp() { |
| 774 #if defined(OS_WIN) | 774 #if defined(OS_WIN) |
| 775 CommandLine::ForCurrentProcess()->AppendSwitch( | 775 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 776 switches::kEnableMediaTransferProtocolDeviceOperations); | 776 switches::kEnableMediaTransferProtocolDeviceOperations); |
| 777 test::TestPortableDeviceWatcherWin* portable_device_watcher = | 777 test::TestPortableDeviceWatcherWin* portable_device_watcher = |
| 778 new test::TestPortableDeviceWatcherWin; | 778 new test::TestPortableDeviceWatcherWin; |
| 779 portable_device_watcher->set_use_dummy_mtp_storage_info(true); | 779 portable_device_watcher->set_use_dummy_mtp_storage_info(true); |
| 780 window_.reset(new test::TestRemovableDeviceNotificationsWindowWin( | 780 window_.reset(new test::TestStorageMonitorWindowWin( |
| 781 new test::TestVolumeMountWatcherWin, portable_device_watcher)); | 781 new test::TestVolumeMountWatcherWin, portable_device_watcher)); |
| 782 window_->Init(); | 782 window_->Init(); |
| 783 #endif | 783 #endif |
| 784 | 784 |
| 785 ChromeRenderViewHostTestHarness::SetUp(); | 785 ChromeRenderViewHostTestHarness::SetUp(); |
| 786 DeleteContents(); | 786 DeleteContents(); |
| 787 SetRenderProcessHostFactory(&rph_factory_); | 787 SetRenderProcessHostFactory(&rph_factory_); |
| 788 | 788 |
| 789 TestMediaStorageUtil::SetTestingMode(); | 789 TestMediaStorageUtil::SetTestingMode(); |
| 790 test_file_system_context_ = new TestMediaFileSystemContext( | 790 test_file_system_context_ = new TestMediaFileSystemContext( |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 pref_info_with_relpath.device_id = device_id; | 1015 pref_info_with_relpath.device_id = device_id; |
| 1016 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), | 1016 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), |
| 1017 pref_info_with_relpath.AbsolutePath().value()); | 1017 pref_info_with_relpath.AbsolutePath().value()); |
| 1018 | 1018 |
| 1019 DetachDevice(device_id); | 1019 DetachDevice(device_id); |
| 1020 EXPECT_TRUE(pref_info.AbsolutePath().empty()); | 1020 EXPECT_TRUE(pref_info.AbsolutePath().empty()); |
| 1021 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); | 1021 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 } // namespace chrome | 1024 } // namespace chrome |
| OLD | NEW |