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