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

Side by Side Diff: ui/message_center/views/custom_notification_view_unittest.cc

Issue 2371113003: Do not give instant focus if a view's toplevelwidget is not active (Closed)
Patch Set: add ClearNativeFocus() Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(), 147 base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(),
148 base::UTF8ToUTF16("display source"), GURL(), 148 base::UTF8ToUTF16("display source"), GURL(),
149 NotifierId(NotifierId::APPLICATION, "extension_id"), 149 NotifierId(NotifierId::APPLICATION, "extension_id"),
150 message_center::RichNotificationData(), notification_delegate_.get())); 150 message_center::RichNotificationData(), notification_delegate_.get()));
151 151
152 notification_view_.reset(static_cast<CustomNotificationView*>( 152 notification_view_.reset(static_cast<CustomNotificationView*>(
153 MessageViewFactory::Create(controller(), *notification_, true))); 153 MessageViewFactory::Create(controller(), *notification_, true)));
154 notification_view_->set_owned_by_client(); 154 notification_view_->set_owned_by_client();
155 155
156 views::Widget::InitParams init_params( 156 views::Widget::InitParams init_params(
157 CreateParams(views::Widget::InitParams::TYPE_POPUP)); 157 CreateParams(views::Widget::InitParams::TYPE_WINDOW_FRAMELESS));
158 views::Widget* widget = new views::Widget(); 158 views::Widget* widget = new views::Widget();
159 widget->Init(init_params); 159 widget->Init(init_params);
160 widget->SetContentsView(notification_view_.get()); 160 widget->SetContentsView(notification_view_.get());
161 widget->SetSize(notification_view_->GetPreferredSize()); 161 widget->SetSize(notification_view_->GetPreferredSize());
162 } 162 }
163 163
164 void TearDown() override { 164 void TearDown() override {
165 widget()->Close(); 165 widget()->Close();
166 notification_view_.reset(); 166 notification_view_.reset();
167 views::ViewsTestBase::TearDown(); 167 views::ViewsTestBase::TearDown();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 233 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
234 widget()->OnMouseEvent(&move); 234 widget()->OnMouseEvent(&move);
235 EXPECT_EQ(3, custom_view()->mouse_event_count()); 235 EXPECT_EQ(3, custom_view()->mouse_event_count());
236 236
237 EXPECT_EQ(0, custom_view()->keyboard_event_count()); 237 EXPECT_EQ(0, custom_view()->keyboard_event_count());
238 KeyPress(ui::VKEY_A); 238 KeyPress(ui::VKEY_A);
239 EXPECT_EQ(1, custom_view()->keyboard_event_count()); 239 EXPECT_EQ(1, custom_view()->keyboard_event_count());
240 } 240 }
241 241
242 } // namespace message_center 242 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698