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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add loop to DataReductionProxyConfiguratorTest. Created 5 years, 8 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 "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"
11 #include "chrome/browser/ui/toolbar/test_toolbar_model.h" 11 #include "chrome/browser/ui/toolbar/test_toolbar_model.h"
12 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
13 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 using base::ASCIIToUTF16; 16 using base::ASCIIToUTF16;
16 using base::UTF8ToUTF16; 17 using base::UTF8ToUTF16;
17 using content::WebContents; 18 using content::WebContents;
18 19
19 namespace { 20 namespace {
20 21
21 class TestingOmniboxView : public OmniboxView { 22 class TestingOmniboxView : public OmniboxView {
22 public: 23 public:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 DISALLOW_COPY_AND_ASSIGN(TestingOmniboxEditController); 123 DISALLOW_COPY_AND_ASSIGN(TestingOmniboxEditController);
123 }; 124 };
124 125
125 } // namespace 126 } // namespace
126 127
127 class AutocompleteEditTest : public ::testing::Test { 128 class AutocompleteEditTest : public ::testing::Test {
128 public: 129 public:
129 TestToolbarModel* toolbar_model() { return &toolbar_model_; } 130 TestToolbarModel* toolbar_model() { return &toolbar_model_; }
130 131
131 private: 132 private:
133 content::TestBrowserThreadBundle thread_bundle_;
132 TestToolbarModel toolbar_model_; 134 TestToolbarModel toolbar_model_;
133 }; 135 };
134 136
135 // Tests various permutations of AutocompleteModel::AdjustTextForCopy. 137 // Tests various permutations of AutocompleteModel::AdjustTextForCopy.
136 TEST_F(AutocompleteEditTest, AdjustTextForCopy) { 138 TEST_F(AutocompleteEditTest, AdjustTextForCopy) {
137 struct Data { 139 struct Data {
138 const char* perm_text; 140 const char* perm_text;
139 const int sel_start; 141 const int sel_start;
140 const bool is_all_selected; 142 const bool is_all_selected;
141 const char* input; 143 const char* input;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 252
251 model.SetUserText(UTF8ToUTF16("he")); 253 model.SetUserText(UTF8ToUTF16("he"));
252 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false); 254 model.OnPopupDataChanged(UTF8ToUTF16("llo"), NULL, base::string16(), false);
253 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); 255 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText());
254 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text()); 256 EXPECT_EQ(UTF8ToUTF16("llo"), view.inline_autocomplete_text());
255 257
256 model.AcceptTemporaryTextAsUserText(); 258 model.AcceptTemporaryTextAsUserText();
257 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText()); 259 EXPECT_EQ(UTF8ToUTF16("hello"), view.GetText());
258 EXPECT_EQ(base::string16(), view.inline_autocomplete_text()); 260 EXPECT_EQ(base::string16(), view.inline_autocomplete_text());
259 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698