| OLD | NEW |
| 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 <stdint.h> |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 7 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 11 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_helper_browsertest.h" | 12 #include "chrome/browser/browsing_data/browsing_data_helper_browsertest.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "content/public/browser/storage_partition.h" | 16 #include "content/public/browser/storage_partition.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 28 "chrome-extension_behllobkkfkfnphdnhnkndlbkcpglgmj_0"; | 30 "chrome-extension_behllobkkfkfnphdnhnkndlbkcpglgmj_0"; |
| 29 | 31 |
| 30 class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest { | 32 class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest { |
| 31 public: | 33 public: |
| 32 virtual void CreateDatabases() { | 34 virtual void CreateDatabases() { |
| 33 storage::DatabaseTracker* db_tracker = | 35 storage::DatabaseTracker* db_tracker = |
| 34 BrowserContext::GetDefaultStoragePartition(browser()->profile()) | 36 BrowserContext::GetDefaultStoragePartition(browser()->profile()) |
| 35 ->GetDatabaseTracker(); | 37 ->GetDatabaseTracker(); |
| 36 base::string16 db_name = base::ASCIIToUTF16("db"); | 38 base::string16 db_name = base::ASCIIToUTF16("db"); |
| 37 base::string16 description = base::ASCIIToUTF16("db_description"); | 39 base::string16 description = base::ASCIIToUTF16("db_description"); |
| 38 int64 size; | 40 int64_t size; |
| 39 db_tracker->DatabaseOpened(kTestIdentifier1, db_name, description, | 41 db_tracker->DatabaseOpened(kTestIdentifier1, db_name, description, |
| 40 1, &size); | 42 1, &size); |
| 41 db_tracker->DatabaseClosed(kTestIdentifier1, db_name); | 43 db_tracker->DatabaseClosed(kTestIdentifier1, db_name); |
| 42 base::FilePath db_path1 = | 44 base::FilePath db_path1 = |
| 43 db_tracker->GetFullDBFilePath(kTestIdentifier1, db_name); | 45 db_tracker->GetFullDBFilePath(kTestIdentifier1, db_name); |
| 44 base::CreateDirectory(db_path1.DirName()); | 46 base::CreateDirectory(db_path1.DirName()); |
| 45 ASSERT_EQ(0, base::WriteFile(db_path1, nullptr, 0)); | 47 ASSERT_EQ(0, base::WriteFile(db_path1, nullptr, 0)); |
| 46 db_tracker->DatabaseOpened(kTestIdentifierExtension, db_name, description, | 48 db_tracker->DatabaseOpened(kTestIdentifierExtension, db_name, description, |
| 47 1, &size); | 49 1, &size); |
| 48 db_tracker->DatabaseClosed(kTestIdentifierExtension, db_name); | 50 db_tracker->DatabaseClosed(kTestIdentifierExtension, db_name); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 base::Unretained(&callback))); | 145 base::Unretained(&callback))); |
| 144 | 146 |
| 145 std::list<BrowsingDataDatabaseHelper::DatabaseInfo> result = | 147 std::list<BrowsingDataDatabaseHelper::DatabaseInfo> result = |
| 146 callback.result(); | 148 callback.result(); |
| 147 | 149 |
| 148 ASSERT_EQ(1u, result.size()); | 150 ASSERT_EQ(1u, result.size()); |
| 149 EXPECT_EQ(origin_str, result.begin()->identifier.ToString()); | 151 EXPECT_EQ(origin_str, result.begin()->identifier.ToString()); |
| 150 EXPECT_STREQ(db, result.begin()->database_name.c_str()); | 152 EXPECT_STREQ(db, result.begin()->database_name.c_str()); |
| 151 } | 153 } |
| 152 } // namespace | 154 } // namespace |
| OLD | NEW |