| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/omnibox/browser/autocomplete_classifier.h" | 10 #include "components/omnibox/browser/autocomplete_classifier.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 const base::string16& display_text, | 44 const base::string16& display_text, |
| 45 bool update_popup) override { | 45 bool update_popup) override { |
| 46 text_ = display_text; | 46 text_ = display_text; |
| 47 } | 47 } |
| 48 void SetWindowTextAndCaretPos(const base::string16& text, | 48 void SetWindowTextAndCaretPos(const base::string16& text, |
| 49 size_t caret_pos, | 49 size_t caret_pos, |
| 50 bool update_popup, | 50 bool update_popup, |
| 51 bool notify_text_changed) override { | 51 bool notify_text_changed) override { |
| 52 text_ = text; | 52 text_ = text; |
| 53 } | 53 } |
| 54 void SetForcedQuery() override {} | 54 void EnterKeywordModeForDefaultSearchProvider() override {} |
| 55 bool IsSelectAll() const override { return false; } | 55 bool IsSelectAll() const override { return false; } |
| 56 bool DeleteAtEndPressed() override { return false; } | 56 bool DeleteAtEndPressed() override { return false; } |
| 57 void GetSelectionBounds(size_t* start, size_t* end) const override {} | 57 void GetSelectionBounds(size_t* start, size_t* end) const override {} |
| 58 void SelectAll(bool reversed) override {} | 58 void SelectAll(bool reversed) override {} |
| 59 void RevertAll() override {} | 59 void RevertAll() override {} |
| 60 void UpdatePopup() override {} | 60 void UpdatePopup() override {} |
| 61 void SetFocus() override {} | 61 void SetFocus() override {} |
| 62 void ApplyCaretVisibility() override {} | 62 void ApplyCaretVisibility() override {} |
| 63 void OnTemporaryTextMaybeChanged(const base::string16& display_text, | 63 void OnTemporaryTextMaybeChanged(const base::string16& display_text, |
| 64 bool save_original_selection, | 64 bool save_original_selection, |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 make_scoped_ptr(new TestingOmniboxClient())); | 338 make_scoped_ptr(new TestingOmniboxClient())); |
| 339 | 339 |
| 340 // Test if the model updates the inline autocomplete text in the view. | 340 // Test if the model updates the inline autocomplete text in the view. |
| 341 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); | 341 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); |
| 342 model.SetUserText(UTF8ToUTF16("he")); | 342 model.SetUserText(UTF8ToUTF16("he")); |
| 343 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); | 343 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); |
| 344 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 344 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 345 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); | 345 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); |
| 346 | 346 |
| 347 model.OnAfterPossibleChange(UTF8ToUTF16("he"), UTF8ToUTF16("hel"), 3, 3, | 347 model.OnAfterPossibleChange(UTF8ToUTF16("he"), UTF8ToUTF16("hel"), 3, 3, |
| 348 false, true, false, true); | 348 false, true, false, false, true); |
| 349 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); | 349 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); |
| 350 model.OnPopupDataChanged(UTF8ToUTF16("lo"), NULL, base::string16(), false); | 350 model.OnPopupDataChanged(UTF8ToUTF16("lo"), NULL, base::string16(), false); |
| 351 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 351 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 352 EXPECT_EQ(UTF8ToUTF16("lo"), view.inline_autocomplete_text()); | 352 EXPECT_EQ(UTF8ToUTF16("lo"), view.inline_autocomplete_text()); |
| 353 | 353 |
| 354 model.Revert(); | 354 model.Revert(); |
| 355 EXPECT_EQ(base::string16(), view.GetText()); | 355 EXPECT_EQ(base::string16(), view.GetText()); |
| 356 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); | 356 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); |
| 357 | 357 |
| 358 model.SetUserText(UTF8ToUTF16("he")); | 358 model.SetUserText(UTF8ToUTF16("he")); |
| 359 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); | 359 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); |
| 360 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 360 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 361 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); | 361 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); |
| 362 | 362 |
| 363 model.AcceptTemporaryTextAsUserText(); | 363 model.AcceptTemporaryTextAsUserText(); |
| 364 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 364 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 365 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); | 365 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); |
| 366 } | 366 } |
| OLD | NEW |