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

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

Issue 13160004: Re-implement form validation message UI with native widgets. (Common and Mac) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6
7 #include "base/memory/scoped_nsobject.h"
8 #include "base/utf_string_conversions.h"
9 #import "chrome/browser/ui/cocoa/validation_message_bubble_controller.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace {
13
14 static NSView* constructView(const char* main_text, const char* sub_text) {
15 return [ValidationMessageBubbleController
16 constructContentView:UTF8ToUTF16(main_text)
17 subText:UTF8ToUTF16(sub_text)];
18 }
19
20 TEST(ValidationMessageBubbleControllerTest, FrameSize) {
21 NSRect shortMainNoSubFrame = [constructView("abc", "") frame];
22 EXPECT_GE(NSWidth(shortMainNoSubFrame), 40);
23 EXPECT_GT(NSHeight(shortMainNoSubFrame), 0);
24
25 NSRect longMainNoSubFrame = [constructView(
26 "very very very long text which overlfows the maximum window width. "
27 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
28 " tempor incididunt ut labore et dolore magna aliqua.", "") frame];
29 EXPECT_LT(NSWidth(longMainNoSubFrame), 500);
30 EXPECT_LT(NSHeight(shortMainNoSubFrame), NSHeight(longMainNoSubFrame));
31
32 NSRect shortMainMediumSubFrame = [constructView("abc", "foo bar baz") frame];
33 EXPECT_GT(NSWidth(shortMainMediumSubFrame), NSWidth(shortMainNoSubFrame));
34 EXPECT_GT(NSHeight(shortMainMediumSubFrame), NSHeight(shortMainNoSubFrame));
35
36 NSRect shortMainLongSubFrame = [constructView("abc",
37 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
38 " tempor incididunt ut labore et dolore magna aliqua.") frame];
39 EXPECT_GT(NSWidth(shortMainLongSubFrame), NSWidth(shortMainMediumSubFrame));
40 EXPECT_LT(NSWidth(shortMainLongSubFrame), 500);
41 EXPECT_GT(NSHeight(shortMainLongSubFrame), NSHeight(shortMainMediumSubFrame));
42 }
43
44 }
45
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/validation_message_bubble_controller.h ('k') | chrome/browser/ui/gtk/validation_message_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698