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

Unified Diff: ash/shell_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/shell/window_type_launcher.cc ('k') | ash/test/ash_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell_unittest.cc
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc
index ec3c01d2c5660f4f716b7f4a6eef42362a9c6cb9..a1851ff659ca4218ba13574e5d2a4f591af4bad0 100644
--- a/ash/shell_unittest.cc
+++ b/ash/shell_unittest.cc
@@ -31,12 +31,6 @@ namespace ash {
namespace {
-views::Widget* CreateTestWindow(const views::Widget::InitParams& params) {
- views::Widget* widget = new views::Widget;
- widget->Init(params);
- return widget;
-}
-
aura::Window* GetDefaultContainer() {
return Shell::GetContainer(
Shell::GetPrimaryRootWindow(),
@@ -82,22 +76,6 @@ void ExpectAllContainers() {
root_window, internal::kShellWindowId_OverlayContainer));
}
-void TestCreateWindow(views::Widget::InitParams::Type type,
- bool always_on_top,
- aura::Window* expected_container) {
- views::Widget::InitParams widget_params(type);
- widget_params.keep_on_top = always_on_top;
-
- views::Widget* widget = CreateTestWindow(widget_params);
- widget->Show();
-
- EXPECT_TRUE(expected_container->Contains(
- widget->GetNativeWindow()->parent())) <<
- "TestCreateWindow: type=" << type << ", always_on_top=" << always_on_top;
-
- widget->Close();
-}
-
class ModalWindow : public views::WidgetDelegateView {
public:
ModalWindow() {}
@@ -123,7 +101,33 @@ class ModalWindow : public views::WidgetDelegateView {
} // namespace
-typedef test::AshTestBase ShellTest;
+class ShellTest : public test::AshTestBase {
+ public:
+ views::Widget* CreateTestWindow(views::Widget::InitParams params) {
+ views::Widget* widget = new views::Widget;
+ params.context = CurrentContext();
+ widget->Init(params);
+ return widget;
+ }
+
+ void TestCreateWindow(views::Widget::InitParams::Type type,
+ bool always_on_top,
+ aura::Window* expected_container) {
+ views::Widget::InitParams widget_params(type);
+ widget_params.keep_on_top = always_on_top;
+
+ views::Widget* widget = CreateTestWindow(widget_params);
+ widget->Show();
+
+ EXPECT_TRUE(
+ expected_container->Contains(widget->GetNativeWindow()->parent())) <<
+ "TestCreateWindow: type=" << type << ", always_on_top=" <<
+ always_on_top;
+
+ widget->Close();
+}
+
+};
TEST_F(ShellTest, CreateWindow) {
// Normal window should be created in default container.
« no previous file with comments | « ash/shell/window_type_launcher.cc ('k') | ash/test/ash_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698