OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/app_list/views/speech_view.h" | 5 #include "ui/app_list/views/speech_view.h" |
6 | 6 |
7 #include "ui/app_list/test/app_list_test_view_delegate.h" | 7 #include "ui/app_list/test/app_list_test_view_delegate.h" |
8 #include "ui/views/controls/button/image_button.h" | 8 #include "ui/views/controls/button/image_button.h" |
9 #include "ui/views/test/widget_test.h" | 9 #include "ui/views/test/widget_test.h" |
10 | 10 |
11 namespace app_list { | 11 namespace app_list { |
12 namespace test { | 12 namespace test { |
13 | 13 |
14 class SpeechViewTest : public views::test::WidgetTest, | 14 class SpeechViewTest : public views::test::WidgetTest, |
15 public AppListTestViewDelegate { | 15 public AppListTestViewDelegate { |
16 public: | 16 public: |
17 SpeechViewTest() {} | 17 SpeechViewTest() {} |
18 virtual ~SpeechViewTest() {} | 18 virtual ~SpeechViewTest() {} |
19 | 19 |
20 // Overridden from testing::Test: | 20 // Overridden from testing::Test: |
21 virtual void SetUp() OVERRIDE { | 21 virtual void SetUp() override { |
22 views::test::WidgetTest::SetUp(); | 22 views::test::WidgetTest::SetUp(); |
23 widget_ = CreateTopLevelPlatformWidget(); | 23 widget_ = CreateTopLevelPlatformWidget(); |
24 widget_->SetBounds(gfx::Rect(0, 0, 300, 200)); | 24 widget_->SetBounds(gfx::Rect(0, 0, 300, 200)); |
25 view_ = new SpeechView(&view_delegate_); | 25 view_ = new SpeechView(&view_delegate_); |
26 widget_->GetContentsView()->AddChildView(view_); | 26 widget_->GetContentsView()->AddChildView(view_); |
27 view_->SetBoundsRect(widget_->GetContentsView()->GetLocalBounds()); | 27 view_->SetBoundsRect(widget_->GetContentsView()->GetLocalBounds()); |
28 } | 28 } |
29 | 29 |
30 virtual void TearDown() OVERRIDE { | 30 virtual void TearDown() override { |
31 widget_->CloseNow(); | 31 widget_->CloseNow(); |
32 views::test::WidgetTest::TearDown(); | 32 views::test::WidgetTest::TearDown(); |
33 } | 33 } |
34 | 34 |
35 protected: | 35 protected: |
36 SpeechView* view() { return view_; } | 36 SpeechView* view() { return view_; } |
37 views::Widget* widget() { return widget_; } | 37 views::Widget* widget() { return widget_; } |
38 | 38 |
39 int GetToggleSpeechRecognitionCountAndReset() { | 39 int GetToggleSpeechRecognitionCountAndReset() { |
40 return view_delegate_.GetToggleSpeechRecognitionCountAndReset(); | 40 return view_delegate_.GetToggleSpeechRecognitionCountAndReset(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 bottom_right, | 85 bottom_right, |
86 ui::EF_LEFT_MOUSE_BUTTON, | 86 ui::EF_LEFT_MOUSE_BUTTON, |
87 0); | 87 0); |
88 widget()->OnMouseEvent(&press); | 88 widget()->OnMouseEvent(&press); |
89 widget()->OnMouseEvent(&release); | 89 widget()->OnMouseEvent(&release); |
90 EXPECT_EQ(0, GetToggleSpeechRecognitionCountAndReset()); | 90 EXPECT_EQ(0, GetToggleSpeechRecognitionCountAndReset()); |
91 } | 91 } |
92 | 92 |
93 } // namespace test | 93 } // namespace test |
94 } // namespace app_list | 94 } // namespace app_list |
OLD | NEW |