| 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 // This file defines a unit test for the profile's token service. | 5 // This file defines a unit test for the profile's token service. |
| 6 | 6 |
| 7 #include "chrome/browser/net/gaia/token_service_unittest.h" | 7 #include "chrome/browser/net/gaia/token_service_unittest.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 service_.Initialize("test", profile_.get()); | 82 service_.Initialize("test", profile_.get()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void TokenServiceTestHarness::TearDown() { | 85 void TokenServiceTestHarness::TearDown() { |
| 86 // You have to destroy the profile before the db_thread_ stops. | 86 // You have to destroy the profile before the db_thread_ stops. |
| 87 if (profile_.get()) { | 87 if (profile_.get()) { |
| 88 profile_.reset(NULL); | 88 profile_.reset(NULL); |
| 89 } | 89 } |
| 90 | 90 |
| 91 db_thread_.Stop(); | 91 db_thread_.Stop(); |
| 92 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 92 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure); |
| 93 MessageLoop::current()->Run(); | 93 MessageLoop::current()->Run(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void TokenServiceTestHarness::WaitForDBLoadCompletion() { | 96 void TokenServiceTestHarness::WaitForDBLoadCompletion() { |
| 97 // The WebDB does all work on the DB thread. This will add an event | 97 // The WebDB does all work on the DB thread. This will add an event |
| 98 // to the end of the DB thread, so when we reach this task, all DB | 98 // to the end of the DB thread, so when we reach this task, all DB |
| 99 // operations should be complete. | 99 // operations should be complete. |
| 100 base::WaitableEvent done(false, false); | 100 base::WaitableEvent done(false, false); |
| 101 BrowserThread::PostTask( | 101 BrowserThread::PostTask( |
| 102 BrowserThread::DB, | 102 BrowserThread::DB, |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 524 |
| 525 *CommandLine::ForCurrentProcess() = original_cl; | 525 *CommandLine::ForCurrentProcess() = original_cl; |
| 526 } | 526 } |
| 527 }; | 527 }; |
| 528 | 528 |
| 529 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { | 529 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { |
| 530 EXPECT_TRUE(service_.HasTokenForService("my_service")); | 530 EXPECT_TRUE(service_.HasTokenForService("my_service")); |
| 531 EXPECT_EQ("my_value", service_.GetTokenForService("my_service")); | 531 EXPECT_EQ("my_value", service_.GetTokenForService("my_service")); |
| 532 } | 532 } |
| 533 #endif // ifndef NDEBUG | 533 #endif // ifndef NDEBUG |
| OLD | NEW |