| 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, |
| 225 content::ContentBrowserClient* client) const OVERRIDE; |
| 224 | 226 |
| 225 private: | 227 private: |
| 226 typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*> | 228 typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*> |
| 227 ProfileRPHMap; | 229 ProfileRPHMap; |
| 228 mutable ProfileRPHMap rph_map_; | 230 mutable ProfileRPHMap rph_map_; |
| 229 | 231 |
| 230 DISALLOW_COPY_AND_ASSIGN(MockProfileSharedRenderProcessHostFactory); | 232 DISALLOW_COPY_AND_ASSIGN(MockProfileSharedRenderProcessHostFactory); |
| 231 }; | 233 }; |
| 232 | 234 |
| 233 class ProfileState { | 235 class ProfileState { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 ProfileRPHMap::iterator existing = rph_map_.find(browser_context); | 418 ProfileRPHMap::iterator existing = rph_map_.find(browser_context); |
| 417 if (existing == rph_map_.end()) | 419 if (existing == rph_map_.end()) |
| 418 return NULL; | 420 return NULL; |
| 419 content::MockRenderProcessHost* result = existing->second; | 421 content::MockRenderProcessHost* result = existing->second; |
| 420 rph_map_.erase(existing); | 422 rph_map_.erase(existing); |
| 421 return result; | 423 return result; |
| 422 } | 424 } |
| 423 | 425 |
| 424 content::RenderProcessHost* | 426 content::RenderProcessHost* |
| 425 MockProfileSharedRenderProcessHostFactory::CreateRenderProcessHost( | 427 MockProfileSharedRenderProcessHostFactory::CreateRenderProcessHost( |
| 426 content::BrowserContext* browser_context) const { | 428 content::BrowserContext* browser_context, |
| 429 content::SiteInstance* site_instance, |
| 430 content::ContentBrowserClient* client) const { |
| 427 ProfileRPHMap::const_iterator existing = rph_map_.find(browser_context); | 431 ProfileRPHMap::const_iterator existing = rph_map_.find(browser_context); |
| 428 if (existing != rph_map_.end()) | 432 if (existing != rph_map_.end()) |
| 429 return existing->second; | 433 return existing->second; |
| 430 rph_map_[browser_context] = | 434 rph_map_[browser_context] = |
| 431 new content::MockRenderProcessHost(browser_context); | 435 new content::MockRenderProcessHost(browser_context); |
| 432 return rph_map_[browser_context]; | 436 return rph_map_[browser_context]; |
| 433 } | 437 } |
| 434 | 438 |
| 435 ////////////////// | 439 ////////////////// |
| 436 // ProfileState // | 440 // ProfileState // |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 pref_info_with_relpath.device_id = device_id; | 997 pref_info_with_relpath.device_id = device_id; |
| 994 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), | 998 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), |
| 995 pref_info_with_relpath.AbsolutePath().value()); | 999 pref_info_with_relpath.AbsolutePath().value()); |
| 996 | 1000 |
| 997 DetachDevice(device_id); | 1001 DetachDevice(device_id); |
| 998 EXPECT_TRUE(pref_info.AbsolutePath().empty()); | 1002 EXPECT_TRUE(pref_info.AbsolutePath().empty()); |
| 999 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); | 1003 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); |
| 1000 } | 1004 } |
| 1001 | 1005 |
| 1002 } // namespace chrome | 1006 } // namespace chrome |
| OLD | NEW |