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