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

Side by Side Diff: chrome/browser/ui/views/validation_message_bubble_delegate_unittest.cc

Issue 14627004: Re-implement form validation message UI with native widgets (Views) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments 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
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 #include "chrome/browser/ui/views/validation_message_bubble_delegate.h"
6
7 #include "base/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace {
11
12 gfx::Size GetSizeForMessages(const std::string& main_text,
13 const std::string& sub_text) {
14 ValidationMessageBubbleDelegate delegate(
15 gfx::Rect(), UTF8ToUTF16(main_text), UTF8ToUTF16(sub_text));
16 return delegate.GetPreferredSize();
17 }
18
19 TEST(ValidationMessageBubbleDelegate, Size) {
20 gfx::Size short_main_empty_sub_size = GetSizeForMessages("foo", "");
21 EXPECT_GE(short_main_empty_sub_size.width(), 64);
sky 2013/05/01 14:05:05 expect/assert have the format expected, actual.
tkent 2013/05/01 21:42:30 Done.
22 EXPECT_GT(short_main_empty_sub_size.height(), 0);
23
24 gfx::Size long_main_empty_sub_size = GetSizeForMessages(
25 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
26 " tempor incididunt ut labore et dolore magna aliqua.", "");
27 EXPECT_LE(long_main_empty_sub_size.width(), 256);
28 EXPECT_GT(long_main_empty_sub_size.height(),
29 short_main_empty_sub_size.height());
30
31 gfx::Size short_main_medium_sub_size =
32 GetSizeForMessages("foo", "foo bar baz");
33 EXPECT_GT(short_main_medium_sub_size.width(),
34 short_main_empty_sub_size.width());
35 EXPECT_GT(short_main_medium_sub_size.height(),
36 short_main_empty_sub_size.height());
37
38 gfx::Size short_main_long_sub_size = GetSizeForMessages("foo",
39 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
40 " tempor incididunt ut labore et dolore magna aliqua.");
41 EXPECT_GT(short_main_long_sub_size.width(),
42 short_main_medium_sub_size.width());
43 EXPECT_LE(short_main_long_sub_size.width(), 256);
44 EXPECT_GT(short_main_long_sub_size.height(),
45 short_main_medium_sub_size.height());
46 }
47
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698