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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2951053005: Add Mojo API for Blink hit testing (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index bee86223c90fd75656e878c23480fbd248942b7f..424f6cd0da8a67d5f27b20ad3036905ac6a90e29 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -64,6 +64,7 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/common/browser_side_navigation_policy.h"
+#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
@@ -267,6 +268,14 @@ double GetPageScaleFactor(Shell* shell) {
.page_scale_factor;
}
+bool callback_received = false;
+int received_frame_id = -2;
+
+void callback(int frame_id) {
+ received_frame_id = frame_id;
+ callback_received = true;
+}
+
// Helper function that performs a surface hittest.
void SurfaceHitTestTestHelper(
Shell* shell,
@@ -324,6 +333,18 @@ void SurfaceHitTestTestHelper(
child_event.click_count = 1;
main_frame_monitor.ResetEventReceived();
child_frame_monitor.ResetEventReceived();
+
+ callback_received = false;
+ root->current_frame_host()->GetFrameInputHandler()->HitTestFrameAt(
+ (gfx::PointF)child_event.PositionInWidget(), base::Bind(&callback));
+ while (!callback_received) {
+ base::RunLoop run_loop;
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
+ run_loop.Run();
+ }
+ ASSERT_EQ(4, received_frame_id);
+
router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo());
EXPECT_TRUE(child_frame_monitor.EventWasReceived());
@@ -619,11 +640,16 @@ std::string SitePerProcessBrowserTest::DepictFrameTree(FrameTreeNode* node) {
void SitePerProcessBrowserTest::SetUpCommandLine(
base::CommandLine* command_line) {
IsolateAllSitesForTesting(command_line);
+ std::vector<base::StringPiece> enabled_features;
+ std::vector<base::StringPiece> disabled_features;
+ enabled_features.push_back(features::kMojoInputMessages.name);
#if !defined(OS_ANDROID)
// TODO(bokan): Needed for scrollability check in
// FrameOwnerPropertiesPropagationScrolling. crbug.com/662196.
- feature_list_.InitAndDisableFeature(features::kOverlayScrollbar);
+ disabled_features.push_back(features::kOverlayScrollbar.name);
#endif
+ feature_list_.InitFromCommandLine(base::JoinString(enabled_features, ","),
+ base::JoinString(disabled_features, ","));
}
void SitePerProcessBrowserTest::SetUpOnMainThread() {

Powered by Google App Engine
This is Rietveld 408576698