| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/speech/speech_recognition_bubble_controller.h" | 8 #include "chrome/browser/speech/speech_recognition_bubble_controller.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 virtual void TearDown() { | 121 virtual void TearDown() { |
| 122 SpeechRecognitionBubble::set_factory(NULL); | 122 SpeechRecognitionBubble::set_factory(NULL); |
| 123 BrowserWithTestWindowTest::TearDown(); | 123 BrowserWithTestWindowTest::TearDown(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 static void ActivateBubble() { | 126 static void ActivateBubble() { |
| 127 if (MockSpeechRecognitionBubble::type() != | 127 if (MockSpeechRecognitionBubble::type() != |
| 128 MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED) { | 128 MockSpeechRecognitionBubble::BUBBLE_TEST_FOCUS_CHANGED) { |
| 129 test_fixture_->controller_->SetBubbleMessage(ASCIIToUTF16("Test")); | 129 test_fixture_->controller_->SetBubbleMessage(base::ASCIIToUTF16("Test")); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 static SpeechRecognitionBubble* CreateBubble( | 133 static SpeechRecognitionBubble* CreateBubble( |
| 134 WebContents* web_contents, | 134 WebContents* web_contents, |
| 135 SpeechRecognitionBubble::Delegate* delegate, | 135 SpeechRecognitionBubble::Delegate* delegate, |
| 136 const gfx::Rect& element_rect) { | 136 const gfx::Rect& element_rect) { |
| 137 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 137 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 138 // Set up to activate the bubble soon after it gets created, since we test | 138 // Set up to activate the bubble soon after it gets created, since we test |
| 139 // events sent by the bubble and those are handled only when the bubble is | 139 // events sent by the bubble and those are handled only when the bubble is |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 controller_->CreateBubble(kBubbleSessionId, 1, 1, gfx::Rect(1, 1)); | 207 controller_->CreateBubble(kBubbleSessionId, 1, 1, gfx::Rect(1, 1)); |
| 208 base::RunLoop().RunUntilIdle(); | 208 base::RunLoop().RunUntilIdle(); |
| 209 EXPECT_FALSE(cancel_clicked_); | 209 EXPECT_FALSE(cancel_clicked_); |
| 210 EXPECT_TRUE(try_again_clicked_); | 210 EXPECT_TRUE(try_again_clicked_); |
| 211 EXPECT_FALSE(focus_changed_); | 211 EXPECT_FALSE(focus_changed_); |
| 212 controller_->CloseBubble(); | 212 controller_->CloseBubble(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace speech | 215 } // namespace speech |
| OLD | NEW |