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

Unified Diff: chrome/browser/speech/speech_recognition_bubble_controller.cc

Issue 10703141: End-to-end browser tests for speech recognition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/speech/speech_recognition_bubble_controller.cc
diff --git a/chrome/browser/speech/speech_recognition_bubble_controller.cc b/chrome/browser/speech/speech_recognition_bubble_controller.cc
index 930b5cbf60c4bdc631e6b3e0fcddd3e38f61f6bc..ef7c184ea8c0302175c4e9c6bb36ca6188d28143 100644
--- a/chrome/browser/speech/speech_recognition_bubble_controller.cc
+++ b/chrome/browser/speech/speech_recognition_bubble_controller.cc
@@ -23,6 +23,22 @@ const int kInvalidSessionId = 0;
namespace speech {
+SpeechRecognitionBubbleControllerDelegateForTests*
+SpeechRecognitionBubbleController::delegate_for_tests_ = NULL;
+
+SpeechRecognitionBubbleController*
+SpeechRecognitionBubbleController::instance_for_tests_ = NULL;
+
+void SpeechRecognitionBubbleController::SetDelegateForTests(
+ DelegateForTests* delegate_for_tests) {
+ delegate_for_tests_ = delegate_for_tests;
+}
+
+SpeechRecognitionBubbleController*
+SpeechRecognitionBubbleController::GetInstanceForTests() {
+ return instance_for_tests_;
+}
+
SpeechRecognitionBubbleController::SpeechRecognitionBubbleController(
Delegate* delegate)
: delegate_(delegate),
@@ -30,10 +46,12 @@ SpeechRecognitionBubbleController::SpeechRecognitionBubbleController(
current_bubble_render_process_id_(0),
current_bubble_render_view_id_(0),
last_request_issued_(REQUEST_CLOSE) {
+ instance_for_tests_ = this;
}
SpeechRecognitionBubbleController::~SpeechRecognitionBubbleController() {
DCHECK_EQ(kInvalidSessionId, current_bubble_session_id_);
+ instance_for_tests_ = NULL;
}
void SpeechRecognitionBubbleController::CreateBubble(
@@ -158,25 +176,37 @@ void SpeechRecognitionBubbleController::ProcessRequestInUiThread(
}
bubble_->Show();
bubble_->SetWarmUpMode();
+ if (delegate_for_tests_)
+ delegate_for_tests_->BubbleCreated();
break;
case REQUEST_SET_RECORDING_MODE:
DCHECK(bubble_.get());
bubble_->SetRecordingMode();
+ if (delegate_for_tests_)
+ delegate_for_tests_->BubbleSwitchedToRecordingMode();
break;
case REQUEST_SET_RECOGNIZING_MODE:
DCHECK(bubble_.get());
bubble_->SetRecognizingMode();
+ if (delegate_for_tests_)
+ delegate_for_tests_->BubbleSwitchedToRecognizingMode();
break;
case REQUEST_SET_MESSAGE:
DCHECK(bubble_.get());
bubble_->SetMessage(request.message);
+ if (delegate_for_tests_)
+ delegate_for_tests_->BubbleMessageDisplayed();
break;
case REQUEST_SET_INPUT_VOLUME:
DCHECK(bubble_.get());
bubble_->SetInputVolume(request.volume, request.noise_volume);
break;
case REQUEST_CLOSE:
- bubble_.reset();
+ if (bubble_.get()) {
+ bubble_.reset();
+ if (delegate_for_tests_)
+ delegate_for_tests_->BubbleClosed();
+ }
break;
default:
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698