Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef ASH_TEST_ASH_TEST_BASE_H_ | 5 #ifndef ASH_TEST_ASH_TEST_BASE_H_ |
| 6 #define ASH_TEST_ASH_TEST_BASE_H_ | 6 #define ASH_TEST_ASH_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "ash/public/cpp/shell_window_ids.h" | |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 15 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
| 18 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
| 19 #include "ui/wm/public/window_types.h" | 20 #include "ui/wm/public/window_types.h" |
| 20 | 21 |
| 21 namespace aura { | 22 namespace aura { |
| 22 class Window; | 23 class Window; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 // primary root Window. | 85 // primary root Window. |
| 85 aura::Window* CurrentContext(); | 86 aura::Window* CurrentContext(); |
| 86 | 87 |
| 87 // Creates and shows a widget. See ash/public/cpp/shell_window_ids.h for | 88 // Creates and shows a widget. See ash/public/cpp/shell_window_ids.h for |
| 88 // values for |container_id|. | 89 // values for |container_id|. |
| 89 static std::unique_ptr<views::Widget> CreateTestWidget( | 90 static std::unique_ptr<views::Widget> CreateTestWidget( |
| 90 views::WidgetDelegate* delegate, | 91 views::WidgetDelegate* delegate, |
| 91 int container_id, | 92 int container_id, |
| 92 const gfx::Rect& bounds); | 93 const gfx::Rect& bounds); |
| 93 | 94 |
| 95 // Creates a visible window in the appropriate container. If | |
| 96 // |bounds_in_screen| is empty the window is added to the primary root | |
| 97 // window, otherwise the window is added to the display matching | |
| 98 // |bounds_in_screen|. |shell_window_id| is the shell window id to give to | |
| 99 // the new window. | |
| 100 // TODO(sky): convert existing CreateTestWindow() functions into this one. | |
|
msw
2017/04/18 21:43:09
aside q: Will returning a unique_ptr instead of a
sky
2017/04/18 22:03:02
I actually haven't done a big analysis. I generall
| |
| 101 std::unique_ptr<aura::Window> CreateTestWindow( | |
|
msw
2017/04/18 21:43:09
optional nit: order params to match CreateTestWind
sky
2017/04/18 22:03:02
I went with this ordering based on looking at test
| |
| 102 const gfx::Rect& bounds_in_screen = gfx::Rect(), | |
| 103 ui::wm::WindowType type = ui::wm::WINDOW_TYPE_NORMAL, | |
| 104 int shell_window_id = kShellWindowId_Invalid); | |
| 105 | |
| 94 // Versions of the functions in aura::test:: that go through our shell | 106 // Versions of the functions in aura::test:: that go through our shell |
| 95 // StackingController instead of taking a parent. | 107 // StackingController instead of taking a parent. |
| 96 aura::Window* CreateTestWindowInShellWithId(int id); | 108 aura::Window* CreateTestWindowInShellWithId(int id); |
| 97 aura::Window* CreateTestWindowInShellWithBounds(const gfx::Rect& bounds); | 109 aura::Window* CreateTestWindowInShellWithBounds(const gfx::Rect& bounds); |
| 98 aura::Window* CreateTestWindowInShell(SkColor color, | 110 aura::Window* CreateTestWindowInShell(SkColor color, |
| 99 int id, | 111 int id, |
| 100 const gfx::Rect& bounds); | 112 const gfx::Rect& bounds); |
| 101 aura::Window* CreateTestWindowInShellWithDelegate( | 113 aura::Window* CreateTestWindowInShellWithDelegate( |
| 102 aura::WindowDelegate* delegate, | 114 aura::WindowDelegate* delegate, |
| 103 int id, | 115 int id, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 ~NoSessionAshTestBase() override {} | 203 ~NoSessionAshTestBase() override {} |
| 192 | 204 |
| 193 private: | 205 private: |
| 194 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); | 206 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); |
| 195 }; | 207 }; |
| 196 | 208 |
| 197 } // namespace test | 209 } // namespace test |
| 198 } // namespace ash | 210 } // namespace ash |
| 199 | 211 |
| 200 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 212 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
| OLD | NEW |