| OLD | NEW |
| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/window_size_autosaver.h" | 7 #import "chrome/browser/ui/cocoa/window_size_autosaver.h" |
| 8 | 8 |
| 9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/memory/scoped_nsobject.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 11 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 12 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class WindowSizeAutosaverTest : public CocoaProfileTest { | 18 class WindowSizeAutosaverTest : public CocoaProfileTest { |
| 19 virtual void SetUp() { | 19 virtual void SetUp() { |
| 20 CocoaProfileTest::SetUp(); | 20 CocoaProfileTest::SetUp(); |
| 21 path_ = "WindowSizeAutosaverTest"; | 21 path_ = "WindowSizeAutosaverTest"; |
| 22 window_ = | 22 window_ = |
| 23 [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 101, 150, 151) | 23 [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 101, 150, 151) |
| 24 styleMask:NSTitledWindowMask| | 24 styleMask:NSTitledWindowMask| |
| 25 NSResizableWindowMask | 25 NSResizableWindowMask |
| 26 backing:NSBackingStoreBuffered | 26 backing:NSBackingStoreBuffered |
| 27 defer:NO]; | 27 defer:NO]; |
| 28 profile()->GetPrefs()->RegisterDictionaryPref( | 28 profile()->GetPrefs()->RegisterDictionaryPref( |
| 29 path_, | 29 path_, |
| 30 PrefService::UNSYNCABLE_PREF); | 30 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void TearDown() { | 33 virtual void TearDown() { |
| 34 [window_ close]; | 34 [window_ close]; |
| 35 CocoaProfileTest::TearDown(); | 35 CocoaProfileTest::TearDown(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 public: | 38 public: |
| 39 NSWindow* window_; | 39 NSWindow* window_; |
| 40 const char* path_; | 40 const char* path_; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 int x1, y1, x2, y2; | 198 int x1, y1, x2, y2; |
| 199 EXPECT_FALSE(windowPref->GetInteger("x", &x1)); | 199 EXPECT_FALSE(windowPref->GetInteger("x", &x1)); |
| 200 EXPECT_FALSE(windowPref->GetInteger("y", &x1)); | 200 EXPECT_FALSE(windowPref->GetInteger("y", &x1)); |
| 201 ASSERT_FALSE(windowPref->GetInteger("left", &x1)); | 201 ASSERT_FALSE(windowPref->GetInteger("left", &x1)); |
| 202 ASSERT_FALSE(windowPref->GetInteger("right", &x2)); | 202 ASSERT_FALSE(windowPref->GetInteger("right", &x2)); |
| 203 ASSERT_FALSE(windowPref->GetInteger("top", &y1)); | 203 ASSERT_FALSE(windowPref->GetInteger("top", &y1)); |
| 204 ASSERT_FALSE(windowPref->GetInteger("bottom", &y2)); | 204 ASSERT_FALSE(windowPref->GetInteger("bottom", &y2)); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace | 207 } // namespace |
| OLD | NEW |