Chromium Code Reviews| 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_ |