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

Side by Side Diff: webkit/database/databases_table_unittest.cc

Issue 13219005: Replace string16 with base::string16 in src/webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/string_util.h" 5 #include "base/string_util.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "sql/connection.h" 7 #include "sql/connection.h"
8 #include "sql/statement.h" 8 #include "sql/statement.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "webkit/database/databases_table.h" 10 #include "webkit/database/databases_table.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // There should be only two databases with origin "origin1". 118 // There should be only two databases with origin "origin1".
119 std::vector<DatabaseDetails> details_out_origin1; 119 std::vector<DatabaseDetails> details_out_origin1;
120 EXPECT_TRUE(databases_table.GetAllDatabaseDetailsForOrigin( 120 EXPECT_TRUE(databases_table.GetAllDatabaseDetailsForOrigin(
121 details_in1.origin_identifier, &details_out_origin1)); 121 details_in1.origin_identifier, &details_out_origin1));
122 EXPECT_EQ(size_t(2), details_out_origin1.size()); 122 EXPECT_EQ(size_t(2), details_out_origin1.size());
123 CheckDetailsAreEqual(details_in1, details_out_origin1[0]); 123 CheckDetailsAreEqual(details_in1, details_out_origin1[0]);
124 CheckDetailsAreEqual(details_in2, details_out_origin1[1]); 124 CheckDetailsAreEqual(details_in2, details_out_origin1[1]);
125 125
126 // Get the list of all origins: should be "origin1" and "origin2". 126 // Get the list of all origins: should be "origin1" and "origin2".
127 std::vector<string16> origins_out; 127 std::vector<base::string16> origins_out;
128 EXPECT_TRUE(databases_table.GetAllOrigins(&origins_out)); 128 EXPECT_TRUE(databases_table.GetAllOrigins(&origins_out));
129 EXPECT_EQ(size_t(2), origins_out.size()); 129 EXPECT_EQ(size_t(2), origins_out.size());
130 EXPECT_EQ(details_in1.origin_identifier, origins_out[0]); 130 EXPECT_EQ(details_in1.origin_identifier, origins_out[0]);
131 EXPECT_EQ(details_in3.origin_identifier, origins_out[1]); 131 EXPECT_EQ(details_in3.origin_identifier, origins_out[1]);
132 132
133 // Delete an origin and check that it's no longer in the table. 133 // Delete an origin and check that it's no longer in the table.
134 origins_out.clear(); 134 origins_out.clear();
135 EXPECT_TRUE(databases_table.DeleteOrigin(details_in3.origin_identifier)); 135 EXPECT_TRUE(databases_table.DeleteOrigin(details_in3.origin_identifier));
136 EXPECT_TRUE(databases_table.GetAllOrigins(&origins_out)); 136 EXPECT_TRUE(databases_table.GetAllOrigins(&origins_out));
137 EXPECT_EQ(size_t(1), origins_out.size()); 137 EXPECT_EQ(size_t(1), origins_out.size());
138 EXPECT_EQ(details_in1.origin_identifier, origins_out[0]); 138 EXPECT_EQ(details_in1.origin_identifier, origins_out[0]);
139 139
140 // Deleting an origin that doesn't have any record in this table should fail. 140 // Deleting an origin that doesn't have any record in this table should fail.
141 EXPECT_FALSE(databases_table.DeleteOrigin(ASCIIToUTF16("unknown_origin"))); 141 EXPECT_FALSE(databases_table.DeleteOrigin(ASCIIToUTF16("unknown_origin")));
142 142
143 // Delete the details for 'db1' and check that they're no longer there. 143 // Delete the details for 'db1' and check that they're no longer there.
144 EXPECT_TRUE(databases_table.DeleteDatabaseDetails( 144 EXPECT_TRUE(databases_table.DeleteDatabaseDetails(
145 details_in1.origin_identifier, details_in1.database_name)); 145 details_in1.origin_identifier, details_in1.database_name));
146 EXPECT_FALSE(databases_table.GetDatabaseDetails( 146 EXPECT_FALSE(databases_table.GetDatabaseDetails(
147 details_in1.origin_identifier, 147 details_in1.origin_identifier,
148 details_in1.database_name, 148 details_in1.database_name,
149 &details_out1)); 149 &details_out1));
150 150
151 // Check that trying to delete a record that doesn't exist fails. 151 // Check that trying to delete a record that doesn't exist fails.
152 EXPECT_FALSE(databases_table.DeleteDatabaseDetails( 152 EXPECT_FALSE(databases_table.DeleteDatabaseDetails(
153 ASCIIToUTF16("unknown_origin"), ASCIIToUTF16("unknown_database"))); 153 ASCIIToUTF16("unknown_origin"), ASCIIToUTF16("unknown_database")));
154 } 154 }
155 155
156 } // namespace webkit_database 156 } // namespace webkit_database
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698