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 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_tabstrip.h" | 11 #include "chrome/browser/ui/browser_tabstrip.h" |
12 #include "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" | 12 #include "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" |
13 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h" | 13 #import "chrome/browser/ui/cocoa/applescript/browsercrapplication+applescript.h" |
14 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" | 14 #import "chrome/browser/ui/cocoa/applescript/constants_applescript.h" |
15 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" | 15 #import "chrome/browser/ui/cocoa/applescript/window_applescript.h" |
16 #include "chrome/browser/ui/cocoa/test/run_loop_testing.h" | 16 #include "chrome/browser/ui/cocoa/test/run_loop_testing.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "testing/gtest_mac.h" | 20 #include "testing/gtest_mac.h" |
21 #include "ui/gfx/geometry/size.h" | 21 #include "ui/gfx/geometry/size.h" |
22 | 22 |
23 typedef InProcessBrowserTest BrowserCrApplicationAppleScriptTest; | 23 typedef InProcessBrowserTest BrowserCrApplicationAppleScriptTest; |
24 | 24 |
25 // Create windows of different |Type|. | 25 // Create windows of different |Type|. |
26 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, Creation) { | 26 IN_PROC_BROWSER_TEST_F(BrowserCrApplicationAppleScriptTest, Creation) { |
27 // Create additional |Browser*| objects of different type. | 27 // Create additional |Browser*| objects of different type. |
28 Profile* profile = browser()->profile(); | 28 Profile* profile = browser()->profile(); |
29 Browser* b1 = | 29 Browser* b1 = |
30 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile)); | 30 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile, true)); |
31 Browser* b2 = new Browser(Browser::CreateParams::CreateForApp( | 31 Browser* b2 = new Browser(Browser::CreateParams::CreateForApp( |
32 "Test", true /* trusted_source */, gfx::Rect(), profile)); | 32 "Test", true /* trusted_source */, gfx::Rect(), profile, true)); |
33 | 33 |
34 EXPECT_EQ(3U, [[NSApp appleScriptWindows] count]); | 34 EXPECT_EQ(3U, [[NSApp appleScriptWindows] count]); |
35 for (WindowAppleScript* window in [NSApp appleScriptWindows]) { | 35 for (WindowAppleScript* window in [NSApp appleScriptWindows]) { |
36 EXPECT_NSEQ(AppleScript::kWindowsProperty, | 36 EXPECT_NSEQ(AppleScript::kWindowsProperty, |
37 [window containerProperty]); | 37 [window containerProperty]); |
38 EXPECT_NSEQ(NSApp, [window container]); | 38 EXPECT_NSEQ(NSApp, [window container]); |
39 } | 39 } |
40 | 40 |
41 // Close the additional browsers. | 41 // Close the additional browsers. |
42 b1->tab_strip_model()->CloseAllTabs(); | 42 b1->tab_strip_model()->CloseAllTabs(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 [bookmarkFolder containerProperty]); | 112 [bookmarkFolder containerProperty]); |
113 } | 113 } |
114 | 114 |
115 BookmarkFolderAppleScript* otherBookmarks = | 115 BookmarkFolderAppleScript* otherBookmarks = |
116 base::mac::ObjCCast<BookmarkFolderAppleScript>([NSApp otherBookmarks]); | 116 base::mac::ObjCCast<BookmarkFolderAppleScript>([NSApp otherBookmarks]); |
117 EXPECT_NSEQ(@"Other Bookmarks", [otherBookmarks title]); | 117 EXPECT_NSEQ(@"Other Bookmarks", [otherBookmarks title]); |
118 BookmarkFolderAppleScript* bookmarksBar = | 118 BookmarkFolderAppleScript* bookmarksBar = |
119 base::mac::ObjCCast<BookmarkFolderAppleScript>([NSApp bookmarksBar]); | 119 base::mac::ObjCCast<BookmarkFolderAppleScript>([NSApp bookmarksBar]); |
120 EXPECT_NSEQ(@"Bookmarks Bar", [bookmarksBar title]); | 120 EXPECT_NSEQ(@"Bookmarks Bar", [bookmarksBar title]); |
121 } | 121 } |
OLD | NEW |