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

Side by Side Diff: chrome/browser/ui/cocoa/options/font_language_settings_controller_unittest.mm

Issue 6339002: [Mac] Consolidate all files relating to preferences in a subdir of c/b/ui/coc... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 #include "base/scoped_nsobject.h" 5 #include "base/scoped_nsobject.h"
6 #include "chrome/browser/character_encoding.h" 6 #include "chrome/browser/character_encoding.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/cocoa/browser_test_helper.h" 8 #include "chrome/browser/ui/cocoa/browser_test_helper.h"
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
10 #import "chrome/browser/ui/cocoa/font_language_settings_controller.h" 10 #import "chrome/browser/ui/cocoa/options/font_language_settings_controller.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #import "testing/gtest_mac.h" 12 #import "testing/gtest_mac.h"
13 #include "testing/platform_test.h" 13 #include "testing/platform_test.h"
14 14
15 // The FontLanguageSettingsControllerForTest overrides the getFontFieldOrigin 15 // The FontLanguageSettingsControllerForTest overrides the getFontFieldOrigin
16 // method to provide a dummy point, so we don't have to actually display the 16 // method to provide a dummy point, so we don't have to actually display the
17 // window to test the controller. 17 // window to test the controller.
18 @interface FontLanguageSettingsControllerForTest : 18 @interface FontLanguageSettingsControllerForTest :
19 FontLanguageSettingsController { 19 FontLanguageSettingsController {
20 } 20 }
(...skipping 15 matching lines...) Expand all
36 @interface FontLanguageSettingsController (Testing) 36 @interface FontLanguageSettingsController (Testing)
37 - (void)updateDisplayField:(NSTextField*)field 37 - (void)updateDisplayField:(NSTextField*)field
38 withFont:(NSFont*)font 38 withFont:(NSFont*)font
39 withLabel:(NSTextField*)label; 39 withLabel:(NSTextField*)label;
40 @end 40 @end
41 41
42 class FontLanguageSettingsControllerTest : public CocoaTest { 42 class FontLanguageSettingsControllerTest : public CocoaTest {
43 public: 43 public:
44 FontLanguageSettingsControllerTest() { 44 FontLanguageSettingsControllerTest() {
45 Profile* profile = helper_.profile(); 45 Profile* profile = helper_.profile();
46 font_controller_.reset( 46 font_controller_.reset([[FontLanguageSettingsControllerForTest alloc]
47 [[FontLanguageSettingsControllerForTest alloc] initWithProfile:profile]) ; 47 initWithProfile:profile]);
48 } 48 }
49 ~FontLanguageSettingsControllerTest() {} 49 ~FontLanguageSettingsControllerTest() {}
50 50
51 BrowserTestHelper helper_; 51 BrowserTestHelper helper_;
52 scoped_nsobject<FontLanguageSettingsController> font_controller_; 52 scoped_nsobject<FontLanguageSettingsController> font_controller_;
53 }; 53 };
54 54
55 TEST_F(FontLanguageSettingsControllerTest, Init) { 55 TEST_F(FontLanguageSettingsControllerTest, Init) {
56 ASSERT_EQ(CharacterEncoding::GetSupportCanonicalEncodingCount(), 56 ASSERT_EQ(CharacterEncoding::GetSupportCanonicalEncodingCount(),
57 static_cast<int>([[font_controller_ encodings] count])); 57 static_cast<int>([[font_controller_ encodings] count]));
(...skipping 24 matching lines...) Expand all
82 withLabel:label]; 82 withLabel:label];
83 83
84 ASSERT_NSEQ(@"foo", [field stringValue]); 84 ASSERT_NSEQ(@"foo", [field stringValue]);
85 } 85 }
86 86
87 TEST_F(FontLanguageSettingsControllerTest, UpdateDisplayFieldNilField) { 87 TEST_F(FontLanguageSettingsControllerTest, UpdateDisplayFieldNilField) {
88 // Don't crash. 88 // Don't crash.
89 NSFont* font = [NSFont fontWithName:@"Times-Roman" size:12.0]; 89 NSFont* font = [NSFont fontWithName:@"Times-Roman" size:12.0];
90 [font_controller_ updateDisplayField:nil withFont:font withLabel:nil]; 90 [font_controller_ updateDisplayField:nil withFont:font withLabel:nil];
91 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698