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

Unified Diff: ash/wm/frame_painter_unittest.cc

Issue 11194015: Fix crash bugs of FramePainter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/wm/frame_painter.cc ('k') | ash/wm/window_properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « ash/wm/frame_painter.cc ('k') | ash/wm/window_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698