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

Unified Diff: chrome/browser/ui/cocoa/find_bar_cocoa_controller_unittest.mm

Issue 6366001: [Mac] Move the associated find bar files into a subdir of c/b/ui/cocoa/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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/ui/cocoa/find_bar_cocoa_controller.mm ('k') | chrome/browser/ui/cocoa/find_bar_text_field.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/find_bar_cocoa_controller_unittest.mm
===================================================================
--- chrome/browser/ui/cocoa/find_bar_cocoa_controller_unittest.mm (revision 71508)
+++ chrome/browser/ui/cocoa/find_bar_cocoa_controller_unittest.mm (working copy)
@@ -1,138 +0,0 @@
-// 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.
-
-#include "base/string_util.h"
-#include "base/sys_string_conversions.h"
-#include "chrome/browser/browser_window.h"
-#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
-#import "chrome/browser/ui/cocoa/find_bar_cocoa_controller.h"
-#import "chrome/browser/ui/cocoa/find_pasteboard.h"
-#import "chrome/browser/ui/cocoa/find_bar_text_field.h"
-#include "chrome/browser/ui/find_bar/find_notification_details.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
-
-// Expose private variables to make testing easier.
-@interface FindBarCocoaController(Testing)
-- (NSView*)findBarView;
-- (NSString*)findText;
-- (FindBarTextField*)findTextField;
-@end
-
-@implementation FindBarCocoaController(Testing)
-- (NSView*)findBarView {
- return findBarView_;
-}
-
-- (NSString*)findText {
- return [findText_ stringValue];
-}
-
-- (FindBarTextField*)findTextField {
- return findText_;
-}
-
-- (NSButton*)nextButton {
- return nextButton_;
-}
-
-- (NSButton*)previousButton {
- return previousButton_;
-}
-@end
-
-namespace {
-
-class FindBarCocoaControllerTest : public CocoaTest {
- public:
- virtual void SetUp() {
- CocoaTest::SetUp();
- controller_.reset([[FindBarCocoaController alloc] init]);
- [[test_window() contentView] addSubview:[controller_ view]];
- }
-
- protected:
- scoped_nsobject<FindBarCocoaController> controller_;
-};
-
-TEST_VIEW(FindBarCocoaControllerTest, [controller_ view])
-
-TEST_F(FindBarCocoaControllerTest, ImagesLoadedProperly) {
- EXPECT_TRUE([[[controller_ nextButton] image] isValid]);
- EXPECT_TRUE([[[controller_ previousButton] image] isValid]);
-}
-
-TEST_F(FindBarCocoaControllerTest, ShowAndHide) {
- NSView* findBarView = [controller_ findBarView];
-
- ASSERT_GT([findBarView frame].origin.y, 0);
- ASSERT_FALSE([controller_ isFindBarVisible]);
-
- [controller_ showFindBar:NO];
- EXPECT_EQ([findBarView frame].origin.y, 0);
- EXPECT_TRUE([controller_ isFindBarVisible]);
-
- [controller_ hideFindBar:NO];
- EXPECT_GT([findBarView frame].origin.y, 0);
- EXPECT_FALSE([controller_ isFindBarVisible]);
-}
-
-TEST_F(FindBarCocoaControllerTest, SetFindText) {
- NSTextField* findTextField = [controller_ findTextField];
-
- // Start by making the find bar visible.
- [controller_ showFindBar:NO];
- EXPECT_TRUE([controller_ isFindBarVisible]);
-
- // Set the find text.
- NSString* const kFindText = @"Google";
- [controller_ setFindText:kFindText];
- EXPECT_EQ(
- NSOrderedSame,
- [[findTextField stringValue] compare:kFindText]);
-
- // Call clearResults, which doesn't actually clear the find text but
- // simply sets it back to what it was before. This is silly, but
- // matches the behavior on other platforms. |details| isn't used by
- // our implementation of clearResults, so it's ok to pass in an
- // empty |details|.
- FindNotificationDetails details;
- [controller_ clearResults:details];
- EXPECT_EQ(
- NSOrderedSame,
- [[findTextField stringValue] compare:kFindText]);
-}
-
-TEST_F(FindBarCocoaControllerTest, ResultLabelUpdatesCorrectly) {
- // TODO(rohitrao): Test this. It may involve creating some dummy
- // FindNotificationDetails objects.
-}
-
-TEST_F(FindBarCocoaControllerTest, FindTextIsGlobal) {
- scoped_nsobject<FindBarCocoaController> otherController(
- [[FindBarCocoaController alloc] init]);
- [[test_window() contentView] addSubview:[otherController view]];
-
- // Setting the text in one controller should update the other controller's
- // text as well.
- NSString* const kFindText = @"Respect to the man in the ice cream van";
- [controller_ setFindText:kFindText];
- EXPECT_EQ(
- NSOrderedSame,
- [[controller_ findText] compare:kFindText]);
- EXPECT_EQ(
- NSOrderedSame,
- [[otherController.get() findText] compare:kFindText]);
-}
-
-TEST_F(FindBarCocoaControllerTest, SettingFindTextUpdatesFindPboard) {
- NSString* const kFindText =
- @"It's not a bird, it's not a plane, it must be Dave who's on the train";
- [controller_ setFindText:kFindText];
- EXPECT_EQ(
- NSOrderedSame,
- [[[FindPasteboard sharedInstance] findText] compare:kFindText]);
-}
-
-} // namespace
« no previous file with comments | « chrome/browser/ui/cocoa/find_bar_cocoa_controller.mm ('k') | chrome/browser/ui/cocoa/find_bar_text_field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698