| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | |
| 9 #import "chrome/browser/ui/cocoa/focus_tracker.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/platform_test.h" | 9 #include "testing/platform_test.h" |
| 10 #import "ui/base/cocoa/focus_tracker.h" |
| 11 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class FocusTrackerTest : public CocoaTest { | 15 class FocusTrackerTest : public ui::CocoaTest { |
| 16 public: | 16 public: |
| 17 virtual void SetUp() { | 17 virtual void SetUp() { |
| 18 CocoaTest::SetUp(); | 18 ui::CocoaTest::SetUp(); |
| 19 scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); | 19 scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); |
| 20 viewA_ = view.get(); | 20 viewA_ = view.get(); |
| 21 [[test_window() contentView] addSubview:viewA_]; | 21 [[test_window() contentView] addSubview:viewA_]; |
| 22 | 22 |
| 23 view.reset([[NSView alloc] initWithFrame:NSZeroRect]); | 23 view.reset([[NSView alloc] initWithFrame:NSZeroRect]); |
| 24 viewB_ = view.get(); | 24 viewB_ = view.get(); |
| 25 [[test_window() contentView] addSubview:viewB_]; | 25 [[test_window() contentView] addSubview:viewB_]; |
| 26 } | 26 } |
| 27 | 27 |
| 28 protected: | 28 protected: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Give focus to |viewB_|, then try and restore focus in a different | 82 // Give focus to |viewB_|, then try and restore focus in a different |
| 83 // window. It is ok to pass a nil NSWindow here because we only use | 83 // window. It is ok to pass a nil NSWindow here because we only use |
| 84 // it for direct comparison. | 84 // it for direct comparison. |
| 85 ASSERT_TRUE([window makeFirstResponder:viewB_]); | 85 ASSERT_TRUE([window makeFirstResponder:viewB_]); |
| 86 EXPECT_FALSE([tracker restoreFocusInWindow:nil]); | 86 EXPECT_FALSE([tracker restoreFocusInWindow:nil]); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 } // namespace | 90 } // namespace |
| OLD | NEW |