| 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/browser_test_helper.h" | 12 #include "chrome/browser/ui/cocoa/browser_test_helper.h" |
| 13 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 13 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class WindowSizeAutosaverTest : public CocoaTest { | 19 class WindowSizeAutosaverTest : public CocoaTest { |
| 20 virtual void SetUp() { | 20 virtual void SetUp() { |
| 21 CocoaTest::SetUp(); | 21 CocoaTest::SetUp(); |
| 22 path_ = "WindowSizeAutosaverTest"; | 22 path_ = "WindowSizeAutosaverTest"; |
| 23 window_ = | 23 window_ = |
| 24 [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 101, 150, 151) | 24 [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 101, 150, 151) |
| 25 styleMask:NSTitledWindowMask| | 25 styleMask:NSTitledWindowMask| |
| 26 NSResizableWindowMask | 26 NSResizableWindowMask |
| 27 backing:NSBackingStoreBuffered | 27 backing:NSBackingStoreBuffered |
| 28 defer:NO]; | 28 defer:NO]; |
| 29 browser_helper_.profile()->GetPrefs()->RegisterDictionaryPref(path_); | 29 browser_helper_.profile()->GetPrefs()->RegisterDictionaryPref( |
| 30 path_, |
| 31 false /* don't sync pref */); |
| 30 } | 32 } |
| 31 | 33 |
| 32 virtual void TearDown() { | 34 virtual void TearDown() { |
| 33 [window_ close]; | 35 [window_ close]; |
| 34 CocoaTest::TearDown(); | 36 CocoaTest::TearDown(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 public: | 39 public: |
| 38 BrowserTestHelper browser_helper_; | 40 BrowserTestHelper browser_helper_; |
| 39 NSWindow* window_; | 41 NSWindow* window_; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 int x1, y1, x2, y2; | 200 int x1, y1, x2, y2; |
| 199 EXPECT_FALSE(windowPref->GetInteger("x", &x1)); | 201 EXPECT_FALSE(windowPref->GetInteger("x", &x1)); |
| 200 EXPECT_FALSE(windowPref->GetInteger("y", &x1)); | 202 EXPECT_FALSE(windowPref->GetInteger("y", &x1)); |
| 201 ASSERT_FALSE(windowPref->GetInteger("left", &x1)); | 203 ASSERT_FALSE(windowPref->GetInteger("left", &x1)); |
| 202 ASSERT_FALSE(windowPref->GetInteger("right", &x2)); | 204 ASSERT_FALSE(windowPref->GetInteger("right", &x2)); |
| 203 ASSERT_FALSE(windowPref->GetInteger("top", &y1)); | 205 ASSERT_FALSE(windowPref->GetInteger("top", &y1)); |
| 204 ASSERT_FALSE(windowPref->GetInteger("bottom", &y2)); | 206 ASSERT_FALSE(windowPref->GetInteger("bottom", &y2)); |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace | 209 } // namespace |
| OLD | NEW |