| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // A concrete class is needed to test the combobox. | 87 // A concrete class is needed to test the combobox. |
| 88 class TestComboboxModel : public ui::ComboboxModel { | 88 class TestComboboxModel : public ui::ComboboxModel { |
| 89 public: | 89 public: |
| 90 TestComboboxModel() {} | 90 TestComboboxModel() {} |
| 91 virtual ~TestComboboxModel() {} | 91 virtual ~TestComboboxModel() {} |
| 92 | 92 |
| 93 // ui::ComboboxModel: | 93 // ui::ComboboxModel: |
| 94 virtual int GetItemCount() const OVERRIDE { | 94 virtual int GetItemCount() const OVERRIDE { |
| 95 return 10; | 95 return 10; |
| 96 } | 96 } |
| 97 virtual string16 GetItemAt(int index) OVERRIDE { | 97 virtual base::string16 GetItemAt(int index) OVERRIDE { |
| 98 if (IsItemSeparatorAt(index)) { | 98 if (IsItemSeparatorAt(index)) { |
| 99 NOTREACHED(); | 99 NOTREACHED(); |
| 100 return ASCIIToUTF16("SEPARATOR"); | 100 return ASCIIToUTF16("SEPARATOR"); |
| 101 } | 101 } |
| 102 return ASCIIToUTF16(index % 2 == 0 ? "PEANUT BUTTER" : "JELLY"); | 102 return ASCIIToUTF16(index % 2 == 0 ? "PEANUT BUTTER" : "JELLY"); |
| 103 } | 103 } |
| 104 virtual bool IsItemSeparatorAt(int index) OVERRIDE { | 104 virtual bool IsItemSeparatorAt(int index) OVERRIDE { |
| 105 return separators_.find(index) != separators_.end(); | 105 return separators_.find(index) != separators_.end(); |
| 106 } | 106 } |
| 107 | 107 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 test_api.reset( | 531 test_api.reset( |
| 532 new test::MenuRunnerTestAPI(combobox_->dropdown_list_menu_runner_.get())); | 532 new test::MenuRunnerTestAPI(combobox_->dropdown_list_menu_runner_.get())); |
| 533 test_api->SetMenuRunnerHandler(menu_runner_handler.Pass()); | 533 test_api->SetMenuRunnerHandler(menu_runner_handler.Pass()); |
| 534 PerformClick(gfx::Point(combobox_->x() + 1, | 534 PerformClick(gfx::Point(combobox_->x() + 1, |
| 535 combobox_->y() + combobox_->height() / 2)); | 535 combobox_->y() + combobox_->height() / 2)); |
| 536 EXPECT_TRUE(listener.on_combobox_text_button_clicked_called()); | 536 EXPECT_TRUE(listener.on_combobox_text_button_clicked_called()); |
| 537 EXPECT_FALSE(test_menu_runner_handler->executed()); | 537 EXPECT_FALSE(test_menu_runner_handler->executed()); |
| 538 } | 538 } |
| 539 | 539 |
| 540 } // namespace views | 540 } // namespace views |
| OLD | NEW |