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

Side by Side Diff: ui/views/widget/widget_interactive_uitest.cc

Issue 2926683003: Enable WidgetTestInteractive.DesktopNativeWidgetWithModalTransientChild on OS_WIN (Closed)
Patch Set: change to the test coverage only Created 3 years, 6 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
« no previous file with comments | « no previous file | 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 EXPECT_TRUE(minimize_waiter.Wait()); 1264 EXPECT_TRUE(minimize_waiter.Wait());
1265 1265
1266 PropertyWaiter restore_waiter( 1266 PropertyWaiter restore_waiter(
1267 base::Bind(&Widget::IsMinimized, base::Unretained(widget)), false); 1267 base::Bind(&Widget::IsMinimized, base::Unretained(widget)), false);
1268 widget->Restore(); 1268 widget->Restore();
1269 EXPECT_TRUE(restore_waiter.Wait()); 1269 EXPECT_TRUE(restore_waiter.Wait());
1270 1270
1271 widget->CloseNow(); 1271 widget->CloseNow();
1272 } 1272 }
1273 1273
1274 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(OS_WIN) 1274 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
1275 // TODO(warx): Investigate the flakiness on OS_WIN (crbug.com/729331).
1276 // Tests that when a desktop native widget has modal transient child, it should 1275 // Tests that when a desktop native widget has modal transient child, it should
1277 // avoid restore focused view itself as the modal transient child window will do 1276 // avoid restore focused view itself as the modal transient child window will do
1278 // that, thus avoids having multiple focused view visually (crbug.com/727641). 1277 // that, thus avoids having multiple focused view visually (crbug.com/727641).
1279 TEST_F(WidgetTestInteractive, DesktopNativeWidgetWithModalTransientChild) { 1278 TEST_F(WidgetTestInteractive, DesktopNativeWidgetWithModalTransientChild) {
1279 #if defined(OS_WIN)
sky 2017/06/07 16:09:34 I get that you really only need this for windows,
Qiang(Joe) Xu 2017/06/07 17:28:17 yes, we can always do it. Done.
1280 // On Windows, Widget::Deactivate() works by activating the next topmost
1281 // window on the z-order stack. This only works if there is at least one other
1282 // window, so make sure that is the case.
1283 Widget* deactivate_widget = CreateWidget();
1284 deactivate_widget->Show();
1285 #endif
1280 // Create a top level desktop native widget. 1286 // Create a top level desktop native widget.
1281 Widget* top_level = CreateWidget(); 1287 Widget* top_level = CreateWidget();
1282 1288
1283 Textfield* textfield = new Textfield; 1289 Textfield* textfield = new Textfield;
1284 textfield->SetBounds(0, 0, 200, 20); 1290 textfield->SetBounds(0, 0, 200, 20);
1285 top_level->GetRootView()->AddChildView(textfield); 1291 top_level->GetRootView()->AddChildView(textfield);
1286 ShowSync(top_level); 1292 ShowSync(top_level);
1287 textfield->RequestFocus(); 1293 textfield->RequestFocus();
1288 EXPECT_TRUE(textfield->HasFocus()); 1294 EXPECT_TRUE(textfield->HasFocus());
1289 1295
(...skipping 18 matching lines...) Expand all
1308 EXPECT_FALSE(dialog_textfield->HasFocus()); 1314 EXPECT_FALSE(dialog_textfield->HasFocus());
1309 EXPECT_FALSE(textfield->HasFocus()); 1315 EXPECT_FALSE(textfield->HasFocus());
1310 1316
1311 // After deactivation and activation of top level widget, only modal dialog 1317 // After deactivation and activation of top level widget, only modal dialog
1312 // should restore focused view. 1318 // should restore focused view.
1313 ActivateSync(top_level); 1319 ActivateSync(top_level);
1314 EXPECT_TRUE(dialog_textfield->HasFocus()); 1320 EXPECT_TRUE(dialog_textfield->HasFocus());
1315 EXPECT_FALSE(textfield->HasFocus()); 1321 EXPECT_FALSE(textfield->HasFocus());
1316 1322
1317 top_level->CloseNow(); 1323 top_level->CloseNow();
1324
1325 #if defined(OS_WIN)
1326 deactivate_widget->CloseNow();
1327 #endif
1318 } 1328 }
1319 #endif // defined(USE_AURA) && !defined(OS_CHROMEOS) && !defined(OS_WIN) 1329 #endif // defined(USE_AURA) && !defined(OS_CHROMEOS)
1320 1330
1321 namespace { 1331 namespace {
1322 1332
1323 // Helper class for CaptureLostTrackingWidget to store whether 1333 // Helper class for CaptureLostTrackingWidget to store whether
1324 // OnMouseCaptureLost has been invoked for a widget. 1334 // OnMouseCaptureLost has been invoked for a widget.
1325 class CaptureLostState { 1335 class CaptureLostState {
1326 public: 1336 public:
1327 CaptureLostState() : got_capture_lost_(false) {} 1337 CaptureLostState() : got_capture_lost_(false) {}
1328 1338
1329 bool GetAndClearGotCaptureLost() { 1339 bool GetAndClearGotCaptureLost() {
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 1920
1911 ui::KeyEvent key_event2(key_event); 1921 ui::KeyEvent key_event2(key_event);
1912 widget->OnKeyEvent(&key_event2); 1922 widget->OnKeyEvent(&key_event2);
1913 EXPECT_FALSE(key_event2.stopped_propagation()); 1923 EXPECT_FALSE(key_event2.stopped_propagation());
1914 1924
1915 widget->CloseNow(); 1925 widget->CloseNow();
1916 } 1926 }
1917 1927
1918 } // namespace test 1928 } // namespace test
1919 } // namespace views 1929 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698