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

Side by Side Diff: webkit/browser/fileapi/sandbox_mount_point_provider_unittest.cc

Issue 16097005: Fix leak in fileapi::SandboxMountPointProviderTest::GetRootPath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « 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 (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 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h" 5 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 base::FilePath target = provider_-> 103 base::FilePath target = provider_->
104 GetBaseDirectoryForOriginAndType(origin, type, true); 104 GetBaseDirectoryForOriginAndType(origin, type, true);
105 ASSERT_TRUE(!target.empty()); 105 ASSERT_TRUE(!target.empty());
106 ASSERT_TRUE(file_util::DirectoryExists(target)); 106 ASSERT_TRUE(file_util::DirectoryExists(target));
107 } 107 }
108 108
109 bool GetRootPath(const GURL& origin_url, 109 bool GetRootPath(const GURL& origin_url,
110 fileapi::FileSystemType type, 110 fileapi::FileSystemType type,
111 OpenFileSystemMode mode, 111 OpenFileSystemMode mode,
112 base::FilePath* root_path) { 112 base::FilePath* root_path) {
113 base::PlatformFileError* error = new base::PlatformFileError( 113 base::PlatformFileError error = base::PLATFORM_FILE_OK;
114 base::PLATFORM_FILE_OK);
115 provider_->OpenFileSystem( 114 provider_->OpenFileSystem(
116 origin_url, type, mode, 115 origin_url, type, mode,
117 base::Bind(&DidOpenFileSystem, error)); 116 base::Bind(&DidOpenFileSystem, &error));
118 base::MessageLoop::current()->RunUntilIdle(); 117 base::MessageLoop::current()->RunUntilIdle();
119 if (*error != base::PLATFORM_FILE_OK) 118 if (error != base::PLATFORM_FILE_OK)
120 return false; 119 return false;
121 base::FilePath returned_root_path = 120 base::FilePath returned_root_path =
122 provider_->GetBaseDirectoryForOriginAndType( 121 provider_->GetBaseDirectoryForOriginAndType(
123 origin_url, type, false /* create */); 122 origin_url, type, false /* create */);
124 if (root_path) 123 if (root_path)
125 *root_path = returned_root_path; 124 *root_path = returned_root_path;
126 return !returned_root_path.empty(); 125 return !returned_root_path.empty();
127 } 126 }
128 127
129 base::FilePath file_system_path() const { 128 base::FilePath file_system_path() const {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, 386 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
388 &root_path)); 387 &root_path));
389 base::FilePath expected = file_system_path().AppendASCII( 388 base::FilePath expected = file_system_path().AppendASCII(
390 kRootPathFileURITestCases[i].expected_path); 389 kRootPathFileURITestCases[i].expected_path);
391 EXPECT_EQ(expected.value(), root_path.value()); 390 EXPECT_EQ(expected.value(), root_path.value());
392 EXPECT_TRUE(file_util::DirectoryExists(root_path)); 391 EXPECT_TRUE(file_util::DirectoryExists(root_path));
393 } 392 }
394 } 393 }
395 394
396 } // namespace fileapi 395 } // namespace fileapi
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