| Index: ash/wm/frame_painter_unittest.cc
|
| diff --git a/ash/wm/frame_painter_unittest.cc b/ash/wm/frame_painter_unittest.cc
|
| index 8ce42eb8564e8099a09c2cc278a67ddce23e7190..4f34d5ad364f9ad408863654bc606982d39b106f 100644
|
| --- a/ash/wm/frame_painter_unittest.cc
|
| +++ b/ash/wm/frame_painter_unittest.cc
|
| @@ -8,6 +8,7 @@
|
| #include "ash/shell_window_ids.h"
|
| #include "ash/test/ash_test_base.h"
|
| #include "ash/wm/property_util.h"
|
| +#include "ash/wm/window_properties.h"
|
| #include "ash/wm/window_util.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "grit/ash_resources.h"
|
| @@ -123,6 +124,40 @@ TEST_F(FramePainterTest, Basics) {
|
| EXPECT_EQ(0u, FramePainter::instances_->size());
|
| }
|
|
|
| +TEST_F(FramePainterTest, CreateAndDeleteSingleWindow) {
|
| + // Ensure that creating/deleting a window works well and doesn't cause
|
| + // crashes. See crbug.com/155634
|
| + aura::RootWindow* root = Shell::GetActiveRootWindow();
|
| +
|
| + scoped_ptr<Widget> widget(CreateTestWidget());
|
| + scoped_ptr<FramePainter> painter(new FramePainter);
|
| + ImageButton size(NULL);
|
| + ImageButton close(NULL);
|
| + painter->Init(
|
| + widget.get(), NULL, &size, &close, FramePainter::SIZE_BUTTON_MAXIMIZES);
|
| + widget->Show();
|
| +
|
| + // We only have one window, so it should use a solo header.
|
| + EXPECT_TRUE(painter->UseSoloWindowHeader());
|
| + EXPECT_EQ(painter.get(),
|
| + root->GetProperty(internal::kSoloWindowFramePainterKey));
|
| +
|
| + // Close the window.
|
| + widget.reset();
|
| + EXPECT_EQ(NULL, root->GetProperty(internal::kSoloWindowFramePainterKey));
|
| +
|
| + // Recreate another window again.
|
| + painter.reset(new FramePainter);
|
| + widget.reset(CreateTestWidget());
|
| +
|
| + painter->Init(
|
| + widget.get(), NULL, &size, &close, FramePainter::SIZE_BUTTON_MAXIMIZES);
|
| + widget->Show();
|
| + EXPECT_TRUE(painter->UseSoloWindowHeader());
|
| + EXPECT_EQ(painter.get(),
|
| + root->GetProperty(internal::kSoloWindowFramePainterKey));
|
| +}
|
| +
|
| TEST_F(FramePainterTest, UseSoloWindowHeader) {
|
| // Create a widget and a painter for it.
|
| scoped_ptr<Widget> w1(CreateTestWidget());
|
|
|