Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4754)

Unified Diff: chrome/browser/cocoa/cocoa_test_helper.h

Issue 259023: [Mac] Window titles for Expose. (Closed)
Patch Set: Fix unit_test expectations for Release. Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/chrome_browser_window_unittest.mm ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/browser/cocoa/chrome_browser_window_unittest.mm ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698