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

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

Issue 402066: Moved a whole pile of unittests over to CocoaTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
Property Changes:
Added: svn:eol-style
+ LF
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 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #include "chrome/browser/cocoa/browser_test_helper.h" 8 #include "chrome/browser/cocoa/browser_test_helper.h"
9 #import "chrome/browser/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/cocoa/cocoa_test_helper.h"
10 #import "chrome/browser/cocoa/nswindow_local_state.h" 10 #import "chrome/browser/cocoa/nswindow_local_state.h"
11 #include "chrome/common/pref_service.h" 11 #include "chrome/common/pref_service.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/platform_test.h" 13 #include "testing/platform_test.h"
14 14
15 class NSWindowLocalStateTest : public PlatformTest { 15 class NSWindowLocalStateTest : public CocoaTest {
16 virtual void SetUp() { 16 virtual void SetUp() {
17 CocoaTest::SetUp();
17 path_ = L"NSWindowLocalStateTest"; 18 path_ = L"NSWindowLocalStateTest";
18 window_.reset( 19 window_ =
19 [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 20, 20) 20 [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 20, 20)
20 styleMask:NSTitledWindowMask 21 styleMask:NSTitledWindowMask
21 backing:NSBackingStoreBuffered 22 backing:NSBackingStoreBuffered
22 defer:NO]); 23 defer:NO];
23 browser_helper_.profile()->GetPrefs()->RegisterDictionaryPref(path_); 24 browser_helper_.profile()->GetPrefs()->RegisterDictionaryPref(path_);
24 } 25 }
25 26
27 virtual void TearDown() {
28 [window_ close];
29 CocoaTest::TearDown();
30 }
31
26 public: 32 public:
27 CocoaTestHelper cocoa_helper_;
28 BrowserTestHelper browser_helper_; 33 BrowserTestHelper browser_helper_;
29 scoped_nsobject<NSWindow> window_; 34 NSWindow* window_;
30 const wchar_t* path_; 35 const wchar_t* path_;
31 }; 36 };
32 37
33 TEST_F(NSWindowLocalStateTest, SaveWindowPlacement) { 38 TEST_F(NSWindowLocalStateTest, SaveWindowPlacement) {
34 PrefService* prefs = browser_helper_.profile()->GetPrefs(); 39 PrefService* prefs = browser_helper_.profile()->GetPrefs();
35 ASSERT_TRUE(prefs != NULL); 40 ASSERT_TRUE(prefs != NULL);
36 41
37 // Check to make sure there is no existing pref for window placement. 42 // Check to make sure there is no existing pref for window placement.
38 ASSERT_TRUE(prefs->GetDictionary(path_) == NULL); 43 ASSERT_TRUE(prefs->GetDictionary(path_) == NULL);
39 44
(...skipping 17 matching lines...) Expand all
57 62
58 // Large enough so that the window is on screen without cascasding to a 63 // Large enough so that the window is on screen without cascasding to a
59 // totally new location. 64 // totally new location.
60 const int value = 420; 65 const int value = 420;
61 windowPrefs->SetInteger(L"x", value); 66 windowPrefs->SetInteger(L"x", value);
62 windowPrefs->SetInteger(L"y", value); 67 windowPrefs->SetInteger(L"y", value);
63 [window_ restoreWindowPositionFromPrefs:prefs withPath:path_]; 68 [window_ restoreWindowPositionFromPrefs:prefs withPath:path_];
64 EXPECT_LT(value, [window_ frame].origin.x); 69 EXPECT_LT(value, [window_ frame].origin.x);
65 EXPECT_GT(value, [window_ frame].origin.y); 70 EXPECT_GT(value, [window_ frame].origin.y);
66 } 71 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/location_bar_view_mac_unittest.mm ('k') | chrome/browser/cocoa/page_info_window_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698