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