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

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

Issue 801043003: Change ShowConfirmBubble() to take model by scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « chrome/browser/ui/views/confirm_bubble_views.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_constrained_window_views_client.h" 9 #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
10 #include "components/constrained_window/constrained_window_views.h" 10 #include "components/constrained_window/constrained_window_views.h"
(...skipping 10 matching lines...) Expand all
21 21
22 // Create parent widget, as confirm bubble must have an owner. 22 // Create parent widget, as confirm bubble must have an owner.
23 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); 23 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
24 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 24 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
25 scoped_ptr<views::Widget> parent_widget(new Widget); 25 scoped_ptr<views::Widget> parent_widget(new Widget);
26 parent_widget->Init(params); 26 parent_widget->Init(params);
27 parent_widget->Show(); 27 parent_widget->Show();
28 28
29 // Bubble owns the model. 29 // Bubble owns the model.
30 bool model_deleted = false; 30 bool model_deleted = false;
31 TestConfirmBubbleModel* model = 31 scoped_ptr<TestConfirmBubbleModel> model(
32 new TestConfirmBubbleModel(&model_deleted, NULL, NULL, NULL); 32 new TestConfirmBubbleModel(&model_deleted, NULL, NULL, NULL));
33 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(model); 33 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(model.Pass());
34 gfx::NativeWindow parent = parent_widget->GetNativeWindow(); 34 gfx::NativeWindow parent = parent_widget->GetNativeWindow();
35 constrained_window::CreateBrowserModalDialogViews(bubble, parent)->Show(); 35 constrained_window::CreateBrowserModalDialogViews(bubble, parent)->Show();
36 36
37 // Clean up. 37 // Clean up.
38 bubble->GetWidget()->CloseNow(); 38 bubble->GetWidget()->CloseNow();
39 parent_widget->CloseNow(); 39 parent_widget->CloseNow();
40 EXPECT_TRUE(model_deleted); 40 EXPECT_TRUE(model_deleted);
41 41
42 constrained_window::SetConstrainedWindowViewsClient(nullptr); 42 constrained_window::SetConstrainedWindowViewsClient(nullptr);
43 } 43 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/confirm_bubble_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698