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

Side by Side Diff: ui/views/mus/native_widget_mus_unittest.cc

Issue 1988283002: Implement and test aura::client::CaptureClient in views::NativeWidgetMus for plumbing (Set|Release)… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_widget_mus7
Patch Set: rebase Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/views/mus/native_widget_mus.h" 5 #include "ui/views/mus/native_widget_mus.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/mus/public/cpp/property_type_converters.h" 9 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/tests/window_tree_client_impl_private.h" 10 #include "components/mus/public/cpp/tests/window_tree_client_impl_private.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 &ack_callback); 429 &ack_callback);
430 430
431 // The widget was deleted. 431 // The widget was deleted.
432 EXPECT_FALSE(widget.get()); 432 EXPECT_FALSE(widget.get());
433 433
434 // The test took ownership of the callback and called it. 434 // The test took ownership of the callback and called it.
435 EXPECT_FALSE(ack_callback); 435 EXPECT_FALSE(ack_callback);
436 EXPECT_EQ(1, ack_callback_count()); 436 EXPECT_EQ(1, ack_callback_count());
437 } 437 }
438 438
439 TEST_F(NativeWidgetMusTest, SetAndReleaseCapture) {
440 std::unique_ptr<Widget> widget(CreateWidget(nullptr));
441 widget->Show();
442 View* content = new View;
443 widget->GetContentsView()->AddChildView(content);
444 internal::NativeWidgetPrivate* widget_private =
445 widget->native_widget_private();
446 mus::Window* mus_window =
447 static_cast<NativeWidgetMus*>(widget_private)->window();
448 EXPECT_FALSE(widget_private->HasCapture());
449 EXPECT_FALSE(mus_window->HasCapture());
450
451 widget->SetCapture(content);
452 EXPECT_TRUE(widget_private->HasCapture());
453 EXPECT_TRUE(mus_window->HasCapture());
454
455 widget->ReleaseCapture();
456 EXPECT_FALSE(widget_private->HasCapture());
457 EXPECT_FALSE(mus_window->HasCapture());
sadrul 2016/05/24 15:25:19 Hm, because the mus WS is launched just once for a
Mark Dittmer 2016/05/24 16:06:21 Alright. I'll see how the bots feel about this whe
458 }
459
439 } // namespace views 460 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698