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/prefix_selector.h" | 5 #include "ui/views/controls/prefix_selector.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 virtual int GetSelectedRow() OVERRIDE { | 31 virtual int GetSelectedRow() OVERRIDE { |
32 return selected_row_; | 32 return selected_row_; |
33 } | 33 } |
34 | 34 |
35 virtual void SetSelectedRow(int row) OVERRIDE { | 35 virtual void SetSelectedRow(int row) OVERRIDE { |
36 selected_row_ = row; | 36 selected_row_ = row; |
37 } | 37 } |
38 | 38 |
39 virtual string16 GetTextForRow(int row) OVERRIDE { | 39 virtual base::string16 GetTextForRow(int row) OVERRIDE { |
40 return rows_[row]; | 40 return rows_[row]; |
41 } | 41 } |
42 | 42 |
43 private: | 43 private: |
44 std::vector<string16> rows_; | 44 std::vector<base::string16> rows_; |
45 int selected_row_; | 45 int selected_row_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(TestPrefixDelegate); | 47 DISALLOW_COPY_AND_ASSIGN(TestPrefixDelegate); |
48 }; | 48 }; |
49 | 49 |
50 class PrefixSelectorTest : public ViewsTestBase { | 50 class PrefixSelectorTest : public ViewsTestBase { |
51 public: | 51 public: |
52 PrefixSelectorTest() { | 52 PrefixSelectorTest() { |
53 selector_.reset(new PrefixSelector(&delegate_)); | 53 selector_.reset(new PrefixSelector(&delegate_)); |
54 } | 54 } |
(...skipping 25 matching lines...) Expand all Loading... |
80 EXPECT_EQ(2, delegate_.GetSelectedRow()); | 80 EXPECT_EQ(2, delegate_.GetSelectedRow()); |
81 | 81 |
82 selector_->OnViewBlur(); | 82 selector_->OnViewBlur(); |
83 selector_->InsertText(ASCIIToUTF16("\t")); | 83 selector_->InsertText(ASCIIToUTF16("\t")); |
84 selector_->InsertText(ASCIIToUTF16("b")); | 84 selector_->InsertText(ASCIIToUTF16("b")); |
85 selector_->InsertText(ASCIIToUTF16("a")); | 85 selector_->InsertText(ASCIIToUTF16("a")); |
86 EXPECT_EQ(2, delegate_.GetSelectedRow()); | 86 EXPECT_EQ(2, delegate_.GetSelectedRow()); |
87 } | 87 } |
88 | 88 |
89 } // namespace views | 89 } // namespace views |
OLD | NEW |