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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_COCOA_COCOA_TEST_HELPER_H_ 6 #define CHROME_BROWSER_UI_COCOA_COCOA_TEST_HELPER_H_ 7 8 #import <Cocoa/Cocoa.h> 9 10 #import "ui/gfx/test/ui_cocoa_test_helper.h" 11 12 // A test class that all tests that depend on AppKit should inherit from. 13 // Sets up paths correctly, and makes sure that any windows created in the test 14 // are closed down properly by the test. If you need to inherit from a 15 // different test class, but need to set up the AppKit runtime environment, you 16 // can call BootstrapCocoa directly from your test class. You will have to deal 17 // with windows on your own though. Note that NSApp is initialized by 18 // ChromeTestSuite. 19 class CocoaTest : public ui::CocoaTest { 20 public: 21 // Sets up paths correctly for unit tests. If you can't inherit from 22 // CocoaTest but are going to be using any AppKit features directly, or 23 // indirectly, you should be calling this from the c'tor or SetUp methods of 24 // your test class. Note that NSApp is initialized by ChromeTestSuite. 25 static void BootstrapCocoa(); 26 27 CocoaTest(); 28 }; 29 30 #endif // CHROME_BROWSER_UI_COCOA_COCOA_TEST_HELPER_H_ 31