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 12class SpeechInputBubbleTest : public SpeechInputBubbleDelegate, 13 public InProcessBrowserTest { 14 public: 15 // SpeechInputBubble::Delegate methods. 16 virtual void InfoBubbleButtonClicked(SpeechInputBubble::Button button) {} 17 virtual void InfoBubbleFocusChanged() {} 18 19 protected: 20}; 21 22IN_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 29IN_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 37IN_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 46IN_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