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

Side by Side Diff: chrome/browser/media_galleries/media_file_system_registry_unittest.cc

Issue 12382005: Rename RemovableDeviceNotifications=>StorageMonitor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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
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 // 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/public/browser/render_view_host.h" 42 #include "content/public/browser/render_view_host.h"
43 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
44 #include "content/public/test/mock_render_process_host.h" 44 #include "content/public/test/mock_render_process_host.h"
45 #include "content/public/test/test_browser_thread.h" 45 #include "content/public/test/test_browser_thread.h"
46 #include "content/public/test/web_contents_tester.h" 46 #include "content/public/test/web_contents_tester.h"
47 #include "sync/api/string_ordinal.h" 47 #include "sync/api/string_ordinal.h"
48 #include "testing/gtest/include/gtest/gtest.h" 48 #include "testing/gtest/include/gtest/gtest.h"
49 49
50 #if defined(OS_WIN) 50 #if defined(OS_WIN)
51 #include "chrome/browser/storage_monitor/test_portable_device_watcher_win.h" 51 #include "chrome/browser/storage_monitor/test_portable_device_watcher_win.h"
52 #include "chrome/browser/storage_monitor/test_removable_device_notifications_win dow_win.h" 52 #include "chrome/browser/storage_monitor/test_storage_monitor_win.h"
53 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h" 53 #include "chrome/browser/storage_monitor/test_volume_mount_watcher_win.h"
54 #include "chrome/common/chrome_switches.h" 54 #include "chrome/common/chrome_switches.h"
55 #endif 55 #endif
56 56
57 namespace chrome { 57 namespace chrome {
58 58
59 // Not anonymous so it can be friends with MediaFileSystemRegistry. 59 // Not anonymous so it can be friends with MediaFileSystemRegistry.
60 class TestMediaFileSystemContext : public MediaFileSystemContext { 60 class TestMediaFileSystemContext : public MediaFileSystemContext {
61 public: 61 public:
62 struct FSInfo { 62 struct FSInfo {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 // MediaFileSystemRegistry owns this. 398 // MediaFileSystemRegistry owns this.
399 TestMediaFileSystemContext* test_file_system_context_; 399 TestMediaFileSystemContext* test_file_system_context_;
400 400
401 // Needed for extension service & friends to work. 401 // Needed for extension service & friends to work.
402 content::TestBrowserThread ui_thread_; 402 content::TestBrowserThread ui_thread_;
403 content::TestBrowserThread file_thread_; 403 content::TestBrowserThread file_thread_;
404 404
405 // TODO(gbillock): Eliminate windows-specific code from this test. 405 // TODO(gbillock): Eliminate windows-specific code from this test.
406 #if defined(OS_WIN) 406 #if defined(OS_WIN)
407 scoped_ptr<test::TestRemovableDeviceNotificationsWindowWin> window_; 407 scoped_ptr<test::TestStorageMonitorWin> monitor_;
408 #else 408 #else
409 chrome::test::TestStorageMonitor monitor_; 409 chrome::test::TestStorageMonitor monitor_;
410 #endif 410 #endif
411 411
412 MockProfileSharedRenderProcessHostFactory rph_factory_; 412 MockProfileSharedRenderProcessHostFactory rph_factory_;
413 413
414 ScopedVector<ProfileState> profile_states_; 414 ScopedVector<ProfileState> profile_states_;
415 415
416 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistryTest); 416 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistryTest);
417 }; 417 };
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 return result; 772 return result;
773 } 773 }
774 774
775 void MediaFileSystemRegistryTest::SetUp() { 775 void MediaFileSystemRegistryTest::SetUp() {
776 #if defined(OS_WIN) 776 #if defined(OS_WIN)
777 CommandLine::ForCurrentProcess()->AppendSwitch( 777 CommandLine::ForCurrentProcess()->AppendSwitch(
778 switches::kEnableMediaTransferProtocolDeviceOperations); 778 switches::kEnableMediaTransferProtocolDeviceOperations);
779 test::TestPortableDeviceWatcherWin* portable_device_watcher = 779 test::TestPortableDeviceWatcherWin* portable_device_watcher =
780 new test::TestPortableDeviceWatcherWin; 780 new test::TestPortableDeviceWatcherWin;
781 portable_device_watcher->set_use_dummy_mtp_storage_info(true); 781 portable_device_watcher->set_use_dummy_mtp_storage_info(true);
782 window_.reset(new test::TestRemovableDeviceNotificationsWindowWin( 782 monitor_.reset(
783 new test::TestVolumeMountWatcherWin, portable_device_watcher)); 783 new test::TestStorageMonitorWin(new test::TestVolumeMountWatcherWin,
784 window_->Init(); 784 portable_device_watcher));
785 monitor_->Init();
785 #endif 786 #endif
786 787
787 ChromeRenderViewHostTestHarness::SetUp(); 788 ChromeRenderViewHostTestHarness::SetUp();
788 DeleteContents(); 789 DeleteContents();
789 SetRenderProcessHostFactory(&rph_factory_); 790 SetRenderProcessHostFactory(&rph_factory_);
790 791
791 TestMediaStorageUtil::SetTestingMode(); 792 TestMediaStorageUtil::SetTestingMode();
792 test_file_system_context_ = new TestMediaFileSystemContext( 793 test_file_system_context_ = new TestMediaFileSystemContext(
793 g_browser_process->media_file_system_registry()); 794 g_browser_process->media_file_system_registry());
794 (new extensions::BackgroundManifestHandler)->Register(); 795 (new extensions::BackgroundManifestHandler)->Register();
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 pref_info_with_relpath.device_id = device_id; 1020 pref_info_with_relpath.device_id = device_id;
1020 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), 1021 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(),
1021 pref_info_with_relpath.AbsolutePath().value()); 1022 pref_info_with_relpath.AbsolutePath().value());
1022 1023
1023 DetachDevice(device_id); 1024 DetachDevice(device_id);
1024 EXPECT_TRUE(pref_info.AbsolutePath().empty()); 1025 EXPECT_TRUE(pref_info.AbsolutePath().empty());
1025 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); 1026 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty());
1026 } 1027 }
1027 1028
1028 } // namespace chrome 1029 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698