Enable builtin Mojo JS modules in layout tests

This adds a new BindingsPolicy exclusively for enabling
Mojo system API and ServiceRegistry modules to a render
view. Previously these were only made available in
conjunction with WebUI bindings.

While still implied by WebUI bindings availability, Mojo
modules are now also available to any view created during
a layout test run.

Part of a CL series to enable Mojo service mocks in layout
tests:

 1. https://codereview.chromium.org/1468903002
 2. this CL
 3. https://codereview.chromium.org/1470153002

[email protected] for WebUI

Review URL: https://codereview.chromium.org/1470823002

Cr-Commit-Position: refs/heads/master@{#371470}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 84e6d1a..cb1625f 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2361,7 +2361,13 @@
     new WebUIExtensionData(this);
 
     if (main_render_frame_)
-      main_render_frame_->EnableMojoBindings();
+      main_render_frame_->EnableMojoBindings(false /* for_layout_tests */);
+  }
+
+  if ((enabled_bindings_flags & BINDINGS_POLICY_MOJO) &&
+      !(enabled_bindings_ & BINDINGS_POLICY_MOJO) &&
+      main_render_frame_) {
+    main_render_frame_->EnableMojoBindings(true /* for_layout_tests */);
   }
 
   enabled_bindings_ |= enabled_bindings_flags;