| 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/sync/sync_error_notifier_ash.h" | 5 #include "chrome/browser/sync/sync_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/files/file_util.h" | |
| 9 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
| 12 #include "chrome/browser/notifications/notification_ui_manager.h" | 11 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 13 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | |
| 14 #include "chrome/browser/profiles/profile_info_cache.h" | |
| 15 #include "chrome/browser/sync/profile_sync_service_mock.h" | 12 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 16 #include "chrome/browser/sync/sync_error_controller.h" | 13 #include "chrome/browser/sync/sync_error_controller.h" |
| 17 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 15 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 19 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 20 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 22 #include "chrome/test/base/testing_profile_manager.h" | 19 #include "chrome/test/base/testing_profile_manager.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 SyncErrorNotifierTest() {} | 93 SyncErrorNotifierTest() {} |
| 97 ~SyncErrorNotifierTest() override {} | 94 ~SyncErrorNotifierTest() override {} |
| 98 | 95 |
| 99 void SetUp() override { | 96 void SetUp() override { |
| 100 profile_manager_.reset( | 97 profile_manager_.reset( |
| 101 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 98 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 102 ASSERT_TRUE(profile_manager_->SetUp()); | 99 ASSERT_TRUE(profile_manager_->SetUp()); |
| 103 | 100 |
| 104 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); | 101 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); |
| 105 | 102 |
| 106 #if !defined(OS_CHROMEOS) | |
| 107 // Preload the desktop avatar icon so it's cached for the test's execution. | |
| 108 ProfileInfoCache& cache = *profile_manager_->profile_info_cache(); | |
| 109 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); | |
| 110 cache.GetAvatarIconOfProfileAtIndex(index); | |
| 111 base::MessageLoop::current()->RunUntilIdle(); | |
| 112 ASSERT_TRUE(base::PathExists(profiles::GetPathOfHighResAvatarAtIndex( | |
| 113 cache.GetAvatarIconIndexOfProfileAtIndex(index)))); | |
| 114 #endif | |
| 115 | |
| 116 TestingBrowserProcess::GetGlobal(); | 103 TestingBrowserProcess::GetGlobal(); |
| 117 AshTestBase::SetUp(); | 104 AshTestBase::SetUp(); |
| 118 | 105 |
| 119 // Set up a desktop screen for Windows to hold native widgets, used when | 106 // Set up a desktop screen for Windows to hold native widgets, used when |
| 120 // adding desktop widgets (i.e., message center notifications). | 107 // adding desktop widgets (i.e., message center notifications). |
| 121 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
| 122 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); | 109 test_screen_.reset(aura::TestScreen::Create(gfx::Size())); |
| 123 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 110 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
| 124 gfx::Screen::SetScreenTypeDelegate(&screen_type_delegate_); | 111 gfx::Screen::SetScreenTypeDelegate(&screen_type_delegate_); |
| 125 #endif | 112 #endif |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); | 232 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); |
| 246 VerifySyncErrorNotifierResult( | 233 VerifySyncErrorNotifierResult( |
| 247 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, | 234 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, |
| 248 false /* not signed in */, | 235 false /* not signed in */, |
| 249 false /* no error */); | 236 false /* no error */); |
| 250 } | 237 } |
| 251 } | 238 } |
| 252 | 239 |
| 253 } // namespace test | 240 } // namespace test |
| 254 } // namespace ash | 241 } // namespace ash |
| OLD | NEW |