OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/speech/speech_input_bubble_controller.h" | 7 #include "chrome/browser/speech/speech_input_bubble_controller.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/test/base/browser_with_test_window_test.h" | 9 #include "chrome/test/base/browser_with_test_window_test.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // SpeechInputBubbleControllerDelegate methods. | 92 // SpeechInputBubbleControllerDelegate methods. |
93 virtual void InfoBubbleButtonClicked(int caller_id, | 93 virtual void InfoBubbleButtonClicked(int caller_id, |
94 SpeechInputBubble::Button button) { | 94 SpeechInputBubble::Button button) { |
95 VLOG(1) << "Received InfoBubbleButtonClicked for button " << button; | 95 VLOG(1) << "Received InfoBubbleButtonClicked for button " << button; |
96 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 96 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
97 if (button == SpeechInputBubble::BUTTON_CANCEL) { | 97 if (button == SpeechInputBubble::BUTTON_CANCEL) { |
98 cancel_clicked_ = true; | 98 cancel_clicked_ = true; |
99 } else if (button == SpeechInputBubble::BUTTON_TRY_AGAIN) { | 99 } else if (button == SpeechInputBubble::BUTTON_TRY_AGAIN) { |
100 try_again_clicked_ = true; | 100 try_again_clicked_ = true; |
101 } | 101 } |
102 message_loop()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 102 message_loop()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
103 } | 103 } |
104 | 104 |
105 virtual void InfoBubbleFocusChanged(int caller_id) { | 105 virtual void InfoBubbleFocusChanged(int caller_id) { |
106 VLOG(1) << "Received InfoBubbleFocusChanged"; | 106 VLOG(1) << "Received InfoBubbleFocusChanged"; |
107 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 107 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
108 focus_changed_ = true; | 108 focus_changed_ = true; |
109 message_loop()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 109 message_loop()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
110 } | 110 } |
111 | 111 |
112 // testing::Test methods. | 112 // testing::Test methods. |
113 virtual void SetUp() { | 113 virtual void SetUp() { |
114 BrowserWithTestWindowTest::SetUp(); | 114 BrowserWithTestWindowTest::SetUp(); |
115 SpeechInputBubble::set_factory( | 115 SpeechInputBubble::set_factory( |
116 &SpeechInputBubbleControllerTest::CreateBubble); | 116 &SpeechInputBubbleControllerTest::CreateBubble); |
117 io_thread_.Start(); | 117 io_thread_.Start(); |
118 } | 118 } |
119 | 119 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 controller_->CreateBubble(kBubbleCallerId, 1, 1, gfx::Rect(1, 1)); | 210 controller_->CreateBubble(kBubbleCallerId, 1, 1, gfx::Rect(1, 1)); |
211 MessageLoop::current()->Run(); | 211 MessageLoop::current()->Run(); |
212 EXPECT_FALSE(cancel_clicked_); | 212 EXPECT_FALSE(cancel_clicked_); |
213 EXPECT_TRUE(try_again_clicked_); | 213 EXPECT_TRUE(try_again_clicked_); |
214 EXPECT_FALSE(focus_changed_); | 214 EXPECT_FALSE(focus_changed_); |
215 controller_->CloseBubble(kBubbleCallerId); | 215 controller_->CloseBubble(kBubbleCallerId); |
216 } | 216 } |
217 | 217 |
218 } // namespace speech_input | 218 } // namespace speech_input |
OLD | NEW |