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

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: Linux build 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"
sky 2013/04/30 13:53:21 nit: newline between 5/6.
tkent 2013/05/01 03:15:02 Done.
6 #include "base/utf_string_conversions.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace {
10
11 gfx::Size GetSizeForMessages(const char* main_text, const char* sub_text) {
sky 2013/04/30 13:53:21 Make these take const std::string&.
tkent 2013/05/01 03:15:02 Done.
12 scoped_ptr<ValidationMessageBubbleDelegate> delegate(
sky 2013/04/30 13:53:21 Why the scoped_ptr here? Why not create on the sta
tkent 2013/05/01 03:15:02 No reason to use scoped_ptr. Changed to an object
13 new ValidationMessageBubbleDelegate(
14 gfx::Rect(), UTF8ToUTF16(main_text), UTF8ToUTF16(sub_text)));
15 return delegate->GetPreferredSize();
16 }
17
18 TEST(ValidationMessageBubbleDelegate, Size) {
19 gfx::Size shortMainEmptySubSize = GetSizeForMessages("foo", "");
sky 2013/04/30 13:53:21 short_main_empty_sub_size, in fact you have the wr
tkent 2013/05/01 03:15:02 Updated all local variables.
20 EXPECT_GT(shortMainEmptySubSize.width(), 40);
sky 2013/04/30 13:53:21 Where do these numbers come from?
tkent 2013/05/01 03:15:02 It is a value smaller than kWindowMinWidth. Using
sky 2013/05/01 14:05:05 Duplicating the values of constants defeats the va
tkent 2013/05/01 21:42:30 Done.
21 EXPECT_GT(shortMainEmptySubSize.height(), 0);
22
23 gfx::Size longMainEmptySubSize = GetSizeForMessages(
24 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
25 " tempor incididunt ut labore et dolore magna aliqua.", "");
26 EXPECT_LT(longMainEmptySubSize.width(), 500);
27 EXPECT_GT(longMainEmptySubSize.height(), shortMainEmptySubSize.height());
28
29 gfx::Size shortMainMediumSubSize =
30 GetSizeForMessages("foo", "foo bar baz");
31 EXPECT_GT(shortMainMediumSubSize.width(), shortMainEmptySubSize.width());
32 EXPECT_GT(shortMainMediumSubSize.height(), shortMainEmptySubSize.height());
33
34 gfx::Size shortMainLongSubSize = GetSizeForMessages("foo",
35 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod"
36 " tempor incididunt ut labore et dolore magna aliqua.");
37 EXPECT_GT(shortMainLongSubSize.width(), shortMainMediumSubSize.width());
38 EXPECT_LT(shortMainLongSubSize.width(), 500);
39 EXPECT_GT(shortMainLongSubSize.height(), shortMainMediumSubSize.height());
40
sky 2013/04/30 13:53:21 No new empty line here.
tkent 2013/05/01 03:15:02 Done.
41 }
42
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698