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/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 public: | 213 public: |
214 MockProfileSharedRenderProcessHostFactory() {} | 214 MockProfileSharedRenderProcessHostFactory() {} |
215 virtual ~MockProfileSharedRenderProcessHostFactory(); | 215 virtual ~MockProfileSharedRenderProcessHostFactory(); |
216 | 216 |
217 // RPH created with this factory are owned by it. If the RPH is destroyed | 217 // RPH created with this factory are owned by it. If the RPH is destroyed |
218 // for testing purposes, it must be removed from the factory first. | 218 // for testing purposes, it must be removed from the factory first. |
219 content::MockRenderProcessHost* ReleaseRPH( | 219 content::MockRenderProcessHost* ReleaseRPH( |
220 content::BrowserContext* browser_context); | 220 content::BrowserContext* browser_context); |
221 | 221 |
222 virtual content::RenderProcessHost* CreateRenderProcessHost( | 222 virtual content::RenderProcessHost* CreateRenderProcessHost( |
223 content::BrowserContext* browser_context) const OVERRIDE; | 223 content::BrowserContext* browser_context, |
| 224 content::SiteInstance* site_instance) const OVERRIDE; |
224 | 225 |
225 private: | 226 private: |
226 typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*> | 227 typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*> |
227 ProfileRPHMap; | 228 ProfileRPHMap; |
228 mutable ProfileRPHMap rph_map_; | 229 mutable ProfileRPHMap rph_map_; |
229 | 230 |
230 DISALLOW_COPY_AND_ASSIGN(MockProfileSharedRenderProcessHostFactory); | 231 DISALLOW_COPY_AND_ASSIGN(MockProfileSharedRenderProcessHostFactory); |
231 }; | 232 }; |
232 | 233 |
233 class ProfileState { | 234 class ProfileState { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 ProfileRPHMap::iterator existing = rph_map_.find(browser_context); | 417 ProfileRPHMap::iterator existing = rph_map_.find(browser_context); |
417 if (existing == rph_map_.end()) | 418 if (existing == rph_map_.end()) |
418 return NULL; | 419 return NULL; |
419 content::MockRenderProcessHost* result = existing->second; | 420 content::MockRenderProcessHost* result = existing->second; |
420 rph_map_.erase(existing); | 421 rph_map_.erase(existing); |
421 return result; | 422 return result; |
422 } | 423 } |
423 | 424 |
424 content::RenderProcessHost* | 425 content::RenderProcessHost* |
425 MockProfileSharedRenderProcessHostFactory::CreateRenderProcessHost( | 426 MockProfileSharedRenderProcessHostFactory::CreateRenderProcessHost( |
426 content::BrowserContext* browser_context) const { | 427 content::BrowserContext* browser_context, |
| 428 content::SiteInstance* site_instance) const { |
427 ProfileRPHMap::const_iterator existing = rph_map_.find(browser_context); | 429 ProfileRPHMap::const_iterator existing = rph_map_.find(browser_context); |
428 if (existing != rph_map_.end()) | 430 if (existing != rph_map_.end()) |
429 return existing->second; | 431 return existing->second; |
430 rph_map_[browser_context] = | 432 rph_map_[browser_context] = |
431 new content::MockRenderProcessHost(browser_context); | 433 new content::MockRenderProcessHost(browser_context); |
432 return rph_map_[browser_context]; | 434 return rph_map_[browser_context]; |
433 } | 435 } |
434 | 436 |
435 ////////////////// | 437 ////////////////// |
436 // ProfileState // | 438 // ProfileState // |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 pref_info_with_relpath.device_id = device_id; | 995 pref_info_with_relpath.device_id = device_id; |
994 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), | 996 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), |
995 pref_info_with_relpath.AbsolutePath().value()); | 997 pref_info_with_relpath.AbsolutePath().value()); |
996 | 998 |
997 DetachDevice(device_id); | 999 DetachDevice(device_id); |
998 EXPECT_TRUE(pref_info.AbsolutePath().empty()); | 1000 EXPECT_TRUE(pref_info.AbsolutePath().empty()); |
999 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); | 1001 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); |
1000 } | 1002 } |
1001 | 1003 |
1002 } // namespace chrome | 1004 } // namespace chrome |
OLD | NEW |