OLD | NEW |
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 <limits> | 5 #include <limits> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "chrome/browser/password_manager/encryptor.h" | 10 #include "chrome/browser/password_manager/encryptor.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 EXPECT_GE(version, 12); | 218 EXPECT_GE(version, 12); |
219 | 219 |
220 SQLStatement table_query; | 220 SQLStatement table_query; |
221 table_query.prepare(handle, "SELECT name FROM sqlite_master " | 221 table_query.prepare(handle, "SELECT name FROM sqlite_master " |
222 "WHERE type='table' AND name='signin_types'"); | 222 "WHERE type='table' AND name='signin_types'"); |
223 ASSERT_NE(SQLITE_ROW, table_query.step()); | 223 ASSERT_NE(SQLITE_ROW, table_query.step()); |
224 } | 224 } |
225 } | 225 } |
226 | 226 |
227 TEST_F(UserSettingsTest, APEncode) { | 227 TEST_F(UserSettingsTest, APEncode) { |
228 string test; | 228 std::string test; |
229 char i; | 229 char i; |
230 for (i = numeric_limits<char>::min(); i < numeric_limits<char>::max(); ++i) | 230 for (i = numeric_limits<char>::min(); i < numeric_limits<char>::max(); ++i) |
231 test.push_back(i); | 231 test.push_back(i); |
232 test.push_back(i); | 232 test.push_back(i); |
233 const string encoded = APEncode(test); | 233 const std::string encoded = APEncode(test); |
234 const string decoded = APDecode(encoded); | 234 const std::string decoded = APDecode(encoded); |
235 ASSERT_EQ(test, decoded); | 235 ASSERT_EQ(test, decoded); |
236 } | 236 } |
237 | 237 |
238 TEST_F(UserSettingsTest, PersistEmptyToken) { | 238 TEST_F(UserSettingsTest, PersistEmptyToken) { |
239 ScopedTempDir temp_dir; | 239 ScopedTempDir temp_dir; |
240 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 240 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
241 UserSettings settings; | 241 UserSettings settings; |
242 settings.Init(temp_dir.path().AppendASCII("UserSettings.sqlite3")); | 242 settings.Init(temp_dir.path().AppendASCII("UserSettings.sqlite3")); |
243 settings.SetAuthTokenForService("username", "service", ""); | 243 settings.SetAuthTokenForService("username", "service", ""); |
244 std::string username; | 244 std::string username; |
(...skipping 17 matching lines...) Expand all Loading... |
262 std::string token; | 262 std::string token; |
263 ASSERT_TRUE(settings.GetLastUserAndServiceToken("service", &username, | 263 ASSERT_TRUE(settings.GetLastUserAndServiceToken("service", &username, |
264 &token)); | 264 &token)); |
265 EXPECT_EQ( | 265 EXPECT_EQ( |
266 "oonetuhasonteuhasonetuhasonetuhasonetuhasouhasonetuhasonetuhasonetuhah" | 266 "oonetuhasonteuhasonetuhasonetuhasonetuhasouhasonetuhasonetuhasonetuhah" |
267 "oonetuhasonteuhasonetuhasonetuhasonetuhasouhasonetuhasonetuhasonetuhah" | 267 "oonetuhasonteuhasonetuhasonetuhasonetuhasouhasonetuhasonetuhasonetuhah" |
268 "oonetuhasonteuhasonetuhasonetuhasonetuhasouhasonetuhasonetuhasonetuhah", | 268 "oonetuhasonteuhasonetuhasonetuhasonetuhasouhasonetuhasonetuhasonetuhah", |
269 token); | 269 token); |
270 EXPECT_EQ("username", username); | 270 EXPECT_EQ("username", username); |
271 } | 271 } |
OLD | NEW |