| Index: ui/views/test/widget_test_aura.cc
|
| diff --git a/ui/views/test/widget_test_aura.cc b/ui/views/test/widget_test_aura.cc
|
| index 5c725531a55bca300c351b3f4c6fb9bc44bd523e..8cabaf5cf256a5634350549cb3f7e8ccdf606520 100644
|
| --- a/ui/views/test/widget_test_aura.cc
|
| +++ b/ui/views/test/widget_test_aura.cc
|
| @@ -6,9 +6,12 @@
|
|
|
| #include "build/build_config.h"
|
| #include "ui/aura/client/focus_client.h"
|
| +#include "ui/aura/mus/window_tree_client.h"
|
| +#include "ui/aura/test/aura_test_helper.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_delegate.h"
|
| #include "ui/aura/window_tree_host.h"
|
| +#include "ui/views/mus/mus_client.h"
|
| #include "ui/views/widget/widget.h"
|
|
|
| #if defined(USE_X11)
|
| @@ -16,6 +19,10 @@
|
| #include "ui/gfx/x/x11_types.h" // nogncheck
|
| #endif
|
|
|
| +#if defined(USE_X11) && !defined(OS_CHROMEOS)
|
| +#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
| +#endif
|
| +
|
| namespace views {
|
| namespace test {
|
|
|
| @@ -48,6 +55,46 @@ bool FindLayersInOrder(const std::vector<ui::Layer*>& children,
|
| return false;
|
| }
|
|
|
| +#if defined(OS_WIN)
|
| +
|
| +struct FindAllWindowsData {
|
| + std::vector<aura::Window*>* windows;
|
| +};
|
| +
|
| +BOOL CALLBACK FindAllWindowsCallback(HWND hwnd, LPARAM param) {
|
| + FindAllWindowsData* data = reinterpret_cast<FindAllWindowsData*>(param);
|
| + if (aura::WindowTreeHost* host =
|
| + aura::WindowTreeHost::GetForAcceleratedWidget(hwnd))
|
| + data->windows->push_back(host->window());
|
| + return TRUE;
|
| +}
|
| +
|
| +#endif // OS_WIN
|
| +
|
| +std::vector<aura::Window*> GetAllTopLeveLWindows() {
|
| + std::vector<aura::Window*> roots;
|
| +#if defined(USE_X11) && !defined(OS_CHROMEOS)
|
| + roots = DesktopWindowTreeHostX11::GetAllOpenWindows();
|
| +#endif
|
| +#if defined(OS_WIN)
|
| + {
|
| + FindAllWindowsData data = {&roots};
|
| + EnumThreadWindows(GetCurrentThreadId(), FindAllWindowsCallback,
|
| + reinterpret_cast<LPARAM>(&data));
|
| + }
|
| +#endif // OS_WIN
|
| + aura::test::AuraTestHelper* aura_test_helper =
|
| + aura::test::AuraTestHelper::GetInstance();
|
| + if (aura_test_helper)
|
| + roots.push_back(aura_test_helper->root_window());
|
| +
|
| + if (MusClient::Get()) {
|
| + auto mus_roots = MusClient::Get()->window_tree_client()->GetRoots();
|
| + roots.insert(roots.end(), mus_roots.begin(), mus_roots.end());
|
| + }
|
| + return roots;
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -114,5 +161,14 @@ bool WidgetTest::IsNativeWindowTransparent(gfx::NativeWindow window) {
|
| return window->transparent();
|
| }
|
|
|
| +// static
|
| +Widget::Widgets WidgetTest::GetAllWidgets() {
|
| + std::vector<aura::Window*> toplevel = GetAllTopLeveLWindows();
|
| + Widget::Widgets all_widgets;
|
| + for (aura::Window* root : toplevel)
|
| + Widget::GetAllChildWidgets(root, &all_widgets);
|
| + return all_widgets;
|
| +}
|
| +
|
| } // namespace test
|
| } // namespace views
|
|
|