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

Side by Side Diff: content/browser/indexed_db/indexed_db_unittest.cc

Issue 17948002: Update Linux to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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
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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/indexed_db/indexed_db_context_impl.h" 10 #include "content/browser/indexed_db/indexed_db_context_impl.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 55 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
56 56
57 base::FilePath normal_path; 57 base::FilePath normal_path;
58 base::FilePath session_only_path; 58 base::FilePath session_only_path;
59 59
60 // Create the scope which will ensure we run the destructor of the context 60 // Create the scope which will ensure we run the destructor of the context
61 // which should trigger the clean up. 61 // which should trigger the clean up.
62 { 62 {
63 scoped_refptr<IndexedDBContextImpl> idb_context = 63 scoped_refptr<IndexedDBContextImpl> idb_context =
64 new IndexedDBContextImpl(temp_dir.path(), 64 new IndexedDBContextImpl(temp_dir.path(),
65 special_storage_policy_, 65 special_storage_policy_.get(),
66 NULL, 66 NULL,
67 task_runner_); 67 task_runner_.get());
68 68
69 normal_path = idb_context->GetFilePathForTesting( 69 normal_path = idb_context->GetFilePathForTesting(
70 webkit_database::GetIdentifierFromOrigin(kNormalOrigin)); 70 webkit_database::GetIdentifierFromOrigin(kNormalOrigin));
71 session_only_path = idb_context->GetFilePathForTesting( 71 session_only_path = idb_context->GetFilePathForTesting(
72 webkit_database::GetIdentifierFromOrigin(kSessionOnlyOrigin)); 72 webkit_database::GetIdentifierFromOrigin(kSessionOnlyOrigin));
73 ASSERT_TRUE(file_util::CreateDirectory(normal_path)); 73 ASSERT_TRUE(file_util::CreateDirectory(normal_path));
74 ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); 74 ASSERT_TRUE(file_util::CreateDirectory(session_only_path));
75 FlushIndexedDBTaskRunner(); 75 FlushIndexedDBTaskRunner();
76 message_loop_.RunUntilIdle(); 76 message_loop_.RunUntilIdle();
77 } 77 }
(...skipping 11 matching lines...) Expand all
89 89
90 base::FilePath normal_path; 90 base::FilePath normal_path;
91 base::FilePath session_only_path; 91 base::FilePath session_only_path;
92 92
93 // Create the scope which will ensure we run the destructor of the context. 93 // Create the scope which will ensure we run the destructor of the context.
94 { 94 {
95 // Create some indexedDB paths. 95 // Create some indexedDB paths.
96 // With the levelDB backend, these are directories. 96 // With the levelDB backend, these are directories.
97 scoped_refptr<IndexedDBContextImpl> idb_context = 97 scoped_refptr<IndexedDBContextImpl> idb_context =
98 new IndexedDBContextImpl(temp_dir.path(), 98 new IndexedDBContextImpl(temp_dir.path(),
99 special_storage_policy_, 99 special_storage_policy_.get(),
100 NULL, 100 NULL,
101 task_runner_); 101 task_runner_.get());
102 102
103 // Save session state. This should bypass the destruction-time deletion. 103 // Save session state. This should bypass the destruction-time deletion.
104 idb_context->SetForceKeepSessionState(); 104 idb_context->SetForceKeepSessionState();
105 105
106 normal_path = idb_context->GetFilePathForTesting( 106 normal_path = idb_context->GetFilePathForTesting(
107 webkit_database::GetIdentifierFromOrigin(kNormalOrigin)); 107 webkit_database::GetIdentifierFromOrigin(kNormalOrigin));
108 session_only_path = idb_context->GetFilePathForTesting( 108 session_only_path = idb_context->GetFilePathForTesting(
109 webkit_database::GetIdentifierFromOrigin(kSessionOnlyOrigin)); 109 webkit_database::GetIdentifierFromOrigin(kSessionOnlyOrigin));
110 ASSERT_TRUE(file_util::CreateDirectory(normal_path)); 110 ASSERT_TRUE(file_util::CreateDirectory(normal_path));
111 ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); 111 ASSERT_TRUE(file_util::CreateDirectory(session_only_path));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 base::FilePath test_path; 148 base::FilePath test_path;
149 149
150 // Create the scope which will ensure we run the destructor of the context. 150 // Create the scope which will ensure we run the destructor of the context.
151 { 151 {
152 TestBrowserContext browser_context; 152 TestBrowserContext browser_context;
153 153
154 const GURL kTestOrigin("http://test/"); 154 const GURL kTestOrigin("http://test/");
155 155
156 scoped_refptr<IndexedDBContextImpl> idb_context = 156 scoped_refptr<IndexedDBContextImpl> idb_context =
157 new IndexedDBContextImpl(temp_dir.path(), 157 new IndexedDBContextImpl(temp_dir.path(),
158 special_storage_policy_, 158 special_storage_policy_.get(),
159 NULL, 159 NULL,
160 task_runner_); 160 task_runner_.get());
161 161
162 test_path = idb_context->GetFilePathForTesting( 162 test_path = idb_context->GetFilePathForTesting(
163 webkit_database::GetIdentifierFromOrigin(kTestOrigin)); 163 webkit_database::GetIdentifierFromOrigin(kTestOrigin));
164 ASSERT_TRUE(file_util::CreateDirectory(test_path)); 164 ASSERT_TRUE(file_util::CreateDirectory(test_path));
165 165
166 const bool kExpectForceClose = true; 166 const bool kExpectForceClose = true;
167 167
168 MockWebIDBDatabase connection1(kExpectForceClose); 168 MockWebIDBDatabase connection1(kExpectForceClose);
169 idb_context->TaskRunner()->PostTask( 169 idb_context->TaskRunner()->PostTask(
170 FROM_HERE, 170 FROM_HERE,
(...skipping 25 matching lines...) Expand all
196 message_loop_.RunUntilIdle(); 196 message_loop_.RunUntilIdle();
197 } 197 }
198 198
199 // Make sure we wait until the destructor has run. 199 // Make sure we wait until the destructor has run.
200 message_loop_.RunUntilIdle(); 200 message_loop_.RunUntilIdle();
201 201
202 EXPECT_FALSE(file_util::DirectoryExists(test_path)); 202 EXPECT_FALSE(file_util::DirectoryExists(test_path));
203 } 203 }
204 204
205 } // namespace content 205 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698