Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Unified Diff: ui/views/controls/prefix_selector_unittest.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/prefix_selector.cc ('k') | ui/views/controls/progress_bar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/prefix_selector_unittest.cc
diff --git a/ui/views/controls/prefix_selector_unittest.cc b/ui/views/controls/prefix_selector_unittest.cc
deleted file mode 100644
index ce041804f703e95d10781bdb4311458f3a51cd51..0000000000000000000000000000000000000000
--- a/ui/views/controls/prefix_selector_unittest.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/views/controls/prefix_selector.h"
-
-#include <string>
-
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "ui/views/controls/prefix_delegate.h"
-#include "ui/views/test/views_test_base.h"
-
-using base::ASCIIToUTF16;
-
-namespace views {
-
-class TestPrefixDelegate : public PrefixDelegate {
- public:
- TestPrefixDelegate() : selected_row_(0) {
- rows_.push_back(ASCIIToUTF16("aardvark"));
- rows_.push_back(ASCIIToUTF16("antelope"));
- rows_.push_back(ASCIIToUTF16("badger"));
- rows_.push_back(ASCIIToUTF16("gnu"));
- }
-
- virtual ~TestPrefixDelegate() {}
-
- virtual int GetRowCount() override {
- return static_cast<int>(rows_.size());
- }
-
- virtual int GetSelectedRow() override {
- return selected_row_;
- }
-
- virtual void SetSelectedRow(int row) override {
- selected_row_ = row;
- }
-
- virtual base::string16 GetTextForRow(int row) override {
- return rows_[row];
- }
-
- private:
- std::vector<base::string16> rows_;
- int selected_row_;
-
- DISALLOW_COPY_AND_ASSIGN(TestPrefixDelegate);
-};
-
-class PrefixSelectorTest : public ViewsTestBase {
- public:
- PrefixSelectorTest() {
- selector_.reset(new PrefixSelector(&delegate_));
- }
-
- protected:
- scoped_ptr<PrefixSelector> selector_;
- TestPrefixDelegate delegate_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PrefixSelectorTest);
-};
-
-TEST_F(PrefixSelectorTest, PrefixSelect) {
- selector_->InsertText(ASCIIToUTF16("an"));
- EXPECT_EQ(1, delegate_.GetSelectedRow());
-
- // Invoke OnViewBlur() to reset time.
- selector_->OnViewBlur();
- selector_->InsertText(ASCIIToUTF16("a"));
- EXPECT_EQ(0, delegate_.GetSelectedRow());
-
- selector_->OnViewBlur();
- selector_->InsertText(ASCIIToUTF16("g"));
- EXPECT_EQ(3, delegate_.GetSelectedRow());
-
- selector_->OnViewBlur();
- selector_->InsertText(ASCIIToUTF16("b"));
- selector_->InsertText(ASCIIToUTF16("a"));
- EXPECT_EQ(2, delegate_.GetSelectedRow());
-
- selector_->OnViewBlur();
- selector_->InsertText(ASCIIToUTF16("\t"));
- selector_->InsertText(ASCIIToUTF16("b"));
- selector_->InsertText(ASCIIToUTF16("a"));
- EXPECT_EQ(2, delegate_.GetSelectedRow());
-}
-
-} // namespace views
« no previous file with comments | « ui/views/controls/prefix_selector.cc ('k') | ui/views/controls/progress_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698