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

Unified Diff: chrome/test/base/interactive_test_utils_views.cc

Issue 2910033002: Fail tests that use ClickOnView() on an inactive window.
Patch Set: Fail more Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/interactive_test_utils_cocoa.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/interactive_test_utils_views.cc
diff --git a/chrome/test/base/interactive_test_utils_views.cc b/chrome/test/base/interactive_test_utils_views.cc
index f1dce9d43b99783713733b025068094f8ecd83c7..c1cb74bbe47ac381941cb19d431045835d26209b 100644
--- a/chrome/test/base/interactive_test_utils_views.cc
+++ b/chrome/test/base/interactive_test_utils_views.cc
@@ -6,7 +6,9 @@
#include "base/message_loop/message_loop.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/focus/focus_manager.h"
namespace ui_test_utils {
@@ -27,6 +29,10 @@ bool IsViewFocused(const Browser* browser, ViewID vid) {
void ClickOnView(const Browser* browser, ViewID vid) {
views::View* view =
BrowserView::GetBrowserViewForBrowser(browser)->GetViewByID(vid);
+ // Fail tests that use ClickOnView() on an inactive window. Tests that do will
+ // flake too easily.
+ EXPECT_TRUE(browser->window()->IsActive())
+ << "ClickOnView() in an inactive window is not robust.";
DCHECK(view);
MoveMouseToCenterAndPress(view, ui_controls::LEFT,
ui_controls::DOWN | ui_controls::UP,
« no previous file with comments | « chrome/test/base/interactive_test_utils_cocoa.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698