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

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

Issue 7056025: More WebSQLDatabase and QuotaManager integration. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/browsing_data_database_helper.h" 7 #include "chrome/browser/browsing_data_database_helper.h"
8 #include "chrome/browser/browsing_data_helper_browsertest.h" 8 #include "chrome/browser/browsing_data_helper_browsertest.h"
9 #include "chrome/test/in_process_browser_test.h" 9 #include "chrome/test/in_process_browser_test.h"
10 #include "chrome/test/testing_profile.h" 10 #include "chrome/test/testing_profile.h"
(...skipping 10 matching lines...) Expand all
21 "chrome-extension_behllobkkfkfnphdnhnkndlbkcpglgmj_0"; 21 "chrome-extension_behllobkkfkfnphdnhnkndlbkcpglgmj_0";
22 22
23 class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest { 23 class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest {
24 public: 24 public:
25 virtual void CreateDatabases() { 25 virtual void CreateDatabases() {
26 webkit_database::DatabaseTracker* db_tracker = 26 webkit_database::DatabaseTracker* db_tracker =
27 testing_profile_.GetDatabaseTracker(); 27 testing_profile_.GetDatabaseTracker();
28 string16 db_name = ASCIIToUTF16("db"); 28 string16 db_name = ASCIIToUTF16("db");
29 string16 description = ASCIIToUTF16("db_description"); 29 string16 description = ASCIIToUTF16("db_description");
30 int64 size; 30 int64 size;
31 int64 available;
32 string16 identifier1(UTF8ToUTF16(kTestIdentifier1)); 31 string16 identifier1(UTF8ToUTF16(kTestIdentifier1));
33 db_tracker->DatabaseOpened(identifier1, db_name, description, 1, &size, 32 db_tracker->DatabaseOpened(identifier1, db_name, description, 1, &size);
34 &available);
35 db_tracker->DatabaseClosed(identifier1, db_name); 33 db_tracker->DatabaseClosed(identifier1, db_name);
36 FilePath db_path1 = db_tracker->GetFullDBFilePath(identifier1, db_name); 34 FilePath db_path1 = db_tracker->GetFullDBFilePath(identifier1, db_name);
37 file_util::CreateDirectory(db_path1.DirName()); 35 file_util::CreateDirectory(db_path1.DirName());
38 ASSERT_EQ(0, file_util::WriteFile(db_path1, NULL, 0)); 36 ASSERT_EQ(0, file_util::WriteFile(db_path1, NULL, 0));
39 string16 identifierExtension(UTF8ToUTF16(kTestIdentifierExtension)); 37 string16 identifierExtension(UTF8ToUTF16(kTestIdentifierExtension));
40 db_tracker->DatabaseOpened(identifierExtension, db_name, description, 1, 38 db_tracker->DatabaseOpened(identifierExtension, db_name, description, 1,
41 &size, &available); 39 &size);
42 db_tracker->DatabaseClosed(identifierExtension, db_name); 40 db_tracker->DatabaseClosed(identifierExtension, db_name);
43 FilePath db_path2 = 41 FilePath db_path2 =
44 db_tracker->GetFullDBFilePath(identifierExtension, db_name); 42 db_tracker->GetFullDBFilePath(identifierExtension, db_name);
45 file_util::CreateDirectory(db_path2.DirName()); 43 file_util::CreateDirectory(db_path2.DirName());
46 ASSERT_EQ(0, file_util::WriteFile(db_path2, NULL, 0)); 44 ASSERT_EQ(0, file_util::WriteFile(db_path2, NULL, 0));
47 std::vector<webkit_database::OriginInfo> origins; 45 std::vector<webkit_database::OriginInfo> origins;
48 db_tracker->GetAllOriginsInfo(&origins); 46 db_tracker->GetAllOriginsInfo(&origins);
49 ASSERT_EQ(2U, origins.size()); 47 ASSERT_EQ(2U, origins.size());
50 } 48 }
51 49
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 NewCallback(&callback, &TestCompletionCallback::callback)); 131 NewCallback(&callback, &TestCompletionCallback::callback));
134 132
135 std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> result = 133 std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> result =
136 callback.result(); 134 callback.result();
137 135
138 ASSERT_EQ(1u, result.size()); 136 ASSERT_EQ(1u, result.size());
139 EXPECT_STREQ(origin_str, result[0].origin_identifier.c_str()); 137 EXPECT_STREQ(origin_str, result[0].origin_identifier.c_str());
140 EXPECT_STREQ(db, result[0].database_name.c_str()); 138 EXPECT_STREQ(db, result[0].database_name.c_str());
141 } 139 }
142 } // namespace 140 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_unittest.cc » ('j') | webkit/database/database_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698