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

Unified Diff: ash/extended_desktop_unittest.cc

Issue 11795004: Continue threading context through unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « ash/display/shared_display_edge_indicator.cc ('k') | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/extended_desktop_unittest.cc
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc
index 29f8b88ff2ab81de1a9a2e37b3575582ea8e6bca..5517f3c54c9294943a726e82e6f82e88066bf94c 100644
--- a/ash/extended_desktop_unittest.cc
+++ b/ash/extended_desktop_unittest.cc
@@ -33,24 +33,6 @@
namespace ash {
namespace {
-views::Widget* CreateTestWidgetWithParent(views::Widget* parent,
- const gfx::Rect& bounds,
- bool child) {
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- if (parent)
- params.parent = parent->GetNativeView();
- params.bounds = bounds;
- params.child = child;
- views::Widget* widget = new views::Widget;
- widget->Init(params);
- widget->Show();
- return widget;
-}
-
-views::Widget* CreateTestWidget(const gfx::Rect& bounds) {
- return CreateTestWidgetWithParent(NULL, bounds, false);
-}
-
void SetSecondaryDisplayLayout(DisplayLayout::Position position) {
DisplayController* display_controller =
Shell::GetInstance()->display_controller();
@@ -104,7 +86,36 @@ class MoveWindowByClickEventFilter : public ui::EventHandler {
} // namespace
-typedef test::AshTestBase ExtendedDesktopTest;
+class ExtendedDesktopTest : public test::AshTestBase {
+ public:
+ views::Widget* CreateTestWidget(const gfx::Rect& bounds) {
+ return CreateTestWidgetWithParentAndContext(
+ NULL, CurrentContext(), bounds, false);
+ }
+
+ views::Widget* CreateTestWidgetWithParent(views::Widget* parent,
+ const gfx::Rect& bounds,
+ bool child) {
+ CHECK(parent);
+ return CreateTestWidgetWithParentAndContext(parent, NULL, bounds, child);
+ }
+
+ views::Widget* CreateTestWidgetWithParentAndContext(views::Widget* parent,
+ gfx::NativeView context,
+ const gfx::Rect& bounds,
+ bool child) {
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
+ if (parent)
+ params.parent = parent->GetNativeView();
+ params.context = context;
+ params.bounds = bounds;
+ params.child = child;
+ views::Widget* widget = new views::Widget;
+ widget->Init(params);
+ widget->Show();
+ return widget;
+ }
+};
// Test conditions that root windows in extended desktop mode
// must satisfy.
@@ -170,8 +181,10 @@ TEST_F(ExtendedDesktopTest, SystemModal) {
EXPECT_EQ(root_windows[0], Shell::GetActiveRootWindow());
// Open system modal. Make sure it's on 2nd root window and active.
- views::Widget* modal_widget = views::Widget::CreateWindowWithBounds(
- new ModalWidgetDelegate(), gfx::Rect(1200, 100, 100, 100));
+ views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds(
+ new ModalWidgetDelegate(),
+ CurrentContext(),
+ gfx::Rect(1200, 100, 100, 100));
modal_widget->Show();
EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow());
@@ -608,8 +621,7 @@ TEST_F(ExtendedDesktopTest, OpenSystemTray) {
TEST_F(ExtendedDesktopTest, StayInSameRootWindow) {
UpdateDisplay("100x100,200x200");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- views::Widget* w1 = CreateTestWidgetWithParent(
- NULL, gfx::Rect(10, 10, 50, 50), false);
+ views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 50, 50));
EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow());
w1->SetBounds(gfx::Rect(150, 10, 50, 50));
EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
« no previous file with comments | « ash/display/shared_display_edge_indicator.cc ('k') | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698