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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_browsertest.cc

Issue 12210030: Linux/ChromeOS Chromium style checker cleanup, content/ edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug109187Test) { 148 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug109187Test) {
149 const GURL url = GetTestUrl("indexeddb", "bug_109187.html"); 149 const GURL url = GetTestUrl("indexeddb", "bug_109187.html");
150 150
151 // Just navigate to the URL. Test will crash if it fails. 151 // Just navigate to the URL. Test will crash if it fails.
152 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1); 152 NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1);
153 } 153 }
154 154
155 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { 155 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest {
156 public: 156 public:
157 virtual void SetUpOnMainThread() { 157 virtual void SetUpOnMainThread() OVERRIDE {
158 const int kInitialQuotaKilobytes = 5000; 158 const int kInitialQuotaKilobytes = 5000;
159 const int kTemporaryStorageQuotaMaxSize = kInitialQuotaKilobytes 159 const int kTemporaryStorageQuotaMaxSize = kInitialQuotaKilobytes
160 * 1024 * QuotaManager::kPerHostTemporaryPortion; 160 * 1024 * QuotaManager::kPerHostTemporaryPortion;
161 SetTempQuota( 161 SetTempQuota(
162 kTemporaryStorageQuotaMaxSize, 162 kTemporaryStorageQuotaMaxSize,
163 BrowserContext::GetDefaultStoragePartition( 163 BrowserContext::GetDefaultStoragePartition(
164 shell()->web_contents()->GetBrowserContext())->GetQuotaManager()); 164 shell()->web_contents()->GetBrowserContext())->GetQuotaManager());
165 } 165 }
166 166
167 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { 167 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) {
(...skipping 14 matching lines...) Expand all
182 } 182 }
183 183
184 }; 184 };
185 185
186 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) { 186 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) {
187 SimpleTest(GetTestUrl("indexeddb", "quota_test.html")); 187 SimpleTest(GetTestUrl("indexeddb", "quota_test.html"));
188 } 188 }
189 189
190 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { 190 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest {
191 public: 191 public:
192 virtual void SetUpCommandLine(CommandLine* command_line) { 192 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
193 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); 193 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
194 } 194 }
195 }; 195 };
196 196
197 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, 197 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed,
198 DatabaseCallbacksTest) { 198 DatabaseCallbacksTest) {
199 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html")); 199 SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html"));
200 } 200 }
201 201
202 static void CopyLevelDBToProfile(Shell* shell, 202 static void CopyLevelDBToProfile(Shell* shell,
(...skipping 13 matching lines...) Expand all
216 const bool kRecursive = true; 216 const bool kRecursive = true;
217 ASSERT_TRUE(file_util::CopyDirectory(test_data_dir, 217 ASSERT_TRUE(file_util::CopyDirectory(test_data_dir,
218 context_impl->data_path(), 218 context_impl->data_path(),
219 kRecursive)); 219 kRecursive));
220 } 220 }
221 221
222 class IndexedDBBrowserTestWithPreexistingLevelDB : public IndexedDBBrowserTest { 222 class IndexedDBBrowserTestWithPreexistingLevelDB : public IndexedDBBrowserTest {
223 public: 223 public:
224 IndexedDBBrowserTestWithPreexistingLevelDB() : disk_usage_(-1) { } 224 IndexedDBBrowserTestWithPreexistingLevelDB() : disk_usage_(-1) { }
225 225
226 virtual void SetUpOnMainThread() { 226 virtual void SetUpOnMainThread() OVERRIDE {
227 scoped_refptr<IndexedDBContext> context = GetContext(); 227 scoped_refptr<IndexedDBContext> context = GetContext();
228 BrowserThread::PostTask( 228 BrowserThread::PostTask(
229 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, 229 BrowserThread::WEBKIT_DEPRECATED, FROM_HERE,
230 base::Bind(&CopyLevelDBToProfile, shell(), context, 230 base::Bind(&CopyLevelDBToProfile, shell(), context,
231 EnclosingLevelDBDir())); 231 EnclosingLevelDBDir()));
232 scoped_refptr<base::ThreadTestHelper> helper( 232 scoped_refptr<base::ThreadTestHelper> helper(
233 new base::ThreadTestHelper(BrowserThread::GetMessageLoopProxyForThread( 233 new base::ThreadTestHelper(BrowserThread::GetMessageLoopProxyForThread(
234 BrowserThread::WEBKIT_DEPRECATED))); 234 BrowserThread::WEBKIT_DEPRECATED)));
235 ASSERT_TRUE(helper->Run()); 235 ASSERT_TRUE(helper->Run());
236 } 236 }
(...skipping 20 matching lines...) Expand all
257 virtual void DidGetDiskUsage(int64 bytes) { 257 virtual void DidGetDiskUsage(int64 bytes) {
258 EXPECT_GT(bytes, 0); 258 EXPECT_GT(bytes, 0);
259 disk_usage_ = bytes; 259 disk_usage_ = bytes;
260 } 260 }
261 261
262 int64 disk_usage_; 262 int64 disk_usage_;
263 }; 263 };
264 264
265 class IndexedDBBrowserTestWithVersion0Schema : public 265 class IndexedDBBrowserTestWithVersion0Schema : public
266 IndexedDBBrowserTestWithPreexistingLevelDB { 266 IndexedDBBrowserTestWithPreexistingLevelDB {
267 virtual std::string EnclosingLevelDBDir() { 267 virtual std::string EnclosingLevelDBDir() OVERRIDE {
268 return "migration_from_0"; 268 return "migration_from_0";
269 } 269 }
270 }; 270 };
271 271
272 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) { 272 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion0Schema, MigrationTest) {
273 SimpleTest(GetTestUrl("indexeddb", "migration_test.html")); 273 SimpleTest(GetTestUrl("indexeddb", "migration_test.html"));
274 } 274 }
275 275
276 class IndexedDBBrowserTestWithVersion123456Schema : public 276 class IndexedDBBrowserTestWithVersion123456Schema : public
277 IndexedDBBrowserTestWithPreexistingLevelDB { 277 IndexedDBBrowserTestWithPreexistingLevelDB {
278 virtual std::string EnclosingLevelDBDir() { 278 virtual std::string EnclosingLevelDBDir() OVERRIDE {
279 return "schema_version_123456"; 279 return "schema_version_123456";
280 } 280 }
281 }; 281 };
282 282
283 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema, 283 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion123456Schema,
284 DestroyTest) { 284 DestroyTest) {
285 int64 original_size = RequestDiskUsage(); 285 int64 original_size = RequestDiskUsage();
286 EXPECT_GT(original_size, 0); 286 EXPECT_GT(original_size, 0);
287 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 287 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
288 int64 new_size = RequestDiskUsage(); 288 int64 new_size = RequestDiskUsage();
289 EXPECT_NE(original_size, new_size); 289 EXPECT_NE(original_size, new_size);
290 } 290 }
291 291
292 class IndexedDBBrowserTestWithVersion987654SSVData : public 292 class IndexedDBBrowserTestWithVersion987654SSVData : public
293 IndexedDBBrowserTestWithPreexistingLevelDB { 293 IndexedDBBrowserTestWithPreexistingLevelDB {
294 virtual std::string EnclosingLevelDBDir() { 294 virtual std::string EnclosingLevelDBDir() OVERRIDE {
295 return "ssv_version_987654"; 295 return "ssv_version_987654";
296 } 296 }
297 }; 297 };
298 298
299 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData, 299 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithVersion987654SSVData,
300 DestroyTest) { 300 DestroyTest) {
301 int64 original_size = RequestDiskUsage(); 301 int64 original_size = RequestDiskUsage();
302 EXPECT_GT(original_size, 0); 302 EXPECT_GT(original_size, 0);
303 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 303 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
304 int64 new_size = RequestDiskUsage(); 304 int64 new_size = RequestDiskUsage();
305 EXPECT_NE(original_size, new_size); 305 EXPECT_NE(original_size, new_size);
306 } 306 }
307 307
308 class IndexedDBBrowserTestWithCorruptLevelDB : public 308 class IndexedDBBrowserTestWithCorruptLevelDB : public
309 IndexedDBBrowserTestWithPreexistingLevelDB { 309 IndexedDBBrowserTestWithPreexistingLevelDB {
310 virtual std::string EnclosingLevelDBDir() { 310 virtual std::string EnclosingLevelDBDir() OVERRIDE {
311 return "corrupt_leveldb"; 311 return "corrupt_leveldb";
312 } 312 }
313 }; 313 };
314 314
315 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB, 315 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithCorruptLevelDB,
316 DestroyTest) { 316 DestroyTest) {
317 int64 original_size = RequestDiskUsage(); 317 int64 original_size = RequestDiskUsage();
318 EXPECT_GT(original_size, 0); 318 EXPECT_GT(original_size, 0);
319 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html")); 319 SimpleTest(GetTestUrl("indexeddb", "open_bad_db.html"));
320 int64 new_size = RequestDiskUsage(); 320 int64 new_size = RequestDiskUsage();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16); 403 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16);
404 404
405 base::KillProcess( 405 base::KillProcess(
406 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true); 406 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true);
407 shell()->Close(); 407 shell()->Close();
408 408
409 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); 409 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
410 } 410 }
411 411
412 } // namespace content 412 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/webgl_conformance_test.cc ('k') | content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698