| 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 // 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 "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
| 8 #include "chrome/browser/net/gaia/token_service.h" | 8 #include "chrome/browser/net/gaia/token_service.h" |
| 9 #include "chrome/browser/password_manager/encryptor.h" | 9 #include "chrome/browser/password_manager/encryptor.h" |
| 10 #include "chrome/browser/webdata/web_data_service.h" | 10 #include "chrome/browser/webdata/web_data_service.h" |
| 11 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 11 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
| 12 #include "chrome/common/net/gaia/gaia_authenticator2_unittest.h" | 12 #include "chrome/common/net/gaia/gaia_authenticator2_unittest.h" |
| 13 #include "chrome/common/net/gaia/gaia_constants.h" | 13 #include "chrome/common/net/gaia/gaia_constants.h" |
| 14 #include "chrome/common/net/test_url_fetcher_factory.h" | 14 #include "chrome/common/net/test_url_fetcher_factory.h" |
| 15 #include "chrome/test/signaling_task.h" | 15 #include "chrome/test/signaling_task.h" |
| 16 #include "chrome/test/test_notification_tracker.h" | 16 #include "chrome/test/test_notification_tracker.h" |
| 17 #include "chrome/test/testing_profile.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 // TestNotificationTracker doesn't do a deep copy on the notification details. | 20 // TestNotificationTracker doesn't do a deep copy on the notification details. |
| 20 // We have to in order to read it out, or we have a bad ptr, since the details | 21 // We have to in order to read it out, or we have a bad ptr, since the details |
| 21 // are a reference on the stack. | 22 // are a reference on the stack. |
| 22 class TokenAvailableTracker : public TestNotificationTracker { | 23 class TokenAvailableTracker : public TestNotificationTracker { |
| 23 public: | 24 public: |
| 24 const TokenService::TokenAvailableDetails& get_last_token_details() { | 25 const TokenService::TokenAvailableDetails& get_last_token_details() { |
| 25 return details_; | 26 return details_; |
| 26 } | 27 } |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // Reset it one more time so there's no surprises. | 366 // Reset it one more time so there's no surprises. |
| 366 service_.ResetCredentialsInMemory(); | 367 service_.ResetCredentialsInMemory(); |
| 367 success_tracker_.Reset(); | 368 success_tracker_.Reset(); |
| 368 | 369 |
| 369 service_.LoadTokensFromDB(); | 370 service_.LoadTokensFromDB(); |
| 370 WaitForDBLoadCompletion(); | 371 WaitForDBLoadCompletion(); |
| 371 | 372 |
| 372 EXPECT_EQ(1U, success_tracker_.size()); | 373 EXPECT_EQ(1U, success_tracker_.size()); |
| 373 EXPECT_TRUE(service_.HasTokenForService(GaiaConstants::kSyncService)); | 374 EXPECT_TRUE(service_.HasTokenForService(GaiaConstants::kSyncService)); |
| 374 } | 375 } |
| OLD | NEW |