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

Side by Side Diff: chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript_unittest.mm

Issue 9904003: Fix some grammar in chrome/browser/ui/cocoa (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/content_settings/cookie_details.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #import "chrome/browser/ui/cocoa/applescript/bookmark_applescript_utils_unittest .h" 9 #import "chrome/browser/ui/cocoa/applescript/bookmark_applescript_utils_unittest .h"
10 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" 10 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 TEST_F(BookmarkFolderAppleScriptTest, InsertBookmarkFolder) { 44 TEST_F(BookmarkFolderAppleScriptTest, InsertBookmarkFolder) {
45 // Emulate what applescript would do when inserting a new bookmark folder. 45 // Emulate what applescript would do when inserting a new bookmark folder.
46 // Emulates a script like |set var to make new bookmark folder with 46 // Emulates a script like |set var to make new bookmark folder with
47 // properties {title:"foo"}|. 47 // properties {title:"foo"}|.
48 scoped_nsobject<BookmarkFolderAppleScript> bookmarkFolder( 48 scoped_nsobject<BookmarkFolderAppleScript> bookmarkFolder(
49 [[BookmarkFolderAppleScript alloc] init]); 49 [[BookmarkFolderAppleScript alloc] init]);
50 scoped_nsobject<NSNumber> var([[bookmarkFolder.get() uniqueID] copy]); 50 scoped_nsobject<NSNumber> var([[bookmarkFolder.get() uniqueID] copy]);
51 [bookmarkFolder.get() setTitle:@"foo"]; 51 [bookmarkFolder.get() setTitle:@"foo"];
52 [bookmarkBar_.get() insertInBookmarkFolders:bookmarkFolder.get()]; 52 [bookmarkBar_.get() insertInBookmarkFolders:bookmarkFolder.get()];
53 53
54 // Represents the bookmark folder after its added. 54 // Represents the bookmark folder after it's added.
55 BookmarkFolderAppleScript* bf = 55 BookmarkFolderAppleScript* bf =
56 [[bookmarkBar_.get() bookmarkFolders] objectAtIndex:2]; 56 [[bookmarkBar_.get() bookmarkFolders] objectAtIndex:2];
57 EXPECT_NSEQ(@"foo", [bf title]); 57 EXPECT_NSEQ(@"foo", [bf title]);
58 EXPECT_EQ([bf container], bookmarkBar_.get()); 58 EXPECT_EQ([bf container], bookmarkBar_.get());
59 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty, 59 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty,
60 [bf containerProperty]); 60 [bf containerProperty]);
61 EXPECT_NSEQ(var.get(), [bf uniqueID]); 61 EXPECT_NSEQ(var.get(), [bf uniqueID]);
62 } 62 }
63 63
64 // Insert a new bookmark folder at a particular position. 64 // Insert a new bookmark folder at a particular position.
65 TEST_F(BookmarkFolderAppleScriptTest, InsertBookmarkFolderAtPosition) { 65 TEST_F(BookmarkFolderAppleScriptTest, InsertBookmarkFolderAtPosition) {
66 // Emulate what applescript would do when inserting a new bookmark folder. 66 // Emulate what applescript would do when inserting a new bookmark folder.
67 // Emulates a script like |set var to make new bookmark folder with 67 // Emulates a script like |set var to make new bookmark folder with
68 // properties {title:"foo"} at after bookmark folder 1|. 68 // properties {title:"foo"} at after bookmark folder 1|.
69 scoped_nsobject<BookmarkFolderAppleScript> bookmarkFolder( 69 scoped_nsobject<BookmarkFolderAppleScript> bookmarkFolder(
70 [[BookmarkFolderAppleScript alloc] init]); 70 [[BookmarkFolderAppleScript alloc] init]);
71 scoped_nsobject<NSNumber> var([[bookmarkFolder.get() uniqueID] copy]); 71 scoped_nsobject<NSNumber> var([[bookmarkFolder.get() uniqueID] copy]);
72 [bookmarkFolder.get() setTitle:@"foo"]; 72 [bookmarkFolder.get() setTitle:@"foo"];
73 [bookmarkBar_.get() insertInBookmarkFolders:bookmarkFolder.get() atIndex:1]; 73 [bookmarkBar_.get() insertInBookmarkFolders:bookmarkFolder.get() atIndex:1];
74 74
75 // Represents the bookmark folder after its added. 75 // Represents the bookmark folder after it's added.
76 BookmarkFolderAppleScript* bf = 76 BookmarkFolderAppleScript* bf =
77 [[bookmarkBar_.get() bookmarkFolders] objectAtIndex:1]; 77 [[bookmarkBar_.get() bookmarkFolders] objectAtIndex:1];
78 EXPECT_NSEQ(@"foo", [bf title]); 78 EXPECT_NSEQ(@"foo", [bf title]);
79 EXPECT_EQ([bf container], bookmarkBar_.get()); 79 EXPECT_EQ([bf container], bookmarkBar_.get());
80 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty, [bf containerProperty]); 80 EXPECT_NSEQ(AppleScript::kBookmarkFoldersProperty, [bf containerProperty]);
81 EXPECT_NSEQ(var.get(), [bf uniqueID]); 81 EXPECT_NSEQ(var.get(), [bf uniqueID]);
82 } 82 }
83 83
84 // Delete bookmark folders. 84 // Delete bookmark folders.
85 TEST_F(BookmarkFolderAppleScriptTest, DeleteBookmarkFolders) { 85 TEST_F(BookmarkFolderAppleScriptTest, DeleteBookmarkFolders) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Emulate what applescript would do when inserting a new bookmark folder. 119 // Emulate what applescript would do when inserting a new bookmark folder.
120 // Emulates a script like |set var to make new bookmark item with 120 // Emulates a script like |set var to make new bookmark item with
121 // properties {title:"Google", URL:"http://google.com"}|. 121 // properties {title:"Google", URL:"http://google.com"}|.
122 scoped_nsobject<BookmarkItemAppleScript> bookmarkItem( 122 scoped_nsobject<BookmarkItemAppleScript> bookmarkItem(
123 [[BookmarkItemAppleScript alloc] init]); 123 [[BookmarkItemAppleScript alloc] init]);
124 scoped_nsobject<NSNumber> var([[bookmarkItem.get() uniqueID] copy]); 124 scoped_nsobject<NSNumber> var([[bookmarkItem.get() uniqueID] copy]);
125 [bookmarkItem.get() setTitle:@"Google"]; 125 [bookmarkItem.get() setTitle:@"Google"];
126 [bookmarkItem.get() setURL:@"http://google.com"]; 126 [bookmarkItem.get() setURL:@"http://google.com"];
127 [bookmarkBar_.get() insertInBookmarkItems:bookmarkItem.get()]; 127 [bookmarkBar_.get() insertInBookmarkItems:bookmarkItem.get()];
128 128
129 // Represents the bookmark item after its added. 129 // Represents the bookmark item after it's added.
130 BookmarkItemAppleScript* bi = 130 BookmarkItemAppleScript* bi =
131 [[bookmarkBar_.get() bookmarkItems] objectAtIndex:3]; 131 [[bookmarkBar_.get() bookmarkItems] objectAtIndex:3];
132 EXPECT_NSEQ(@"Google", [bi title]); 132 EXPECT_NSEQ(@"Google", [bi title]);
133 EXPECT_EQ(GURL("http://google.com/"), 133 EXPECT_EQ(GURL("http://google.com/"),
134 GURL(base::SysNSStringToUTF8([bi URL]))); 134 GURL(base::SysNSStringToUTF8([bi URL])));
135 EXPECT_EQ([bi container], bookmarkBar_.get()); 135 EXPECT_EQ([bi container], bookmarkBar_.get());
136 EXPECT_NSEQ(AppleScript::kBookmarkItemsProperty, [bi containerProperty]); 136 EXPECT_NSEQ(AppleScript::kBookmarkItemsProperty, [bi containerProperty]);
137 EXPECT_NSEQ(var.get(), [bi uniqueID]); 137 EXPECT_NSEQ(var.get(), [bi uniqueID]);
138 138
139 // Test to see no bookmark item is created when no/invlid URL is entered. 139 // Test to see no bookmark item is created when no/invlid URL is entered.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 // Set and get title. 192 // Set and get title.
193 TEST_F(BookmarkFolderAppleScriptTest, GetAndSetTitle) { 193 TEST_F(BookmarkFolderAppleScriptTest, GetAndSetTitle) {
194 NSArray* bookmarkFolders = [bookmarkBar_.get() bookmarkFolders]; 194 NSArray* bookmarkFolders = [bookmarkBar_.get() bookmarkFolders];
195 BookmarkFolderAppleScript* folder1 = [bookmarkFolders objectAtIndex:0]; 195 BookmarkFolderAppleScript* folder1 = [bookmarkFolders objectAtIndex:0];
196 [folder1 setTitle:@"Foo"]; 196 [folder1 setTitle:@"Foo"];
197 EXPECT_NSEQ(@"Foo", [folder1 title]); 197 EXPECT_NSEQ(@"Foo", [folder1 title]);
198 } 198 }
199 199
200 } // namespace 200 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/content_settings/cookie_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698