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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 base::FilePath path; | 73 base::FilePath path; |
74 std::string fs_name; | 74 std::string fs_name; |
75 }; | 75 }; |
76 | 76 |
77 explicit TestMediaFileSystemContext(MediaFileSystemRegistry* registry); | 77 explicit TestMediaFileSystemContext(MediaFileSystemRegistry* registry); |
78 virtual ~TestMediaFileSystemContext() {} | 78 virtual ~TestMediaFileSystemContext() {} |
79 | 79 |
80 // MediaFileSystemContext implementation. | 80 // MediaFileSystemContext implementation. |
81 virtual bool RegisterFileSystem(const std::string& device_id, | 81 virtual bool RegisterFileSystem(const std::string& device_id, |
82 const std::string& fs_name, | 82 const std::string& fs_name, |
83 const base::FilePath& path) OVERRIDE; | 83 const base::FilePath& path) override; |
84 | 84 |
85 virtual void RevokeFileSystem(const std::string& fs_name) OVERRIDE; | 85 virtual void RevokeFileSystem(const std::string& fs_name) override; |
86 | 86 |
87 virtual base::FilePath GetRegisteredPath( | 87 virtual base::FilePath GetRegisteredPath( |
88 const std::string& fs_name) const OVERRIDE; | 88 const std::string& fs_name) const override; |
89 | 89 |
90 MediaFileSystemRegistry* registry() { return registry_; } | 90 MediaFileSystemRegistry* registry() { return registry_; } |
91 | 91 |
92 private: | 92 private: |
93 void AddFSEntry(const std::string& device_id, | 93 void AddFSEntry(const std::string& device_id, |
94 const base::FilePath& path, | 94 const base::FilePath& path, |
95 const std::string& fs_name); | 95 const std::string& fs_name); |
96 | 96 |
97 MediaFileSystemRegistry* registry_; | 97 MediaFileSystemRegistry* registry_; |
98 | 98 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 MockProfileSharedRenderProcessHostFactory() {} | 194 MockProfileSharedRenderProcessHostFactory() {} |
195 virtual ~MockProfileSharedRenderProcessHostFactory(); | 195 virtual ~MockProfileSharedRenderProcessHostFactory(); |
196 | 196 |
197 // RPH created with this factory are owned by it. If the RPH is destroyed | 197 // RPH created with this factory are owned by it. If the RPH is destroyed |
198 // for testing purposes, it must be removed from the factory first. | 198 // for testing purposes, it must be removed from the factory first. |
199 content::MockRenderProcessHost* ReleaseRPH( | 199 content::MockRenderProcessHost* ReleaseRPH( |
200 content::BrowserContext* browser_context); | 200 content::BrowserContext* browser_context); |
201 | 201 |
202 virtual content::RenderProcessHost* CreateRenderProcessHost( | 202 virtual content::RenderProcessHost* CreateRenderProcessHost( |
203 content::BrowserContext* browser_context, | 203 content::BrowserContext* browser_context, |
204 content::SiteInstance* site_instance) const OVERRIDE; | 204 content::SiteInstance* site_instance) const override; |
205 | 205 |
206 private: | 206 private: |
207 typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*> | 207 typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*> |
208 ProfileRPHMap; | 208 ProfileRPHMap; |
209 mutable ProfileRPHMap rph_map_; | 209 mutable ProfileRPHMap rph_map_; |
210 | 210 |
211 DISALLOW_COPY_AND_ASSIGN(MockProfileSharedRenderProcessHostFactory); | 211 DISALLOW_COPY_AND_ASSIGN(MockProfileSharedRenderProcessHostFactory); |
212 }; | 212 }; |
213 | 213 |
214 class ProfileState { | 214 class ProfileState { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 343 } |
344 | 344 |
345 size_t GetExtensionGalleriesHostCount( | 345 size_t GetExtensionGalleriesHostCount( |
346 const MediaFileSystemRegistry* registry) const; | 346 const MediaFileSystemRegistry* registry) const; |
347 | 347 |
348 int num_auto_galleries() { | 348 int num_auto_galleries() { |
349 return media_directories_.num_galleries(); | 349 return media_directories_.num_galleries(); |
350 } | 350 } |
351 | 351 |
352 protected: | 352 protected: |
353 virtual void SetUp() OVERRIDE; | 353 virtual void SetUp() override; |
354 virtual void TearDown() OVERRIDE; | 354 virtual void TearDown() override; |
355 | 355 |
356 private: | 356 private: |
357 // This makes sure that at least one default gallery exists on the file | 357 // This makes sure that at least one default gallery exists on the file |
358 // system. | 358 // system. |
359 EnsureMediaDirectoriesExists media_directories_; | 359 EnsureMediaDirectoriesExists media_directories_; |
360 | 360 |
361 // Some test gallery directories. | 361 // Some test gallery directories. |
362 base::ScopedTempDir galleries_dir_; | 362 base::ScopedTempDir galleries_dir_; |
363 // An empty directory in |galleries_dir_| | 363 // An empty directory in |galleries_dir_| |
364 base::FilePath empty_dir_; | 364 base::FilePath empty_dir_; |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 fs_info.begin()->second.fsid).empty()); | 1071 fs_info.begin()->second.fsid).empty()); |
1072 | 1072 |
1073 // Revoke permission and ensure that the file system is revoked. | 1073 // Revoke permission and ensure that the file system is revoked. |
1074 SetGalleryPermission(profile_state, | 1074 SetGalleryPermission(profile_state, |
1075 profile_state->regular_permission_extension(), | 1075 profile_state->regular_permission_extension(), |
1076 device_id, | 1076 device_id, |
1077 false /*has access*/); | 1077 false /*has access*/); |
1078 EXPECT_TRUE(test_file_system_context()->GetRegisteredPath( | 1078 EXPECT_TRUE(test_file_system_context()->GetRegisteredPath( |
1079 fs_info.begin()->second.fsid).empty()); | 1079 fs_info.begin()->second.fsid).empty()); |
1080 } | 1080 } |
OLD | NEW |