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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_controller_unittest.mm

Issue 7709023: Revert 97828 - Clicking tab close with option key close the other tabs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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
Index: chrome/browser/ui/cocoa/tabs/tab_controller_unittest.mm
===================================================================
--- chrome/browser/ui/cocoa/tabs/tab_controller_unittest.mm (revision 97831)
+++ chrome/browser/ui/cocoa/tabs/tab_controller_unittest.mm (working copy)
@@ -13,7 +13,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
#include "testing/platform_test.h"
-#import "third_party/ocmock/OCMock/OCMock.h"
// Implements the target interface for the tab, which gets sent messages when
// the tab is clicked on by the user and when its close box is clicked.
@@ -21,12 +20,10 @@
@private
bool selected_;
bool closed_;
- bool closedOtherTabs_;
scoped_nsobject<TabStripDragController> dragController_;
}
- (bool)selected;
- (bool)closed;
-- (bool)closedOtherTabs;
@end
@implementation TabControllerTestTarget
@@ -43,25 +40,19 @@
- (bool)closed {
return closed_;
}
-- (bool)closedOtherTabs {
- return closedOtherTabs_;
-}
- (void)selectTab:(id)sender {
selected_ = true;
}
- (void)closeTab:(id)sender {
closed_ = true;
}
-- (void)closeOtherTabs:(id)sender {
- closedOtherTabs_ = true;
-}
- (void)mouseTimer:(NSTimer*)timer {
// Fire the mouseUp to break the TabView drag loop.
NSEvent* current = [NSApp currentEvent];
NSWindow* window = [timer userInfo];
NSEvent* up = [NSEvent mouseEventWithType:NSLeftMouseUp
location:[current locationInWindow]
- modifierFlags:[current modifierFlags]
+ modifierFlags:0
timestamp:[current timestamp]
windowNumber:[window windowNumber]
context:nil
@@ -137,46 +128,6 @@
[[controller view] removeFromSuperview];
}
-// Tests sending it a closeTab message with a mousedown event and ensuring
-// that the target/action get called. closeOtherTabs message should be called
-// when the tab is clicked with option key.
-TEST_F(TabControllerTest, CloseOtherTabs) {
- NSWindow* window = test_window();
- scoped_nsobject<TabController> controller([[TabController alloc] init]);
- [[window contentView] addSubview:[controller view]];
-
- scoped_nsobject<TabControllerTestTarget> target(
- [[TabControllerTestTarget alloc] init]);
- EXPECT_FALSE([target closedOtherTabs]);
- [controller setTarget:target];
- [controller setAction:@selector(closeTab:)];
- EXPECT_EQ(target.get(), [controller target]);
- EXPECT_EQ(@selector(closeTab:), [controller action]);
-
- // Create a mouse event with |NSAlternateKeyMask| and mock NSApp so that
- // [NSApp currentEvent] returns the event.
- NSEvent* current = [NSApp currentEvent];
- NSEvent* down = [NSEvent mouseEventWithType:NSLeftMouseDown
- location:[current locationInWindow]
- modifierFlags:NSAlternateKeyMask
- timestamp:[current timestamp]
- windowNumber:[window windowNumber]
- context:nil
- eventNumber:0
- clickCount:1
- pressure:1.0];
- // OCMock will swap NSApp internally and will restore it when the mock gets
- // deallocated. This happens when the autorelease pool drains at the end of
- // the test.
- id fakeApp = [OCMockObject partialMockForObject:NSApp];
- [[[fakeApp stub] andReturn:down] currentEvent];
-
- [controller closeTab:nil];
- EXPECT_TRUE([target closedOtherTabs]);
- EXPECT_FALSE([target closed]);
- [[controller view] removeFromSuperview];
-}
-
// Tests setting the |selected| property via code.
TEST_F(TabControllerTest, APISelection) {
NSWindow* window = test_window();
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_controller_target.h ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698