OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "google_apis/gaia/gaia_constants.h" | 9 #include "google_apis/gaia/gaia_constants.h" |
10 #include "google_apis/gaia/google_service_auth_error.h" | 10 #include "google_apis/gaia/google_service_auth_error.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 std::string refresh_token(it->second); | 85 std::string refresh_token(it->second); |
86 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token); | 86 return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token); |
87 }; | 87 }; |
88 | 88 |
89 std::map<std::string, std::string> refresh_tokens_; | 89 std::map<std::string, std::string> refresh_tokens_; |
90 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; | 90 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; |
91 }; | 91 }; |
92 | 92 |
93 class OAuth2TokenServiceTest : public testing::Test { | 93 class OAuth2TokenServiceTest : public testing::Test { |
94 public: | 94 public: |
95 virtual void SetUp() override { | 95 void SetUp() override { |
96 oauth2_service_.reset( | 96 oauth2_service_.reset( |
97 new TestOAuth2TokenService(new net::TestURLRequestContextGetter( | 97 new TestOAuth2TokenService(new net::TestURLRequestContextGetter( |
98 message_loop_.message_loop_proxy()))); | 98 message_loop_.message_loop_proxy()))); |
99 account_id_ = "test_user@gmail.com"; | 99 account_id_ = "test_user@gmail.com"; |
100 } | 100 } |
101 | 101 |
102 virtual void TearDown() override { | 102 void TearDown() override { |
103 // Makes sure that all the clean up tasks are run. | 103 // Makes sure that all the clean up tasks are run. |
104 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
105 } | 105 } |
106 | 106 |
107 protected: | 107 protected: |
108 base::MessageLoopForIO message_loop_; // net:: stuff needs IO message loop. | 108 base::MessageLoopForIO message_loop_; // net:: stuff needs IO message loop. |
109 net::TestURLFetcherFactory factory_; | 109 net::TestURLFetcherFactory factory_; |
110 scoped_ptr<TestOAuth2TokenService> oauth2_service_; | 110 scoped_ptr<TestOAuth2TokenService> oauth2_service_; |
111 std::string account_id_; | 111 std::string account_id_; |
112 TestingOAuth2TokenServiceConsumer consumer_; | 112 TestingOAuth2TokenServiceConsumer consumer_; |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 } else if (i < j) { | 641 } else if (i < j) { |
642 EXPECT_TRUE(params[i] < params[j]) << " i=" << i << ", j=" << j; | 642 EXPECT_TRUE(params[i] < params[j]) << " i=" << i << ", j=" << j; |
643 EXPECT_FALSE(params[j] < params[i]) << " i=" << i << ", j=" << j; | 643 EXPECT_FALSE(params[j] < params[i]) << " i=" << i << ", j=" << j; |
644 } else { | 644 } else { |
645 EXPECT_TRUE(params[j] < params[i]) << " i=" << i << ", j=" << j; | 645 EXPECT_TRUE(params[j] < params[i]) << " i=" << i << ", j=" << j; |
646 EXPECT_FALSE(params[i] < params[j]) << " i=" << i << ", j=" << j; | 646 EXPECT_FALSE(params[i] < params[j]) << " i=" << i << ", j=" << j; |
647 } | 647 } |
648 } | 648 } |
649 } | 649 } |
650 } | 650 } |
OLD | NEW |