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 // 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/signin/token_service_unittest.h" | 7 #include "chrome/browser/signin/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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // to the end of the DB thread, so when we reach this task, all DB | 112 // to the end of the DB thread, so when we reach this task, all DB |
113 // operations should be complete. | 113 // operations should be complete. |
114 base::WaitableEvent done(false, false); | 114 base::WaitableEvent done(false, false); |
115 BrowserThread::PostTask( | 115 BrowserThread::PostTask( |
116 BrowserThread::DB, | 116 BrowserThread::DB, |
117 FROM_HERE, | 117 FROM_HERE, |
118 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); | 118 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
119 done.Wait(); | 119 done.Wait(); |
120 | 120 |
121 // Notifications should be returned from the DB thread onto the UI thread. | 121 // Notifications should be returned from the DB thread onto the UI thread. |
122 message_loop_.RunAllPending(); | 122 message_loop_.RunUntilIdle(); |
123 } | 123 } |
124 | 124 |
125 class TokenServiceTest : public TokenServiceTestHarness { | 125 class TokenServiceTest : public TokenServiceTestHarness { |
126 public: | 126 public: |
127 virtual void SetUp() { | 127 virtual void SetUp() { |
128 TokenServiceTestHarness::SetUp(); | 128 TokenServiceTestHarness::SetUp(); |
129 service_->UpdateCredentials(credentials_); | 129 service_->UpdateCredentials(credentials_); |
130 } | 130 } |
131 protected: | 131 protected: |
132 void TestLoadSingleToken( | 132 void TestLoadSingleToken( |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 *CommandLine::ForCurrentProcess() = original_cl; | 422 *CommandLine::ForCurrentProcess() = original_cl; |
423 } | 423 } |
424 }; | 424 }; |
425 | 425 |
426 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { | 426 TEST_F(TokenServiceCommandLineTest, TestValueOverride) { |
427 EXPECT_TRUE(service_->HasTokenForService("my_service")); | 427 EXPECT_TRUE(service_->HasTokenForService("my_service")); |
428 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); | 428 EXPECT_EQ("my_value", service_->GetTokenForService("my_service")); |
429 } | 429 } |
430 #endif // ifndef NDEBUG | 430 #endif // ifndef NDEBUG |
OLD | NEW |