Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: trunk/src/chrome/browser/sync/sync_error_notifier_ash_unittest.cc

Issue 286753002: Revert 270290 "Reduce creation of ViewsDelegate" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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"
11 #include "chrome/browser/notifications/notification_ui_manager.h" 11 #include "chrome/browser/notifications/notification_ui_manager.h"
12 #include "chrome/browser/sync/profile_sync_service_mock.h" 12 #include "chrome/browser/sync/profile_sync_service_mock.h"
13 #include "chrome/browser/sync/sync_error_controller.h" 13 #include "chrome/browser/sync/sync_error_controller.h"
14 #include "chrome/browser/ui/ash/test_views_delegate_with_parent.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 16 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
16 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "chrome/test/base/testing_browser_process.h" 19 #include "chrome/test/base/testing_browser_process.h"
19 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
20 #include "chrome/test/base/testing_profile_manager.h" 21 #include "chrome/test/base/testing_profile_manager.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/message_center/notification.h" 24 #include "ui/message_center/notification.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 content::BrowserContext* profile) { 91 content::BrowserContext* profile) {
91 return new FakeLoginUIService(); 92 return new FakeLoginUIService();
92 } 93 }
93 94
94 class SyncErrorNotifierTest : public AshTestBase { 95 class SyncErrorNotifierTest : public AshTestBase {
95 public: 96 public:
96 SyncErrorNotifierTest() {} 97 SyncErrorNotifierTest() {}
97 virtual ~SyncErrorNotifierTest() {} 98 virtual ~SyncErrorNotifierTest() {}
98 99
99 virtual void SetUp() OVERRIDE { 100 virtual void SetUp() OVERRIDE {
101 views::ViewsDelegate::views_delegate = &views_delegate_;
102
100 profile_manager_.reset( 103 profile_manager_.reset(
101 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 104 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
102 ASSERT_TRUE(profile_manager_->SetUp()); 105 ASSERT_TRUE(profile_manager_->SetUp());
103 106
104 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId); 107 profile_ = profile_manager_->CreateTestingProfile(kTestAccountId);
105 108
106 TestingBrowserProcess::GetGlobal(); 109 TestingBrowserProcess::GetGlobal();
107 AshTestBase::SetUp(); 110 AshTestBase::SetUp();
108 111
109 // Set up a desktop screen for Windows to hold native widgets, used when 112 // Set up a desktop screen for Windows to hold native widgets, used when
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 168 }
166 } 169 }
167 170
168 scoped_ptr<TestingProfileManager> profile_manager_; 171 scoped_ptr<TestingProfileManager> profile_manager_;
169 scoped_ptr<SyncErrorController> error_controller_; 172 scoped_ptr<SyncErrorController> error_controller_;
170 scoped_ptr<SyncErrorNotifier> error_notifier_; 173 scoped_ptr<SyncErrorNotifier> error_notifier_;
171 scoped_ptr<NiceMock<ProfileSyncServiceMock> > service_; 174 scoped_ptr<NiceMock<ProfileSyncServiceMock> > service_;
172 TestingProfile* profile_; 175 TestingProfile* profile_;
173 FakeLoginUI login_ui_; 176 FakeLoginUI login_ui_;
174 NotificationUIManager* notification_ui_manager_; 177 NotificationUIManager* notification_ui_manager_;
178 TestViewsDelegateWithParent views_delegate_;
175 179
176 DISALLOW_COPY_AND_ASSIGN(SyncErrorNotifierTest); 180 DISALLOW_COPY_AND_ASSIGN(SyncErrorNotifierTest);
177 }; 181 };
178 182
179 } // namespace 183 } // namespace
180 184
181 // Test that SyncErrorNotifier shows an notification if a passphrase is 185 // Test that SyncErrorNotifier shows an notification if a passphrase is
182 // required. 186 // required.
183 TEST_F(SyncErrorNotifierTest, PassphraseNotification) { 187 TEST_F(SyncErrorNotifierTest, PassphraseNotification) {
184 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId)); 188 ASSERT_FALSE(notification_ui_manager_->FindById(kNotificationId));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SCOPED_TRACE("Not expecting notification since sync setup is incomplete"); 223 SCOPED_TRACE("Not expecting notification since sync setup is incomplete");
220 VerifySyncErrorNotifierResult( 224 VerifySyncErrorNotifierResult(
221 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, 225 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS,
222 false /* not signed in */, 226 false /* not signed in */,
223 false /* no error */); 227 false /* no error */);
224 } 228 }
225 } 229 }
226 230
227 } // namespace test 231 } // namespace test
228 } // namespace ash 232 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698