| OLD | NEW |
| 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 <stdarg.h> | 5 #include <stdarg.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 form_isc_.action = GURL("http://www.isc.org/auth"); | 300 form_isc_.action = GURL("http://www.isc.org/auth"); |
| 301 form_isc_.username_element = UTF8ToUTF16("id"); | 301 form_isc_.username_element = UTF8ToUTF16("id"); |
| 302 form_isc_.username_value = UTF8ToUTF16("janedoe"); | 302 form_isc_.username_value = UTF8ToUTF16("janedoe"); |
| 303 form_isc_.password_element = UTF8ToUTF16("passwd"); | 303 form_isc_.password_element = UTF8ToUTF16("passwd"); |
| 304 form_isc_.password_value = UTF8ToUTF16("ihazabukkit"); | 304 form_isc_.password_value = UTF8ToUTF16("ihazabukkit"); |
| 305 form_isc_.submit_element = UTF8ToUTF16("login"); | 305 form_isc_.submit_element = UTF8ToUTF16("login"); |
| 306 form_isc_.signon_realm = "ISC"; | 306 form_isc_.signon_realm = "ISC"; |
| 307 } | 307 } |
| 308 | 308 |
| 309 virtual void TearDown() { | 309 virtual void TearDown() { |
| 310 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 310 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure); |
| 311 MessageLoop::current()->Run(); | 311 MessageLoop::current()->Run(); |
| 312 db_thread_.Stop(); | 312 db_thread_.Stop(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void RunBothThreads() { | 315 void RunBothThreads() { |
| 316 // First we post a message to the DB thread that will run after all other | 316 // First we post a message to the DB thread that will run after all other |
| 317 // messages that have been posted to the DB thread (we don't expect more | 317 // messages that have been posted to the DB thread (we don't expect more |
| 318 // to be posted), which posts a message to the UI thread to quit the loop. | 318 // to be posted), which posts a message to the UI thread to quit the loop. |
| 319 // That way we can run both loops and be sure that the UI thread loop will | 319 // That way we can run both loops and be sure that the UI thread loop will |
| 320 // quit so we can get on with the rest of the test. | 320 // quit so we can get on with the rest of the test. |
| 321 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, | 321 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 322 base::Bind(&PostQuitTask, &message_loop_)); | 322 base::Bind(&PostQuitTask, &message_loop_)); |
| 323 MessageLoop::current()->Run(); | 323 MessageLoop::current()->Run(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 static void PostQuitTask(MessageLoop* loop) { | 326 static void PostQuitTask(MessageLoop* loop) { |
| 327 loop->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 327 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void CheckUint32Attribute(const MockKeyringItem* item, | 330 void CheckUint32Attribute(const MockKeyringItem* item, |
| 331 const std::string& attribute, | 331 const std::string& attribute, |
| 332 uint32_t value) { | 332 uint32_t value) { |
| 333 MockKeyringItem::attribute_map::const_iterator it = | 333 MockKeyringItem::attribute_map::const_iterator it = |
| 334 item->attributes.find(attribute); | 334 item->attributes.find(attribute); |
| 335 EXPECT_NE(item->attributes.end(), it); | 335 EXPECT_NE(item->attributes.end(), it); |
| 336 if (it != item->attributes.end()) { | 336 if (it != item->attributes.end()) { |
| 337 EXPECT_EQ(MockKeyringItem::ItemAttribute::UINT32, it->second.type); | 337 EXPECT_EQ(MockKeyringItem::ItemAttribute::UINT32, it->second.type); |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 RunBothThreads(); | 886 RunBothThreads(); |
| 887 | 887 |
| 888 // The other two copies of the password in different profiles should remain. | 888 // The other two copies of the password in different profiles should remain. |
| 889 EXPECT_EQ(2u, mock_keyring_items.size()); | 889 EXPECT_EQ(2u, mock_keyring_items.size()); |
| 890 if (mock_keyring_items.size() > 0) | 890 if (mock_keyring_items.size() > 0) |
| 891 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); | 891 CheckMockKeyringItem(&mock_keyring_items[0], form_google_, "chrome"); |
| 892 if (mock_keyring_items.size() > 1) | 892 if (mock_keyring_items.size() > 1) |
| 893 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); | 893 CheckMockKeyringItem(&mock_keyring_items[1], form_google_, "chrome-42"); |
| 894 } | 894 } |
| 895 } | 895 } |
| OLD | NEW |