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

Side by Side Diff: chrome/browser/cocoa/toolbar_controller_unittest.mm

Issue 465130: Share the code that builds the page menu in a common model, make Mac and Win ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller.mm ('k') | chrome/browser/page_menu_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/scoped_nsobject.h" 7 #import "base/scoped_nsobject.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 26 matching lines...) Expand all
37 37
38 namespace { 38 namespace {
39 39
40 class ToolbarControllerTest : public CocoaTest { 40 class ToolbarControllerTest : public CocoaTest {
41 public: 41 public:
42 42
43 // Indexes that match the ordering returned by the private ToolbarController 43 // Indexes that match the ordering returned by the private ToolbarController
44 // |-toolbarViews| method. 44 // |-toolbarViews| method.
45 enum { 45 enum {
46 kBackIndex, kForwardIndex, kReloadIndex, kHomeIndex, kStarIndex, kGoIndex, 46 kBackIndex, kForwardIndex, kReloadIndex, kHomeIndex, kStarIndex, kGoIndex,
47 kPageIndex, kWrenchIndex, kLocationIndex, kEncodingMenuIndex, 47 kPageIndex, kWrenchIndex, kLocationIndex,
48 kBrowserActionContainerViewIndex 48 kBrowserActionContainerViewIndex
49 }; 49 };
50 50
51 ToolbarControllerTest() { 51 ToolbarControllerTest() {
52 Browser* browser = helper_.browser(); 52 Browser* browser = helper_.browser();
53 CommandUpdater* updater = browser->command_updater(); 53 CommandUpdater* updater = browser->command_updater();
54 // The default state for the commands is true, set a couple to false to 54 // The default state for the commands is true, set a couple to false to
55 // ensure they get picked up correct on initialization 55 // ensure they get picked up correct on initialization
56 updater->UpdateCommandEnabled(IDC_BACK, false); 56 updater->UpdateCommandEnabled(IDC_BACK, false);
57 updater->UpdateCommandEnabled(IDC_FORWARD, false); 57 updater->UpdateCommandEnabled(IDC_FORWARD, false);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 scoped_nsobject<NSButton> button([[NSButton alloc] init]); 276 scoped_nsobject<NSButton> button([[NSButton alloc] init]);
277 [view setHitTestReturn:button]; 277 [view setHitTestReturn:button];
278 EXPECT_FALSE([bar_ hoverButtonForEvent:event]); 278 EXPECT_FALSE([bar_ hoverButtonForEvent:event]);
279 279
280 // Now! 280 // Now!
281 scoped_nsobject<GradientButtonCell> cell([[GradientButtonCell alloc] init]); 281 scoped_nsobject<GradientButtonCell> cell([[GradientButtonCell alloc] init]);
282 [button setCell:cell.get()]; 282 [button setCell:cell.get()];
283 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]); 283 EXPECT_TRUE([bar_ hoverButtonForEvent:nil]);
284 } 284 }
285 285
286 TEST_F(ToolbarControllerTest, PopulateEncodingMenu) {
287 NSMenu* encodings = [[bar_ toolbarViews] objectAtIndex:kEncodingMenuIndex];
288
289 // Can't check item strings because of localization, but the nib has zero
290 // items so check that we at least populated the menu with something at
291 // startup.
292 EXPECT_NE(0, [encodings numberOfItems]);
293 }
294
295 } // namespace 286 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller.mm ('k') | chrome/browser/page_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698