Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Unified Diff: ui/app_list/views/speech_view_unittest.cc

Issue 645853013: Remove some platform specific stuff from views. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/speech_view.cc ('k') | ui/app_list/views/start_page_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/speech_view_unittest.cc
diff --git a/ui/app_list/views/speech_view_unittest.cc b/ui/app_list/views/speech_view_unittest.cc
deleted file mode 100644
index ad49f0d104644a61980817eba50919cdce7b08f4..0000000000000000000000000000000000000000
--- a/ui/app_list/views/speech_view_unittest.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/app_list/views/speech_view.h"
-
-#include "ui/app_list/test/app_list_test_view_delegate.h"
-#include "ui/views/controls/button/image_button.h"
-#include "ui/views/test/widget_test.h"
-
-namespace app_list {
-namespace test {
-
-class SpeechViewTest : public views::test::WidgetTest,
- public AppListTestViewDelegate {
- public:
- SpeechViewTest() {}
- virtual ~SpeechViewTest() {}
-
- // Overridden from testing::Test:
- virtual void SetUp() override {
- views::test::WidgetTest::SetUp();
- widget_ = CreateTopLevelPlatformWidget();
- widget_->SetBounds(gfx::Rect(0, 0, 300, 200));
- view_ = new SpeechView(&view_delegate_);
- widget_->GetContentsView()->AddChildView(view_);
- view_->SetBoundsRect(widget_->GetContentsView()->GetLocalBounds());
- }
-
- virtual void TearDown() override {
- widget_->CloseNow();
- views::test::WidgetTest::TearDown();
- }
-
- protected:
- SpeechView* view() { return view_; }
- views::Widget* widget() { return widget_; }
-
- int GetToggleSpeechRecognitionCountAndReset() {
- return view_delegate_.GetToggleSpeechRecognitionCountAndReset();
- }
-
- private:
- AppListTestViewDelegate view_delegate_;
- views::Widget* widget_;
- SpeechView* view_;
-
- DISALLOW_COPY_AND_ASSIGN(SpeechViewTest);
-};
-
-// Tests that clicking within the circular hit-test mask of MicButton invokes
-// SpeechView::ToggleSpeechRecognition() and clicking outside of the
-// hit-test mask does not.
-TEST_F(SpeechViewTest, ClickMicButton) {
- EXPECT_EQ(0, GetToggleSpeechRecognitionCountAndReset());
- gfx::Rect screen_bounds(view()->mic_button()->GetBoundsInScreen());
-
- // Simulate a mouse click in the center of the MicButton.
- ui::MouseEvent press(ui::ET_MOUSE_PRESSED,
- screen_bounds.CenterPoint(),
- screen_bounds.CenterPoint(),
- ui::EF_LEFT_MOUSE_BUTTON,
- 0);
- ui::MouseEvent release(ui::ET_MOUSE_RELEASED,
- screen_bounds.CenterPoint(),
- screen_bounds.CenterPoint(),
- ui::EF_LEFT_MOUSE_BUTTON,
- 0);
- widget()->OnMouseEvent(&press);
- widget()->OnMouseEvent(&release);
- EXPECT_EQ(1, GetToggleSpeechRecognitionCountAndReset());
-
- // Simulate a mouse click in the bottom right-hand corner of the
- // MicButton's view bounds (which would fall outside of its
- // circular hit-test mask).
- gfx::Point bottom_right(screen_bounds.right() - 1,
- screen_bounds.bottom() - 2);
- press = ui::MouseEvent(ui::ET_MOUSE_PRESSED,
- bottom_right,
- bottom_right,
- ui::EF_LEFT_MOUSE_BUTTON,
- 0);
- release = ui::MouseEvent(ui::ET_MOUSE_RELEASED,
- bottom_right,
- bottom_right,
- ui::EF_LEFT_MOUSE_BUTTON,
- 0);
- widget()->OnMouseEvent(&press);
- widget()->OnMouseEvent(&release);
- EXPECT_EQ(0, GetToggleSpeechRecognitionCountAndReset());
-}
-
-} // namespace test
-} // namespace app_list
« no previous file with comments | « ui/app_list/views/speech_view.cc ('k') | ui/app_list/views/start_page_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698