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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
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 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h" 10 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h"
10 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" 11 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h"
11 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" 12 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h"
12 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include "testing/gtest_mac.h" 15 #include "testing/gtest_mac.h"
15 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
16 17
17 typedef InProcessBrowserTest BrowserCrApplicationAppleScriptTest; 18 typedef InProcessBrowserTest BrowserCrApplicationAppleScriptTest;
18 19
19 // Create windows of different |Type|. 20 // Create windows of different |Type|.
20 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, Creation) { 21 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, Creation) {
21 // Create additional |Browser*| objects of different type. 22 // Create additional |Browser*| objects of different type.
22 Profile* profile = browser()->profile(); 23 Profile* profile = browser()->profile();
23 Browser* b1 = Browser::CreateWithParams( 24 Browser* b1 = Browser::CreateWithParams(
24 Browser::CreateParams(Browser::TYPE_POPUP, profile)); 25 Browser::CreateParams(Browser::TYPE_POPUP, profile));
25 Browser* b2 = Browser::CreateWithParams( 26 Browser* b2 = Browser::CreateWithParams(
26 Browser::CreateParams::CreateForApp( 27 Browser::CreateParams::CreateForApp(
27 Browser::TYPE_PANEL, "Test", gfx::Rect(), profile)); 28 Browser::TYPE_PANEL, "Test", gfx::Rect(), profile));
28 29
29 EXPECT_EQ(3U, [[NSApp appleScriptWindows] count]); 30 EXPECT_EQ(3U, [[NSApp appleScriptWindows] count]);
30 for (WindowAppleScript* window in [NSApp appleScriptWindows]) { 31 for (WindowAppleScript* window in [NSApp appleScriptWindows]) {
31 EXPECT_NSEQ(AppleScript::kWindowsProperty, 32 EXPECT_NSEQ(AppleScript::kWindowsProperty,
32 [window containerProperty]); 33 [window containerProperty]);
33 EXPECT_NSEQ(NSApp, [window container]); 34 EXPECT_NSEQ(NSApp, [window container]);
34 } 35 }
35 36
36 // Close the additional browsers. 37 // Close the additional browsers.
37 b1->CloseAllTabs(); 38 chrome::CloseAllTabs(b1);
38 b2->CloseAllTabs(); 39 chrome::CloseAllTabs(b2);
39 } 40 }
40 41
41 // Insert a new window. 42 // Insert a new window.
42 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, InsertWindow) { 43 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, InsertWindow) {
43 // Emulate what applescript would do when creating a new window. 44 // Emulate what applescript would do when creating a new window.
44 // Emulate a script like |set var to make new window with properties 45 // Emulate a script like |set var to make new window with properties
45 // {visible:false}|. 46 // {visible:false}|.
46 scoped_nsobject<WindowAppleScript> aWindow([[WindowAppleScript alloc] init]); 47 scoped_nsobject<WindowAppleScript> aWindow([[WindowAppleScript alloc] init]);
47 scoped_nsobject<NSNumber> var([[aWindow.get() uniqueID] copy]); 48 scoped_nsobject<NSNumber> var([[aWindow.get() uniqueID] copy]);
48 [aWindow.get() setValue:[NSNumber numberWithBool:YES] forKey:@"isVisible"]; 49 [aWindow.get() setValue:[NSNumber numberWithBool:YES] forKey:@"isVisible"];
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 for (BookmarkFolderAppleScript* bookmarkFolder in bookmarkFolders) { 102 for (BookmarkFolderAppleScript* bookmarkFolder in bookmarkFolders) {
102 EXPECT_EQ(NSApp, 103 EXPECT_EQ(NSApp,
103 [bookmarkFolder container]); 104 [bookmarkFolder container]);
104 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty, 105 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty,
105 [bookmarkFolder containerProperty]); 106 [bookmarkFolder containerProperty]);
106 } 107 }
107 108
108 EXPECT_NSEQ(@"Other Bookmarks", [[NSApp otherBookmarks] title]); 109 EXPECT_NSEQ(@"Other Bookmarks", [[NSApp otherBookmarks] title]);
109 EXPECT_NSEQ(@"Bookmarks Bar", [[NSApp bookmarksBar] title]); 110 EXPECT_NSEQ(@"Bookmarks Bar", [[NSApp bookmarksBar] title]);
110 } 111 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_win.cc ('k') | chrome/browser/ui/cocoa/applescript/window_applescript.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698