| 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 "chrome/browser/cocoa/applescript/bookmark_applescript_utils_unittest.h" |
| 6 |
| 7 @implementation FakeAppDelegate |
| 8 |
| 9 @synthesize helper = helper_; |
| 10 |
| 11 - (Profile*)defaultProfile { |
| 12 if (!helper_) |
| 13 return NULL; |
| 14 return helper_->profile(); |
| 15 } |
| 16 @end |
| 17 |
| 18 // Represents the current fake command that is executing. |
| 19 static FakeScriptCommand* kFakeCurrentCommand; |
| 20 |
| 21 @implementation FakeScriptCommand |
| 22 |
| 23 - (id)init { |
| 24 if ((self = [super init])) { |
| 25 originalMethod_ = class_getClassMethod([NSScriptCommand class], |
| 26 @selector(currentCommand)); |
| 27 alternateMethod_ = class_getClassMethod([self class], |
| 28 @selector(currentCommand)); |
| 29 method_exchangeImplementations(originalMethod_, alternateMethod_); |
| 30 kFakeCurrentCommand = self; |
| 31 } |
| 32 return self; |
| 33 } |
| 34 |
| 35 + (NSScriptCommand*)currentCommand { |
| 36 return kFakeCurrentCommand; |
| 37 } |
| 38 |
| 39 - (void)dealloc { |
| 40 method_exchangeImplementations(originalMethod_, alternateMethod_); |
| 41 kFakeCurrentCommand = nil; |
| 42 [super dealloc]; |
| 43 } |
| 44 |
| 45 @end |
| OLD | NEW |