OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ | 5 #ifndef UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ |
6 #define UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ | 6 #define UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 public: | 52 public: |
53 CocoaTest(); | 53 CocoaTest(); |
54 virtual ~CocoaTest(); | 54 virtual ~CocoaTest(); |
55 | 55 |
56 // Must be called by subclasses that override TearDown. We verify that it | 56 // Must be called by subclasses that override TearDown. We verify that it |
57 // is called in our destructor. Takes care of making sure that all windows | 57 // is called in our destructor. Takes care of making sure that all windows |
58 // are closed off correctly. If your tests open windows, they must be sure | 58 // are closed off correctly. If your tests open windows, they must be sure |
59 // to close them before CocoaTest::TearDown is called. A standard way of doing | 59 // to close them before CocoaTest::TearDown is called. A standard way of doing |
60 // this would be to create them in SetUp (after calling CocoaTest::Setup) and | 60 // this would be to create them in SetUp (after calling CocoaTest::Setup) and |
61 // then close them in TearDown before calling CocoaTest::TearDown. | 61 // then close them in TearDown before calling CocoaTest::TearDown. |
62 virtual void TearDown() OVERRIDE; | 62 virtual void TearDown() override; |
63 | 63 |
64 // Retuns a test window that can be used by views and other UI objects | 64 // Retuns a test window that can be used by views and other UI objects |
65 // as part of their tests. Is created lazily, and will be closed correctly | 65 // as part of their tests. Is created lazily, and will be closed correctly |
66 // in CocoaTest::TearDown. Note that it is a CocoaTestHelperWindow which | 66 // in CocoaTest::TearDown. Note that it is a CocoaTestHelperWindow which |
67 // has special handling for being Key. | 67 // has special handling for being Key. |
68 CocoaTestHelperWindow* test_window(); | 68 CocoaTestHelperWindow* test_window(); |
69 | 69 |
70 protected: | 70 protected: |
71 // Allows subclasses to do initialization before calling through to the base | 71 // Allows subclasses to do initialization before calling through to the base |
72 // class's initialization. | 72 // class's initialization. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 #define EXPECT_NSRECT_EQ(expected, actual) \ | 140 #define EXPECT_NSRECT_EQ(expected, actual) \ |
141 EXPECT_TRUE(CGFLOAT_EQ(expected.origin.x, actual.origin.x) && \ | 141 EXPECT_TRUE(CGFLOAT_EQ(expected.origin.x, actual.origin.x) && \ |
142 CGFLOAT_EQ(expected.origin.y, actual.origin.y) && \ | 142 CGFLOAT_EQ(expected.origin.y, actual.origin.y) && \ |
143 CGFLOAT_EQ(expected.size.width, actual.size.width) && \ | 143 CGFLOAT_EQ(expected.size.width, actual.size.width) && \ |
144 CGFLOAT_EQ(expected.size.height, actual.size.height)) << \ | 144 CGFLOAT_EQ(expected.size.height, actual.size.height)) << \ |
145 "Rects do not match: " << \ | 145 "Rects do not match: " << \ |
146 [NSStringFromRect(expected) UTF8String] << \ | 146 [NSStringFromRect(expected) UTF8String] << \ |
147 " != " << [NSStringFromRect(actual) UTF8String] | 147 " != " << [NSStringFromRect(actual) UTF8String] |
148 | 148 |
149 #endif // UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ | 149 #endif // UI_GFX_TEST_UI_COCOA_TEST_HELPER_H_ |
OLD | NEW |