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

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

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

Powered by Google App Engine
This is Rietveld 408576698