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

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

Issue 1880853002: Convert ValidationMessageBubbleView to BubbleDialogDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: msw review Created 4 years, 8 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/strings/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(), base::UTF8ToUTF16(main_text),
16 base::UTF8ToUTF16(sub_text), NULL);
17 return delegate.GetPreferredSize();
18 }
19
20 TEST(ValidationMessageBubbleDelegate, Size) {
21 gfx::Size short_main_empty_sub_size = GetSizeForMessages("foo", "");
22 EXPECT_LE(ValidationMessageBubbleDelegate::kWindowMinWidth,
23 short_main_empty_sub_size.width());
24 EXPECT_LE(0, short_main_empty_sub_size.height());
25
26 gfx::Size long_main_empty_sub_size = GetSizeForMessages(
27 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
28 " tempor incididunt ut labore et dolore magna aliqua.", "");
29 EXPECT_GE(ValidationMessageBubbleDelegate::kWindowMaxWidth,
30 long_main_empty_sub_size.width());
31 EXPECT_GT(long_main_empty_sub_size.height(),
32 short_main_empty_sub_size.height());
33
34 gfx::Size short_main_medium_sub_size =
35 GetSizeForMessages("foo", "foo bar baz");
36 EXPECT_GT(short_main_medium_sub_size.width(),
37 short_main_empty_sub_size.width());
38 EXPECT_GT(short_main_medium_sub_size.height(),
39 short_main_empty_sub_size.height());
40
41 gfx::Size short_main_long_sub_size = GetSizeForMessages("foo",
42 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
43 " tempor incididunt ut labore et dolore magna aliqua.");
44 EXPECT_GT(short_main_long_sub_size.width(),
45 short_main_medium_sub_size.width());
46 EXPECT_GE(ValidationMessageBubbleDelegate::kWindowMaxWidth,
47 short_main_long_sub_size.width());
48 EXPECT_GT(short_main_long_sub_size.height(),
49 short_main_medium_sub_size.height());
50 }
51
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698