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

Unified Diff: chrome/browser/cocoa/extension_shelf_controller_unittest.mm

Issue 175025: Add a bare-bones extension shelf that displays extension items on OS X. (Closed)
Patch Set: Merge ToT, address more comments Created 11 years, 3 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/extension_shelf_controller.mm ('k') | chrome/browser/cocoa/extension_view_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/extension_shelf_controller_unittest.mm
diff --git a/chrome/browser/cocoa/extension_shelf_controller_unittest.mm b/chrome/browser/cocoa/extension_shelf_controller_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ddbca2a11740174a903c68e36e7eb39d00869675
--- /dev/null
+++ b/chrome/browser/cocoa/extension_shelf_controller_unittest.mm
@@ -0,0 +1,56 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/scoped_nsobject.h"
+#include "chrome/browser/cocoa/browser_test_helper.h"
+#import "chrome/browser/cocoa/cocoa_test_helper.h"
+#import "chrome/browser/cocoa/extension_shelf_controller.h"
+#import "chrome/browser/cocoa/view_resizer_pong.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+namespace {
+
+class ExtensionShelfControllerTest : public PlatformTest {
+ public:
+ ExtensionShelfControllerTest() {
+ resizeDelegate_.reset([[ViewResizerPong alloc] init]);
+
+ NSRect frame = NSMakeRect(0, 0, 100, 30);
+ controller_.reset([[ExtensionShelfController alloc]
+ initWithBrowser:helper_.browser()
+ resizeDelegate:resizeDelegate_.get()]);
+ }
+
+ CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
+ BrowserTestHelper helper_;
+ scoped_nsobject<ExtensionShelfController> controller_;
+ scoped_nsobject<ViewResizerPong> resizeDelegate_;
+};
+
+// Check that |hide:| tells the delegate to set the shelf's height to zero.
+TEST_F(ExtensionShelfControllerTest, HideSetsHeightToZero) {
+ [resizeDelegate_ setHeight:10];
+ [controller_ hide:nil];
+ EXPECT_EQ(0, [resizeDelegate_ height]);
+}
+
+// Check that |show:| tells the delegate to set the shelf's height to the
+// shelf's desired height.
+TEST_F(ExtensionShelfControllerTest, ShowSetsHeightToHeight) {
+ [resizeDelegate_ setHeight:0];
+ [controller_ show:nil];
+ EXPECT_GT([controller_ height], 0);
+ EXPECT_EQ([controller_ height], [resizeDelegate_ height]);
+}
+
+// Test adding to the view hierarchy, mostly to ensure nothing leaks or crashes.
+TEST_F(ExtensionShelfControllerTest, Add) {
+ [cocoa_helper_.contentView() addSubview:[controller_ view]];
+ [controller_ wasInsertedIntoWindow];
+}
+
+} // namespace
« no previous file with comments | « chrome/browser/cocoa/extension_shelf_controller.mm ('k') | chrome/browser/cocoa/extension_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698