| 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" | 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 void SetUp() override { | 30 void SetUp() override { |
| 31 // Create a signed-in profile. | 31 // Create a signed-in profile. |
| 32 TestingProfile::Builder builder; | 32 TestingProfile::Builder builder; |
| 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 profile_->GetPrefs()->SetString( | |
| 40 prefs::kGoogleServicesUsername, kTestAccountId); | |
| 41 SigninManagerFactory::GetForProfile(profile_.get()) | 39 SigninManagerFactory::GetForProfile(profile_.get()) |
| 42 ->SetAuthenticatedUsername(kTestAccountId); | 40 ->SetAuthenticatedUsername(kTestAccountId); |
| 43 | 41 |
| 44 global_error_ = SigninGlobalErrorFactory::GetForProfile(profile_.get()); | 42 global_error_ = SigninGlobalErrorFactory::GetForProfile(profile_.get()); |
| 45 error_controller_ = ProfileOAuth2TokenServiceFactory::GetForProfile( | 43 error_controller_ = ProfileOAuth2TokenServiceFactory::GetForProfile( |
| 46 profile_.get())->signin_error_controller(); | 44 profile_.get())->signin_error_controller(); |
| 47 } | 45 } |
| 48 | 46 |
| 49 content::TestBrowserThreadBundle thread_bundle_; | 47 content::TestBrowserThreadBundle thread_bundle_; |
| 50 scoped_ptr<TestingProfile> profile_; | 48 scoped_ptr<TestingProfile> profile_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 121 |
| 124 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); | 122 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); |
| 125 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); | 123 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); |
| 126 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), | 124 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), |
| 127 !table[i].is_error); | 125 !table[i].is_error); |
| 128 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); | 126 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); |
| 129 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); | 127 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); |
| 130 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); | 128 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); |
| 131 } | 129 } |
| 132 } | 130 } |
| OLD | NEW |