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

Side by Side Diff: chrome/browser/media_galleries/win/mtp_device_delegate_impl_win_unittest.cc

Issue 2677943003: Fix and enable MTPDeviceDelegateImplWinTest.GalleryNameMTP. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 extension_system->CreateExtensionService( 104 extension_system->CreateExtensionService(
105 base::CommandLine::ForCurrentProcess(), base::FilePath(), false); 105 base::CommandLine::ForCurrentProcess(), base::FilePath(), false);
106 106
107 std::vector<std::string> all_permissions; 107 std::vector<std::string> all_permissions;
108 all_permissions.push_back("allAutoDetected"); 108 all_permissions.push_back("allAutoDetected");
109 all_permissions.push_back("read"); 109 all_permissions.push_back("read");
110 extension_ = AddMediaGalleriesApp("all", all_permissions, profile()); 110 extension_ = AddMediaGalleriesApp("all", all_permissions, profile());
111 } 111 }
112 112
113 void MTPDeviceDelegateImplWinTest::TearDown() { 113 void MTPDeviceDelegateImplWinTest::TearDown() {
114 // Windows storage monitor must be destroyed on the same thread 114 ChromeRenderViewHostTestHarness::TearDown();
115 // as construction. 115
116 TestingBrowserProcess::DeleteInstance();
117
118 // Windows storage monitor must be destroyed after the MediaFileSystemRegistry
119 // owned by TestingBrowserProcess because it uses it in its destructor.
116 TestStorageMonitor::Destroy(); 120 TestStorageMonitor::Destroy();
117
118 ChromeRenderViewHostTestHarness::TearDown();
119 } 121 }
120 122
121 void MTPDeviceDelegateImplWinTest::ProcessAttach( 123 void MTPDeviceDelegateImplWinTest::ProcessAttach(
122 const std::string& id, 124 const std::string& id,
123 const base::string16& label, 125 const base::string16& label,
124 const base::FilePath::StringType& location) { 126 const base::FilePath::StringType& location) {
125 StorageInfo info(id, location, label, base::string16(), base::string16(), 0); 127 StorageInfo info(id, location, label, base::string16(), base::string16(), 0);
126 monitor_->receiver()->ProcessAttach(info); 128 monitor_->receiver()->ProcessAttach(info);
127 } 129 }
128 130
(...skipping 20 matching lines...) Expand all
149 EXPECT_EQ(removable, info.removable); 151 EXPECT_EQ(removable, info.removable);
150 EXPECT_EQ(media_device, info.media_device); 152 EXPECT_EQ(media_device, info.media_device);
151 EXPECT_NE(0UL, info.pref_id); 153 EXPECT_NE(0UL, info.pref_id);
152 154
153 if (removable) 155 if (removable)
154 EXPECT_NE(0UL, info.transient_device_id.size()); 156 EXPECT_NE(0UL, info.transient_device_id.size());
155 else 157 else
156 EXPECT_EQ(0UL, info.transient_device_id.size()); 158 EXPECT_EQ(0UL, info.transient_device_id.size());
157 } 159 }
158 160
159 // Crashes on chromium.win/Win7 bot. http://crbug.com/686803 161 TEST_F(MTPDeviceDelegateImplWinTest, GalleryNameMTP) {
160 TEST_F(MTPDeviceDelegateImplWinTest, DISABLED_GalleryNameMTP) {
161 base::FilePath location( 162 base::FilePath location(
162 PortableDeviceWatcherWin::GetStoragePathFromStorageId( 163 PortableDeviceWatcherWin::GetStoragePathFromStorageId(
163 TestPortableDeviceWatcherWin::kStorageUniqueIdA)); 164 TestPortableDeviceWatcherWin::kStorageUniqueIdA));
164 AttachDevice(StorageInfo::MTP_OR_PTP, "mtp_fake_id", location); 165 AttachDevice(StorageInfo::MTP_OR_PTP, "mtp_fake_id", location);
165 166
166 FSInfoMap results; 167 FSInfoMap results;
167 MediaFileSystemRegistry* registry = 168 MediaFileSystemRegistry* registry =
168 g_browser_process->media_file_system_registry(); 169 g_browser_process->media_file_system_registry();
169 registry->GetMediaFileSystemsForExtension( 170 registry->GetMediaFileSystemsForExtension(
170 web_contents(), extension_.get(), 171 web_contents(), extension_.get(),
171 base::Bind(&GetGalleryInfoCallback, base::Unretained(&results))); 172 base::Bind(&GetGalleryInfoCallback, base::Unretained(&results)));
172 base::RunLoop().RunUntilIdle(); 173 base::RunLoop().RunUntilIdle();
173 174
174 ASSERT_EQ(media_directories_.num_galleries() + 1u, results.size()); 175 ASSERT_EQ(media_directories_.num_galleries() + 1u, results.size());
175 bool checked = false; 176 bool checked = false;
176 for (FSInfoMap::iterator i = results.begin(); i != results.end(); ++i) { 177 for (FSInfoMap::iterator i = results.begin(); i != results.end(); ++i) {
177 MediaFileSystemInfo info = i->second; 178 MediaFileSystemInfo info = i->second;
178 if (info.path == location) { 179 if (info.path == location) {
179 CheckGalleryInfo(info, location.LossyDisplayName(), location, true, true); 180 CheckGalleryInfo(info, location.LossyDisplayName(), location, true, true);
180 checked = true; 181 checked = true;
181 break; 182 break;
182 } 183 }
183 } 184 }
184 EXPECT_TRUE(checked); 185 EXPECT_TRUE(checked);
185 } 186 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698