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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" 9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
10 #include "chrome/browser/browsing_data/browsing_data_helper_browsertest.h" 10 #include "chrome/browser/browsing_data/browsing_data_helper_browsertest.h"
(...skipping 12 matching lines...) Expand all
23 TestCompletionCallback; 23 TestCompletionCallback;
24 24
25 const char kTestIdentifier1[] = "http_www.google.com_0"; 25 const char kTestIdentifier1[] = "http_www.google.com_0";
26 26
27 const char kTestIdentifierExtension[] = 27 const char kTestIdentifierExtension[] =
28 "chrome-extension_behllobkkfkfnphdnhnkndlbkcpglgmj_0"; 28 "chrome-extension_behllobkkfkfnphdnhnkndlbkcpglgmj_0";
29 29
30 class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest { 30 class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest {
31 public: 31 public:
32 virtual void CreateDatabases() { 32 virtual void CreateDatabases() {
33 webkit_database::DatabaseTracker* db_tracker = 33 storage::DatabaseTracker* db_tracker =
34 BrowserContext::GetDefaultStoragePartition(browser()->profile())-> 34 BrowserContext::GetDefaultStoragePartition(browser()->profile())
35 GetDatabaseTracker(); 35 ->GetDatabaseTracker();
36 base::string16 db_name = base::ASCIIToUTF16("db"); 36 base::string16 db_name = base::ASCIIToUTF16("db");
37 base::string16 description = base::ASCIIToUTF16("db_description"); 37 base::string16 description = base::ASCIIToUTF16("db_description");
38 int64 size; 38 int64 size;
39 db_tracker->DatabaseOpened(kTestIdentifier1, db_name, description, 39 db_tracker->DatabaseOpened(kTestIdentifier1, db_name, description,
40 1, &size); 40 1, &size);
41 db_tracker->DatabaseClosed(kTestIdentifier1, db_name); 41 db_tracker->DatabaseClosed(kTestIdentifier1, db_name);
42 base::FilePath db_path1 = 42 base::FilePath db_path1 =
43 db_tracker->GetFullDBFilePath(kTestIdentifier1, db_name); 43 db_tracker->GetFullDBFilePath(kTestIdentifier1, db_name);
44 base::CreateDirectory(db_path1.DirName()); 44 base::CreateDirectory(db_path1.DirName());
45 ASSERT_EQ(0, base::WriteFile(db_path1, NULL, 0)); 45 ASSERT_EQ(0, base::WriteFile(db_path1, NULL, 0));
46 db_tracker->DatabaseOpened(kTestIdentifierExtension, db_name, description, 46 db_tracker->DatabaseOpened(kTestIdentifierExtension, db_name, description,
47 1, &size); 47 1, &size);
48 db_tracker->DatabaseClosed(kTestIdentifierExtension, db_name); 48 db_tracker->DatabaseClosed(kTestIdentifierExtension, db_name);
49 base::FilePath db_path2 = 49 base::FilePath db_path2 =
50 db_tracker->GetFullDBFilePath(kTestIdentifierExtension, db_name); 50 db_tracker->GetFullDBFilePath(kTestIdentifierExtension, db_name);
51 base::CreateDirectory(db_path2.DirName()); 51 base::CreateDirectory(db_path2.DirName());
52 ASSERT_EQ(0, base::WriteFile(db_path2, NULL, 0)); 52 ASSERT_EQ(0, base::WriteFile(db_path2, NULL, 0));
53 std::vector<webkit_database::OriginInfo> origins; 53 std::vector<storage::OriginInfo> origins;
54 db_tracker->GetAllOriginsInfo(&origins); 54 db_tracker->GetAllOriginsInfo(&origins);
55 ASSERT_EQ(2U, origins.size()); 55 ASSERT_EQ(2U, origins.size());
56 } 56 }
57 }; 57 };
58 58
59 // Called back by BrowsingDataDatabaseHelper on the UI thread once the database 59 // Called back by BrowsingDataDatabaseHelper on the UI thread once the database
60 // information has been retrieved. 60 // information has been retrieved.
61 class StopTestOnCallback { 61 class StopTestOnCallback {
62 public: 62 public:
63 explicit StopTestOnCallback( 63 explicit StopTestOnCallback(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 base::Unretained(&callback))); 143 base::Unretained(&callback)));
144 144
145 std::list<BrowsingDataDatabaseHelper::DatabaseInfo> result = 145 std::list<BrowsingDataDatabaseHelper::DatabaseInfo> result =
146 callback.result(); 146 callback.result();
147 147
148 ASSERT_EQ(1u, result.size()); 148 ASSERT_EQ(1u, result.size());
149 EXPECT_EQ(origin_str, result.begin()->identifier.ToString()); 149 EXPECT_EQ(origin_str, result.begin()->identifier.ToString());
150 EXPECT_STREQ(db, result.begin()->database_name.c_str()); 150 EXPECT_STREQ(db, result.begin()->database_name.c_str());
151 } 151 }
152 } // namespace 152 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698