Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_UI_COCOA_APPLESCRIPT_BOOKMARK_APPLESCRIPT_UTILS_UNITTEST_ H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_APPLESCRIPT_BOOKMARK_APPLESCRIPT_UTILS_BROWSERTE ST_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_APPLESCRIPT_BOOKMARK_APPLESCRIPT_UTILS_UNITTEST_ H_ | 6 #define CHROME_BROWSER_UI_COCOA_APPLESCRIPT_BOOKMARK_APPLESCRIPT_UTILS_BROWSERTE ST_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import <objc/objc-runtime.h> | 9 #import <objc/objc-runtime.h> |
| 10 | 10 |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #import "chrome/browser/app_controller_mac.h" | 12 #import "chrome/browser/app_controller_mac.h" |
| 13 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" | 13 #import "chrome/browser/ui/cocoa/applescript/bookmark_folder_applescript.h" |
| 14 #include "chrome/browser/ui/cocoa/test/cocoa_profile_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
| 16 | 16 |
| 17 class BookmarkAppleScriptTest; | |
| 18 | |
| 17 // The fake object that acts as our app's delegate, useful for testing purposes. | 19 // The fake object that acts as our app's delegate, useful for testing purposes. |
| 18 @interface FakeAppDelegate : AppController { | 20 @interface FakeAppDelegate : AppController { |
|
tapted
2017/03/02 23:17:17
Does anything alloc this any more? (can we just re
snake
2017/03/06 12:53:34
Done.
| |
| 19 @public | 21 @public |
| 20 CocoaProfileTest* test_; // weak. | 22 BookmarkAppleScriptTest* test_; // weak. |
| 21 } | 23 } |
| 22 @property(nonatomic) CocoaProfileTest* test; | 24 @property(nonatomic) BookmarkAppleScriptTest* test; |
| 23 // Return the |TestingProfile*| which is used for testing. | 25 // Return the |TestingProfile*| which is used for testing. |
| 24 - (Profile*)lastProfile; | 26 - (Profile*)lastProfile; |
| 25 @end | 27 @end |
| 26 | 28 |
| 27 | 29 |
| 28 // Used to emulate an active running script, useful for testing purposes. | 30 // Used to emulate an active running script, useful for testing purposes. |
| 29 @interface FakeScriptCommand : NSScriptCommand { | 31 @interface FakeScriptCommand : NSScriptCommand { |
| 30 Method originalMethod_; | 32 Method originalMethod_; |
| 31 Method alternateMethod_; | 33 Method alternateMethod_; |
| 32 } | 34 } |
| 33 @end | 35 @end |
| 34 | 36 |
| 35 | 37 |
| 36 // The base class for all our bookmark releated unit tests. | 38 // The base class for all our bookmark releated unit tests. |
| 37 class BookmarkAppleScriptTest : public CocoaProfileTest { | 39 class BookmarkAppleScriptTest : public InProcessBrowserTest { |
| 38 public: | 40 public: |
| 39 BookmarkAppleScriptTest(); | 41 BookmarkAppleScriptTest(); |
| 40 ~BookmarkAppleScriptTest() override; | 42 ~BookmarkAppleScriptTest() override; |
| 41 void SetUp() override; | 43 void SetUpOnMainThread() override; |
| 44 | |
| 45 Profile* profile() const; | |
| 42 | 46 |
| 43 private: | 47 private: |
| 44 base::scoped_nsobject<FakeAppDelegate> appDelegate_; | 48 base::scoped_nsobject<FakeAppDelegate> appDelegate_; |
| 45 | 49 |
| 46 protected: | 50 protected: |
| 47 base::scoped_nsobject<BookmarkFolderAppleScript> bookmarkBar_; | 51 base::scoped_nsobject<BookmarkFolderAppleScript> bookmarkBar_; |
| 48 }; | 52 }; |
| 49 | 53 |
| 50 #endif // CHROME_BROWSER_UI_COCOA_APPLESCRIPT_BOOKMARK_APPLESCRIPT_UTILS_UNITTE ST_H_ | 54 #endif // CHROME_BROWSER_UI_COCOA_APPLESCRIPT_BOOKMARK_APPLESCRIPT_UTILS_BROWSE RTEST_H_ |
| OLD | NEW |