OLD | NEW |
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 <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 enum RemoveBetweenMethod { // Used in CheckRemoveLoginsBetween(). | 331 enum RemoveBetweenMethod { // Used in CheckRemoveLoginsBetween(). |
332 CREATED, | 332 CREATED, |
333 SYNCED, | 333 SYNCED, |
334 }; | 334 }; |
335 | 335 |
336 NativeBackendGnomeTest() | 336 NativeBackendGnomeTest() |
337 : ui_thread_(BrowserThread::UI, &message_loop_), | 337 : ui_thread_(BrowserThread::UI, &message_loop_), |
338 db_thread_(BrowserThread::DB) { | 338 db_thread_(BrowserThread::DB) { |
339 } | 339 } |
340 | 340 |
341 virtual void SetUp() { | 341 void SetUp() override { |
342 ASSERT_TRUE(db_thread_.Start()); | 342 ASSERT_TRUE(db_thread_.Start()); |
343 | 343 |
344 ASSERT_TRUE(MockGnomeKeyringLoader::LoadMockGnomeKeyring()); | 344 ASSERT_TRUE(MockGnomeKeyringLoader::LoadMockGnomeKeyring()); |
345 | 345 |
346 form_google_.origin = GURL("http://www.google.com/"); | 346 form_google_.origin = GURL("http://www.google.com/"); |
347 form_google_.action = GURL("http://www.google.com/login"); | 347 form_google_.action = GURL("http://www.google.com/login"); |
348 form_google_.username_element = UTF8ToUTF16("user"); | 348 form_google_.username_element = UTF8ToUTF16("user"); |
349 form_google_.username_value = UTF8ToUTF16("joeschmoe"); | 349 form_google_.username_value = UTF8ToUTF16("joeschmoe"); |
350 form_google_.password_element = UTF8ToUTF16("pass"); | 350 form_google_.password_element = UTF8ToUTF16("pass"); |
351 form_google_.password_value = UTF8ToUTF16("seekrit"); | 351 form_google_.password_value = UTF8ToUTF16("seekrit"); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 form_isc_.date_synced = base::Time::Now(); | 386 form_isc_.date_synced = base::Time::Now(); |
387 | 387 |
388 other_auth_.origin = GURL("http://www.example.com/"); | 388 other_auth_.origin = GURL("http://www.example.com/"); |
389 other_auth_.username_value = UTF8ToUTF16("username"); | 389 other_auth_.username_value = UTF8ToUTF16("username"); |
390 other_auth_.password_value = UTF8ToUTF16("pass"); | 390 other_auth_.password_value = UTF8ToUTF16("pass"); |
391 other_auth_.signon_realm = "http://www.example.com/Realm"; | 391 other_auth_.signon_realm = "http://www.example.com/Realm"; |
392 other_auth_.date_created = base::Time::Now(); | 392 other_auth_.date_created = base::Time::Now(); |
393 other_auth_.date_synced = base::Time::Now(); | 393 other_auth_.date_synced = base::Time::Now(); |
394 } | 394 } |
395 | 395 |
396 virtual void TearDown() { | 396 void TearDown() override { |
397 base::MessageLoop::current()->PostTask(FROM_HERE, | 397 base::MessageLoop::current()->PostTask(FROM_HERE, |
398 base::MessageLoop::QuitClosure()); | 398 base::MessageLoop::QuitClosure()); |
399 base::MessageLoop::current()->Run(); | 399 base::MessageLoop::current()->Run(); |
400 db_thread_.Stop(); | 400 db_thread_.Stop(); |
401 } | 401 } |
402 | 402 |
403 void RunBothThreads() { | 403 void RunBothThreads() { |
404 // First we post a message to the DB thread that will run after all other | 404 // First we post a message to the DB thread that will run after all other |
405 // messages that have been posted to the DB thread (we don't expect more | 405 // messages that have been posted to the DB thread (we don't expect more |
406 // to be posted), which posts a message to the UI thread to quit the loop. | 406 // to be posted), which posts a message to the UI thread to quit the loop. |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 | 1071 |
1072 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { | 1072 TEST_F(NativeBackendGnomeTest, RemoveLoginsCreatedBetween) { |
1073 CheckRemoveLoginsBetween(CREATED); | 1073 CheckRemoveLoginsBetween(CREATED); |
1074 } | 1074 } |
1075 | 1075 |
1076 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { | 1076 TEST_F(NativeBackendGnomeTest, RemoveLoginsSyncedBetween) { |
1077 CheckRemoveLoginsBetween(SYNCED); | 1077 CheckRemoveLoginsBetween(SYNCED); |
1078 } | 1078 } |
1079 | 1079 |
1080 // TODO(mdm): add more basic tests here at some point. | 1080 // TODO(mdm): add more basic tests here at some point. |
OLD | NEW |