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 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "components/signin/core/browser/fake_account_fetcher_service.h" | 36 #include "components/signin/core/browser/fake_account_fetcher_service.h" |
37 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
38 #include "components/signin/core/browser/signin_manager.h" | 38 #include "components/signin/core/browser/signin_manager.h" |
39 #include "content/public/browser/browser_context.h" | 39 #include "content/public/browser/browser_context.h" |
40 #include "content/public/browser/notification_details.h" | 40 #include "content/public/browser/notification_details.h" |
41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/notification_source.h" | 42 #include "content/public/browser/notification_source.h" |
43 #include "content/public/test/test_browser_thread_bundle.h" | 43 #include "content/public/test/test_browser_thread_bundle.h" |
44 #include "google_apis/gaia/gaia_constants.h" | 44 #include "google_apis/gaia/gaia_constants.h" |
45 #include "google_apis/gaia/google_service_auth_error.h" | 45 #include "google_apis/gaia/google_service_auth_error.h" |
| 46 #include "net/base/net_errors.h" |
46 #include "net/http/http_status_code.h" | 47 #include "net/http/http_status_code.h" |
47 #include "net/url_request/test_url_fetcher_factory.h" | 48 #include "net/url_request/test_url_fetcher_factory.h" |
48 #include "net/url_request/url_request_context_getter.h" | 49 #include "net/url_request/url_request_context_getter.h" |
49 #include "net/url_request/url_request_status.h" | 50 #include "net/url_request/url_request_status.h" |
50 #include "net/url_request/url_request_test_util.h" | 51 #include "net/url_request/url_request_test_util.h" |
51 #include "testing/gmock/include/gmock/gmock.h" | 52 #include "testing/gmock/include/gmock/gmock.h" |
52 #include "testing/gtest/include/gtest/gtest.h" | 53 #include "testing/gtest/include/gtest/gtest.h" |
53 | 54 |
54 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
55 #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h" | 56 #include "chrome/browser/policy/cloud/user_policy_signin_service_mobile.h" |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 ASSERT_TRUE(IsRequestActive()); | 596 ASSERT_TRUE(IsRequestActive()); |
596 EXPECT_FALSE(register_completed_); | 597 EXPECT_FALSE(register_completed_); |
597 | 598 |
598 // Cause the access token fetch to fail - callback should be invoked. | 599 // Cause the access token fetch to fail - callback should be invoked. |
599 #if defined(OS_ANDROID) | 600 #if defined(OS_ANDROID) |
600 ASSERT_TRUE(!GetTokenService()->GetPendingRequests().empty()); | 601 ASSERT_TRUE(!GetTokenService()->GetPendingRequests().empty()); |
601 GetTokenService()->IssueErrorForAllPendingRequests( | 602 GetTokenService()->IssueErrorForAllPendingRequests( |
602 GoogleServiceAuthError::FromServiceError("fail")); | 603 GoogleServiceAuthError::FromServiceError("fail")); |
603 #else | 604 #else |
604 net::TestURLFetcher* fetcher = url_factory_.GetFetcherByID(0); | 605 net::TestURLFetcher* fetcher = url_factory_.GetFetcherByID(0); |
605 fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::FAILED, -1)); | 606 fetcher->set_status(net::URLRequestStatus::FromError(net::ERR_FAILED)); |
606 fetcher->delegate()->OnURLFetchComplete(fetcher); | 607 fetcher->delegate()->OnURLFetchComplete(fetcher); |
607 #endif | 608 #endif |
608 | 609 |
609 EXPECT_TRUE(register_completed_); | 610 EXPECT_TRUE(register_completed_); |
610 EXPECT_TRUE(dm_token_.empty()); | 611 EXPECT_TRUE(dm_token_.empty()); |
611 EXPECT_FALSE(IsRequestActive()); | 612 EXPECT_FALSE(IsRequestActive()); |
612 } | 613 } |
613 | 614 |
614 TEST_F(UserPolicySigninServiceTest, RegisterPolicyClientNonHostedDomain) { | 615 TEST_F(UserPolicySigninServiceTest, RegisterPolicyClientNonHostedDomain) { |
615 UserPolicySigninService* signin_service = | 616 UserPolicySigninService* signin_service = |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 base::RunLoop().RunUntilIdle(); | 815 base::RunLoop().RunUntilIdle(); |
815 EXPECT_FALSE(manager_->IsClientRegistered()); | 816 EXPECT_FALSE(manager_->IsClientRegistered()); |
816 #if !defined(OS_ANDROID) | 817 #if !defined(OS_ANDROID) |
817 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); | 818 EXPECT_FALSE(signin_manager_->IsSignoutProhibited()); |
818 #endif | 819 #endif |
819 } | 820 } |
820 | 821 |
821 } // namespace | 822 } // namespace |
822 | 823 |
823 } // namespace policy | 824 } // namespace policy |
OLD | NEW |