OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 "https_www.google.com_0.localstorage", | 436 "https_www.google.com_0.localstorage", |
437 "https_www.google.com_0.localstorage-journal" }, | 437 "https_www.google.com_0.localstorage-journal" }, |
438 { "http://www.google.com:8080/", | 438 { "http://www.google.com:8080/", |
439 "http_www.google.com_8080.localstorage", | 439 "http_www.google.com_8080.localstorage", |
440 "http_www.google.com_8080.localstorage-journal" }, | 440 "http_www.google.com_8080.localstorage-journal" }, |
441 { "file:///", | 441 { "file:///", |
442 "file__0.localstorage", | 442 "file__0.localstorage", |
443 "file__0.localstorage-journal" }, | 443 "file__0.localstorage-journal" }, |
444 }; | 444 }; |
445 | 445 |
446 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kCases); ++i) { | 446 for (size_t i = 0; i < arraysize(kCases); ++i) { |
447 GURL origin = GURL(kCases[i].origin).GetOrigin(); | 447 GURL origin = GURL(kCases[i].origin).GetOrigin(); |
448 base::FilePath file_name = | 448 base::FilePath file_name = |
449 base::FilePath().AppendASCII(kCases[i].file_name); | 449 base::FilePath().AppendASCII(kCases[i].file_name); |
450 base::FilePath journal_file_name = | 450 base::FilePath journal_file_name = |
451 base::FilePath().AppendASCII(kCases[i].journal_file_name); | 451 base::FilePath().AppendASCII(kCases[i].journal_file_name); |
452 | 452 |
453 EXPECT_EQ(file_name, | 453 EXPECT_EQ(file_name, |
454 DOMStorageArea::DatabaseFileNameFromOrigin(origin)); | 454 DOMStorageArea::DatabaseFileNameFromOrigin(origin)); |
455 EXPECT_EQ(origin, | 455 EXPECT_EQ(origin, |
456 DOMStorageArea::OriginFromDatabaseFileName(file_name)); | 456 DOMStorageArea::OriginFromDatabaseFileName(file_name)); |
457 EXPECT_EQ(journal_file_name, | 457 EXPECT_EQ(journal_file_name, |
458 DOMStorageDatabase::GetJournalFilePath(file_name)); | 458 DOMStorageDatabase::GetJournalFilePath(file_name)); |
459 } | 459 } |
460 | 460 |
461 // Also test some DOMStorageDatabase::GetJournalFilePath cases here. | 461 // Also test some DOMStorageDatabase::GetJournalFilePath cases here. |
462 base::FilePath parent = base::FilePath().AppendASCII("a").AppendASCII("b"); | 462 base::FilePath parent = base::FilePath().AppendASCII("a").AppendASCII("b"); |
463 EXPECT_EQ( | 463 EXPECT_EQ( |
464 parent.AppendASCII("file-journal"), | 464 parent.AppendASCII("file-journal"), |
465 DOMStorageDatabase::GetJournalFilePath(parent.AppendASCII("file"))); | 465 DOMStorageDatabase::GetJournalFilePath(parent.AppendASCII("file"))); |
466 EXPECT_EQ( | 466 EXPECT_EQ( |
467 base::FilePath().AppendASCII("-journal"), | 467 base::FilePath().AppendASCII("-journal"), |
468 DOMStorageDatabase::GetJournalFilePath(base::FilePath())); | 468 DOMStorageDatabase::GetJournalFilePath(base::FilePath())); |
469 EXPECT_EQ( | 469 EXPECT_EQ( |
470 base::FilePath().AppendASCII(".extensiononly-journal"), | 470 base::FilePath().AppendASCII(".extensiononly-journal"), |
471 DOMStorageDatabase::GetJournalFilePath( | 471 DOMStorageDatabase::GetJournalFilePath( |
472 base::FilePath().AppendASCII(".extensiononly"))); | 472 base::FilePath().AppendASCII(".extensiononly"))); |
473 } | 473 } |
474 | 474 |
475 } // namespace content | 475 } // namespace content |
OLD | NEW |