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

Side by Side Diff: chrome/browser/ui/cocoa/validation_message_bubble_controller_unittest.mm

Issue 112913004: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #import "chrome/browser/ui/cocoa/validation_message_bubble_controller.h" 8 #import "chrome/browser/ui/cocoa/validation_message_bubble_controller.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace { 11 namespace {
12 12
13 static NSView* constructView(const char* main_text, const char* sub_text) { 13 static NSView* constructView(const char* main_text, const char* sub_text) {
14 return [ValidationMessageBubbleController 14 return [ValidationMessageBubbleController
15 constructContentView:UTF8ToUTF16(main_text) 15 constructContentView:base::UTF8ToUTF16(main_text)
16 subText:UTF8ToUTF16(sub_text)]; 16 subText:base::UTF8ToUTF16(sub_text)];
17 } 17 }
18 18
19 TEST(ValidationMessageBubbleControllerTest, FrameSize) { 19 TEST(ValidationMessageBubbleControllerTest, FrameSize) {
20 NSRect shortMainNoSubFrame = [constructView("abc", "") frame]; 20 NSRect shortMainNoSubFrame = [constructView("abc", "") frame];
21 EXPECT_GE(NSWidth(shortMainNoSubFrame), 40); 21 EXPECT_GE(NSWidth(shortMainNoSubFrame), 40);
22 EXPECT_GT(NSHeight(shortMainNoSubFrame), 0); 22 EXPECT_GT(NSHeight(shortMainNoSubFrame), 0);
23 23
24 NSRect longMainNoSubFrame = [constructView( 24 NSRect longMainNoSubFrame = [constructView(
25 "very very very long text which overlfows the maximum window width. " 25 "very very very long text which overlfows the maximum window width. "
26 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod" 26 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
27 " tempor incididunt ut labore et dolore magna aliqua.", "") frame]; 27 " tempor incididunt ut labore et dolore magna aliqua.", "") frame];
28 EXPECT_LT(NSWidth(longMainNoSubFrame), 500); 28 EXPECT_LT(NSWidth(longMainNoSubFrame), 500);
29 EXPECT_LT(NSHeight(shortMainNoSubFrame), NSHeight(longMainNoSubFrame)); 29 EXPECT_LT(NSHeight(shortMainNoSubFrame), NSHeight(longMainNoSubFrame));
30 30
31 NSRect shortMainMediumSubFrame = [constructView("abc", "foo bar baz") frame]; 31 NSRect shortMainMediumSubFrame = [constructView("abc", "foo bar baz") frame];
32 EXPECT_GT(NSWidth(shortMainMediumSubFrame), NSWidth(shortMainNoSubFrame)); 32 EXPECT_GT(NSWidth(shortMainMediumSubFrame), NSWidth(shortMainNoSubFrame));
33 EXPECT_GT(NSHeight(shortMainMediumSubFrame), NSHeight(shortMainNoSubFrame)); 33 EXPECT_GT(NSHeight(shortMainMediumSubFrame), NSHeight(shortMainNoSubFrame));
34 34
35 NSRect shortMainLongSubFrame = [constructView("abc", 35 NSRect shortMainLongSubFrame = [constructView("abc",
36 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod" 36 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
37 " tempor incididunt ut labore et dolore magna aliqua.") frame]; 37 " tempor incididunt ut labore et dolore magna aliqua.") frame];
38 EXPECT_GT(NSWidth(shortMainLongSubFrame), NSWidth(shortMainMediumSubFrame)); 38 EXPECT_GT(NSWidth(shortMainLongSubFrame), NSWidth(shortMainMediumSubFrame));
39 EXPECT_LT(NSWidth(shortMainLongSubFrame), 500); 39 EXPECT_LT(NSWidth(shortMainLongSubFrame), 500);
40 EXPECT_GT(NSHeight(shortMainLongSubFrame), NSHeight(shortMainMediumSubFrame)); 40 EXPECT_GT(NSHeight(shortMainLongSubFrame), NSHeight(shortMainMediumSubFrame));
41 } 41 }
42 42
43 } 43 }
44 44
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm ('k') | chrome/browser/ui/cocoa/view_id_util_browsertest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698