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 327 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 |