| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/ui/desktop_ios_promotion/sms_service.h" | 5 #include "chrome/browser/ui/desktop_ios_promotion/sms_service.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/test/scoped_task_environment.h" | |
| 9 #include "components/signin/core/browser/account_tracker_service.h" | 8 #include "components/signin/core/browser/account_tracker_service.h" |
| 10 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 9 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
| 11 #include "components/signin/core/browser/fake_signin_manager.h" | 10 #include "components/signin/core/browser/fake_signin_manager.h" |
| 12 #include "components/signin/core/browser/test_signin_client.h" | 11 #include "components/signin/core/browser/test_signin_client.h" |
| 13 #include "net/http/http_status_code.h" | 12 #include "net/http/http_status_code.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 138 } |
| 140 | 139 |
| 141 TestingSMSService* sms_service() { return &sms_service_; } | 140 TestingSMSService* sms_service() { return &sms_service_; } |
| 142 | 141 |
| 143 void SetNextRequestResponseData(int response_code, | 142 void SetNextRequestResponseData(int response_code, |
| 144 const std::string& response_body) { | 143 const std::string& response_body) { |
| 145 sms_service_.SetNextRequestResponseData(response_code, response_body); | 144 sms_service_.SetNextRequestResponseData(response_code, response_body); |
| 146 } | 145 } |
| 147 | 146 |
| 148 private: | 147 private: |
| 149 base::test::ScopedTaskEnvironment scoped_task_environment_; | 148 base::MessageLoop message_loop_; |
| 150 FakeProfileOAuth2TokenService token_service_; | 149 FakeProfileOAuth2TokenService token_service_; |
| 151 AccountTrackerService account_tracker_; | 150 AccountTrackerService account_tracker_; |
| 152 TestSigninClient signin_client_; | 151 TestSigninClient signin_client_; |
| 153 FakeSigninManagerBase signin_manager_; | 152 FakeSigninManagerBase signin_manager_; |
| 154 scoped_refptr<net::URLRequestContextGetter> url_request_context_; | 153 scoped_refptr<net::URLRequestContextGetter> url_request_context_; |
| 155 TestingSMSService sms_service_; | 154 TestingSMSService sms_service_; |
| 156 | 155 |
| 157 DISALLOW_COPY_AND_ASSIGN(SMSServiceTest); | 156 DISALLOW_COPY_AND_ASSIGN(SMSServiceTest); |
| 158 }; | 157 }; |
| 159 | 158 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 base::Bind(&TestingSMSService::QueryPhoneNumberCallbackFailed, | 190 base::Bind(&TestingSMSService::QueryPhoneNumberCallbackFailed, |
| 192 base::Unretained(sms_service()))); | 191 base::Unretained(sms_service()))); |
| 193 base::RunLoop().RunUntilIdle(); | 192 base::RunLoop().RunUntilIdle(); |
| 194 std::string send_sms_invalid = "{}"; | 193 std::string send_sms_invalid = "{}"; |
| 195 sms_service()->SetNextRequestResponseData(net::HTTP_OK, send_sms_invalid); | 194 sms_service()->SetNextRequestResponseData(net::HTTP_OK, send_sms_invalid); |
| 196 sms_service()->SendSMS( | 195 sms_service()->SendSMS( |
| 197 promo_id, base::Bind(&TestingSMSService::QueryPhoneNumberCallbackFailed, | 196 promo_id, base::Bind(&TestingSMSService::QueryPhoneNumberCallbackFailed, |
| 198 base::Unretained(sms_service()))); | 197 base::Unretained(sms_service()))); |
| 199 base::RunLoop().RunUntilIdle(); | 198 base::RunLoop().RunUntilIdle(); |
| 200 } | 199 } |
| OLD | NEW |