| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "extensions/browser/app_window/native_app_window.h" | 5 #include "extensions/browser/app_window/native_app_window.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" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 [waiter waitForEnterCount:2 exitCount:2]; | 269 [waiter waitForEnterCount:2 exitCount:2]; |
| 270 EXPECT_EQ(AppWindow::FULLSCREEN_TYPE_NONE, | 270 EXPECT_EQ(AppWindow::FULLSCREEN_TYPE_NONE, |
| 271 app_window->fullscreen_types_for_test()); | 271 app_window->fullscreen_types_for_test()); |
| 272 EXPECT_FALSE(window->IsFullscreen()); | 272 EXPECT_FALSE(window->IsFullscreen()); |
| 273 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); | 273 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); |
| 274 EXPECT_TRUE(gfx::IsNSWindowAlwaysOnTop(ns_window)); | 274 EXPECT_TRUE(gfx::IsNSWindowAlwaysOnTop(ns_window)); |
| 275 } | 275 } |
| 276 | 276 |
| 277 // Test Minimize, Restore combinations with their native equivalents. | 277 // Test Minimize, Restore combinations with their native equivalents. |
| 278 IN_PROC_BROWSER_TEST_P(NativeAppWindowCocoaBrowserTest, Minimize) { | 278 IN_PROC_BROWSER_TEST_P(NativeAppWindowCocoaBrowserTest, Minimize) { |
| 279 if (base::mac::IsOS10_10()) |
| 280 return; // Fails when swarmed. http://crbug.com/660582 |
| 279 SetUpAppWithWindows(1); | 281 SetUpAppWithWindows(1); |
| 280 AppWindow* app_window = GetFirstAppWindow(); | 282 AppWindow* app_window = GetFirstAppWindow(); |
| 281 extensions::NativeAppWindow* window = app_window->GetBaseWindow(); | 283 extensions::NativeAppWindow* window = app_window->GetBaseWindow(); |
| 282 NSWindow* ns_window = app_window->GetNativeWindow(); | 284 NSWindow* ns_window = app_window->GetNativeWindow(); |
| 283 | 285 |
| 284 NSRect initial_frame = [ns_window frame]; | 286 NSRect initial_frame = [ns_window frame]; |
| 285 | 287 |
| 286 EXPECT_FALSE(window->IsMinimized()); | 288 EXPECT_FALSE(window->IsMinimized()); |
| 287 EXPECT_FALSE([ns_window isMiniaturized]); | 289 EXPECT_FALSE([ns_window isMiniaturized]); |
| 288 | 290 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 object:ns_window]); | 396 object:ns_window]); |
| 395 app_window->Restore(); | 397 app_window->Restore(); |
| 396 [watcher wait]; | 398 [watcher wait]; |
| 397 EXPECT_EQ(initial_restored_bounds, window->GetRestoredBounds()); | 399 EXPECT_EQ(initial_restored_bounds, window->GetRestoredBounds()); |
| 398 EXPECT_NSEQ(initial_frame, [ns_window frame]); | 400 EXPECT_NSEQ(initial_frame, [ns_window frame]); |
| 399 EXPECT_FALSE(window->IsMaximized()); | 401 EXPECT_FALSE(window->IsMaximized()); |
| 400 } | 402 } |
| 401 | 403 |
| 402 // Test Minimize, Maximize, Restore combinations with their native equivalents. | 404 // Test Minimize, Maximize, Restore combinations with their native equivalents. |
| 403 IN_PROC_BROWSER_TEST_P(NativeAppWindowCocoaBrowserTest, MinimizeMaximize) { | 405 IN_PROC_BROWSER_TEST_P(NativeAppWindowCocoaBrowserTest, MinimizeMaximize) { |
| 406 if (base::mac::IsOS10_10()) |
| 407 return; // Fails when swarmed. http://crbug.com/660582 |
| 404 SetUpAppWithWindows(1); | 408 SetUpAppWithWindows(1); |
| 405 AppWindow* app_window = GetFirstAppWindow(); | 409 AppWindow* app_window = GetFirstAppWindow(); |
| 406 extensions::NativeAppWindow* window = app_window->GetBaseWindow(); | 410 extensions::NativeAppWindow* window = app_window->GetBaseWindow(); |
| 407 NSWindow* ns_window = app_window->GetNativeWindow(); | 411 NSWindow* ns_window = app_window->GetNativeWindow(); |
| 408 base::scoped_nsobject<WindowedNSNotificationObserver> watcher; | 412 base::scoped_nsobject<WindowedNSNotificationObserver> watcher; |
| 409 | 413 |
| 410 NSRect initial_frame = [ns_window frame]; | 414 NSRect initial_frame = [ns_window frame]; |
| 411 NSRect maximized_frame = [[ns_window screen] visibleFrame]; | 415 NSRect maximized_frame = [[ns_window screen] visibleFrame]; |
| 412 | 416 |
| 413 EXPECT_FALSE(window->IsMaximized()); | 417 EXPECT_FALSE(window->IsMaximized()); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 [expected_color getComponents:expected_components]; | 694 [expected_color getComponents:expected_components]; |
| 691 [color getComponents:color_components]; | 695 [color getComponents:color_components]; |
| 692 EXPECT_NEAR(expected_components[0], color_components[0], 0.01); | 696 EXPECT_NEAR(expected_components[0], color_components[0], 0.01); |
| 693 EXPECT_NEAR(expected_components[1], color_components[1], 0.01); | 697 EXPECT_NEAR(expected_components[1], color_components[1], 0.01); |
| 694 EXPECT_NEAR(expected_components[2], color_components[2], 0.01); | 698 EXPECT_NEAR(expected_components[2], color_components[2], 0.01); |
| 695 } | 699 } |
| 696 | 700 |
| 697 INSTANTIATE_TEST_CASE_P(NativeAppWindowCocoaBrowserTestInstance, | 701 INSTANTIATE_TEST_CASE_P(NativeAppWindowCocoaBrowserTestInstance, |
| 698 NativeAppWindowCocoaBrowserTest, | 702 NativeAppWindowCocoaBrowserTest, |
| 699 ::testing::Bool()); | 703 ::testing::Bool()); |
| OLD | NEW |