+// Disabled because of memory leaks, see http://crbug.com/341042.
+TEST_F(ComboboxTest, DISABLED_ContentWidth) {
+ std::vector<std::string> values;
+
+ scoped_ptr<VectorComboboxModel> model(new VectorComboboxModel(&values));
+ combobox_ = new TestCombobox(model.get());
+
+ std::string long_item = "this is the long item";
+ std::string short_item = "s";
+
+ values.resize(1);
+ values[0] = long_item;
+ combobox_->ModelChanged();
+
+ const int long_item_width = combobox_->content_size_.width();
+
+ values[0] = short_item;
+ combobox_->ModelChanged();
+
+ const int short_item_width = combobox_->content_size_.width();
+
+ values.resize(2);
+ values[0] = short_item;
+ values[1] = long_item;
+ combobox_->ModelChanged();
+
+ // When the style is STYLE_NORMAL, the width will fit with the longest item.
+ combobox_->SetStyle(Combobox::STYLE_NORMAL);
+ EXPECT_EQ(long_item_width, combobox_->content_size_.width());
+
+ // When the style is STYLE_ACTION, the width will fit with the first items'
+ // width.
+ combobox_->SetStyle(Combobox::STYLE_ACTION);
+ EXPECT_EQ(short_item_width, combobox_->content_size_.width());
+}
+
+TEST_F(ComboboxTest, TypingPrefixNotifiesListener) {
+ InitCombobox();
+
+ TestComboboxListener listener;
+ combobox_->set_listener(&listener);
+
+ // Type the first character of the second menu item ("JELLY").
+ combobox_->GetTextInputClient()->InsertChar('J', ui::EF_NONE);
+ EXPECT_EQ(1, listener.actions_performed());
+ EXPECT_EQ(1, listener.perform_action_index());
+
+ // Type the second character of "JELLY", item shouldn't change and
+ // OnPerformAction() shouldn't be re-called.
+ combobox_->GetTextInputClient()->InsertChar('E', ui::EF_NONE);
+ EXPECT_EQ(1, listener.actions_performed());
+ EXPECT_EQ(1, listener.perform_action_index());
+
+ // Clears the typed text.
+ combobox_->OnBlur();
+
+ // Type the first character of "PEANUT BUTTER", which should change the
+ // selected index and perform an action.
+ combobox_->GetTextInputClient()->InsertChar('P', ui::EF_NONE);
+ EXPECT_EQ(2, listener.actions_performed());
+ EXPECT_EQ(2, listener.perform_action_index());
+}
+