OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/views/controls/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "ui/base/ime/input_method.h" | 12 #include "ui/base/ime/input_method.h" |
13 #include "ui/base/ime/text_input_client.h" | 13 #include "ui/base/ime/text_input_client.h" |
14 #include "ui/base/models/combobox_model.h" | 14 #include "ui/base/models/combobox_model.h" |
15 #include "ui/base/models/menu_model.h" | 15 #include "ui/base/models/menu_model.h" |
16 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
17 #include "ui/events/event_constants.h" | 17 #include "ui/events/event_constants.h" |
18 #include "ui/events/event_utils.h" | 18 #include "ui/events/event_utils.h" |
19 #include "ui/events/keycodes/dom/dom_code.h" | 19 #include "ui/events/keycodes/dom/dom_code.h" |
20 #include "ui/events/keycodes/keyboard_codes.h" | 20 #include "ui/events/keycodes/keyboard_codes.h" |
21 #include "ui/events/test/event_generator.h" | 21 #include "ui/events/test/event_generator.h" |
22 #include "ui/views/controls/combobox/combobox_listener.h" | 22 #include "ui/views/controls/combobox/combobox_listener.h" |
23 #include "ui/views/style/platform_style.h" | |
23 #include "ui/views/test/combobox_test_api.h" | 24 #include "ui/views/test/combobox_test_api.h" |
24 #include "ui/views/test/views_test_base.h" | 25 #include "ui/views/test/views_test_base.h" |
25 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
26 | 27 |
27 using base::ASCIIToUTF16; | 28 using base::ASCIIToUTF16; |
28 | 29 |
29 namespace views { | 30 namespace views { |
30 | 31 |
31 using test::ComboboxTestApi; | 32 using test::ComboboxTestApi; |
32 | 33 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 | 269 |
269 // The current menu show count. | 270 // The current menu show count. |
270 int menu_show_count_ = 0; | 271 int menu_show_count_ = 0; |
271 | 272 |
272 std::unique_ptr<ui::test::EventGenerator> event_generator_; | 273 std::unique_ptr<ui::test::EventGenerator> event_generator_; |
273 | 274 |
274 private: | 275 private: |
275 DISALLOW_COPY_AND_ASSIGN(ComboboxTest); | 276 DISALLOW_COPY_AND_ASSIGN(ComboboxTest); |
276 }; | 277 }; |
277 | 278 |
279 #if defined(OS_MACOSX) | |
278 TEST_F(ComboboxTest, KeyTest) { | 280 TEST_F(ComboboxTest, KeyTest) { |
tapted
2017/01/13 19:06:39
perhaps call this KeyTestMac? Since it's quite dif
tapted
2017/01/13 19:06:40
nit: comment before describing test
karandeepb
2017/01/16 04:26:16
Done.
karandeepb
2017/01/16 04:26:16
Done.
| |
279 InitCombobox(nullptr, Combobox::STYLE_NORMAL); | 281 InitCombobox(nullptr, Combobox::STYLE_NORMAL); |
280 PressKey(ui::VKEY_END); | 282 PressKey(ui::VKEY_END); |
281 EXPECT_EQ(combobox_->selected_index() + 1, model_->GetItemCount()); | 283 EXPECT_EQ(0, combobox_->selected_index()); |
284 EXPECT_EQ(0, menu_show_count_); | |
285 | |
282 PressKey(ui::VKEY_HOME); | 286 PressKey(ui::VKEY_HOME); |
283 EXPECT_EQ(combobox_->selected_index(), 0); | 287 EXPECT_EQ(0, combobox_->selected_index()); |
288 EXPECT_EQ(0, menu_show_count_); | |
289 | |
290 PressKey(ui::VKEY_DOWN); | |
291 EXPECT_EQ(0, combobox_->selected_index()); | |
292 EXPECT_EQ(1, menu_show_count_); | |
293 | |
294 PressKey(ui::VKEY_RIGHT); | |
295 EXPECT_EQ(0, combobox_->selected_index()); | |
296 EXPECT_EQ(1, menu_show_count_); | |
297 | |
298 PressKey(ui::VKEY_LEFT); | |
299 EXPECT_EQ(0, combobox_->selected_index()); | |
300 EXPECT_EQ(1, menu_show_count_); | |
301 | |
302 PressKey(ui::VKEY_UP); | |
303 EXPECT_EQ(0, combobox_->selected_index()); | |
304 EXPECT_EQ(2, menu_show_count_); | |
305 | |
306 PressKey(ui::VKEY_PRIOR); | |
307 EXPECT_EQ(0, combobox_->selected_index()); | |
308 EXPECT_EQ(2, menu_show_count_); | |
309 | |
310 PressKey(ui::VKEY_NEXT); | |
311 EXPECT_EQ(0, combobox_->selected_index()); | |
312 EXPECT_EQ(2, menu_show_count_); | |
313 } | |
314 #else | |
tapted
2017/01/13 19:06:39
nit: // !OS_MACOSX
karandeepb
2017/01/16 04:26:16
Don't think it's needed now.
| |
315 TEST_F(ComboboxTest, KeyTest) { | |
tapted
2017/01/13 19:06:39
nit: comment before
karandeepb
2017/01/16 04:26:16
Done.
| |
316 InitCombobox(nullptr, Combobox::STYLE_NORMAL); | |
317 PressKey(ui::VKEY_END); | |
318 EXPECT_EQ(model_->GetItemCount(), combobox_->selected_index() + 1); | |
319 PressKey(ui::VKEY_HOME); | |
320 EXPECT_EQ(0, combobox_->selected_index()); | |
284 PressKey(ui::VKEY_DOWN); | 321 PressKey(ui::VKEY_DOWN); |
285 PressKey(ui::VKEY_DOWN); | 322 PressKey(ui::VKEY_DOWN); |
286 EXPECT_EQ(combobox_->selected_index(), 2); | 323 EXPECT_EQ(2, combobox_->selected_index()); |
287 PressKey(ui::VKEY_RIGHT); | 324 PressKey(ui::VKEY_RIGHT); |
288 EXPECT_EQ(combobox_->selected_index(), 2); | 325 EXPECT_EQ(2, combobox_->selected_index()); |
289 PressKey(ui::VKEY_LEFT); | 326 PressKey(ui::VKEY_LEFT); |
290 EXPECT_EQ(combobox_->selected_index(), 2); | 327 EXPECT_EQ(2, combobox_->selected_index()); |
291 PressKey(ui::VKEY_UP); | 328 PressKey(ui::VKEY_UP); |
292 EXPECT_EQ(combobox_->selected_index(), 1); | 329 EXPECT_EQ(1, combobox_->selected_index()); |
293 PressKey(ui::VKEY_PRIOR); | 330 PressKey(ui::VKEY_PRIOR); |
294 EXPECT_EQ(combobox_->selected_index(), 0); | 331 EXPECT_EQ(0, combobox_->selected_index()); |
295 PressKey(ui::VKEY_NEXT); | 332 PressKey(ui::VKEY_NEXT); |
296 EXPECT_EQ(combobox_->selected_index(), model_->GetItemCount() - 1); | 333 EXPECT_EQ(model_->GetItemCount() - 1, combobox_->selected_index()); |
297 } | 334 } |
335 #endif // OS_MACOSX | |
298 | 336 |
299 // Check that if a combobox is disabled before it has a native wrapper, then the | 337 // Check that if a combobox is disabled before it has a native wrapper, then the |
300 // native wrapper inherits the disabled state when it gets created. | 338 // native wrapper inherits the disabled state when it gets created. |
301 TEST_F(ComboboxTest, DisabilityTest) { | 339 TEST_F(ComboboxTest, DisabilityTest) { |
302 model_.reset(new TestComboboxModel()); | 340 model_.reset(new TestComboboxModel()); |
303 | 341 |
304 ASSERT_FALSE(combobox_); | 342 ASSERT_FALSE(combobox_); |
305 combobox_ = new TestCombobox(model_.get(), Combobox::STYLE_NORMAL); | 343 combobox_ = new TestCombobox(model_.get(), Combobox::STYLE_NORMAL); |
306 combobox_->SetEnabled(false); | 344 combobox_->SetEnabled(false); |
307 | 345 |
308 widget_ = new Widget; | 346 widget_ = new Widget; |
309 Widget::InitParams params = | 347 Widget::InitParams params = |
310 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 348 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
311 params.bounds = gfx::Rect(100, 100, 100, 100); | 349 params.bounds = gfx::Rect(100, 100, 100, 100); |
312 widget_->Init(params); | 350 widget_->Init(params); |
313 View* container = new View(); | 351 View* container = new View(); |
314 widget_->SetContentsView(container); | 352 widget_->SetContentsView(container); |
315 container->AddChildView(combobox_); | 353 container->AddChildView(combobox_); |
316 EXPECT_FALSE(combobox_->enabled()); | 354 EXPECT_FALSE(combobox_->enabled()); |
317 } | 355 } |
318 | 356 |
357 // On Mac, key events can't change the currently selected index directly for a | |
358 // combobox. | |
359 #if !defined(OS_MACOSX) | |
360 | |
tapted
2017/01/13 19:06:39
let's move TEST_F(ComboboxTest, KeyTest) in here t
karandeepb
2017/01/16 04:26:16
Done.
| |
319 // Verifies that we don't select a separator line in combobox when navigating | 361 // Verifies that we don't select a separator line in combobox when navigating |
320 // through keyboard. | 362 // through keyboard. |
321 TEST_F(ComboboxTest, SkipSeparatorSimple) { | 363 TEST_F(ComboboxTest, SkipSeparatorSimple) { |
322 std::set<int> separators; | 364 std::set<int> separators; |
323 separators.insert(2); | 365 separators.insert(2); |
324 InitCombobox(&separators, Combobox::STYLE_NORMAL); | 366 InitCombobox(&separators, Combobox::STYLE_NORMAL); |
325 EXPECT_EQ(0, combobox_->selected_index()); | 367 EXPECT_EQ(0, combobox_->selected_index()); |
326 PressKey(ui::VKEY_DOWN); | 368 PressKey(ui::VKEY_DOWN); |
327 EXPECT_EQ(1, combobox_->selected_index()); | 369 EXPECT_EQ(1, combobox_->selected_index()); |
328 PressKey(ui::VKEY_DOWN); | 370 PressKey(ui::VKEY_DOWN); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 EXPECT_EQ(5, combobox_->selected_index()); | 471 EXPECT_EQ(5, combobox_->selected_index()); |
430 PressKey(ui::VKEY_HOME); | 472 PressKey(ui::VKEY_HOME); |
431 EXPECT_EQ(0, combobox_->selected_index()); | 473 EXPECT_EQ(0, combobox_->selected_index()); |
432 PressKey(ui::VKEY_NEXT); | 474 PressKey(ui::VKEY_NEXT); |
433 EXPECT_EQ(6, combobox_->selected_index()); | 475 EXPECT_EQ(6, combobox_->selected_index()); |
434 PressKey(ui::VKEY_PRIOR); | 476 PressKey(ui::VKEY_PRIOR); |
435 EXPECT_EQ(0, combobox_->selected_index()); | 477 EXPECT_EQ(0, combobox_->selected_index()); |
436 PressKey(ui::VKEY_END); | 478 PressKey(ui::VKEY_END); |
437 EXPECT_EQ(6, combobox_->selected_index()); | 479 EXPECT_EQ(6, combobox_->selected_index()); |
438 } | 480 } |
481 #endif // OS_MACOSX | |
439 | 482 |
440 TEST_F(ComboboxTest, GetTextForRowTest) { | 483 TEST_F(ComboboxTest, GetTextForRowTest) { |
441 std::set<int> separators; | 484 std::set<int> separators; |
442 separators.insert(0); | 485 separators.insert(0); |
443 separators.insert(1); | 486 separators.insert(1); |
444 separators.insert(9); | 487 separators.insert(9); |
445 InitCombobox(&separators, Combobox::STYLE_NORMAL); | 488 InitCombobox(&separators, Combobox::STYLE_NORMAL); |
446 for (int i = 0; i < combobox_->GetRowCount(); ++i) { | 489 for (int i = 0; i < combobox_->GetRowCount(); ++i) { |
447 if (separators.count(i) != 0) { | 490 if (separators.count(i) != 0) { |
448 EXPECT_TRUE(combobox_->GetTextForRow(i).empty()) << i; | 491 EXPECT_TRUE(combobox_->GetTextForRow(i).empty()) << i; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 } | 582 } |
540 | 583 |
541 TEST_F(ComboboxTest, NotifyOnClickWithReturnKey) { | 584 TEST_F(ComboboxTest, NotifyOnClickWithReturnKey) { |
542 InitCombobox(nullptr, Combobox::STYLE_NORMAL); | 585 InitCombobox(nullptr, Combobox::STYLE_NORMAL); |
543 | 586 |
544 TestComboboxListener listener; | 587 TestComboboxListener listener; |
545 combobox_->set_listener(&listener); | 588 combobox_->set_listener(&listener); |
546 | 589 |
547 // With STYLE_NORMAL, the click event is ignored. Instead the menu is shown. | 590 // With STYLE_NORMAL, the click event is ignored. Instead the menu is shown. |
548 PressKey(ui::VKEY_RETURN); | 591 PressKey(ui::VKEY_RETURN); |
549 EXPECT_EQ(1, menu_show_count_); | 592 EXPECT_EQ(PlatformStyle::kReturnClicksFocusedControl ? 1 : 0, |
593 menu_show_count_); | |
550 EXPECT_FALSE(listener.on_perform_action_called()); | 594 EXPECT_FALSE(listener.on_perform_action_called()); |
551 } | 595 } |
552 | 596 |
553 TEST_F(ComboboxTest, NotifyOnClickWithReturnKeyActionStyle) { | 597 TEST_F(ComboboxTest, NotifyOnClickWithReturnKeyActionStyle) { |
554 InitCombobox(nullptr, Combobox::STYLE_ACTION); | 598 InitCombobox(nullptr, Combobox::STYLE_ACTION); |
555 | 599 |
556 TestComboboxListener listener; | 600 TestComboboxListener listener; |
557 combobox_->set_listener(&listener); | 601 combobox_->set_listener(&listener); |
558 | 602 |
559 // With STYLE_ACTION, the click event is notified and the menu is not shown. | 603 // With STYLE_ACTION, the click event is notified and the menu is not shown. |
560 PressKey(ui::VKEY_RETURN); | 604 PressKey(ui::VKEY_RETURN); |
561 EXPECT_EQ(0, menu_show_count_); | 605 EXPECT_EQ(0, menu_show_count_); |
562 EXPECT_TRUE(listener.on_perform_action_called()); | 606 |
563 EXPECT_EQ(0, listener.perform_action_index()); | 607 if (PlatformStyle::kReturnClicksFocusedControl) { |
608 EXPECT_TRUE(listener.on_perform_action_called()); | |
609 EXPECT_EQ(0, listener.perform_action_index()); | |
610 } else { | |
611 EXPECT_FALSE(listener.on_perform_action_called()); | |
612 EXPECT_EQ(-1, listener.perform_action_index()); | |
613 } | |
564 } | 614 } |
565 | 615 |
566 TEST_F(ComboboxTest, NotifyOnClickWithSpaceKey) { | 616 TEST_F(ComboboxTest, NotifyOnClickWithSpaceKey) { |
567 InitCombobox(nullptr, Combobox::STYLE_NORMAL); | 617 InitCombobox(nullptr, Combobox::STYLE_NORMAL); |
568 | 618 |
569 TestComboboxListener listener; | 619 TestComboboxListener listener; |
570 combobox_->set_listener(&listener); | 620 combobox_->set_listener(&listener); |
571 | 621 |
572 // With STYLE_NORMAL, the click event is ignored. Instead the menu is shwon. | 622 // With STYLE_NORMAL, the click event is ignored. Instead the menu is shwon. |
573 PressKey(ui::VKEY_SPACE); | 623 PressKey(ui::VKEY_SPACE); |
574 EXPECT_EQ(1, menu_show_count_); | 624 EXPECT_EQ(1, menu_show_count_); |
575 EXPECT_FALSE(listener.on_perform_action_called()); | 625 EXPECT_FALSE(listener.on_perform_action_called()); |
576 | 626 |
577 ReleaseKey(ui::VKEY_SPACE); | 627 ReleaseKey(ui::VKEY_SPACE); |
578 EXPECT_EQ(1, menu_show_count_); | 628 EXPECT_EQ(1, menu_show_count_); |
579 EXPECT_FALSE(listener.on_perform_action_called()); | 629 EXPECT_FALSE(listener.on_perform_action_called()); |
580 } | 630 } |
581 | 631 |
582 TEST_F(ComboboxTest, NotifyOnClickWithSpaceKeyActionStyle) { | 632 TEST_F(ComboboxTest, NotifyOnClickWithSpaceKeyActionStyle) { |
583 InitCombobox(nullptr, Combobox::STYLE_ACTION); | 633 InitCombobox(nullptr, Combobox::STYLE_ACTION); |
584 | 634 |
585 TestComboboxListener listener; | 635 TestComboboxListener listener; |
586 combobox_->set_listener(&listener); | 636 combobox_->set_listener(&listener); |
587 | 637 |
588 // With STYLE_ACTION, the click event is notified after releasing and the menu | 638 // With STYLE_ACTION, the click event is notified after releasing and the menu |
589 // is not shown. | 639 // is not shown. On Mac the click event is notified on key press. |
590 PressKey(ui::VKEY_SPACE); | 640 PressKey(ui::VKEY_SPACE); |
591 EXPECT_EQ(0, menu_show_count_); | 641 EXPECT_EQ(0, menu_show_count_); |
642 #if defined(OS_MACOSX) | |
643 EXPECT_TRUE(listener.on_perform_action_called()); | |
644 EXPECT_EQ(0, listener.perform_action_index()); | |
645 #else | |
592 EXPECT_FALSE(listener.on_perform_action_called()); | 646 EXPECT_FALSE(listener.on_perform_action_called()); |
647 EXPECT_EQ(-1, listener.perform_action_index()); | |
648 #endif | |
593 | 649 |
594 ReleaseKey(ui::VKEY_SPACE); | 650 ReleaseKey(ui::VKEY_SPACE); |
595 EXPECT_EQ(0, menu_show_count_); | 651 EXPECT_EQ(0, menu_show_count_); |
596 EXPECT_TRUE(listener.on_perform_action_called()); | 652 EXPECT_TRUE(listener.on_perform_action_called()); |
597 EXPECT_EQ(0, listener.perform_action_index()); | 653 EXPECT_EQ(0, listener.perform_action_index()); |
598 } | 654 } |
599 | 655 |
600 TEST_F(ComboboxTest, NotifyOnClickWithMouse) { | 656 TEST_F(ComboboxTest, NotifyOnClickWithMouse) { |
601 InitCombobox(nullptr, Combobox::STYLE_ACTION); | 657 InitCombobox(nullptr, Combobox::STYLE_ACTION); |
602 | 658 |
(...skipping 28 matching lines...) Expand all Loading... | |
631 PerformMouseRelease(left_point); | 687 PerformMouseRelease(left_point); |
632 | 688 |
633 EXPECT_EQ(1, menu_show_count_); // Unchanged. | 689 EXPECT_EQ(1, menu_show_count_); // Unchanged. |
634 EXPECT_EQ(0, listener.perform_action_index()); | 690 EXPECT_EQ(0, listener.perform_action_index()); |
635 } | 691 } |
636 | 692 |
637 TEST_F(ComboboxTest, ConsumingPressKeyEvents) { | 693 TEST_F(ComboboxTest, ConsumingPressKeyEvents) { |
638 InitCombobox(nullptr, Combobox::STYLE_NORMAL); | 694 InitCombobox(nullptr, Combobox::STYLE_NORMAL); |
639 | 695 |
640 EXPECT_TRUE(combobox_->OnKeyPressed( | 696 EXPECT_TRUE(combobox_->OnKeyPressed( |
641 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE))); | 697 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE))); |
642 EXPECT_EQ(1, menu_show_count_); | 698 EXPECT_EQ(1, menu_show_count_); |
643 EXPECT_TRUE(combobox_->OnKeyPressed( | 699 |
644 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE))); | 700 ui::KeyEvent return_press(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE); |
645 EXPECT_EQ(2, menu_show_count_); | 701 if (PlatformStyle::kReturnClicksFocusedControl) { |
702 EXPECT_TRUE(combobox_->OnKeyPressed(return_press)); | |
703 EXPECT_EQ(2, menu_show_count_); | |
704 } else { | |
705 EXPECT_FALSE(combobox_->OnKeyPressed(return_press)); | |
706 EXPECT_EQ(1, menu_show_count_); | |
707 } | |
646 } | 708 } |
647 | 709 |
648 TEST_F(ComboboxTest, ConsumingKeyPressEventsActionStyle) { | 710 TEST_F(ComboboxTest, ConsumingKeyPressEventsActionStyle) { |
649 // When the combobox's style is STYLE_ACTION, pressing events of a space key | 711 // When the combobox's style is STYLE_ACTION, pressing events of a space key |
650 // or an enter key will be consumed and the menu is not shown. | 712 // or an enter key will be consumed and the menu is not shown. |
651 InitCombobox(nullptr, Combobox::STYLE_ACTION); | 713 InitCombobox(nullptr, Combobox::STYLE_ACTION); |
652 | 714 |
653 EXPECT_TRUE(combobox_->OnKeyPressed( | 715 EXPECT_EQ(PlatformStyle::kReturnClicksFocusedControl, |
654 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE))); | 716 combobox_->OnKeyPressed(ui::KeyEvent( |
717 ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE))); | |
655 EXPECT_EQ(0, menu_show_count_); | 718 EXPECT_EQ(0, menu_show_count_); |
656 EXPECT_TRUE(combobox_->OnKeyPressed( | 719 EXPECT_TRUE(combobox_->OnKeyPressed( |
657 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE))); | 720 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE))); |
658 EXPECT_EQ(0, menu_show_count_); | 721 EXPECT_EQ(0, menu_show_count_); |
659 } | 722 } |
660 | 723 |
661 TEST_F(ComboboxTest, ContentWidth) { | 724 TEST_F(ComboboxTest, ContentWidth) { |
662 std::vector<std::string> values; | 725 std::vector<std::string> values; |
663 VectorComboboxModel model(&values); | 726 VectorComboboxModel model(&values); |
664 TestCombobox combobox(&model, Combobox::STYLE_NORMAL); | 727 TestCombobox combobox(&model, Combobox::STYLE_NORMAL); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
829 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); | 892 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(0)); |
830 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); | 893 EXPECT_EQ(ui::MenuModel::TYPE_COMMAND, menu_model->GetTypeAt(1)); |
831 | 894 |
832 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); | 895 EXPECT_EQ(ASCIIToUTF16("PEANUT BUTTER"), menu_model->GetLabelAt(0)); |
833 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); | 896 EXPECT_EQ(ASCIIToUTF16("JELLY"), menu_model->GetLabelAt(1)); |
834 EXPECT_FALSE(menu_model->IsVisibleAt(0)); | 897 EXPECT_FALSE(menu_model->IsVisibleAt(0)); |
835 EXPECT_TRUE(menu_model->IsVisibleAt(1)); | 898 EXPECT_TRUE(menu_model->IsVisibleAt(1)); |
836 } | 899 } |
837 | 900 |
838 } // namespace views | 901 } // namespace views |
OLD | NEW |