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
3 // found in the LICENSE file.
5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/speech/speech_recognition_bubble.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/gfx/rect.h"
13 class SpeechRecognitionBubbleTest
: public SpeechRecognitionBubbleDelegate
,
14 public InProcessBrowserTest
{
16 // SpeechRecognitionBubble::Delegate methods.
17 virtual void InfoBubbleButtonClicked(
18 SpeechRecognitionBubble::Button button
) OVERRIDE
{
20 virtual void InfoBubbleFocusChanged() OVERRIDE
{}
25 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest
, CreateAndDestroy
) {
26 gfx::Rect
element_rect(100, 100, 100, 100);
27 scoped_ptr
<SpeechRecognitionBubble
> bubble(SpeechRecognitionBubble::Create(
28 browser()->tab_strip_model()->GetActiveWebContents(),
30 EXPECT_TRUE(bubble
.get());
33 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest
, ShowAndDestroy
) {
34 gfx::Rect
element_rect(100, 100, 100, 100);
35 scoped_ptr
<SpeechRecognitionBubble
> bubble(SpeechRecognitionBubble::Create(
36 browser()->tab_strip_model()->GetActiveWebContents(),
38 EXPECT_TRUE(bubble
.get());
42 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest
, ShowAndHide
) {
43 gfx::Rect
element_rect(100, 100, 100, 100);
44 scoped_ptr
<SpeechRecognitionBubble
> bubble(SpeechRecognitionBubble::Create(
45 browser()->tab_strip_model()->GetActiveWebContents(),
47 EXPECT_TRUE(bubble
.get());
52 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBubbleTest
, ShowAndHideTwice
) {
53 gfx::Rect
element_rect(100, 100, 100, 100);
54 scoped_ptr
<SpeechRecognitionBubble
> bubble(SpeechRecognitionBubble::Create(
55 browser()->tab_strip_model()->GetActiveWebContents(),
57 EXPECT_TRUE(bubble
.get());