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

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

Issue 2724603002: MacViews: Enable AppleScript support. (Closed)
Patch Set: MacViews: Enable AppleScript support. Created 3 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6
7 #include "base/mac/scoped_nsobject.h"
8 #include "base/strings/sys_string_conversions.h"
9 #import "chrome/browser/ui/cocoa/applescript/bookmark_applescript_utils_unittest .h"
10 #import "chrome/browser/ui/cocoa/applescript/bookmark_item_applescript.h"
11 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #import "testing/gtest_mac.h"
14 #include "testing/platform_test.h"
15 #include "url/gurl.h"
16
17 typedef BookmarkAppleScriptTest BookmarkItemAppleScriptTest;
18
19 namespace {
20
21 // Set and get title.
22 TEST_F(BookmarkItemAppleScriptTest, GetAndSetTitle) {
23 NSArray* bookmarkItems = [bookmarkBar_.get() bookmarkItems];
24 BookmarkItemAppleScript* item1 = [bookmarkItems objectAtIndex:0];
25 [item1 setTitle:@"Foo"];
26 EXPECT_NSEQ(@"Foo", [item1 title]);
27 }
28
29 // Set and get URL.
30 TEST_F(BookmarkItemAppleScriptTest, GetAndSetURL) {
31 NSArray* bookmarkItems = [bookmarkBar_.get() bookmarkItems];
32 BookmarkItemAppleScript* item1 = [bookmarkItems objectAtIndex:0];
33 [item1 setURL:@"http://foo-bar.org"];
34 EXPECT_EQ(GURL("http://foo-bar.org"),
35 GURL(base::SysNSStringToUTF8([item1 URL])));
36
37 // If scripter enters invalid URL.
38 base::scoped_nsobject<FakeScriptCommand> fakeScriptCommand(
39 [[FakeScriptCommand alloc] init]);
40 [item1 setURL:@"invalid-url.org"];
41 EXPECT_EQ((int)AppleScript::errInvalidURL,
42 [fakeScriptCommand.get() scriptErrorNumber]);
43 }
44
45 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/applescript/bookmark_item_applescript_browsertest.mm ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698