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

Side by Side Diff: webkit/fileapi/file_system_usage_tracker_unittest.cc

Issue 6603034: Stop returning the true root path of each filesystem from openFileSystem.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_usage_tracker.cc ('k') | webkit/fileapi/file_system_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/fileapi/file_system_usage_tracker.h" 5 #include "webkit/fileapi/file_system_usage_tracker.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "base/platform_file.h" 11 #include "base/platform_file.h"
12 #include "base/scoped_callback_factory.h" 12 #include "base/scoped_callback_factory.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "base/scoped_temp_dir.h" 14 #include "base/scoped_temp_dir.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webkit/fileapi/file_system_path_manager.h"
17 #include "webkit/fileapi/file_system_types.h" 16 #include "webkit/fileapi/file_system_types.h"
18 #include "webkit/fileapi/file_system_usage_cache.h" 17 #include "webkit/fileapi/file_system_usage_cache.h"
18 #include "webkit/fileapi/sandbox_mount_point_provider.h"
19 19
20 using namespace fileapi; 20 using namespace fileapi;
21 21
22 namespace { 22 namespace {
23 23
24 static const GURL kDummyURL1("http://www.dummy.org"); 24 static const GURL kDummyURL1("http://www.dummy.org");
25 static const GURL kDummyURL2("http://www.example.com"); 25 static const GURL kDummyURL2("http://www.example.com");
26 26
27 // Declared to shorten the variable names. 27 // Declared to shorten the variable names.
28 static const fileapi::FileSystemType kTemporary = 28 static const fileapi::FileSystemType kTemporary =
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 tracker->GetOriginUsage(origin_url, type, 64 tracker->GetOriginUsage(origin_url, type,
65 callback_factory_.NewCallback( 65 callback_factory_.NewCallback(
66 &FileSystemUsageTrackerTest::OnGetUsage)); 66 &FileSystemUsageTrackerTest::OnGetUsage));
67 MessageLoop::current()->RunAllPending(); 67 MessageLoop::current()->RunAllPending();
68 return usage_; 68 return usage_;
69 } 69 }
70 70
71 FilePath GetOriginBasePath(const GURL& origin_url, 71 FilePath GetOriginBasePath(const GURL& origin_url,
72 fileapi::FileSystemType type) { 72 fileapi::FileSystemType type) {
73 return 73 return
74 FileSystemPathManager::GetFileSystemBaseDirectoryForOriginAndType( 74 SandboxMountPointProvider::GetFileSystemBaseDirectoryForOriginAndType(
75 data_dir_.path().Append( 75 data_dir_.path().Append(
76 FileSystemPathManager::kFileSystemDirectory), 76 SandboxMountPointProvider::kFileSystemDirectory),
77 FileSystemPathManager::GetOriginIdentifierFromURL(origin_url), 77 SandboxMountPointProvider::GetOriginIdentifierFromURL(origin_url),
78 type); 78 type);
79 } 79 }
80 80
81 bool CreateFileSystemDirectory(const char* dir_name, 81 bool CreateFileSystemDirectory(const char* dir_name,
82 const GURL& origin_url, 82 const GURL& origin_url,
83 fileapi::FileSystemType type) { 83 fileapi::FileSystemType type) {
84 FilePath origin_base_path = GetOriginBasePath(origin_url, type); 84 FilePath origin_base_path = GetOriginBasePath(origin_url, type);
85 FilePath dir_path; 85 FilePath dir_path;
86 if (dir_name != NULL) 86 if (dir_name != NULL)
87 dir_path = origin_base_path.AppendASCII(dir_name); 87 dir_path = origin_base_path.AppendASCII(dir_name);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 EXPECT_EQ(1331 + 134 + kUsageFileSize, 270 EXPECT_EQ(1331 + 134 + kUsageFileSize,
271 GetOriginUsage(tracker.get(), kDummyURL1, kTemporary)); 271 GetOriginUsage(tracker.get(), kDummyURL1, kTemporary));
272 EXPECT_EQ(1903 + 19 + kUsageFileSize, 272 EXPECT_EQ(1903 + 19 + kUsageFileSize,
273 GetOriginUsage(tracker.get(), kDummyURL1, kPersistent)); 273 GetOriginUsage(tracker.get(), kDummyURL1, kPersistent));
274 EXPECT_EQ(1319 + 113 + kUsageFileSize, 274 EXPECT_EQ(1319 + 113 + kUsageFileSize,
275 GetOriginUsage(tracker.get(), kDummyURL2, kTemporary)); 275 GetOriginUsage(tracker.get(), kDummyURL2, kTemporary));
276 EXPECT_EQ(2013 + 18 + kUsageFileSize, 276 EXPECT_EQ(2013 + 18 + kUsageFileSize,
277 GetOriginUsage(tracker.get(), kDummyURL2, kPersistent)); 277 GetOriginUsage(tracker.get(), kDummyURL2, kPersistent));
278 } 278 }
279 } 279 }
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_usage_tracker.cc ('k') | webkit/fileapi/file_system_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698