| 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 "base/mac/foundation_util.h" | 7 #import "base/mac/foundation_util.h" |
| 8 #include "base/mac/mac_util.h" |
| 8 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 10 #import "chrome/browser/app_controller_mac.h" | 11 #import "chrome/browser/app_controller_mac.h" |
| 11 #import "chrome/browser/chrome_browser_application_mac.h" | 12 #import "chrome/browser/chrome_browser_application_mac.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" | 14 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" |
| 14 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" | 15 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" |
| 15 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" | 16 #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" |
| 16 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" | 17 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" |
| 17 #include "chrome/browser/ui/cocoa/run_loop_testing.h" | 18 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 for(int j = 0; j < 3; ++j) { | 141 for(int j = 0; j < 3; ++j) { |
| 141 [aWindow.get() removeFromTabsAtIndex:0]; | 142 [aWindow.get() removeFromTabsAtIndex:0]; |
| 142 } | 143 } |
| 143 count = count - 3; | 144 count = count - 3; |
| 144 EXPECT_EQ((int)[[aWindow.get() tabs] count], count); | 145 EXPECT_EQ((int)[[aWindow.get() tabs] count], count); |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 148 // Getting and setting values from the NSWindow. | 149 // Getting and setting values from the NSWindow. |
| 149 IN_PROC_BROWSER_TEST_F(WindowAppleScriptTest, NSWindowTest) { | 150 IN_PROC_BROWSER_TEST_F(WindowAppleScriptTest, NSWindowTest) { |
| 151 if (base::mac::IsOS10_10()) |
| 152 return; // Fails when swarmed. http://crbug.com/660582 |
| 150 base::scoped_nsobject<WindowAppleScript> aWindow( | 153 base::scoped_nsobject<WindowAppleScript> aWindow( |
| 151 [[WindowAppleScript alloc] initWithBrowser:browser()]); | 154 [[WindowAppleScript alloc] initWithBrowser:browser()]); |
| 152 [aWindow.get() setValue:[NSNumber numberWithBool:YES] | 155 [aWindow.get() setValue:[NSNumber numberWithBool:YES] |
| 153 forKey:@"isMiniaturized"]; | 156 forKey:@"isMiniaturized"]; |
| 154 EXPECT_TRUE([[aWindow.get() valueForKey:@"isMiniaturized"] boolValue]); | 157 EXPECT_TRUE([[aWindow.get() valueForKey:@"isMiniaturized"] boolValue]); |
| 155 [aWindow.get() setValue:[NSNumber numberWithBool:NO] | 158 [aWindow.get() setValue:[NSNumber numberWithBool:NO] |
| 156 forKey:@"isMiniaturized"]; | 159 forKey:@"isMiniaturized"]; |
| 157 EXPECT_FALSE([[aWindow.get() valueForKey:@"isMiniaturized"] boolValue]); | 160 EXPECT_FALSE([[aWindow.get() valueForKey:@"isMiniaturized"] boolValue]); |
| 158 } | 161 } |
| 159 | 162 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 174 IN_PROC_BROWSER_TEST_F(WindowAppleScriptTest, WindowOrder) { | 177 IN_PROC_BROWSER_TEST_F(WindowAppleScriptTest, WindowOrder) { |
| 175 base::scoped_nsobject<WindowAppleScript> window2( | 178 base::scoped_nsobject<WindowAppleScript> window2( |
| 176 [[WindowAppleScript alloc] initWithBrowser:browser()]); | 179 [[WindowAppleScript alloc] initWithBrowser:browser()]); |
| 177 base::scoped_nsobject<WindowAppleScript> window1( | 180 base::scoped_nsobject<WindowAppleScript> window1( |
| 178 [[WindowAppleScript alloc] init]); | 181 [[WindowAppleScript alloc] init]); |
| 179 chrome::testing::NSRunLoopRunAllPending(); | 182 chrome::testing::NSRunLoopRunAllPending(); |
| 180 EXPECT_EQ([window1.get() windowComparator:window2.get()], NSOrderedAscending); | 183 EXPECT_EQ([window1.get() windowComparator:window2.get()], NSOrderedAscending); |
| 181 EXPECT_EQ([window2.get() windowComparator:window1.get()], | 184 EXPECT_EQ([window2.get() windowComparator:window1.get()], |
| 182 NSOrderedDescending); | 185 NSOrderedDescending); |
| 183 } | 186 } |
| OLD | NEW |