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

Unified Diff: ui/views/test/native_widget_factory.cc

Issue 2488393003: Changes views_aura_mus_unittests to create DesktopNativeWidgetAura (Closed)
Patch Set: remove this and fix mac Created 4 years, 1 month 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/views/test/native_widget_factory.h ('k') | ui/views/test/native_widget_factory_aura_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/native_widget_factory.cc
diff --git a/ui/views/test/native_widget_factory.cc b/ui/views/test/native_widget_factory.cc
deleted file mode 100644
index ae449abb04c29d1abc5bbd7777e436ba69dbefd0..0000000000000000000000000000000000000000
--- a/ui/views/test/native_widget_factory.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2016 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/views/test/native_widget_factory.h"
-
-#if defined(USE_AURA)
-#include "ui/views/widget/native_widget_aura.h"
-#if !defined(OS_CHROMEOS)
-#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
-#endif
-#elif defined(OS_MACOSX)
-#include "ui/views/widget/native_widget_mac.h"
-#endif
-
-namespace views {
-namespace test {
-
-#if defined(USE_AURA)
-using PlatformNativeWidget = NativeWidgetAura;
-#elif defined(OS_MACOSX)
-using PlatformNativeWidget = NativeWidgetMac;
-#endif
-
-namespace {
-
-// NativeWidget implementation that adds the following:
-// . capture can be mocked.
-// . a boolean is set when the NativeWiget is destroyed.
-class TestPlatformNativeWidget : public PlatformNativeWidget {
- public:
- TestPlatformNativeWidget(internal::NativeWidgetDelegate* delegate,
- bool mock_capture,
- bool* destroyed);
- ~TestPlatformNativeWidget() override;
-
- void SetCapture() override;
- void ReleaseCapture() override;
- bool HasCapture() const override;
-
- private:
- bool mouse_capture_;
- const bool mock_capture_;
- bool* destroyed_;
-
- DISALLOW_COPY_AND_ASSIGN(TestPlatformNativeWidget);
-};
-
-// A widget that assumes mouse capture always works. It won't in testing, so we
-// mock it.
-TestPlatformNativeWidget::TestPlatformNativeWidget(
- internal::NativeWidgetDelegate* delegate,
- bool mock_capture,
- bool* destroyed)
- : PlatformNativeWidget(delegate),
- mouse_capture_(false),
- mock_capture_(mock_capture),
- destroyed_(destroyed) {}
-
-TestPlatformNativeWidget::~TestPlatformNativeWidget() {
- if (destroyed_)
- *destroyed_ = true;
-}
-
-void TestPlatformNativeWidget::SetCapture() {
- if (mock_capture_)
- mouse_capture_ = true;
- else
- PlatformNativeWidget::SetCapture();
-}
-
-void TestPlatformNativeWidget::ReleaseCapture() {
- if (mock_capture_) {
- if (mouse_capture_)
- delegate()->OnMouseCaptureLost();
- mouse_capture_ = false;
- } else {
- PlatformNativeWidget::ReleaseCapture();
- }
-}
-
-bool TestPlatformNativeWidget::HasCapture() const {
- return mock_capture_ ? mouse_capture_ : PlatformNativeWidget::HasCapture();
-}
-
-} // namespace
-
-// Factory methods ------------------------------------------------------------
-
-NativeWidget* CreatePlatformNativeWidgetImpl(
- const Widget::InitParams& init_params,
- Widget* widget,
- uint32_t type,
- bool* destroyed) {
- return new TestPlatformNativeWidget(widget, type == kStubCapture, destroyed);
-}
-
-} // namespace test
-} // namespace views
« no previous file with comments | « ui/views/test/native_widget_factory.h ('k') | ui/views/test/native_widget_factory_aura_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698