| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/signin/signin_global_error.h" | 5 #include "chrome/browser/signin/signin_global_error.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | |
| 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 11 #include "chrome/browser/signin/fake_signin_manager.h" | 10 #include "chrome/browser/signin/fake_signin_manager.h" |
| 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 12 #include "chrome/browser/signin/signin_error_controller_factory.h" |
| 13 #include "chrome/browser/signin/signin_global_error_factory.h" | 13 #include "chrome/browser/signin/signin_global_error_factory.h" |
| 14 #include "chrome/browser/signin/signin_manager_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
| 15 #include "chrome/browser/ui/global_error/global_error_service.h" | 15 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 16 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 16 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 #include "components/signin/core/browser/fake_auth_status_provider.h" | 19 #include "components/signin/core/browser/fake_auth_status_provider.h" |
| 20 #include "components/signin/core/browser/signin_error_controller.h" | 20 #include "components/signin/core/browser/signin_error_controller.h" |
| 21 #include "components/signin/core/browser/signin_manager.h" | 21 #include "components/signin/core/browser/signin_manager.h" |
| 22 #include "content/public/test/test_browser_thread_bundle.h" | 22 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 33 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 34 BuildFakeProfileOAuth2TokenService); | 34 BuildFakeProfileOAuth2TokenService); |
| 35 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 35 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
| 36 FakeSigninManagerBase::Build); | 36 FakeSigninManagerBase::Build); |
| 37 profile_ = builder.Build(); | 37 profile_ = builder.Build(); |
| 38 | 38 |
| 39 SigninManagerFactory::GetForProfile(profile_.get()) | 39 SigninManagerFactory::GetForProfile(profile_.get()) |
| 40 ->SetAuthenticatedUsername(kTestAccountId); | 40 ->SetAuthenticatedUsername(kTestAccountId); |
| 41 | 41 |
| 42 global_error_ = SigninGlobalErrorFactory::GetForProfile(profile_.get()); | 42 global_error_ = SigninGlobalErrorFactory::GetForProfile(profile_.get()); |
| 43 error_controller_ = ProfileOAuth2TokenServiceFactory::GetForProfile( | 43 error_controller_ = SigninErrorControllerFactory::GetForProfile( |
| 44 profile_.get())->signin_error_controller(); | 44 profile_.get()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 content::TestBrowserThreadBundle thread_bundle_; | 47 content::TestBrowserThreadBundle thread_bundle_; |
| 48 scoped_ptr<TestingProfile> profile_; | 48 scoped_ptr<TestingProfile> profile_; |
| 49 SigninGlobalError* global_error_; | 49 SigninGlobalError* global_error_; |
| 50 SigninErrorController* error_controller_; | 50 SigninErrorController* error_controller_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 TEST_F(SigninGlobalErrorTest, NoErrorAuthStatusProviders) { | 53 TEST_F(SigninGlobalErrorTest, NoErrorAuthStatusProviders) { |
| 54 scoped_ptr<FakeAuthStatusProvider> provider; | 54 scoped_ptr<FakeAuthStatusProvider> provider; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); | 122 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); |
| 123 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); | 123 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); |
| 124 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), | 124 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), |
| 125 !table[i].is_error); | 125 !table[i].is_error); |
| 126 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); | 126 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); |
| 127 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); | 127 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); |
| 128 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); | 128 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); |
| 129 } | 129 } |
| 130 } | 130 } |
| OLD | NEW |