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

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

Issue 10332211: views: Remove appcache_info_view* and generic_info_view* files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/ui/views/generic_info_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "base/message_loop.h"
6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/ui/views/generic_info_view.h"
8 #include "grit/chromium_strings.h"
9 #include "grit/generated_resources.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/views/controls/label.h"
13 #include "ui/views/controls/textfield/textfield.h"
14 #include "ui/views/widget/widget.h"
15
16 // This class is only used on windows for now.
17 #if defined(OS_WIN)
18
19 class GenericInfoViewTest : public testing::Test {
20 private:
21 MessageLoopForUI message_loop_;
22 };
23
24 TEST_F(GenericInfoViewTest, GenericInfoView) {
25 const string16 kName = ASCIIToUTF16("Name");
26 const string16 kValue = ASCIIToUTF16("Value");
27
28 views::Widget* widget = new views::Widget;
29 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
30 params.bounds = gfx::Rect(0, 0, 100, 100);
31 widget->Init(params);
32 views::View* root_view = widget->GetRootView();
33
34 GenericInfoView* view1 = new GenericInfoView(1);
35 root_view->AddChildView(view1);
36 view1->SetName(0, kName);
37 view1->SetValue(0, kValue);
38 EXPECT_EQ(kName, view1->name_views_[0]->text());
39 EXPECT_EQ(kValue, view1->value_views_[0]->text());
40 view1->ClearValues();
41 EXPECT_TRUE(view1->value_views_[0]->text().empty());
42
43 // Test setting values by localized string id.
44 static int kNameIds[] = {
45 IDS_PRODUCT_NAME,
46 IDS_PRODUCT_DESCRIPTION
47 };
48 GenericInfoView* view2 = new GenericInfoView(ARRAYSIZE(kNameIds), kNameIds);
49 root_view->AddChildView(view2);
50
51 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
52 string16 product_desc = l10n_util::GetStringUTF16(IDS_PRODUCT_DESCRIPTION);
53 EXPECT_EQ(product_name, view2->name_views_[0]->text());
54 EXPECT_EQ(product_desc, view2->name_views_[1]->text());
55 widget->CloseNow();
56 }
57 #endif // OS_WIN
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/generic_info_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698