| OLD | NEW |
| 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 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #import "chrome/browser/cocoa/page_info_window_controller.h" | 8 #import "chrome/browser/cocoa/page_info_window_controller.h" |
| 9 #include "chrome/browser/cocoa/browser_test_helper.h" | 9 #include "chrome/browser/cocoa/browser_test_helper.h" |
| 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 TEST_F(PageInfoWindowControllerTest, TestShrink) { | 44 TEST_F(PageInfoWindowControllerTest, TestShrink) { |
| 45 [controller_ window]; // Force nib to load. | 45 [controller_ window]; // Force nib to load. |
| 46 [controller_ setShowHistoryBox:YES]; | 46 [controller_ setShowHistoryBox:YES]; |
| 47 NSRect frame = [[controller_ window] frame]; | 47 NSRect frame = [[controller_ window] frame]; |
| 48 [controller_ setShowHistoryBox:NO]; | 48 [controller_ setShowHistoryBox:NO]; |
| 49 NSRect newFrame = [[controller_ window] frame]; | 49 NSRect newFrame = [[controller_ window] frame]; |
| 50 EXPECT_LE(newFrame.size.height, frame.size.height); | 50 EXPECT_LE(newFrame.size.height, frame.size.height); |
| 51 EXPECT_GE(newFrame.origin.y, frame.origin.y); | 51 EXPECT_GE(newFrame.origin.y, frame.origin.y); |
| 52 } | 52 } |
| 53 | |
| 54 | |
| 55 TEST_F(PageInfoWindowControllerTest, TestSaveWindowPlacement) { | |
| 56 PrefService* prefs = helper_.profile()->GetPrefs(); | |
| 57 ASSERT_TRUE(prefs != NULL); | |
| 58 | |
| 59 // Check to make sure there is no existing pref for window placement. | |
| 60 ASSERT_TRUE(prefs->GetDictionary(prefs::kPageInfoWindowPlacement) == NULL); | |
| 61 | |
| 62 // Ask the window to save its position, then check that a preference | |
| 63 // exists. We're technically passing in a pointer to the user prefs | |
| 64 // and not the local state prefs, but a PrefService* is a | |
| 65 // PrefService*, and this is a unittest. | |
| 66 [controller_ saveWindowPositionToPrefs:prefs]; | |
| 67 EXPECT_TRUE(prefs->GetDictionary(prefs::kPageInfoWindowPlacement) != NULL); | |
| 68 } | |
| 69 | |
| OLD | NEW |