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

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

Issue 2973004: [Mac]Implement ViewID support. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Turns out that, it's not a good solution. Created 10 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/cocoa/base_view.mm ('k') | chrome/browser/cocoa/bookmark_bar_controller.mm » ('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) 2010 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 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/base_view.h" 8 #import "chrome/browser/cocoa/base_view.h"
9 #import "chrome/browser/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/cocoa/cocoa_test_helper.h"
10 #import "chrome/browser/cocoa/view_id_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 12 #include "testing/platform_test.h"
12 13
13 namespace { 14 namespace {
14 15
15 class BaseViewTest : public CocoaTest { 16 class BaseViewTest : public CocoaTest {
16 public: 17 public:
17 BaseViewTest() { 18 BaseViewTest() {
18 NSRect frame = NSMakeRect(0, 0, 100, 100); 19 NSRect frame = NSMakeRect(0, 0, 100, 100);
19 scoped_nsobject<BaseView> view([[BaseView alloc] initWithFrame:frame]); 20 scoped_nsobject<BaseView> view([[BaseView alloc] initWithFrame:frame]);
(...skipping 18 matching lines...) Expand all
38 EXPECT_EQ(converted.height(), convert.size.height); 39 EXPECT_EQ(converted.height(), convert.size.height);
39 40
40 // Go back the other way. 41 // Go back the other way.
41 NSRect back_again = [view_ RectToNSRect:converted]; 42 NSRect back_again = [view_ RectToNSRect:converted];
42 EXPECT_EQ(back_again.origin.x, convert.origin.x); 43 EXPECT_EQ(back_again.origin.x, convert.origin.x);
43 EXPECT_EQ(back_again.origin.y, convert.origin.y); 44 EXPECT_EQ(back_again.origin.y, convert.origin.y);
44 EXPECT_EQ(back_again.size.width, convert.size.width); 45 EXPECT_EQ(back_again.size.width, convert.size.width);
45 EXPECT_EQ(back_again.size.height, convert.size.height); 46 EXPECT_EQ(back_again.size.height, convert.size.height);
46 } 47 }
47 48
49 TEST_F(BaseViewTest, Tag) {
50 [view_ setViewID:VIEW_ID_TAB_0];
51 EXPECT_EQ(VIEW_ID_TAB_0, [view_ viewID]);
52 EXPECT_EQ(view_id_util::ViewIDToTag(VIEW_ID_TAB_0), [view_ tag]);
53 EXPECT_EQ((NSView*)view_, view_id_util::GetView(test_window(), VIEW_ID_TAB_0)) ;
54
55 [view_ setViewID:VIEW_ID_TOOLBAR];
56 EXPECT_EQ(VIEW_ID_TOOLBAR, [view_ viewID]);
57 EXPECT_EQ(view_id_util::ViewIDToTag(VIEW_ID_TOOLBAR), [view_ tag]);
58 EXPECT_EQ((NSView*)view_, view_id_util::GetView(test_window(), VIEW_ID_TOOLBAR ));
59 }
60
48 } // namespace 61 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/base_view.mm ('k') | chrome/browser/cocoa/bookmark_bar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698