Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1375)

Side by Side Diff: chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript_test.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanups Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
Mark Mentovai 2013/06/24 21:29:48 #include what you use.
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h" 9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h" 10 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h"
11 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" 11 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h"
12 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" 12 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "testing/gtest_mac.h" 16 #include "testing/gtest_mac.h"
(...skipping 23 matching lines...) Expand all
40 // Close the additional browsers. 40 // Close the additional browsers.
41 b1->tab_strip_model()->CloseAllTabs(); 41 b1->tab_strip_model()->CloseAllTabs();
42 b2->tab_strip_model()->CloseAllTabs(); 42 b2->tab_strip_model()->CloseAllTabs();
43 } 43 }
44 44
45 // Insert a new window. 45 // Insert a new window.
46 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, InsertWindow) { 46 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, InsertWindow) {
47 // Emulate what applescript would do when creating a new window. 47 // Emulate what applescript would do when creating a new window.
48 // Emulate a script like |set var to make new window with properties 48 // Emulate a script like |set var to make new window with properties
49 // {visible:false}|. 49 // {visible:false}|.
50 scoped_nsobject<WindowAppleScript> aWindow([[WindowAppleScript alloc] init]); 50 base::scoped_nsobject<WindowAppleScript> aWindow(
51 scoped_nsobject<NSNumber> var([[aWindow.get() uniqueID] copy]); 51 [[WindowAppleScript alloc] init]);
52 base::scoped_nsobject<NSNumber> var([[aWindow.get() uniqueID] copy]);
52 [aWindow.get() setValue:[NSNumber numberWithBool:YES] forKey:@"isVisible"]; 53 [aWindow.get() setValue:[NSNumber numberWithBool:YES] forKey:@"isVisible"];
53 54
54 [NSApp insertInAppleScriptWindows:aWindow.get()]; 55 [NSApp insertInAppleScriptWindows:aWindow.get()];
55 56
56 // Represents the window after it is added. 57 // Represents the window after it is added.
57 WindowAppleScript* window = [[NSApp appleScriptWindows] objectAtIndex:0]; 58 WindowAppleScript* window = [[NSApp appleScriptWindows] objectAtIndex:0];
58 EXPECT_NSEQ([NSNumber numberWithBool:YES], 59 EXPECT_NSEQ([NSNumber numberWithBool:YES],
59 [aWindow.get() valueForKey:@"isVisible"]); 60 [aWindow.get() valueForKey:@"isVisible"]);
60 EXPECT_EQ([window container], NSApp); 61 EXPECT_EQ([window container], NSApp);
61 EXPECT_NSEQ(AppleScript::kWindowsProperty, 62 EXPECT_NSEQ(AppleScript::kWindowsProperty,
62 [window containerProperty]); 63 [window containerProperty]);
63 EXPECT_NSEQ(var, [window uniqueID]); 64 EXPECT_NSEQ(var, [window uniqueID]);
64 } 65 }
65 66
66 // Inserting and deleting windows. 67 // Inserting and deleting windows.
67 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, 68 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest,
68 InsertAndDeleteWindows) { 69 InsertAndDeleteWindows) {
69 scoped_nsobject<WindowAppleScript> aWindow; 70 base::scoped_nsobject<WindowAppleScript> aWindow;
70 int count; 71 int count;
71 // Create a bunch of windows. 72 // Create a bunch of windows.
72 for (int i = 0; i < 5; ++i) { 73 for (int i = 0; i < 5; ++i) {
73 for (int j = 0; j < 3; ++j) { 74 for (int j = 0; j < 3; ++j) {
74 aWindow.reset([[WindowAppleScript alloc] init]); 75 aWindow.reset([[WindowAppleScript alloc] init]);
75 [NSApp insertInAppleScriptWindows:aWindow.get()]; 76 [NSApp insertInAppleScriptWindows:aWindow.get()];
76 } 77 }
77 count = 3 * i + 4; 78 count = 3 * i + 4;
78 EXPECT_EQ(count, (int)[[NSApp appleScriptWindows] count]); 79 EXPECT_EQ(count, (int)[[NSApp appleScriptWindows] count]);
79 } 80 }
(...skipping 25 matching lines...) Expand all
105 for (BookmarkFolderAppleScript* bookmarkFolder in bookmarkFolders) { 106 for (BookmarkFolderAppleScript* bookmarkFolder in bookmarkFolders) {
106 EXPECT_EQ(NSApp, 107 EXPECT_EQ(NSApp,
107 [bookmarkFolder container]); 108 [bookmarkFolder container]);
108 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty, 109 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty,
109 [bookmarkFolder containerProperty]); 110 [bookmarkFolder containerProperty]);
110 } 111 }
111 112
112 EXPECT_NSEQ(@"Other Bookmarks", [[NSApp otherBookmarks] title]); 113 EXPECT_NSEQ(@"Other Bookmarks", [[NSApp otherBookmarks] title]);
113 EXPECT_NSEQ(@"Bookmarks Bar", [[NSApp bookmarksBar] title]); 114 EXPECT_NSEQ(@"Bookmarks Bar", [[NSApp bookmarksBar] title]);
114 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698