diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-28 04:15:04 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-28 04:15:04 +0000 |
commit | 2bbfc5c543db1570edde26cdd2fd33cab070640a (patch) | |
tree | f11952919cafe927fc97e7eed0962b6e8ed0fc51 /chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm | |
parent | 3c7945c703ee07137e63662640015e12551bd076 (diff) | |
download | chromium_src-2bbfc5c543db1570edde26cdd2fd33cab070640a.zip chromium_src-2bbfc5c543db1570edde26cdd2fd33cab070640a.tar.gz chromium_src-2bbfc5c543db1570edde26cdd2fd33cab070640a.tar.bz2 |
OmniboxPopupViewMac refactoring Part 2
This CL makes the following changes:
- more tests
- decouple OmniboxPopupMatrix from OmniboxPopupView for easier testing
- change camel case naming in c++ code to use underscore
BUG=9977
NOTRY=true
R=shess@chromium.org
Review URL: https://codereview.chromium.org/17787002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209090 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm')
-rw-r--r-- | chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm new file mode 100644 index 0000000..9b08280 --- /dev/null +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm @@ -0,0 +1,47 @@ +// Copyright (c) 2013 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 "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" + +#include "base/mac/scoped_nsobject.h" +#import "chrome/browser/ui/cocoa/cocoa_test_helper.h" + +namespace { + +class OmniboxPopupCellTest : public CocoaTest { + public: + OmniboxPopupCellTest() { + } + + virtual void SetUp() OVERRIDE { + CocoaTest::SetUp(); + cell_.reset([[OmniboxPopupCell alloc] initTextCell:@""]); + button_.reset([[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)]); + [button_ setCell:cell_]; + [[test_window() contentView] addSubview:button_]; + }; + + protected: + base::scoped_nsobject<OmniboxPopupCell> cell_; + base::scoped_nsobject<NSButton> button_; + + private: + DISALLOW_COPY_AND_ASSIGN(OmniboxPopupCellTest); +}; + +TEST_VIEW(OmniboxPopupCellTest, button_); + +TEST_F(OmniboxPopupCellTest, Image) { + [cell_ setImage:[NSImage imageNamed:NSImageNameInfo]]; + [button_ display]; +} + +TEST_F(OmniboxPopupCellTest, Title) { + base::scoped_nsobject<NSAttributedString> text([[NSAttributedString alloc] + initWithString:@"The quick brown fox jumps over the lazy dog."]); + [cell_ setAttributedTitle:text]; + [button_ display]; +} + +} // namespace |