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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/command_updater.h" 8 #include "chrome/browser/command_updater.h"
9 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" 9 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
11 #include "content/public/test/test_browser_thread_bundle.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 #if defined(OS_CHROMEOS) 14 #if defined(OS_CHROMEOS)
14 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 15 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
15 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 16 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
16 #endif 17 #endif
17 18
18 namespace { 19 namespace {
19 20
20 class TestingOmniboxViewViews : public OmniboxViewViews { 21 class TestingOmniboxViewViews : public OmniboxViewViews {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 omnibox_view_->Init(); 100 omnibox_view_->Init();
100 } 101 }
101 102
102 void TearDown() override { 103 void TearDown() override {
103 omnibox_view_.reset(); 104 omnibox_view_.reset();
104 #if defined(OS_CHROMEOS) 105 #if defined(OS_CHROMEOS)
105 chromeos::input_method::Shutdown(); 106 chromeos::input_method::Shutdown();
106 #endif 107 #endif
107 } 108 }
108 109
110 content::TestBrowserThreadBundle thread_bundle_;
109 TestingProfile profile_; 111 TestingProfile profile_;
110 CommandUpdater command_updater_; 112 CommandUpdater command_updater_;
111 TestingOmniboxEditController omnibox_edit_controller_; 113 TestingOmniboxEditController omnibox_edit_controller_;
112 scoped_ptr<TestingOmniboxViewViews> omnibox_view_; 114 scoped_ptr<TestingOmniboxViewViews> omnibox_view_;
113 }; 115 };
114 116
115 // Checks that a single change of the text in the omnibox invokes 117 // Checks that a single change of the text in the omnibox invokes
116 // only one call to OmniboxViewViews::UpdatePopup(). 118 // only one call to OmniboxViewViews::UpdatePopup().
117 TEST_F(OmniboxViewViewsTest, UpdatePopupCall) { 119 TEST_F(OmniboxViewViewsTest, UpdatePopupCall) {
118 omnibox_textfield()->InsertChar('a', 0); 120 omnibox_textfield()->InsertChar('a', 0);
119 omnibox_view()->CheckUpdatePopupCallInfo( 121 omnibox_view()->CheckUpdatePopupCallInfo(
120 1, base::ASCIIToUTF16("a"), gfx::Range(1)); 122 1, base::ASCIIToUTF16("a"), gfx::Range(1));
121 123
122 omnibox_textfield()->InsertChar('b', 0); 124 omnibox_textfield()->InsertChar('b', 0);
123 omnibox_view()->CheckUpdatePopupCallInfo( 125 omnibox_view()->CheckUpdatePopupCallInfo(
124 2, base::ASCIIToUTF16("ab"), gfx::Range(2)); 126 2, base::ASCIIToUTF16("ab"), gfx::Range(2));
125 127
126 ui::KeyEvent pressed(ui::ET_KEY_PRESSED, ui::VKEY_BACK, 0); 128 ui::KeyEvent pressed(ui::ET_KEY_PRESSED, ui::VKEY_BACK, 0);
127 omnibox_textfield()->OnKeyPressed(pressed); 129 omnibox_textfield()->OnKeyPressed(pressed);
128 omnibox_view()->CheckUpdatePopupCallInfo( 130 omnibox_view()->CheckUpdatePopupCallInfo(
129 3, base::ASCIIToUTF16("a"), gfx::Range(1)); 131 3, base::ASCIIToUTF16("a"), gfx::Range(1));
130 } 132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698