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

Side by Side Diff: chrome/browser/ui/views/confirm_bubble_views_unittest.cc

Issue 658383003: Componentize Constrained Window Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: gn Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "chrome/browser/ui/views/confirm_bubble_views.h" 5 #include "chrome/browser/ui/views/confirm_bubble_views.h"
6 6
7 #include "chrome/browser/ui/confirm_bubble.h" 7 #include "chrome/browser/ui/confirm_bubble.h"
8 #include "chrome/browser/ui/test/test_confirm_bubble_model.h" 8 #include "chrome/browser/ui/test/test_confirm_bubble_model.h"
9 #include "chrome/browser/ui/views/constrained_window_views.h" 9 #include "components/constrained_window/constrained_window_views.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/views/test/views_test_base.h" 11 #include "ui/views/test/views_test_base.h"
12 #include "ui/views/widget/widget.h" 12 #include "ui/views/widget/widget.h"
13 13
14 using views::Widget; 14 using views::Widget;
15 15
16 typedef views::ViewsTestBase ConfirmBubbleViewsTest; 16 typedef views::ViewsTestBase ConfirmBubbleViewsTest;
17 17
18 TEST_F(ConfirmBubbleViewsTest, CreateAndClose) { 18 TEST_F(ConfirmBubbleViewsTest, CreateAndClose) {
19 // Create parent widget, as confirm bubble must have an owner. 19 // Create parent widget, as confirm bubble must have an owner.
20 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); 20 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
21 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 21 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
22 scoped_ptr<views::Widget> parent_widget(new Widget); 22 scoped_ptr<views::Widget> parent_widget(new Widget);
23 parent_widget->Init(params); 23 parent_widget->Init(params);
24 parent_widget->Show(); 24 parent_widget->Show();
25 25
26 // Bubble owns the model. 26 // Bubble owns the model.
27 bool model_deleted = false; 27 bool model_deleted = false;
28 TestConfirmBubbleModel* model = 28 TestConfirmBubbleModel* model =
29 new TestConfirmBubbleModel(&model_deleted, NULL, NULL, NULL); 29 new TestConfirmBubbleModel(&model_deleted, NULL, NULL, NULL);
30 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(model); 30 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(model);
31 gfx::NativeWindow parent = parent_widget->GetNativeWindow(); 31 gfx::NativeWindow parent = parent_widget->GetNativeWindow();
32 CreateBrowserModalDialogViews(bubble, parent)->Show(); 32 CreateBrowserModalDialogViews(bubble, parent)->Show();
33 33
34 // Clean up. 34 // Clean up.
35 bubble->GetWidget()->CloseNow(); 35 bubble->GetWidget()->CloseNow();
36 parent_widget->CloseNow(); 36 parent_widget->CloseNow();
37 EXPECT_TRUE(model_deleted); 37 EXPECT_TRUE(model_deleted);
38 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698