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

Side by Side Diff: components/omnibox/browser/omnibox_edit_unittest.cc

Issue 1943683002: Refactor OmniboxEditModel::user_text_ to not include keyword (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test coverage & refactor Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 24 matching lines...) Expand all
35 35
36 // OmniboxView: 36 // OmniboxView:
37 void Update() override {} 37 void Update() override {}
38 void OpenMatch(const AutocompleteMatch& match, 38 void OpenMatch(const AutocompleteMatch& match,
39 WindowOpenDisposition disposition, 39 WindowOpenDisposition disposition,
40 const GURL& alternate_nav_url, 40 const GURL& alternate_nav_url,
41 const base::string16& pasted_text, 41 const base::string16& pasted_text,
42 size_t selected_line) override {} 42 size_t selected_line) override {}
43 base::string16 GetText() const override { return text_; } 43 base::string16 GetText() const override { return text_; }
44 void SetUserText(const base::string16& text, 44 void SetUserText(const base::string16& text,
45 const base::string16& display_text,
46 bool update_popup) override { 45 bool update_popup) override {
47 text_ = display_text; 46 text_ = text;
48 } 47 }
49 void SetWindowTextAndCaretPos(const base::string16& text, 48 void SetWindowTextAndCaretPos(const base::string16& text,
50 size_t caret_pos, 49 size_t caret_pos,
51 bool update_popup, 50 bool update_popup,
52 bool notify_text_changed) override { 51 bool notify_text_changed) override {
53 text_ = text; 52 text_ = text;
54 } 53 }
55 void SetForcedQuery() override {} 54 void SetForcedQuery() override {}
56 bool IsSelectAll() const override { return false; } 55 bool IsSelectAll() const override { return false; }
57 bool DeleteAtEndPressed() override { return false; } 56 bool DeleteAtEndPressed() override { return false; }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 358
360 model.SetUserText(UTF8ToUTF16("he")); 359 model.SetUserText(UTF8ToUTF16("he"));
361 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); 360 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false);
362 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); 361 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText());
363 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); 362 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text());
364 363
365 model.AcceptTemporaryTextAsUserText(); 364 model.AcceptTemporaryTextAsUserText();
366 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); 365 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText());
367 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); 366 EXPECT_EQ(base::string16(), view.inline_autocomplete_text());
368 } 367 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_edit_model.cc ('k') | components/omnibox/browser/omnibox_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698