Index: chrome/browser/cocoa/cocoa_test_helper.h |
diff --git a/chrome/browser/cocoa/cocoa_test_helper.h b/chrome/browser/cocoa/cocoa_test_helper.h |
index ebcb4d49603ea5db3ccad08280aeb70cae1351e4..8eb3438e428837e92a17cc2665d015235754c37c 100644 |
--- a/chrome/browser/cocoa/cocoa_test_helper.h |
+++ b/chrome/browser/cocoa/cocoa_test_helper.h |
@@ -47,9 +47,14 @@ |
// added. If your test wants one, it can derive from PlatformTest instead of |
// testing::Test. |
-class CocoaTestHelper { |
+// Provides the Cocoa goodness without the extraneous window. |
+// TODO(shess): It might make more sense to have CocoaTest as a |
+// PlatformTest subclass which adds the Cocoa magic, then |
+// CocoaViewTest as a further subclass which provides a convenience |
+// window. |
+class CocoaNoWindowTestHelper { |
public: |
- CocoaTestHelper() { |
+ CocoaNoWindowTestHelper() { |
// Look in the framework bundle for resources. |
FilePath path; |
PathService::Get(base::DIR_EXE, &path); |
@@ -62,17 +67,21 @@ class CocoaTestHelper { |
// Bootstrap Cocoa. It's very unhappy without this. |
[NSApplication sharedApplication]; |
- // Create a window. |
+ // Set the duration of AppKit-evaluated animations (such as frame changes) |
+ // to zero for testing purposes. That way they take effect immediately. |
+ [[NSAnimationContext currentContext] setDuration:0.0]; |
+ } |
+}; |
+ |
+class CocoaTestHelper : public CocoaNoWindowTestHelper { |
+ public: |
+ CocoaTestHelper() { |
window_.reset([[CocoaTestHelperWindow alloc] init]); |
if (DebugUtil::BeingDebugged()) { |
[window_ orderFront:nil]; |
} else { |
[window_ orderBack:nil]; |
} |
- |
- // Set the duration of AppKit-evaluated animations (such as frame changes) |
- // to zero for testing purposes. That way they take effect immediately. |
- [[NSAnimationContext currentContext] setDuration:0.0]; |
} |
// Access the Cocoa window created for the test. |