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

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

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.h
diff --git a/chrome/browser/speech/speech_recognition_bubble_controller.h b/chrome/browser/speech/speech_recognition_bubble_controller.h
index e5b18a5aded734c062aef46d30dfeddedd2986ab..f4b50152578d9835fad33dbc440d52f1db1ce3ab 100644
--- a/chrome/browser/speech/speech_recognition_bubble_controller.h
+++ b/chrome/browser/speech/speech_recognition_bubble_controller.h
@@ -35,6 +35,19 @@ class SpeechRecognitionBubbleController
virtual ~Delegate() {}
};
+ // All methods of this delegate are called on the UI thread.
+ class DelegateForTests {
jam 2012/07/11 15:59:04 I haven't seen this pattern before. it seems unfor
Primiano Tucci (use gerrit) 2012/07/11 16:15:49 Unfortunately, I have no other idea on how to chec
+ public:
+ virtual void BubbleCreated() = 0;
+ virtual void BubbleSwitchedToRecordingMode() = 0;
+ virtual void BubbleSwitchedToRecognizingMode() = 0;
+ virtual void BubbleMessageDisplayed() = 0;
+ virtual void BubbleClosed() = 0;
+ };
+
+ static void SetDelegateForTests(DelegateForTests* delegate_for_tests);
+ static SpeechRecognitionBubbleController* GetInstanceForTests();
+
explicit SpeechRecognitionBubbleController(Delegate* delegate);
// Creates and shows a new speech recognition UI bubble in warmup mode.
@@ -105,6 +118,12 @@ class SpeechRecognitionBubbleController
void InvokeDelegateFocusChanged();
void ProcessRequestInUiThread(const UIRequest& request);
+ // Instance getter for simulating button presses during tests.
+ static SpeechRecognitionBubbleController* instance_for_tests_;
+
+ // Delegate for receiving events on the UI thread during tests.
+ static DelegateForTests* delegate_for_tests_;
+
// *** The following are accessed only on the IO thread.
Delegate* delegate_;
@@ -128,6 +147,9 @@ class SpeechRecognitionBubbleController
typedef SpeechRecognitionBubbleController::Delegate
SpeechRecognitionBubbleControllerDelegate;
+typedef SpeechRecognitionBubbleController::DelegateForTests
+ SpeechRecognitionBubbleControllerDelegateForTests;
+
} // namespace speech
#endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_BUBBLE_CONTROLLER_H_
« no previous file with comments | « chrome/browser/speech/speech_recognition_browsertest.cc ('k') | chrome/browser/speech/speech_recognition_bubble_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698