| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_error_notifier_ash.h" | 5 #include "chrome/browser/signin/signin_error_notifier_ash.h" |
| 6 | 6 |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 gfx::SCREEN_TYPE_ALTERNATE : | 55 gfx::SCREEN_TYPE_ALTERNATE : |
| 56 gfx::SCREEN_TYPE_NATIVE; | 56 gfx::SCREEN_TYPE_NATIVE; |
| 57 } | 57 } |
| 58 private: | 58 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateDesktop); | 59 DISALLOW_COPY_AND_ASSIGN(ScreenTypeDelegateDesktop); |
| 60 }; | 60 }; |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 class SigninErrorNotifierTest : public AshTestBase { | 63 class SigninErrorNotifierTest : public AshTestBase { |
| 64 public: | 64 public: |
| 65 virtual void SetUp() override { | 65 void SetUp() override { |
| 66 // Create a signed-in profile. | 66 // Create a signed-in profile. |
| 67 TestingProfile::Builder builder; | 67 TestingProfile::Builder builder; |
| 68 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 68 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
| 69 FakeSigninManagerBase::Build); | 69 FakeSigninManagerBase::Build); |
| 70 profile_ = builder.Build(); | 70 profile_ = builder.Build(); |
| 71 profile_->set_profile_name(kTestAccountId); | 71 profile_->set_profile_name(kTestAccountId); |
| 72 | 72 |
| 73 profile_manager_.reset( | 73 profile_manager_.reset( |
| 74 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 74 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 75 ASSERT_TRUE(profile_manager_->SetUp()); | 75 ASSERT_TRUE(profile_manager_->SetUp()); |
| 76 | 76 |
| 77 TestingBrowserProcess::GetGlobal(); | 77 TestingBrowserProcess::GetGlobal(); |
| 78 AshTestBase::SetUp(); | 78 AshTestBase::SetUp(); |
| 79 | 79 |
| 80 // Set up screen for Windows. | 80 // Set up screen for Windows. |
| 81 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
| 82 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); | 82 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); |
| 83 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 83 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
| 84 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateDesktop); | 84 gfx::Screen::SetScreenTypeDelegate(new ScreenTypeDelegateDesktop); |
| 85 #endif | 85 #endif |
| 86 | 86 |
| 87 error_controller_ = | 87 error_controller_ = |
| 88 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get())-> | 88 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get())-> |
| 89 signin_error_controller(); | 89 signin_error_controller(); |
| 90 SigninErrorNotifierFactory::GetForProfile(profile_.get()); | 90 SigninErrorNotifierFactory::GetForProfile(profile_.get()); |
| 91 notification_ui_manager_ = g_browser_process->notification_ui_manager(); | 91 notification_ui_manager_ = g_browser_process->notification_ui_manager(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 virtual void TearDown() override { | 94 void TearDown() override { |
| 95 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
| 96 test_screen_.reset(); | 96 test_screen_.reset(); |
| 97 #endif | 97 #endif |
| 98 profile_manager_.reset(); | 98 profile_manager_.reset(); |
| 99 | 99 |
| 100 AshTestBase::TearDown(); | 100 AshTestBase::TearDown(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 protected: | 103 protected: |
| 104 void GetMessage(base::string16* message) { | 104 void GetMessage(base::string16* message) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 EXPECT_FALSE(notification->title().empty()); | 251 EXPECT_FALSE(notification->title().empty()); |
| 252 EXPECT_FALSE(notification->message().empty()); | 252 EXPECT_FALSE(notification->message().empty()); |
| 253 EXPECT_EQ((size_t)1, notification->buttons().size()); | 253 EXPECT_EQ((size_t)1, notification->buttons().size()); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 #endif | 257 #endif |
| 258 | 258 |
| 259 } // namespace test | 259 } // namespace test |
| 260 } // namespace ash | 260 } // namespace ash |
| OLD | NEW |