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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/autofill/autofill_dialog_views.h" 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h"
6 6
7 #include <memory>
8
7 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" 11 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" 13 #include "chrome/browser/ui/views/autofill/decorated_textfield.h"
13 #include "chrome/browser/ui/views/frame/browser_view.h" 14 #include "chrome/browser/ui/views/frame/browser_view.h"
14 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" 15 #include "chrome/browser/ui/views/frame/test_with_browser_view.h"
15 #include "components/web_modal/test_web_contents_modal_dialog_host.h" 16 #include "components/web_modal/test_web_contents_modal_dialog_host.h"
16 #include "components/web_modal/test_web_contents_modal_dialog_manager_delegate.h " 17 #include "components/web_modal/test_web_contents_modal_dialog_manager_delegate.h "
17 #include "components/web_modal/web_contents_modal_dialog_manager.h" 18 #include "components/web_modal/web_contents_modal_dialog_manager.h"
18 #include "content/public/browser/native_web_keyboard_event.h" 19 #include "content/public/browser/native_web_keyboard_event.h"
19 #include "content/public/common/url_constants.h" 20 #include "content/public/common/url_constants.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 protected: 92 protected:
92 void SetSectionsFocusable() { 93 void SetSectionsFocusable() {
93 dialog()->GetNotificationAreaForTesting()->SetFocusable(true); 94 dialog()->GetNotificationAreaForTesting()->SetFocusable(true);
94 dialog()->GetScrollableAreaForTesting()->SetFocusable(true); 95 dialog()->GetScrollableAreaForTesting()->SetFocusable(true);
95 } 96 }
96 97
97 private: 98 private:
98 // Fake dialog delegate and host to isolate test behavior. 99 // Fake dialog delegate and host to isolate test behavior.
99 web_modal::TestWebContentsModalDialogManagerDelegate dialog_delegate_; 100 web_modal::TestWebContentsModalDialogManagerDelegate dialog_delegate_;
100 scoped_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_; 101 std::unique_ptr<web_modal::TestWebContentsModalDialogHost> dialog_host_;
101 102
102 // Mock view delegate as this file only tests the view. 103 // Mock view delegate as this file only tests the view.
103 testing::NiceMock<MockAutofillDialogViewDelegate> view_delegate_; 104 testing::NiceMock<MockAutofillDialogViewDelegate> view_delegate_;
104 105
105 scoped_ptr<TestAutofillDialogViews> dialog_; 106 std::unique_ptr<TestAutofillDialogViews> dialog_;
106 }; 107 };
107 108
108 TEST_F(AutofillDialogViewsTest, InitialFocus) { 109 TEST_F(AutofillDialogViewsTest, InitialFocus) {
109 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager(); 110 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager();
110 views::View* focused_view = focus_manager->GetFocusedView(); 111 views::View* focused_view = focus_manager->GetFocusedView();
111 EXPECT_STREQ(DecoratedTextfield::kViewClassName, 112 EXPECT_STREQ(DecoratedTextfield::kViewClassName,
112 focused_view->GetClassName()); 113 focused_view->GetClassName());
113 } 114 }
114 115
115 TEST_F(AutofillDialogViewsTest, ImeEventDoesntCrash) { 116 TEST_F(AutofillDialogViewsTest, ImeEventDoesntCrash) {
116 // IMEs create synthetic events with no backing native event. 117 // IMEs create synthetic events with no backing native event.
117 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager(); 118 views::FocusManager* focus_manager = dialog()->GetWidget()->GetFocusManager();
118 views::View* focused_view = focus_manager->GetFocusedView(); 119 views::View* focused_view = focus_manager->GetFocusedView();
119 ASSERT_STREQ(DecoratedTextfield::kViewClassName, 120 ASSERT_STREQ(DecoratedTextfield::kViewClassName,
120 focused_view->GetClassName()); 121 focused_view->GetClassName());
121 EXPECT_FALSE(dialog()->HandleKeyEvent( 122 EXPECT_FALSE(dialog()->HandleKeyEvent(
122 static_cast<views::Textfield*>(focused_view), 123 static_cast<views::Textfield*>(focused_view),
123 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE))); 124 ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE)));
124 } 125 }
125 126
126 } // namespace autofill 127 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698