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

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

Issue 4682002: Remove "name" field from indexed databases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browsing_data_indexed_db_helper.h" 8 #include "chrome/browser/browsing_data_indexed_db_helper.h"
9 #include "chrome/test/testing_profile.h" 9 #include "chrome/test/testing_profile.h"
10 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" 10 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
(...skipping 24 matching lines...) Expand all
35 35
36 DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback); 36 DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback);
37 }; 37 };
38 38
39 // Functionality incomplete, needs further refactoring, http://crbug.com/60532. 39 // Functionality incomplete, needs further refactoring, http://crbug.com/60532.
40 TEST(CannedBrowsingDataIndexedDBHelperTest, DISABLED_AddIndexedDB) { 40 TEST(CannedBrowsingDataIndexedDBHelperTest, DISABLED_AddIndexedDB) {
41 TestingProfile profile; 41 TestingProfile profile;
42 42
43 const GURL origin1("http://host1:1/"); 43 const GURL origin1("http://host1:1/");
44 const GURL origin2("http://host2:1/"); 44 const GURL origin2("http://host2:1/");
45 const string16 name(ASCIIToUTF16("name"));
46 const string16 description(ASCIIToUTF16("description")); 45 const string16 description(ASCIIToUTF16("description"));
47 const FilePath::CharType file1[] = 46 const FilePath::CharType file1[] =
48 FILE_PATH_LITERAL("http_host1_1@name.indexeddb"); 47 FILE_PATH_LITERAL("http_host1_1.indexeddb");
49 const FilePath::CharType file2[] = 48 const FilePath::CharType file2[] =
50 FILE_PATH_LITERAL("http_host2_1@name.indexeddb"); 49 FILE_PATH_LITERAL("http_host2_1.indexeddb");
51 50
52 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( 51 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
53 new CannedBrowsingDataIndexedDBHelper(&profile)); 52 new CannedBrowsingDataIndexedDBHelper(&profile));
54 helper->AddIndexedDB(origin1, name, description); 53 helper->AddIndexedDB(origin1, description);
55 helper->AddIndexedDB(origin2, name, description); 54 helper->AddIndexedDB(origin2, description);
56 55
57 TestCompletionCallback callback; 56 TestCompletionCallback callback;
58 helper->StartFetching( 57 helper->StartFetching(
59 NewCallback(&callback, &TestCompletionCallback::callback)); 58 NewCallback(&callback, &TestCompletionCallback::callback));
60 ASSERT_TRUE(callback.has_result()); 59 ASSERT_TRUE(callback.has_result());
61 60
62 std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = 61 std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> result =
63 callback.result(); 62 callback.result();
64 63
65 ASSERT_EQ(2U, result.size()); 64 ASSERT_EQ(2U, result.size());
66 EXPECT_EQ(FilePath(file1).value(), result[0].file_path.BaseName().value()); 65 EXPECT_EQ(FilePath(file1).value(), result[0].file_path.BaseName().value());
67 EXPECT_EQ(FilePath(file2).value(), result[1].file_path.BaseName().value()); 66 EXPECT_EQ(FilePath(file2).value(), result[1].file_path.BaseName().value());
68 } 67 }
69 68
70 // Functionality incomplete, needs further refactoring, http://crbug.com/60532. 69 // Functionality incomplete, needs further refactoring, http://crbug.com/60532.
71 TEST(CannedBrowsingDataIndexedDBHelperTest, DISABLED_Unique) { 70 TEST(CannedBrowsingDataIndexedDBHelperTest, DISABLED_Unique) {
72 TestingProfile profile; 71 TestingProfile profile;
73 72
74 const GURL origin("http://host1:1/"); 73 const GURL origin("http://host1:1/");
75 const string16 name(ASCIIToUTF16("name"));
76 const string16 description(ASCIIToUTF16("description")); 74 const string16 description(ASCIIToUTF16("description"));
77 const FilePath::CharType file[] = 75 const FilePath::CharType file[] =
78 FILE_PATH_LITERAL("http_host1_1@name.indexeddb"); 76 FILE_PATH_LITERAL("http_host1_1.indexeddb");
79 77
80 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( 78 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
81 new CannedBrowsingDataIndexedDBHelper(&profile)); 79 new CannedBrowsingDataIndexedDBHelper(&profile));
82 helper->AddIndexedDB(origin, name, description); 80 helper->AddIndexedDB(origin, description);
83 helper->AddIndexedDB(origin, name, description); 81 helper->AddIndexedDB(origin, description);
84 82
85 TestCompletionCallback callback; 83 TestCompletionCallback callback;
86 helper->StartFetching( 84 helper->StartFetching(
87 NewCallback(&callback, &TestCompletionCallback::callback)); 85 NewCallback(&callback, &TestCompletionCallback::callback));
88 ASSERT_TRUE(callback.has_result()); 86 ASSERT_TRUE(callback.has_result());
89 87
90 std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> result = 88 std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> result =
91 callback.result(); 89 callback.result();
92 90
93 ASSERT_EQ(1U, result.size()); 91 ASSERT_EQ(1U, result.size());
94 EXPECT_EQ(FilePath(file).value(), result[0].file_path.BaseName().value()); 92 EXPECT_EQ(FilePath(file).value(), result[0].file_path.BaseName().value());
95 } 93 }
96 94
97 TEST(CannedBrowsingDataIndexedDBHelperTest, Empty) { 95 TEST(CannedBrowsingDataIndexedDBHelperTest, Empty) {
98 TestingProfile profile; 96 TestingProfile profile;
99 97
100 const GURL origin("http://host1:1/"); 98 const GURL origin("http://host1:1/");
101 const string16 name(ASCIIToUTF16("name"));
102 const string16 description(ASCIIToUTF16("description")); 99 const string16 description(ASCIIToUTF16("description"));
103 100
104 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper( 101 scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
105 new CannedBrowsingDataIndexedDBHelper(&profile)); 102 new CannedBrowsingDataIndexedDBHelper(&profile));
106 103
107 ASSERT_TRUE(helper->empty()); 104 ASSERT_TRUE(helper->empty());
108 helper->AddIndexedDB(origin, name, description); 105 helper->AddIndexedDB(origin, description);
109 ASSERT_FALSE(helper->empty()); 106 ASSERT_FALSE(helper->empty());
110 helper->Reset(); 107 helper->Reset();
111 ASSERT_TRUE(helper->empty()); 108 ASSERT_TRUE(helper->empty());
112 } 109 }
113 110
114 } // namespace 111 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_indexed_db_helper.cc ('k') | chrome/browser/cocoa/cookie_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698