| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 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/scoped_nsobject.h" |
| 8 #include "base/sys_string_conversions.h" |
| 9 #import "chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h" |
| 10 #import "chrome/browser/cocoa/applescript/bookmark_item_applescript.h" |
| 11 #import "chrome/browser/cocoa/applescript/error_applescript.h" |
| 12 #include "googleurl/src/gurl.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #import "testing/gtest_mac.h" |
| 15 #include "testing/platform_test.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 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 |
| OLD | NEW |