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

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

Issue 2926683003: Enable WidgetTestInteractive.DesktopNativeWidgetWithModalTransientChild on OS_WIN (Closed)
Patch Set: feedback 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 // Create a desktop native Widget for Widget::Deactivate().
1280 Widget* deactivate_widget = CreateWidget();
1281 ShowSync(deactivate_widget);
1282
1280 // Create a top level desktop native widget. 1283 // Create a top level desktop native widget.
1281 Widget* top_level = CreateWidget(); 1284 Widget* top_level = CreateWidget();
1282 1285
1283 Textfield* textfield = new Textfield; 1286 Textfield* textfield = new Textfield;
1284 textfield->SetBounds(0, 0, 200, 20); 1287 textfield->SetBounds(0, 0, 200, 20);
1285 top_level->GetRootView()->AddChildView(textfield); 1288 top_level->GetRootView()->AddChildView(textfield);
1286 ShowSync(top_level); 1289 ShowSync(top_level);
1287 textfield->RequestFocus(); 1290 textfield->RequestFocus();
1288 EXPECT_TRUE(textfield->HasFocus()); 1291 EXPECT_TRUE(textfield->HasFocus());
1289 1292
(...skipping 18 matching lines...) Expand all
1308 EXPECT_FALSE(dialog_textfield->HasFocus()); 1311 EXPECT_FALSE(dialog_textfield->HasFocus());
1309 EXPECT_FALSE(textfield->HasFocus()); 1312 EXPECT_FALSE(textfield->HasFocus());
1310 1313
1311 // After deactivation and activation of top level widget, only modal dialog 1314 // After deactivation and activation of top level widget, only modal dialog
1312 // should restore focused view. 1315 // should restore focused view.
1313 ActivateSync(top_level); 1316 ActivateSync(top_level);
1314 EXPECT_TRUE(dialog_textfield->HasFocus()); 1317 EXPECT_TRUE(dialog_textfield->HasFocus());
1315 EXPECT_FALSE(textfield->HasFocus()); 1318 EXPECT_FALSE(textfield->HasFocus());
1316 1319
1317 top_level->CloseNow(); 1320 top_level->CloseNow();
1321 deactivate_widget->CloseNow();
1318 } 1322 }
1319 #endif // defined(USE_AURA) && !defined(OS_CHROMEOS) && !defined(OS_WIN) 1323 #endif // defined(USE_AURA) && !defined(OS_CHROMEOS)
1320 1324
1321 namespace { 1325 namespace {
1322 1326
1323 // Helper class for CaptureLostTrackingWidget to store whether 1327 // Helper class for CaptureLostTrackingWidget to store whether
1324 // OnMouseCaptureLost has been invoked for a widget. 1328 // OnMouseCaptureLost has been invoked for a widget.
1325 class CaptureLostState { 1329 class CaptureLostState {
1326 public: 1330 public:
1327 CaptureLostState() : got_capture_lost_(false) {} 1331 CaptureLostState() : got_capture_lost_(false) {}
1328 1332
1329 bool GetAndClearGotCaptureLost() { 1333 bool GetAndClearGotCaptureLost() {
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 1914
1911 ui::KeyEvent key_event2(key_event); 1915 ui::KeyEvent key_event2(key_event);
1912 widget->OnKeyEvent(&key_event2); 1916 widget->OnKeyEvent(&key_event2);
1913 EXPECT_FALSE(key_event2.stopped_propagation()); 1917 EXPECT_FALSE(key_event2.stopped_propagation());
1914 1918
1915 widget->CloseNow(); 1919 widget->CloseNow();
1916 } 1920 }
1917 1921
1918 } // namespace test 1922 } // namespace test
1919 } // namespace views 1923 } // 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