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_auth_status_provider.h" | 9 #include "chrome/browser/signin/fake_auth_status_provider.h" |
10 #include "chrome/browser/signin/fake_signin_manager.h" | 10 #include "chrome/browser/signin/fake_signin_manager.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 public: | 21 public: |
22 virtual void SetUp() OVERRIDE { | 22 virtual void SetUp() OVERRIDE { |
23 // Create a signed-in profile. | 23 // Create a signed-in profile. |
24 profile_.reset(new TestingProfile()); | 24 profile_.reset(new TestingProfile()); |
25 | 25 |
26 SigninManagerBase* manager = static_cast<SigninManagerBase*>( | 26 SigninManagerBase* manager = static_cast<SigninManagerBase*>( |
27 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( | 27 SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( |
28 profile_.get(), FakeSigninManagerBase::Build)); | 28 profile_.get(), FakeSigninManagerBase::Build)); |
29 profile_->GetPrefs()->SetString( | 29 profile_->GetPrefs()->SetString( |
30 prefs::kGoogleServicesUsername, "testuser@test.com"); | 30 prefs::kGoogleServicesUsername, "testuser@test.com"); |
31 manager->Initialize(profile_.get()); | 31 manager->Initialize(profile_.get(), NULL); |
32 global_error_ = manager->signin_global_error(); | 32 global_error_ = manager->signin_global_error(); |
33 } | 33 } |
34 | 34 |
35 scoped_ptr<TestingProfile> profile_; | 35 scoped_ptr<TestingProfile> profile_; |
36 SigninGlobalError* global_error_; | 36 SigninGlobalError* global_error_; |
37 }; | 37 }; |
38 | 38 |
39 TEST_F(SigninGlobalErrorTest, NoAuthStatusProviders) { | 39 TEST_F(SigninGlobalErrorTest, NoAuthStatusProviders) { |
40 ASSERT_FALSE(global_error_->HasMenuItem()); | 40 ASSERT_FALSE(global_error_->HasMenuItem()); |
41 } | 41 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // menu item to display auth status/errors. | 120 // menu item to display auth status/errors. |
121 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); | 121 EXPECT_EQ(global_error_->HasMenuItem(), table[i].is_error); |
122 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); | 122 EXPECT_EQ(global_error_->MenuItemLabel().empty(), !table[i].is_error); |
123 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), | 123 EXPECT_EQ(global_error_->GetBubbleViewMessages().empty(), |
124 !table[i].is_error); | 124 !table[i].is_error); |
125 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); | 125 EXPECT_FALSE(global_error_->GetBubbleViewTitle().empty()); |
126 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); | 126 EXPECT_FALSE(global_error_->GetBubbleViewAcceptButtonLabel().empty()); |
127 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); | 127 EXPECT_TRUE(global_error_->GetBubbleViewCancelButtonLabel().empty()); |
128 } | 128 } |
129 } | 129 } |
OLD | NEW |