| Index: views/focus/focus_manager_unittest.cc
|
| ===================================================================
|
| --- views/focus/focus_manager_unittest.cc (revision 86084)
|
| +++ views/focus/focus_manager_unittest.cc (working copy)
|
| @@ -262,7 +262,7 @@
|
| public:
|
| explicit BorderView(View* child) : child_(child), widget_(NULL) {
|
| DCHECK(child);
|
| - SetFocusable(false);
|
| + set_focusable(false);
|
| }
|
|
|
| virtual ~BorderView() {}
|
| @@ -465,13 +465,13 @@
|
| content_view_->AddChildView(cb);
|
| // In this fast paced world, who really has time for non hard-coded layout?
|
| cb->SetBounds(10, 10, 200, 20);
|
| - cb->SetID(kTopCheckBoxID);
|
| + cb->set_id(kTopCheckBoxID);
|
|
|
| left_container_ = new PaneView();
|
| left_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK));
|
| left_container_->set_background(
|
| Background::CreateSolidBackground(240, 240, 240));
|
| - left_container_->SetID(kLeftContainerID);
|
| + left_container_->set_id(kLeftContainerID);
|
| content_view_->AddChildView(left_container_);
|
| left_container_->SetBounds(10, 35, 250, 200);
|
|
|
| @@ -483,12 +483,12 @@
|
| int gap_between_labels = 10;
|
|
|
| Label* label = new Label(L"Apple:");
|
| - label->SetID(kAppleLabelID);
|
| + label->set_id(kAppleLabelID);
|
| left_container_->AddChildView(label);
|
| label->SetBounds(label_x, y, label_width, label_height);
|
|
|
| Textfield* text_field = new Textfield();
|
| - text_field->SetID(kAppleTextfieldID);
|
| + text_field->set_id(kAppleTextfieldID);
|
| left_container_->AddChildView(text_field);
|
| text_field->SetBounds(label_x + label_width + 5, y,
|
| text_field_width, label_height);
|
| @@ -496,12 +496,12 @@
|
| y += label_height + gap_between_labels;
|
|
|
| label = new Label(L"Orange:");
|
| - label->SetID(kOrangeLabelID);
|
| + label->set_id(kOrangeLabelID);
|
| left_container_->AddChildView(label);
|
| label->SetBounds(label_x, y, label_width, label_height);
|
|
|
| text_field = new Textfield();
|
| - text_field->SetID(kOrangeTextfieldID);
|
| + text_field->set_id(kOrangeTextfieldID);
|
| left_container_->AddChildView(text_field);
|
| text_field->SetBounds(label_x + label_width + 5, y,
|
| text_field_width, label_height);
|
| @@ -509,12 +509,12 @@
|
| y += label_height + gap_between_labels;
|
|
|
| label = new Label(L"Banana:");
|
| - label->SetID(kBananaLabelID);
|
| + label->set_id(kBananaLabelID);
|
| left_container_->AddChildView(label);
|
| label->SetBounds(label_x, y, label_width, label_height);
|
|
|
| text_field = new Textfield();
|
| - text_field->SetID(kBananaTextfieldID);
|
| + text_field->set_id(kBananaTextfieldID);
|
| left_container_->AddChildView(text_field);
|
| text_field->SetBounds(label_x + label_width + 5, y,
|
| text_field_width, label_height);
|
| @@ -522,12 +522,12 @@
|
| y += label_height + gap_between_labels;
|
|
|
| label = new Label(L"Kiwi:");
|
| - label->SetID(kKiwiLabelID);
|
| + label->set_id(kKiwiLabelID);
|
| left_container_->AddChildView(label);
|
| label->SetBounds(label_x, y, label_width, label_height);
|
|
|
| text_field = new Textfield();
|
| - text_field->SetID(kKiwiTextfieldID);
|
| + text_field->set_id(kKiwiTextfieldID);
|
| left_container_->AddChildView(text_field);
|
| text_field->SetBounds(label_x + label_width + 5, y,
|
| text_field_width, label_height);
|
| @@ -536,26 +536,26 @@
|
|
|
| NativeButton* button = new NativeButton(NULL, L"Click me");
|
| button->SetBounds(label_x, y + 10, 80, 30);
|
| - button->SetID(kFruitButtonID);
|
| + button->set_id(kFruitButtonID);
|
| left_container_->AddChildView(button);
|
| y += 40;
|
|
|
| cb = new Checkbox(L"This is another check box");
|
| cb->SetBounds(label_x + label_width + 5, y, 180, 20);
|
| - cb->SetID(kFruitCheckBoxID);
|
| + cb->set_id(kFruitCheckBoxID);
|
| left_container_->AddChildView(cb);
|
| y += 20;
|
|
|
| Combobox* combobox = new Combobox(&combobox_model_);
|
| combobox->SetBounds(label_x + label_width + 5, y, 150, 30);
|
| - combobox->SetID(kComboboxID);
|
| + combobox->set_id(kComboboxID);
|
| left_container_->AddChildView(combobox);
|
|
|
| right_container_ = new PaneView();
|
| right_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK));
|
| right_container_->set_background(
|
| Background::CreateSolidBackground(240, 240, 240));
|
| - right_container_->SetID(kRightContainerID);
|
| + right_container_->set_id(kRightContainerID);
|
| content_view_->AddChildView(right_container_);
|
| right_container_->SetBounds(270, 35, 300, 200);
|
|
|
| @@ -563,35 +563,35 @@
|
| int radio_button_height = 18;
|
| int gap_between_radio_buttons = 10;
|
| RadioButton* radio_button = new RadioButton(L"Asparagus", 1);
|
| - radio_button->SetID(kAsparagusButtonID);
|
| + radio_button->set_id(kAsparagusButtonID);
|
| right_container_->AddChildView(radio_button);
|
| radio_button->SetBounds(5, y, 70, radio_button_height);
|
| - radio_button->SetGroup(1);
|
| + radio_button->set_group(1);
|
| y += radio_button_height + gap_between_radio_buttons;
|
| radio_button = new RadioButton(L"Broccoli", 1);
|
| - radio_button->SetID(kBroccoliButtonID);
|
| + radio_button->set_id(kBroccoliButtonID);
|
| right_container_->AddChildView(radio_button);
|
| radio_button->SetBounds(5, y, 70, radio_button_height);
|
| - radio_button->SetGroup(1);
|
| + radio_button->set_group(1);
|
| RadioButton* radio_button_to_check = radio_button;
|
| y += radio_button_height + gap_between_radio_buttons;
|
| radio_button = new RadioButton(L"Cauliflower", 1);
|
| - radio_button->SetID(kCauliflowerButtonID);
|
| + radio_button->set_id(kCauliflowerButtonID);
|
| right_container_->AddChildView(radio_button);
|
| radio_button->SetBounds(5, y, 70, radio_button_height);
|
| - radio_button->SetGroup(1);
|
| + radio_button->set_group(1);
|
| y += radio_button_height + gap_between_radio_buttons;
|
|
|
| View* inner_container = new View();
|
| inner_container->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK));
|
| inner_container->set_background(
|
| Background::CreateSolidBackground(230, 230, 230));
|
| - inner_container->SetID(kInnerContainerID);
|
| + inner_container->set_id(kInnerContainerID);
|
| right_container_->AddChildView(inner_container);
|
| inner_container->SetBounds(100, 10, 150, 180);
|
|
|
| ScrollView* scroll_view = new ScrollView();
|
| - scroll_view->SetID(kScrollViewID);
|
| + scroll_view->set_id(kScrollViewID);
|
| inner_container->AddChildView(scroll_view);
|
| scroll_view->SetBounds(1, 1, 148, 178);
|
|
|
| @@ -621,7 +621,7 @@
|
| for (size_t i = 0; i < arraysize(kTitles); ++i) {
|
| Link* link = new Link(kTitles[i]);
|
| link->SetHorizontalAlignment(Label::ALIGN_LEFT);
|
| - link->SetID(kIDs[i]);
|
| + link->set_id(kIDs[i]);
|
| scroll_content->AddChildView(link);
|
| link->SetBounds(5, y, 300, 15);
|
| y += 15;
|
| @@ -630,19 +630,19 @@
|
| y = 250;
|
| int width = 60;
|
| button = new NativeButton(NULL, L"OK");
|
| - button->SetID(kOKButtonID);
|
| + button->set_id(kOKButtonID);
|
| button->SetIsDefault(true);
|
|
|
| content_view_->AddChildView(button);
|
| button->SetBounds(150, y, width, 30);
|
|
|
| button = new NativeButton(NULL, L"Cancel");
|
| - button->SetID(kCancelButtonID);
|
| + button->set_id(kCancelButtonID);
|
| content_view_->AddChildView(button);
|
| button->SetBounds(220, y, width, 30);
|
|
|
| button = new NativeButton(NULL, L"Help");
|
| - button->SetID(kHelpButtonID);
|
| + button->set_id(kHelpButtonID);
|
| content_view_->AddChildView(button);
|
| button->SetBounds(290, y, width, 30);
|
|
|
| @@ -654,30 +654,30 @@
|
| cb = new Checkbox(L"Bold");
|
| contents->AddChildView(cb);
|
| cb->SetBounds(10, 10, 50, 20);
|
| - cb->SetID(kBoldCheckBoxID);
|
| + cb->set_id(kBoldCheckBoxID);
|
|
|
| cb = new Checkbox(L"Italic");
|
| contents->AddChildView(cb);
|
| cb->SetBounds(70, 10, 50, 20);
|
| - cb->SetID(kItalicCheckBoxID);
|
| + cb->set_id(kItalicCheckBoxID);
|
|
|
| cb = new Checkbox(L"Underlined");
|
| contents->AddChildView(cb);
|
| cb->SetBounds(130, 10, 70, 20);
|
| - cb->SetID(kUnderlinedCheckBoxID);
|
| + cb->set_id(kUnderlinedCheckBoxID);
|
|
|
| Link* link = new Link(L"Help");
|
| contents->AddChildView(link);
|
| link->SetBounds(10, 35, 70, 10);
|
| - link->SetID(kStyleHelpLinkID);
|
| + link->set_id(kStyleHelpLinkID);
|
|
|
| text_field = new Textfield();
|
| contents->AddChildView(text_field);
|
| text_field->SetBounds(10, 50, 100, 20);
|
| - text_field->SetID(kStyleTextEditID);
|
| + text_field->set_id(kStyleTextEditID);
|
|
|
| style_tab_ = new TabbedPane();
|
| - style_tab_->SetID(kStyleContainerID);
|
| + style_tab_->set_id(kStyleContainerID);
|
| content_view_->AddChildView(style_tab_);
|
| style_tab_->SetBounds(10, y, 210, 100);
|
| style_tab_->AddTab(L"Style", contents);
|
| @@ -689,21 +689,21 @@
|
| text_field = new Textfield();
|
| contents->AddChildView(text_field);
|
| text_field->SetBounds(10, 10, 100, 20);
|
| - text_field->SetID(kSearchTextfieldID);
|
| + text_field->set_id(kSearchTextfieldID);
|
|
|
| button = new NativeButton(NULL, L"Search");
|
| contents->AddChildView(button);
|
| button->SetBounds(112, 5, 60, 30);
|
| - button->SetID(kSearchButtonID);
|
| + button->set_id(kSearchButtonID);
|
|
|
| link = new Link(L"Help");
|
| link->SetHorizontalAlignment(Label::ALIGN_LEFT);
|
| - link->SetID(kHelpLinkID);
|
| + link->set_id(kHelpLinkID);
|
| contents->AddChildView(link);
|
| link->SetBounds(175, 10, 30, 20);
|
|
|
| search_border_view_ = new BorderView(contents);
|
| - search_border_view_->SetID(kSearchContainerID);
|
| + search_border_view_->set_id(kSearchContainerID);
|
|
|
| content_view_->AddChildView(search_border_view_);
|
| search_border_view_->SetBounds(300, y, 240, 50);
|
| @@ -711,17 +711,17 @@
|
| y += 60;
|
|
|
| contents = new View();
|
| - contents->SetFocusable(true);
|
| + contents->set_focusable(true);
|
| contents->set_background(Background::CreateSolidBackground(SK_ColorBLUE));
|
| - contents->SetID(kThumbnailContainerID);
|
| + contents->set_id(kThumbnailContainerID);
|
| button = new NativeButton(NULL, L"Star");
|
| contents->AddChildView(button);
|
| button->SetBounds(5, 5, 50, 30);
|
| - button->SetID(kThumbnailStarID);
|
| + button->set_id(kThumbnailStarID);
|
| button = new NativeButton(NULL, L"SuperStar");
|
| contents->AddChildView(button);
|
| button->SetBounds(60, 5, 100, 30);
|
| - button->SetID(kThumbnailSuperStarID);
|
| + button->set_id(kThumbnailSuperStarID);
|
|
|
| content_view_->AddChildView(contents);
|
| contents->SetBounds(250, y, 200, 50);
|
| @@ -753,16 +753,16 @@
|
| public:
|
| SimpleTestView(std::vector<FocusTestEvent>* event_list, int view_id)
|
| : event_list_(event_list) {
|
| - SetFocusable(true);
|
| - SetID(view_id);
|
| + set_focusable(true);
|
| + set_id(view_id);
|
| }
|
|
|
| virtual void OnFocus() {
|
| - event_list_->push_back(FocusTestEvent(ON_FOCUS, GetID()));
|
| + event_list_->push_back(FocusTestEvent(ON_FOCUS, id()));
|
| }
|
|
|
| virtual void OnBlur() {
|
| - event_list_->push_back(FocusTestEvent(ON_BLUR, GetID()));
|
| + event_list_->push_back(FocusTestEvent(ON_BLUR, id()));
|
| }
|
|
|
| private:
|
| @@ -818,9 +818,9 @@
|
|
|
| TEST_F(FocusManagerTest, FocusChangeListener) {
|
| View* view1 = new View();
|
| - view1->SetFocusable(true);
|
| + view1->set_focusable(true);
|
| View* view2 = new View();
|
| - view2->SetFocusable(true);
|
| + view2->set_focusable(true);
|
| content_view_->AddChildView(view1);
|
| content_view_->AddChildView(view2);
|
|
|
| @@ -968,7 +968,7 @@
|
|
|
| NativeButton* button = new NativeButton(NULL, L"Press me");
|
| View* view = new View();
|
| - view->SetFocusable(true);
|
| + view->set_focusable(true);
|
|
|
| content_view_->AddChildView(button);
|
| button->SetBounds(10, 10, 200, 30);
|
| @@ -1085,7 +1085,7 @@
|
| View* focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
|
|
| @@ -1097,7 +1097,7 @@
|
| View* focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
| }
|
| @@ -1138,7 +1138,7 @@
|
| focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
|
|
| @@ -1150,7 +1150,7 @@
|
| focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
| }
|
| @@ -1190,7 +1190,7 @@
|
| focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
|
|
| @@ -1202,7 +1202,7 @@
|
| focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
| }
|
| @@ -1228,7 +1228,7 @@
|
| View* focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kLeftTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kLeftTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
|
|
| @@ -1240,7 +1240,7 @@
|
| View* focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kLeftTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kLeftTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
|
|
| @@ -1254,10 +1254,10 @@
|
|
|
| FocusSearch focus_search_right(right_container_, true, true);
|
| right_container_->EnablePaneFocus(&focus_search_right);
|
| - FindViewByID(kRosettaLinkID)->SetFocusable(false);
|
| - FindViewByID(kStupeurEtTremblementLinkID)->SetFocusable(false);
|
| + FindViewByID(kRosettaLinkID)->set_focusable(false);
|
| + FindViewByID(kStupeurEtTremblementLinkID)->set_focusable(false);
|
| FindViewByID(kDinerGameLinkID)->set_accessibility_focusable(true);
|
| - FindViewByID(kDinerGameLinkID)->SetFocusable(false);
|
| + FindViewByID(kDinerGameLinkID)->set_focusable(false);
|
| FindViewByID(kAsterixLinkID)->RequestFocus();
|
|
|
| // Traverse the focus hierarchy within the pane several times.
|
| @@ -1267,7 +1267,7 @@
|
| View* focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kRightTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kRightTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
|
|
| @@ -1279,7 +1279,7 @@
|
| View* focused_view = GetFocusManager()->GetFocusedView();
|
| EXPECT_TRUE(focused_view != NULL);
|
| if (focused_view)
|
| - EXPECT_EQ(kRightTraversalIDs[j], focused_view->GetID());
|
| + EXPECT_EQ(kRightTraversalIDs[j], focused_view->id());
|
| }
|
| }
|
|
|
|
|