| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h" | 5 #import "chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h" |
| 6 | 6 |
| 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 8 |
| 7 @implementation FakeAppDelegate | 9 @implementation FakeAppDelegate |
| 8 | 10 |
| 9 @synthesize helper = helper_; | 11 @synthesize helper = helper_; |
| 10 | 12 |
| 11 - (Profile*)defaultProfile { | 13 - (Profile*)defaultProfile { |
| 12 if (!helper_) | 14 if (!helper_) |
| 13 return NULL; | 15 return NULL; |
| 14 return helper_->profile(); | 16 return helper_->profile(); |
| 15 } | 17 } |
| 16 @end | 18 @end |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 return kFakeCurrentCommand; | 38 return kFakeCurrentCommand; |
| 37 } | 39 } |
| 38 | 40 |
| 39 - (void)dealloc { | 41 - (void)dealloc { |
| 40 method_exchangeImplementations(originalMethod_, alternateMethod_); | 42 method_exchangeImplementations(originalMethod_, alternateMethod_); |
| 41 kFakeCurrentCommand = nil; | 43 kFakeCurrentCommand = nil; |
| 42 [super dealloc]; | 44 [super dealloc]; |
| 43 } | 45 } |
| 44 | 46 |
| 45 @end | 47 @end |
| 48 |
| 49 BookmarkAppleScriptTest::BookmarkAppleScriptTest() { |
| 50 appDelegate_.reset([[FakeAppDelegate alloc] init]); |
| 51 [appDelegate_.get() setHelper:&helper_]; |
| 52 [NSApp setDelegate:appDelegate_]; |
| 53 const BookmarkNode* root = model().GetBookmarkBarNode(); |
| 54 const std::wstring modelString(L"a f1:[ b d c ] d f2:[ e f g ] h "); |
| 55 model_test_utils::AddNodesFromModelString(model(), root, modelString); |
| 56 bookmarkBar_.reset([[BookmarkFolderAppleScript alloc] |
| 57 initWithBookmarkNode:model().GetBookmarkBarNode()]); |
| 58 } |
| 59 |
| 60 BookmarkModel& BookmarkAppleScriptTest::model() { |
| 61 return *helper_.profile()->GetBookmarkModel(); |
| 62 } |
| OLD | NEW |