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

Side by Side Diff: chrome/browser/cocoa/preferences_window_controller_unittest.mm

Issue 155151: Hook up the prefs for the optional home buttons and page/wrench buttons. Move... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/scoped_nsobject.h" 7 #import "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/preferences_window_controller.h" 8 #import "chrome/browser/cocoa/preferences_window_controller.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #include "chrome/browser/cocoa/cocoa_test_helper.h" 10 #include "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 14 matching lines...) Expand all
25 - (void)prefsWindowClosed:(NSNotification*)notify { 25 - (void)prefsWindowClosed:(NSNotification*)notify {
26 gotNotification_ = YES; 26 gotNotification_ = YES;
27 } 27 }
28 @end 28 @end
29 29
30 namespace { 30 namespace {
31 31
32 class PrefsControllerTest : public PlatformTest { 32 class PrefsControllerTest : public PlatformTest {
33 public: 33 public:
34 PrefsControllerTest() { 34 PrefsControllerTest() {
35 // Since this is a platform-specific preference, it's not registered by
36 // any of the shared code. We have to register it ourselves.
37 PrefService* prefs = browser_helper_.profile()->GetPrefs();
38 prefs->RegisterBooleanPref(prefs::kShowPageOptionsButtons, false);
39 // The metrics reporting pref is registerd on the local state object in 35 // The metrics reporting pref is registerd on the local state object in
40 // real builds, but we don't have one of those for unit tests. Register 36 // real builds, but we don't have one of those for unit tests. Register
41 // it on prefs so we'll find it when we go looking. 37 // it on prefs so we'll find it when we go looking.
38 PrefService* prefs = browser_helper_.profile()->GetPrefs();
42 prefs->RegisterBooleanPref(prefs::kMetricsReportingEnabled, false); 39 prefs->RegisterBooleanPref(prefs::kMetricsReportingEnabled, false);
43 40
44 pref_controller_.reset([[PreferencesWindowController alloc] 41 pref_controller_.reset([[PreferencesWindowController alloc]
45 initWithProfile:browser_helper_.profile()]); 42 initWithProfile:browser_helper_.profile()]);
46 EXPECT_TRUE(pref_controller_.get()); 43 EXPECT_TRUE(pref_controller_.get());
47 } 44 }
48 45
49 BrowserTestHelper browser_helper_; 46 BrowserTestHelper browser_helper_;
50 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc... 47 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
51 scoped_nsobject<PreferencesWindowController> pref_controller_; 48 scoped_nsobject<PreferencesWindowController> pref_controller_;
(...skipping 14 matching lines...) Expand all
66 selector:@selector(prefsWindowClosed:) 63 selector:@selector(prefsWindowClosed:)
67 name:kUserDoneEditingPrefsNotification 64 name:kUserDoneEditingPrefsNotification
68 object:pref_controller_.get()]; 65 object:pref_controller_.get()];
69 [[pref_controller_ window] performClose:observer]; 66 [[pref_controller_ window] performClose:observer];
70 EXPECT_TRUE(observer.get()->gotNotification_); 67 EXPECT_TRUE(observer.get()->gotNotification_);
71 [[NSNotificationCenter defaultCenter] removeObserver:observer.get()]; 68 [[NSNotificationCenter defaultCenter] removeObserver:observer.get()];
72 #endif 69 #endif
73 } 70 }
74 71
75 } // namespace 72 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698