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

Side by Side Diff: chrome/browser/speech/speech_recognition_bubble_controller_unittest.cc

Issue 148343008: Speech Recognition API: Safeguarding against page closes during startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // passed to CreateBubble would not have matched any active tab. So get a 145 // passed to CreateBubble would not have matched any active tab. So get a
146 // real WebContents pointer from the test fixture and pass that, because 146 // real WebContents pointer from the test fixture and pass that, because
147 // the bubble controller registers for tab close notifications which need 147 // the bubble controller registers for tab close notifications which need
148 // a valid WebContents. 148 // a valid WebContents.
149 web_contents = 149 web_contents =
150 test_fixture_->browser()->tab_strip_model()->GetActiveWebContents(); 150 test_fixture_->browser()->tab_strip_model()->GetActiveWebContents();
151 return new MockSpeechRecognitionBubble(web_contents, delegate, 151 return new MockSpeechRecognitionBubble(web_contents, delegate,
152 element_rect); 152 element_rect);
153 } 153 }
154 154
155
155 protected: 156 protected:
156 bool cancel_clicked_; 157 bool cancel_clicked_;
157 bool try_again_clicked_; 158 bool try_again_clicked_;
158 bool focus_changed_; 159 bool focus_changed_;
159 scoped_refptr<SpeechRecognitionBubbleController> controller_; 160 scoped_refptr<SpeechRecognitionBubbleController> controller_;
160 161
161 static const int kBubbleSessionId; 162 static const int kBubbleSessionId;
162 static SpeechRecognitionBubbleControllerTest* test_fixture_; 163 static SpeechRecognitionBubbleControllerTest* test_fixture_;
163 }; 164 };
164 165
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 207
207 controller_->CreateBubble(kBubbleSessionId, 1, 1, gfx::Rect(1, 1)); 208 controller_->CreateBubble(kBubbleSessionId, 1, 1, gfx::Rect(1, 1));
208 base::RunLoop().RunUntilIdle(); 209 base::RunLoop().RunUntilIdle();
209 EXPECT_FALSE(cancel_clicked_); 210 EXPECT_FALSE(cancel_clicked_);
210 EXPECT_TRUE(try_again_clicked_); 211 EXPECT_TRUE(try_again_clicked_);
211 EXPECT_FALSE(focus_changed_); 212 EXPECT_FALSE(focus_changed_);
212 controller_->CloseBubble(); 213 controller_->CloseBubble();
213 } 214 }
214 215
215 } // namespace speech 216 } // namespace speech
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698