| 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 6 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 7 #include "chrome/browser/search_engines/template_url_service_factory.h" | 7 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
| 9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 9 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 10 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 10 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 public: | 102 public: |
| 103 explicit TestingOmniboxEditController(ToolbarModel* toolbar_model) | 103 explicit TestingOmniboxEditController(ToolbarModel* toolbar_model) |
| 104 : OmniboxEditController(NULL), | 104 : OmniboxEditController(NULL), |
| 105 toolbar_model_(toolbar_model) { | 105 toolbar_model_(toolbar_model) { |
| 106 } | 106 } |
| 107 | 107 |
| 108 // OmniboxEditController: | 108 // OmniboxEditController: |
| 109 virtual void Update(const content::WebContents* contents) OVERRIDE {} | 109 virtual void Update(const content::WebContents* contents) OVERRIDE {} |
| 110 virtual void OnChanged() OVERRIDE {} | 110 virtual void OnChanged() OVERRIDE {} |
| 111 virtual void OnSetFocus() OVERRIDE {} | 111 virtual void OnSetFocus() OVERRIDE {} |
| 112 virtual void ShowURL() OVERRIDE {} |
| 112 virtual InstantController* GetInstant() OVERRIDE { return NULL; } | 113 virtual InstantController* GetInstant() OVERRIDE { return NULL; } |
| 113 virtual WebContents* GetWebContents() OVERRIDE { return NULL; } | 114 virtual WebContents* GetWebContents() OVERRIDE { return NULL; } |
| 114 virtual ToolbarModel* GetToolbarModel() OVERRIDE { return toolbar_model_; } | 115 virtual ToolbarModel* GetToolbarModel() OVERRIDE { return toolbar_model_; } |
| 115 virtual const ToolbarModel* GetToolbarModel() const OVERRIDE { | 116 virtual const ToolbarModel* GetToolbarModel() const OVERRIDE { |
| 116 return toolbar_model_; | 117 return toolbar_model_; |
| 117 } | 118 } |
| 118 | 119 |
| 120 protected: |
| 121 // OmniboxEditController: |
| 122 virtual void HideURLAndShowOriginChip() OVERRIDE {} |
| 123 |
| 119 private: | 124 private: |
| 120 ToolbarModel* toolbar_model_; | 125 ToolbarModel* toolbar_model_; |
| 121 | 126 |
| 122 DISALLOW_COPY_AND_ASSIGN(TestingOmniboxEditController); | 127 DISALLOW_COPY_AND_ASSIGN(TestingOmniboxEditController); |
| 123 }; | 128 }; |
| 124 | 129 |
| 125 } // namespace | 130 } // namespace |
| 126 | 131 |
| 127 class AutocompleteEditTest : public ::testing::Test { | 132 class AutocompleteEditTest : public ::testing::Test { |
| 128 public: | 133 public: |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 255 |
| 251 model.SetUserText(UTF8ToUTF16("he")); | 256 model.SetUserText(UTF8ToUTF16("he")); |
| 252 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); | 257 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); |
| 253 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 258 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 254 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); | 259 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); |
| 255 | 260 |
| 256 model.AcceptTemporaryTextAsUserText(); | 261 model.AcceptTemporaryTextAsUserText(); |
| 257 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); | 262 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); |
| 258 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); | 263 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); |
| 259 } | 264 } |
| OLD | NEW |