OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
10 #import "base/mac/mac_util.h" | 10 #import "base/mac/mac_util.h" |
11 #import "base/mac/sdk_forward_declarations.h" | 11 #import "base/mac/sdk_forward_declarations.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #import "testing/gtest_mac.h" | 16 #import "testing/gtest_mac.h" |
17 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 17 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
18 #import "ui/views/cocoa/bridged_content_view.h" | 18 #import "ui/views/cocoa/bridged_content_view.h" |
19 #import "ui/views/cocoa/native_widget_mac_nswindow.h" | 19 #import "ui/views/cocoa/native_widget_mac_nswindow.h" |
| 20 #import "ui/views/cocoa/views_nswindow_delegate.h" |
20 #include "ui/views/controls/textfield/textfield.h" | 21 #include "ui/views/controls/textfield/textfield.h" |
21 #include "ui/views/ime/input_method.h" | 22 #include "ui/views/ime/input_method.h" |
22 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
23 #include "ui/views/widget/native_widget_mac.h" | 24 #include "ui/views/widget/native_widget_mac.h" |
24 #include "ui/views/widget/root_view.h" | 25 #include "ui/views/widget/root_view.h" |
25 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
26 #include "ui/views/widget/widget_observer.h" | 27 #include "ui/views/widget/widget_observer.h" |
27 | 28 |
28 using base::ASCIIToUTF16; | 29 using base::ASCIIToUTF16; |
29 using base::SysNSStringToUTF8; | 30 using base::SysNSStringToUTF8; |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 EXPECT_EQ(0, [window ignoredToggleFullScreenCount]); | 483 EXPECT_EQ(0, [window ignoredToggleFullScreenCount]); |
483 EXPECT_TRUE(bridge()->target_fullscreen_state()); | 484 EXPECT_TRUE(bridge()->target_fullscreen_state()); |
484 [center postNotificationName:NSWindowDidExitFullScreenNotification | 485 [center postNotificationName:NSWindowDidExitFullScreenNotification |
485 object:window]; | 486 object:window]; |
486 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); | 487 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); |
487 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 488 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
488 | 489 |
489 // Cocoa follows up with a failure message sent to the NSWindowDelegate (there | 490 // Cocoa follows up with a failure message sent to the NSWindowDelegate (there |
490 // is no equivalent notification for failure). Called via id so that this | 491 // is no equivalent notification for failure). Called via id so that this |
491 // compiles on 10.6. | 492 // compiles on 10.6. |
492 id window_delegate = [window delegate]; | 493 ViewsNSWindowDelegate* window_delegate = |
| 494 base::mac::ObjCCast<ViewsNSWindowDelegate>([window delegate]); |
493 [window_delegate windowDidFailToEnterFullScreen:window]; | 495 [window_delegate windowDidFailToEnterFullScreen:window]; |
494 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 496 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
495 | 497 |
496 // Now perform a successful fullscreen operation. | 498 // Now perform a successful fullscreen operation. |
497 [center postNotificationName:NSWindowWillEnterFullScreenNotification | 499 [center postNotificationName:NSWindowWillEnterFullScreenNotification |
498 object:window]; | 500 object:window]; |
499 EXPECT_TRUE(bridge()->target_fullscreen_state()); | 501 EXPECT_TRUE(bridge()->target_fullscreen_state()); |
500 [center postNotificationName:NSWindowDidEnterFullScreenNotification | 502 [center postNotificationName:NSWindowDidEnterFullScreenNotification |
501 object:window]; | 503 object:window]; |
502 EXPECT_TRUE(bridge()->target_fullscreen_state()); | 504 EXPECT_TRUE(bridge()->target_fullscreen_state()); |
(...skipping 10 matching lines...) Expand all Loading... |
513 [center postNotificationName:NSWindowDidExitFullScreenNotification | 515 [center postNotificationName:NSWindowDidExitFullScreenNotification |
514 object:window]; | 516 object:window]; |
515 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. | 517 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. |
516 EXPECT_FALSE(bridge()->target_fullscreen_state()); | 518 EXPECT_FALSE(bridge()->target_fullscreen_state()); |
517 | 519 |
518 widget_->CloseNow(); | 520 widget_->CloseNow(); |
519 } | 521 } |
520 | 522 |
521 } // namespace test | 523 } // namespace test |
522 } // namespace views | 524 } // namespace views |
OLD | NEW |