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/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/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_item_applescript.h" | 10 #import "chrome/browser/ui/cocoa/applescript/bookmark_item_applescript.h" |
11 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" | 11 #import "chrome/browser/ui/cocoa/applescript/error_applescript.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #import "testing/gtest_mac.h" | 14 #import "testing/gtest_mac.h" |
15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
16 | 16 |
17 typedef BookmarkAppleScriptTest BookmarkItemAppleScriptTest; | 17 typedef BookmarkAppleScriptTest BookmarkItemAppleScriptTest; |
(...skipping 10 matching lines...) Expand all Loading... |
28 | 28 |
29 // Set and get URL. | 29 // Set and get URL. |
30 TEST_F(BookmarkItemAppleScriptTest, GetAndSetURL) { | 30 TEST_F(BookmarkItemAppleScriptTest, GetAndSetURL) { |
31 NSArray* bookmarkItems = [bookmarkBar_.get() bookmarkItems]; | 31 NSArray* bookmarkItems = [bookmarkBar_.get() bookmarkItems]; |
32 BookmarkItemAppleScript* item1 = [bookmarkItems objectAtIndex:0]; | 32 BookmarkItemAppleScript* item1 = [bookmarkItems objectAtIndex:0]; |
33 [item1 setURL:@"http://foo-bar.org"]; | 33 [item1 setURL:@"http://foo-bar.org"]; |
34 EXPECT_EQ(GURL("http://foo-bar.org"), | 34 EXPECT_EQ(GURL("http://foo-bar.org"), |
35 GURL(base::SysNSStringToUTF8([item1 URL]))); | 35 GURL(base::SysNSStringToUTF8([item1 URL]))); |
36 | 36 |
37 // If scripter enters invalid URL. | 37 // If scripter enters invalid URL. |
38 scoped_nsobject<FakeScriptCommand> fakeScriptCommand( | 38 base::scoped_nsobject<FakeScriptCommand> fakeScriptCommand( |
39 [[FakeScriptCommand alloc] init]); | 39 [[FakeScriptCommand alloc] init]); |
40 [item1 setURL:@"invalid-url.org"]; | 40 [item1 setURL:@"invalid-url.org"]; |
41 EXPECT_EQ((int)AppleScript::errInvalidURL, | 41 EXPECT_EQ((int)AppleScript::errInvalidURL, |
42 [fakeScriptCommand.get() scriptErrorNumber]); | 42 [fakeScriptCommand.get() scriptErrorNumber]); |
43 } | 43 } |
44 | 44 |
45 } // namespace | 45 } // namespace |
OLD | NEW |