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

Side by Side Diff: chrome/browser/prefs/pref_set_observer_unittest.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/prefs/pref_set_observer.h" 5 #include "chrome/browser/prefs/pref_set_observer.h"
6 #include "chrome/common/chrome_notification_types.h"
6 #include "chrome/common/pref_names.h" 7 #include "chrome/common/pref_names.h"
7 #include "chrome/test/testing_pref_service.h" 8 #include "chrome/test/testing_pref_service.h"
8 #include "content/common/notification_details.h" 9 #include "content/common/notification_details.h"
9 #include "content/common/notification_observer_mock.h" 10 #include "content/common/notification_observer_mock.h"
10 #include "content/common/notification_source.h" 11 #include "content/common/notification_source.h"
11 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 // Unit tests for PrefSetObserver. 15 // Unit tests for PrefSetObserver.
15 class PrefSetObserverTest : public testing::Test { 16 class PrefSetObserverTest : public testing::Test {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 67 }
67 68
68 TEST_F(PrefSetObserverTest, Observe) { 69 TEST_F(PrefSetObserverTest, Observe) {
69 using testing::_; 70 using testing::_;
70 using testing::Mock; 71 using testing::Mock;
71 72
72 NotificationObserverMock observer; 73 NotificationObserverMock observer;
73 scoped_ptr<PrefSetObserver> pref_set(CreatePrefSetObserver(&observer)); 74 scoped_ptr<PrefSetObserver> pref_set(CreatePrefSetObserver(&observer));
74 75
75 EXPECT_CALL(observer, 76 EXPECT_CALL(observer,
76 Observe(NotificationType(NotificationType::PREF_CHANGED), 77 Observe(int(chrome::NOTIFICATION_PREF_CHANGED),
77 Source<PrefService>(pref_service_.get()), 78 Source<PrefService>(pref_service_.get()),
78 PrefNameDetails(prefs::kHomePage))); 79 PrefNameDetails(prefs::kHomePage)));
79 pref_service_->SetUserPref(prefs::kHomePage, 80 pref_service_->SetUserPref(prefs::kHomePage,
80 Value::CreateStringValue("http://crbug.com")); 81 Value::CreateStringValue("http://crbug.com"));
81 Mock::VerifyAndClearExpectations(&observer); 82 Mock::VerifyAndClearExpectations(&observer);
82 83
83 EXPECT_CALL(observer, 84 EXPECT_CALL(observer,
84 Observe(NotificationType(NotificationType::PREF_CHANGED), 85 Observe(int(chrome::NOTIFICATION_PREF_CHANGED),
85 Source<PrefService>(pref_service_.get()), 86 Source<PrefService>(pref_service_.get()),
86 PrefNameDetails(prefs::kHomePageIsNewTabPage))); 87 PrefNameDetails(prefs::kHomePageIsNewTabPage)));
87 pref_service_->SetUserPref(prefs::kHomePageIsNewTabPage, 88 pref_service_->SetUserPref(prefs::kHomePageIsNewTabPage,
88 Value::CreateBooleanValue(true)); 89 Value::CreateBooleanValue(true));
89 Mock::VerifyAndClearExpectations(&observer); 90 Mock::VerifyAndClearExpectations(&observer);
90 91
91 EXPECT_CALL(observer, Observe(_, _, _)).Times(0); 92 EXPECT_CALL(observer, Observe(_, _, _)).Times(0);
92 pref_service_->SetUserPref(prefs::kApplicationLocale, 93 pref_service_->SetUserPref(prefs::kApplicationLocale,
93 Value::CreateStringValue("en_US.utf8")); 94 Value::CreateStringValue("en_US.utf8"));
94 Mock::VerifyAndClearExpectations(&observer); 95 Mock::VerifyAndClearExpectations(&observer);
95 } 96 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_set_observer.cc ('k') | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698