OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/ui/views/generic_info_view.h" | 7 #include "chrome/browser/ui/views/generic_info_view.h" |
8 #include "grit/chromium_strings.h" | 8 #include "grit/chromium_strings.h" |
9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 views::Widget* widget = new views::Widget; | 28 views::Widget* widget = new views::Widget; |
29 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 29 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
30 params.bounds = gfx::Rect(0, 0, 100, 100); | 30 params.bounds = gfx::Rect(0, 0, 100, 100); |
31 widget->Init(params); | 31 widget->Init(params); |
32 views::View* root_view = widget->GetRootView(); | 32 views::View* root_view = widget->GetRootView(); |
33 | 33 |
34 GenericInfoView* view1 = new GenericInfoView(1); | 34 GenericInfoView* view1 = new GenericInfoView(1); |
35 root_view->AddChildView(view1); | 35 root_view->AddChildView(view1); |
36 view1->SetName(0, kName); | 36 view1->SetName(0, kName); |
37 view1->SetValue(0, kValue); | 37 view1->SetValue(0, kValue); |
38 EXPECT_EQ(kName, view1->name_views_[0]->GetText()); | 38 EXPECT_EQ(kName, view1->name_views_[0]->text()); |
39 EXPECT_EQ(kValue, view1->value_views_[0]->text()); | 39 EXPECT_EQ(kValue, view1->value_views_[0]->text()); |
40 view1->ClearValues(); | 40 view1->ClearValues(); |
41 EXPECT_TRUE(view1->value_views_[0]->text().empty()); | 41 EXPECT_TRUE(view1->value_views_[0]->text().empty()); |
42 | 42 |
43 // Test setting values by localized string id. | 43 // Test setting values by localized string id. |
44 static int kNameIds[] = { | 44 static int kNameIds[] = { |
45 IDS_PRODUCT_NAME, | 45 IDS_PRODUCT_NAME, |
46 IDS_PRODUCT_DESCRIPTION | 46 IDS_PRODUCT_DESCRIPTION |
47 }; | 47 }; |
48 GenericInfoView* view2 = new GenericInfoView(ARRAYSIZE(kNameIds), kNameIds); | 48 GenericInfoView* view2 = new GenericInfoView(ARRAYSIZE(kNameIds), kNameIds); |
49 root_view->AddChildView(view2); | 49 root_view->AddChildView(view2); |
50 | 50 |
51 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 51 string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
52 string16 product_desc = l10n_util::GetStringUTF16(IDS_PRODUCT_DESCRIPTION); | 52 string16 product_desc = l10n_util::GetStringUTF16(IDS_PRODUCT_DESCRIPTION); |
53 EXPECT_EQ(product_name, view2->name_views_[0]->GetText()); | 53 EXPECT_EQ(product_name, view2->name_views_[0]->text()); |
54 EXPECT_EQ(product_desc, view2->name_views_[1]->GetText()); | 54 EXPECT_EQ(product_desc, view2->name_views_[1]->text()); |
55 widget->CloseNow(); | 55 widget->CloseNow(); |
56 } | 56 } |
57 #endif // OS_WIN | 57 #endif // OS_WIN |
OLD | NEW |