• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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.
4 
5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/speech/speech_input_bubble.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/test/in_process_browser_test.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/rect.h"
11 
12 class SpeechInputBubbleTest : public SpeechInputBubbleDelegate,
13                               public InProcessBrowserTest {
14  public:
15   // SpeechInputBubble::Delegate methods.
InfoBubbleButtonClicked(SpeechInputBubble::Button button)16   virtual void InfoBubbleButtonClicked(SpeechInputBubble::Button button) {}
InfoBubbleFocusChanged()17   virtual void InfoBubbleFocusChanged() {}
18 
19  protected:
20 };
21 
IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest,CreateAndDestroy)22 IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, CreateAndDestroy) {
23   gfx::Rect element_rect(100, 100, 100, 100);
24   scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
25       browser()->GetSelectedTabContents(), this, element_rect));
26   EXPECT_TRUE(bubble.get());
27 }
28 
IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest,ShowAndDestroy)29 IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndDestroy) {
30   gfx::Rect element_rect(100, 100, 100, 100);
31   scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
32       browser()->GetSelectedTabContents(), this, element_rect));
33   EXPECT_TRUE(bubble.get());
34   bubble->Show();
35 }
36 
IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest,ShowAndHide)37 IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndHide) {
38   gfx::Rect element_rect(100, 100, 100, 100);
39   scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
40       browser()->GetSelectedTabContents(), this, element_rect));
41   EXPECT_TRUE(bubble.get());
42   bubble->Show();
43   bubble->Hide();
44 }
45 
IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest,ShowAndHideTwice)46 IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndHideTwice) {
47   gfx::Rect element_rect(100, 100, 100, 100);
48   scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create(
49       browser()->GetSelectedTabContents(), this, element_rect));
50   EXPECT_TRUE(bubble.get());
51   bubble->Show();
52   bubble->Hide();
53   bubble->Show();
54   bubble->Hide();
55 }
56