diff --git a/BUILD.gn b/BUILD.gn
index 89db3ff..dd4aa36f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -302,7 +302,7 @@
       "//mojo/edk/test:mojo_public_bindings_unittests",
       "//mojo/edk/test:mojo_public_system_unittests",
       "//net:net_perftests",
-      "//services/shell/public/cpp",
+      "//services/service_manager/public/cpp",
       "//storage//browser:storage_unittests",
       "//third_party/WebKit/Source/platform:blink_platform_unittests",
       "//third_party/WebKit/Source/platform/heap:blink_heap_unittests",
@@ -605,7 +605,7 @@
       "//content/public/app:browser",
       "//content/public/app:child",
       "//mojo/edk/test:mojo_public_system_perftests",
-      "//services/shell/public/cpp",
+      "//services/service_manager/public/cpp",
       "//testing/gmock:gmock_main",
       "//third_party/codesighs:nm2tsv",
     ]
@@ -633,10 +633,6 @@
       }
     }
 
-    if (enable_app_list) {
-      deps += [ "//ui/app_list:app_list_demo" ]
-    }
-
     if (use_x11) {
       if (target_cpu != "arm") {
         deps += [ "//gpu/tools/compositor_model_bench" ]
diff --git a/DEPS b/DEPS
index 568356d..bb41a060 100644
--- a/DEPS
+++ b/DEPS
@@ -39,11 +39,11 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and whatever else without interference from each other.
-  'skia_revision': '777b5633f599f2a99e2035fdb7ab600779ab95ac',
+  'skia_revision': 'f489886915034093278353d06c6f1973b2e8b7d2',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
-  'v8_revision': '79df8a6c052598332fd6e1381430394107b96888',
+  'v8_revision': '97105c597448e1434027d538afe0feb971a09a50',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling swarming_client
   # and whatever else without interference from each other.
@@ -63,7 +63,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling PDFium
   # and whatever else without interference from each other.
-  'pdfium_revision': '1d023881cd53485303c0fcc0b5878e700dc470fd',
+  'pdfium_revision': '4dc112664e9d87c0d450ee3349a5091c624a3363',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling openmax_dl
   # and whatever else without interference from each other.
@@ -71,7 +71,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling BoringSSL
   # and whatever else without interference from each other.
-  'boringssl_revision': '0d81373f9169637ff935449227be924c08bf1ec5',
+  'boringssl_revision': 'ac9a7f63848a08a5e937493cee2aa20dd651b5c4',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling google-toolbox-for-mac
   # and whatever else without interference from each other.
@@ -87,7 +87,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling NaCl
   # and whatever else without interference from each other.
-  'nacl_revision': 'be714d07cf63b5e59921348fa1d2a5e9dc3059e5',
+  'nacl_revision': '0ed980949e515a40fa79147e7f1cda70c56cf536',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling freetype-android
   # and whatever else without interference from each other.
@@ -95,7 +95,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling catapult
   # and whatever else without interference from each other.
-  'catapult_revision': 'fcf8330661f623497eb9203846ba49c4cd5f90ee',
+  'catapult_revision': '60871179ac16079df83009da758b0e64e4227f2e',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libFuzzer
   # and whatever else without interference from each other.
@@ -186,7 +186,7 @@
     Var('chromium_git') + '/external/bidichecker/lib.git' + '@' + '97f2aa645b74c28c57eca56992235c79850fa9e0',
 
   'src/third_party/webgl/src':
-    Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '1db74f63016a90bc696e050712a2bd515eae49fc',
+    Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '4e6c509',
 
   'src/third_party/webdriver/pylib':
     Var('chromium_git') + '/external/selenium/py.git' + '@' + '5fd78261a75fe08d27ca4835fb6c5ce4b42275bd',
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn
index d2713b0..be53b7e 100644
--- a/android_webview/BUILD.gn
+++ b/android_webview/BUILD.gn
@@ -53,7 +53,8 @@
   }
 }
 
-locale_pak_resources("locale_paks") {
+android_assets("locale_pak_assets") {
+  disable_compression = true
   sources = []
   foreach(_locale, locales) {
     sources += [ "$root_out_dir/android_webview/locales/$_locale.pak" ]
@@ -135,6 +136,7 @@
 
 android_assets("assets") {
   deps = [
+    ":locale_pak_assets",
     ":monochrome_webview_assets",
     ":pak_file_assets",
   ]
@@ -164,7 +166,6 @@
   resource_dirs = [ "java/res" ]
   custom_package = "org.chromium.android_webview"
   deps = [
-    ":locale_paks",
     ":strings_grd",
   ]
 }
diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS
index 8761625..d996140 100644
--- a/android_webview/browser/DEPS
+++ b/android_webview/browser/DEPS
@@ -41,7 +41,7 @@
 
   "+printing",
 
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 
   "+ui/gfx",
   "+ui/gl",
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc
index 0ecf6c0..9f4cf32 100644
--- a/android_webview/browser/hardware_renderer.cc
+++ b/android_webview/browser/hardware_renderer.cc
@@ -156,6 +156,14 @@
 void HardwareRenderer::DestroySurface() {
   DCHECK(!child_id_.is_null());
   DCHECK(surface_factory_);
+
+  // Submit an empty frame to force any existing resources to be returned.
+  cc::CompositorFrame empty_frame;
+  empty_frame.delegated_frame_data =
+      base::WrapUnique(new cc::DelegatedFrameData);
+  surface_factory_->SubmitCompositorFrame(child_id_, std::move(empty_frame),
+                                          cc::SurfaceFactory::DrawCallback());
+
   surfaces_->RemoveChildId(cc::SurfaceId(frame_sink_id_, child_id_));
   surface_factory_->Destroy(child_id_);
   child_id_ = cc::LocalFrameId();
diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
index ea8e6d5..f222880 100644
--- a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
+++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
@@ -19,7 +19,7 @@
 #include "content/public/browser/user_metrics.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/frame_navigate_params.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace android_webview {
 
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
index 7eb824d..86a246f 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
@@ -45,7 +45,6 @@
 import org.chromium.android_webview.AwResource;
 import org.chromium.android_webview.AwSettings;
 import org.chromium.android_webview.HttpAuthDatabase;
-import org.chromium.android_webview.R;
 import org.chromium.android_webview.ResourcesContextWrapperFactory;
 import org.chromium.base.BuildConfig;
 import org.chromium.base.CommandLine;
@@ -62,7 +61,6 @@
 import org.chromium.base.library_loader.ProcessInitException;
 import org.chromium.content.browser.ContentViewStatics;
 import org.chromium.net.NetworkChangeNotifier;
-import org.chromium.ui.base.ResourceBundle;
 
 import java.io.File;
 import java.util.Queue;
@@ -392,7 +390,6 @@
         final String webViewPackageName = WebViewFactory.getLoadedPackageInfo().packageName;
         Context context = ContextUtils.getApplicationContext();
         setUpResources(webViewPackageName, context);
-        ResourceBundle.initializeLocalePaks(context, R.array.locale_paks);
         initPlatSupportLibrary();
         initNetworkChangeNotifier(context);
         final int extraBindFlags = Context.BIND_EXTERNAL_SERVICE;
@@ -532,35 +529,47 @@
         return new WebViewChromium(this, webView, privateAccess, mShouldDisableThreadChecking);
     }
 
-    // Check this as a workaround for crash issues.
+    // Workaround for IME thread crashes on grandfathered OEM apps.
     private boolean shouldDisableThreadChecking(Context context) {
+        String appName = context.getPackageName();
+        int versionCode = PackageUtils.getPackageVersion(context, appName);
+        int appTargetSdkVersion = context.getApplicationInfo().targetSdkVersion;
+
+        boolean shouldDisable = false;
+
         // crbug.com/651706
         final String lgeMailPackageId = "com.lge.email";
-        if (lgeMailPackageId.equals(context.getPackageName())) {
-            if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M + 1) return false;
-            int versionCode = PackageUtils.getPackageVersion(context, lgeMailPackageId);
+        if (lgeMailPackageId.equals(appName)) {
             // The version code is provided by LGE.
             if (versionCode == -1 || versionCode >= 67700000) return false;
-            Log.w(TAG, "Disabling thread check in WebView (http://crbug.com/651706). "
-                    + "APK name: " + lgeMailPackageId + ", versionCode: " + versionCode);
-            return true;
+            shouldDisable = true;
+        }
+
+        // crbug.com/655759
+        // Also want to cover ".att" variant suffix package name.
+        final String yahooMailPackageId = "com.yahoo.mobile.client.android.mail";
+        if (appName.startsWith(yahooMailPackageId)) {
+            if (appTargetSdkVersion > Build.VERSION_CODES.M) return false;
+            if (versionCode == -1 || versionCode > 1315849) return false;
+            shouldDisable = true;
         }
 
         // crbug.com/622151
-        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) return false;
         final String htcMailPackageId = "com.htc.android.mail";
-        if (!htcMailPackageId.equals(context.getPackageName())) return false;
-        int versionCode = PackageUtils.getPackageVersion(context, htcMailPackageId);
-        if (versionCode == -1) return false;
-        // These values are provided by HTC.
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M && versionCode >= 864021756) return false;
-        if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M && versionCode >= 866001861) {
-            return false;
+        if (htcMailPackageId.equals(appName)) {
+            if (appTargetSdkVersion > Build.VERSION_CODES.M) return false;
+            if (versionCode == -1) return false;
+            // This value is provided by HTC.
+            if (versionCode >= 866001861) return false;
+            shouldDisable = true;
         }
 
-        Log.w(TAG, "Disabling thread check in WebView (http://crbug.com/622151). "
-                + "APK name: " + htcMailPackageId + ", versionCode: " + versionCode);
-        return true;
+        if (shouldDisable) {
+            Log.w(TAG, "Disabling thread check in WebView. "
+                            + "APK name: " + appName + ", versionCode: " + versionCode
+                            + ", targetSdkVersion: " + appTargetSdkVersion);
+        }
+        return shouldDisable;
     }
 
     @Override
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index b48eb87..43bbe6be 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -1897,6 +1897,8 @@
         if (mIsPaused || isDestroyed(NO_WARN)) return;
         mIsPaused = true;
         nativeSetIsPaused(mNativeAwContents, mIsPaused);
+
+        // Geolocation is paused/resumed via the page visibility mechanism.
         updateContentViewCoreVisibility();
     }
 
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 8132d6b3..89f611b 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -850,11 +850,6 @@
                              bool paused) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   browser_view_renderer_.SetIsPaused(paused);
-  ContentViewCore* cvc =
-      ContentViewCore::FromWebContents(web_contents_.get());
-  if (cvc) {
-    cvc->PauseOrResumeGeolocation(paused);
-  }
 }
 
 void AwContents::OnAttachedToWindow(JNIEnv* env,
diff --git a/android_webview/renderer/DEPS b/android_webview/renderer/DEPS
index 8aeca3c..9b429a3 100644
--- a/android_webview/renderer/DEPS
+++ b/android_webview/renderer/DEPS
@@ -18,7 +18,7 @@
 
   "+printing",
   
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 
   "+third_party/WebKit/public/platform",
   "+third_party/WebKit/public/web",
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc
index 477c666..20754a7 100644
--- a/android_webview/renderer/aw_content_renderer_client.cc
+++ b/android_webview/renderer/aw_content_renderer_client.cc
@@ -38,8 +38,8 @@
 #include "content/public/renderer/render_view.h"
 #include "net/base/escape.h"
 #include "net/base/net_errors.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/WebURL.h"
 #include "third_party/WebKit/public/platform/WebURLError.h"
diff --git a/android_webview/system_webview_apk_tmpl.gni b/android_webview/system_webview_apk_tmpl.gni
index 6b19945..8b37716 100644
--- a/android_webview/system_webview_apk_tmpl.gni
+++ b/android_webview/system_webview_apk_tmpl.gni
@@ -24,7 +24,6 @@
     _native_lib_file =
         rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir)
     native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
-    extensions_to_not_compress = ".lpak,.pak,.bin,.dat"
     if (build_apk_secondary_abi && android_64bit_target_cpu) {
       secondary_abi_shared_libraries = [ "//android_webview:libwebviewchromium($android_secondary_abi_toolchain)" ]
     }
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn
index 93c3e9e..00db3efb 100644
--- a/android_webview/test/BUILD.gn
+++ b/android_webview/test/BUILD.gn
@@ -20,6 +20,7 @@
     ":android_webview_apk_assets",
     ":android_webview_apk_resources",
     "//android_webview:android_webview_java",
+    "//android_webview:locale_pak_assets",
     "//base:base_java",
     "//base:base_java_test_support",
     "//components/policy/android:policy_java_test_support",
@@ -51,8 +52,6 @@
   _native_lib_file =
       rebase_path("$root_gen_dir/CHROME_VERSION.json", root_build_dir)
   native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)"
-
-  extensions_to_not_compress = ".dat,.bin,.pak,.lpak"
 }
 
 android_resources("android_webview_apk_resources") {
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
index 1bbf97d1..7b75471 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
@@ -4,11 +4,9 @@
 
 package org.chromium.android_webview.shell;
 
-import org.chromium.android_webview.R;
 import org.chromium.base.CommandLine;
 import org.chromium.base.annotations.SuppressFBWarnings;
 import org.chromium.content.app.ContentApplication;
-import org.chromium.ui.base.ResourceBundle;
 
 /**
  * The android_webview shell Application subclass.
@@ -18,16 +16,6 @@
         super(false /* mShouldInitializeApplicationStatusTracking */);
     }
 
-    @Override
-    public void onCreate() {
-        super.onCreate();
-    }
-
-    @Override
-    protected void initializeLibraryDependencies() {
-        ResourceBundle.initializeLocalePaks(this, R.array.locale_paks);
-    }
-
     @SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME")
     @Override
     public void initCommandLine() {
diff --git a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
index 998091cc..8c85558 100644
--- a/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
+++ b/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
@@ -4407,6 +4407,7 @@
 interface SecurityPolicyViolationEvent : Event
     getter blockedURI
     getter columnNumber
+    getter disposition
     getter documentURI
     getter effectiveDirective
     getter lineNumber
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index a0b0087..5bcd80f3 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -847,7 +847,7 @@
     "//components/wallpaper",
     "//media",
     "//net",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//third_party/icu",
     "//ui/accessibility",
@@ -1219,7 +1219,6 @@
     "common/system/chromeos/power/power_status_unittest.cc",
     "common/system/chromeos/power/power_status_view_unittest.cc",
     "common/system/chromeos/power/tray_power_unittest.cc",
-    "common/system/chromeos/screen_security/screen_tray_item_unittest.cc",
     "common/system/chromeos/session/logout_confirmation_controller_unittest.cc",
     "common/system/chromeos/session/tray_session_length_limit_unittest.cc",
     "common/system/ime/tray_ime_chromeos_unittest.cc",
diff --git a/ash/DEPS b/ash/DEPS
index 3e4fd9f..768cf28 100644
--- a/ash/DEPS
+++ b/ash/DEPS
@@ -10,7 +10,7 @@
   "+grit/ash_strings.h",
   "+media",
   "+mojo/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+skia/ext",
   "+third_party/cros_system_api",
   "+third_party/skia",
diff --git a/ash/aura/pointer_watcher_adapter.cc b/ash/aura/pointer_watcher_adapter.cc
index ccb559f..c9e54ca 100644
--- a/ash/aura/pointer_watcher_adapter.cc
+++ b/ash/aura/pointer_watcher_adapter.cc
@@ -95,19 +95,16 @@
     const ui::LocatedEvent& original_event) {
   const gfx::Point screen_location(GetLocationInScreen(original_event));
   views::Widget* target_widget = GetTargetWidget(original_event);
-  FOR_EACH_OBSERVER(
-      views::PointerWatcher, drag_watchers_,
-      OnPointerEventObserved(event, screen_location, target_widget));
+  for (auto& observer : drag_watchers_)
+    observer.OnPointerEventObserved(event, screen_location, target_widget);
   if (original_event.type() != ui::ET_TOUCH_MOVED &&
       original_event.type() != ui::ET_MOUSE_DRAGGED) {
-    FOR_EACH_OBSERVER(
-        views::PointerWatcher, move_watchers_,
-        OnPointerEventObserved(event, screen_location, target_widget));
+    for (auto& observer : move_watchers_)
+      observer.OnPointerEventObserved(event, screen_location, target_widget);
   }
   if (event.type() != ui::ET_POINTER_MOVED) {
-    FOR_EACH_OBSERVER(
-        views::PointerWatcher, non_move_watchers_,
-        OnPointerEventObserved(event, screen_location, target_widget));
+    for (auto& observer : non_move_watchers_)
+      observer.OnPointerEventObserved(event, screen_location, target_widget);
   }
 }
 
diff --git a/ash/aura/wm_shell_aura.cc b/ash/aura/wm_shell_aura.cc
index a34cc4c..9e0150b 100644
--- a/ash/aura/wm_shell_aura.cc
+++ b/ash/aura/wm_shell_aura.cc
@@ -308,26 +308,26 @@
   WmWindow* lost_active_wm = WmWindowAura::Get(lost_active);
   if (gained_active_wm)
     set_root_window_for_new_windows(gained_active_wm->GetRootWindow());
-  FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_,
-                    OnWindowActivated(gained_active_wm, lost_active_wm));
+  for (auto& observer : activation_observers_)
+    observer.OnWindowActivated(gained_active_wm, lost_active_wm);
 }
 
 void WmShellAura::OnAttemptToReactivateWindow(aura::Window* request_active,
                                               aura::Window* actual_active) {
-  FOR_EACH_OBSERVER(
-      WmActivationObserver, activation_observers_,
-      OnAttemptToReactivateWindow(WmWindowAura::Get(request_active),
-                                  WmWindowAura::Get(actual_active)));
+  for (auto& observer : activation_observers_) {
+    observer.OnAttemptToReactivateWindow(WmWindowAura::Get(request_active),
+                                         WmWindowAura::Get(actual_active));
+  }
 }
 
 void WmShellAura::OnDisplayConfigurationChanging() {
-  FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_,
-                    OnDisplayConfigurationChanging());
+  for (auto& observer : display_observers_)
+    observer.OnDisplayConfigurationChanging();
 }
 
 void WmShellAura::OnDisplayConfigurationChanged() {
-  FOR_EACH_OBSERVER(WmDisplayObserver, display_observers_,
-                    OnDisplayConfigurationChanged());
+  for (auto& observer : display_observers_)
+    observer.OnDisplayConfigurationChanged();
 }
 
 }  // namespace ash
diff --git a/ash/aura/wm_window_aura.cc b/ash/aura/wm_window_aura.cc
index 0bff46e..4536719 100644
--- a/ash/aura/wm_window_aura.cc
+++ b/ash/aura/wm_window_aura.cc
@@ -810,8 +810,8 @@
   wm_params.target = Get(params.target);
   wm_params.new_parent = Get(params.new_parent);
   wm_params.old_parent = Get(params.old_parent);
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_,
-                    OnWindowTreeChanging(this, wm_params));
+  for (auto& observer : observers_)
+    observer.OnWindowTreeChanging(this, wm_params);
 }
 
 void WmWindowAura::OnWindowHierarchyChanged(
@@ -820,13 +820,13 @@
   wm_params.target = Get(params.target);
   wm_params.new_parent = Get(params.new_parent);
   wm_params.old_parent = Get(params.old_parent);
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_,
-                    OnWindowTreeChanged(this, wm_params));
+  for (auto& observer : observers_)
+    observer.OnWindowTreeChanged(this, wm_params);
 }
 
 void WmWindowAura::OnWindowStackingChanged(aura::Window* window) {
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_,
-                    OnWindowStackingChanged(this));
+  for (auto& observer : observers_)
+    observer.OnWindowStackingChanged(this);
 }
 
 void WmWindowAura::OnWindowPropertyChanged(aura::Window* window,
@@ -856,52 +856,55 @@
   } else {
     return;
   }
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_,
-                    OnWindowPropertyChanged(this, wm_property));
+  for (auto& observer : observers_)
+    observer.OnWindowPropertyChanged(this, wm_property);
 }
 
 void WmWindowAura::OnWindowBoundsChanged(aura::Window* window,
                                          const gfx::Rect& old_bounds,
                                          const gfx::Rect& new_bounds) {
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_,
-                    OnWindowBoundsChanged(this, old_bounds, new_bounds));
+  for (auto& observer : observers_)
+    observer.OnWindowBoundsChanged(this, old_bounds, new_bounds);
 }
 
 void WmWindowAura::OnWindowDestroying(aura::Window* window) {
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowDestroying(this));
+  for (auto& observer : observers_)
+    observer.OnWindowDestroying(this);
 }
 
 void WmWindowAura::OnWindowDestroyed(aura::Window* window) {
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowDestroyed(this));
+  for (auto& observer : observers_)
+    observer.OnWindowDestroyed(this);
 }
 
 void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window,
                                               bool visible) {
   DCHECK_EQ(window, window_);
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_,
-                    OnWindowVisibilityChanging(this, visible));
+  for (auto& observer : observers_)
+    observer.OnWindowVisibilityChanging(this, visible);
 }
 
 void WmWindowAura::OnWindowVisibilityChanged(aura::Window* window,
                                              bool visible) {
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_,
-                    OnWindowVisibilityChanged(Get(window), visible));
+  for (auto& observer : observers_)
+    observer.OnWindowVisibilityChanged(Get(window), visible);
 }
 
 void WmWindowAura::OnWindowTitleChanged(aura::Window* window) {
-  FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowTitleChanged(this));
+  for (auto& observer : observers_)
+    observer.OnWindowTitleChanged(this);
 }
 
 void WmWindowAura::OnTransientChildAdded(aura::Window* window,
                                          aura::Window* transient) {
-  FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_,
-                    OnTransientChildAdded(this, Get(transient)));
+  for (auto& observer : transient_observers_)
+    observer.OnTransientChildAdded(this, Get(transient));
 }
 
 void WmWindowAura::OnTransientChildRemoved(aura::Window* window,
                                            aura::Window* transient) {
-  FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_,
-                    OnTransientChildRemoved(this, Get(transient)));
+  for (auto& observer : transient_observers_)
+    observer.OnTransientChildRemoved(this, Get(transient));
 }
 
 }  // namespace ash
diff --git a/ash/autoclick/mus/BUILD.gn b/ash/autoclick/mus/BUILD.gn
index 140dd0e5..4f316bd 100644
--- a/ash/autoclick/mus/BUILD.gn
+++ b/ash/autoclick/mus/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 
 source_set("lib") {
@@ -21,8 +21,8 @@
     "//mash/public/interfaces",
     "//mojo/common",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
     "//ui/views",
@@ -43,8 +43,8 @@
     ":lib",
     "//base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
     "//ui/views/mus:for_mojo_application",
   ]
 
diff --git a/ash/autoclick/mus/DEPS b/ash/autoclick/mus/DEPS
index f82325c8..78606f78 100644
--- a/ash/autoclick/mus/DEPS
+++ b/ash/autoclick/mus/DEPS
@@ -5,6 +5,6 @@
   "+ash/public",
   "+mash/public/interfaces",
   "+mojo/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+services/ui/public",
 ]
diff --git a/ash/autoclick/mus/autoclick_application.cc b/ash/autoclick/mus/autoclick_application.cc
index 9ad69d65..06c7815 100644
--- a/ash/autoclick/mus/autoclick_application.cc
+++ b/ash/autoclick/mus/autoclick_application.cc
@@ -7,7 +7,7 @@
 #include "ash/public/interfaces/container.mojom.h"
 #include "base/macros.h"
 #include "base/strings/utf_string_conversions.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
 #include "ui/views/mus/aura_init.h"
@@ -75,7 +75,7 @@
 
 AutoclickApplication::~AutoclickApplication() {}
 
-void AutoclickApplication::OnStart(const shell::Identity& identity) {
+void AutoclickApplication::OnStart(const service_manager::Identity& identity) {
   aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak"));
   window_manager_connection_ =
       views::WindowManagerConnection::Create(connector(), identity);
@@ -83,8 +83,9 @@
       base::TimeDelta::FromMilliseconds(kDefaultAutoclickDelayMs), this));
 }
 
-bool AutoclickApplication::OnConnect(const shell::Identity& remote_identity,
-                                     shell::InterfaceRegistry* registry) {
+bool AutoclickApplication::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mash::mojom::Launchable>(this);
   registry->AddInterface<mojom::AutoclickController>(this);
   return true;
@@ -125,14 +126,16 @@
       base::TimeDelta::FromMilliseconds(delay_in_milliseconds));
 }
 
-void AutoclickApplication::Create(const shell::Identity& remote_identity,
-                                  mash::mojom::LaunchableRequest request) {
+void AutoclickApplication::Create(
+    const service_manager::Identity& remote_identity,
+    mash::mojom::LaunchableRequest request) {
   launchable_binding_.Close();
   launchable_binding_.Bind(std::move(request));
 }
 
-void AutoclickApplication::Create(const shell::Identity& remote_identity,
-                                  mojom::AutoclickControllerRequest request) {
+void AutoclickApplication::Create(
+    const service_manager::Identity& remote_identity,
+    mojom::AutoclickControllerRequest request) {
   autoclick_binding_.Close();
   autoclick_binding_.Bind(std::move(request));
 }
diff --git a/ash/autoclick/mus/autoclick_application.h b/ash/autoclick/mus/autoclick_application.h
index 7bf11b8..1006ea1 100644
--- a/ash/autoclick/mus/autoclick_application.h
+++ b/ash/autoclick/mus/autoclick_application.h
@@ -13,7 +13,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace views {
 class AuraInit;
@@ -25,21 +25,21 @@
 namespace autoclick {
 
 class AutoclickApplication
-    : public shell::Service,
+    : public service_manager::Service,
       public mash::mojom::Launchable,
       public mojom::AutoclickController,
-      public shell::InterfaceFactory<mash::mojom::Launchable>,
-      public shell::InterfaceFactory<mojom::AutoclickController>,
+      public service_manager::InterfaceFactory<mash::mojom::Launchable>,
+      public service_manager::InterfaceFactory<mojom::AutoclickController>,
       public AutoclickControllerCommonDelegate {
  public:
   AutoclickApplication();
   ~AutoclickApplication() override;
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Launchable:
   void Launch(uint32_t what, mash::mojom::LaunchMode how) override;
@@ -47,12 +47,12 @@
   // mojom::AutoclickController:
   void SetAutoclickDelay(uint32_t delay_in_milliseconds) override;
 
-  // shell::InterfaceFactory<mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mash::mojom::LaunchableRequest request) override;
 
-  // shell::InterfaceFactory<mojom::AutoclickController>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::AutoclickController>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::AutoclickControllerRequest request) override;
 
   // AutoclickControllerCommonDelegate:
diff --git a/ash/autoclick/mus/main.cc b/ash/autoclick/mus/main.cc
index ea3ee18d..805d709 100644
--- a/ash/autoclick/mus/main.cc
+++ b/ash/autoclick/mus/main.cc
@@ -3,10 +3,11 @@
 // found in the LICENSE file.
 
 #include "ash/autoclick/mus/autoclick_application.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new ash::autoclick::AutoclickApplication);
+  service_manager::ServiceRunner runner(
+      new ash::autoclick::AutoclickApplication);
   return runner.Run(service_request_handle);
 }
diff --git a/ash/autoclick/mus/manifest.json b/ash/autoclick/mus/manifest.json
index 6fea0f2..4d7ca4b 100644
--- a/ash/autoclick/mus/manifest.json
+++ b/ash/autoclick/mus/manifest.json
@@ -8,8 +8,8 @@
       "ash:autoclick": [ "ash::autoclick::mojom::AutoclickController" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:shell": { "classes": [ "shell:service_manager" ] }
+      "*": [ "app" ],
+      "service:shell": [ "shell:service_manager" ]
     }
   }
 }
diff --git a/ash/common/BUILD.gn b/ash/common/BUILD.gn
index fb526f0..6059806 100644
--- a/ash/common/BUILD.gn
+++ b/ash/common/BUILD.gn
@@ -28,6 +28,7 @@
   if (is_chromeos) {
     sources += [
       "system/chromeos/brightness/tray_brightness_unittest.cc",
+      "system/chromeos/screen_security/screen_tray_item_unittest.cc",
       "system/chromeos/supervised/tray_supervised_user_unittest.cc",
     ]
     deps += [ "//ui/message_center" ]
diff --git a/ash/common/mojo_interface_factory.cc b/ash/common/mojo_interface_factory.cc
index c16d7b4a..e4384fe 100644
--- a/ash/common/mojo_interface_factory.cc
+++ b/ash/common/mojo_interface_factory.cc
@@ -8,7 +8,7 @@
 #include "ash/common/system/tray/system_tray_controller.h"
 #include "ash/common/wm_shell.h"
 #include "base/bind.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace ash {
 
@@ -28,7 +28,7 @@
 namespace mojo_interface_factory {
 
 void RegisterInterfaces(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) {
   registry->AddInterface(base::Bind(&BindShelfControllerRequestOnMainThread),
                          main_thread_task_runner);
diff --git a/ash/common/mojo_interface_factory.h b/ash/common/mojo_interface_factory.h
index c6ffed8..0851eb3 100644
--- a/ash/common/mojo_interface_factory.h
+++ b/ash/common/mojo_interface_factory.h
@@ -13,7 +13,7 @@
 class SingleThreadTaskRunner;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
@@ -25,7 +25,7 @@
 // (when running ash in-process in chrome) or on the main thread (when running
 // in mash).
 ASH_EXPORT void RegisterInterfaces(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner);
 
 }  // namespace mojo_interface_factory
diff --git a/ash/common/shelf/shelf_background_animator.cc b/ash/common/shelf/shelf_background_animator.cc
index 7cbc31a0..ce9628f4 100644
--- a/ash/common/shelf/shelf_background_animator.cc
+++ b/ash/common/shelf/shelf_background_animator.cc
@@ -88,14 +88,14 @@
 void ShelfBackgroundAnimator::OnAlphaChanged(BackgroundAnimator* animator,
                                              int alpha) {
   if (animator == opaque_background_animator_.get()) {
-    FOR_EACH_OBSERVER(ShelfBackgroundAnimatorObserver, observers_,
-                      UpdateShelfOpaqueBackground(alpha));
+    for (auto& observer : observers_)
+      observer.UpdateShelfOpaqueBackground(alpha);
   } else if (animator == asset_background_animator_.get()) {
-    FOR_EACH_OBSERVER(ShelfBackgroundAnimatorObserver, observers_,
-                      UpdateShelfAssetBackground(alpha));
+    for (auto& observer : observers_)
+      observer.UpdateShelfAssetBackground(alpha);
   } else if (animator == item_background_animator_.get()) {
-    FOR_EACH_OBSERVER(ShelfBackgroundAnimatorObserver, observers_,
-                      UpdateShelfItemBackground(alpha));
+    for (auto& observer : observers_)
+      observer.UpdateShelfItemBackground(alpha);
   } else {
     NOTREACHED();
   }
diff --git a/ash/common/shelf/shelf_button.cc b/ash/common/shelf/shelf_button.cc
index cb23ecd4..ef00082c 100644
--- a/ash/common/shelf/shelf_button.cc
+++ b/ash/common/shelf/shelf_button.cc
@@ -121,7 +121,8 @@
       return;
     if (!animation_.is_animating())
       return;
-    FOR_EACH_OBSERVER(Observer, observers_, AnimationProgressed());
+    for (auto& observer : observers_)
+      observer.AnimationProgressed();
   }
 
   gfx::ThrobAnimation animation_;
diff --git a/ash/common/shelf/shelf_layout_manager.cc b/ash/common/shelf/shelf_layout_manager.cc
index 6bec096..4308b03 100644
--- a/ash/common/shelf/shelf_layout_manager.cc
+++ b/ash/common/shelf/shelf_layout_manager.cc
@@ -131,8 +131,8 @@
   if (update_shelf_observer_)
     update_shelf_observer_->Detach();
 
-  FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
-                    WillDeleteShelfLayoutManager());
+  for (auto& observer : observers_)
+    observer.WillDeleteShelfLayoutManager();
   WmShell::Get()->RemoveShellObserver(this);
   WmShell::Get()->RemoveLockStateObserver(this);
   WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(this);
@@ -176,8 +176,8 @@
   UpdateBoundsAndOpacity(target_bounds, false, change_work_area, NULL);
 
   // Update insets in ShelfWindowTargeter when shelf bounds change.
-  FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
-                    WillChangeVisibilityState(visibility_state()));
+  for (auto& observer : observers_)
+    observer.WillChangeVisibilityState(visibility_state());
 }
 
 void ShelfLayoutManager::LayoutShelf() {
@@ -461,8 +461,8 @@
   if (!force_update && state_.Equals(state))
     return;  // Nothing changed.
 
-  FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
-                    WillChangeVisibilityState(visibility_state));
+  for (auto& observer : observers_)
+    observer.WillChangeVisibilityState(visibility_state);
 
   StopAutoHideTimer();
 
@@ -516,8 +516,8 @@
   if ((old_state.visibility_state != state_.visibility_state &&
        state_.visibility_state == SHELF_AUTO_HIDE) ||
       old_state.auto_hide_state != state_.auto_hide_state) {
-    FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
-                      OnAutoHideStateChanged(state_.auto_hide_state));
+    for (auto& observer : observers_)
+      observer.OnAutoHideStateChanged(state_.auto_hide_state);
   }
 }
 
@@ -790,8 +790,8 @@
 void ShelfLayoutManager::UpdateShelfBackground(
     BackgroundAnimatorChangeType type) {
   const ShelfBackgroundType background_type(GetShelfBackgroundType());
-  FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
-                    OnBackgroundUpdated(background_type, type));
+  for (auto& observer : observers_)
+    observer.OnBackgroundUpdated(background_type, type);
 }
 
 void ShelfLayoutManager::UpdateAutoHideStateNow() {
diff --git a/ash/common/shelf/shelf_model.cc b/ash/common/shelf/shelf_model.cc
index 15b4d09c..cd177c2 100644
--- a/ash/common/shelf/shelf_model.cc
+++ b/ash/common/shelf/shelf_model.cc
@@ -64,7 +64,8 @@
   index = ValidateInsertionIndex(item.type, index);
   items_.insert(items_.begin() + index, item);
   items_[index].id = next_id_++;
-  FOR_EACH_OBSERVER(ShelfModelObserver, observers_, ShelfItemAdded(index));
+  for (auto& observer : observers_)
+    observer.ShelfItemAdded(index);
   return index;
 }
 
@@ -77,10 +78,10 @@
   items_.erase(items_.begin() + index);
   RemoveShelfItemDelegate(id);
   // TODO(jamescook): Fold this into ShelfItemRemoved in existing observers.
-  FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
-                    OnSetShelfItemDelegate(id, nullptr));
-  FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
-                    ShelfItemRemoved(index, id));
+  for (auto& observer : observers_)
+    observer.OnSetShelfItemDelegate(id, nullptr);
+  for (auto& observer : observers_)
+    observer.ShelfItemRemoved(index, id);
 }
 
 void ShelfModel::Move(int index, int target_index) {
@@ -90,8 +91,8 @@
   ShelfItem item(items_[index]);
   items_.erase(items_.begin() + index);
   items_.insert(items_.begin() + target_index, item);
-  FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
-                    ShelfItemMoved(index, target_index));
+  for (auto& observer : observers_)
+    observer.ShelfItemMoved(index, target_index);
 }
 
 void ShelfModel::Set(int index, const ShelfItem& item) {
@@ -103,8 +104,8 @@
   ShelfItem old_item(items_[index]);
   items_[index] = item;
   items_[index].id = old_item.id;
-  FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
-                    ShelfItemChanged(index, old_item));
+  for (auto& observer : observers_)
+    observer.ShelfItemChanged(index, old_item);
 
   // If the type changes confirm that the item is still in the right order.
   if (new_index != index) {
@@ -170,8 +171,8 @@
   // |item_delegate|.
   RemoveShelfItemDelegate(id);
 
-  FOR_EACH_OBSERVER(ShelfModelObserver, observers_,
-                    OnSetShelfItemDelegate(id, item_delegate.get()));
+  for (auto& observer : observers_)
+    observer.OnSetShelfItemDelegate(id, item_delegate.get());
 
   id_to_item_delegate_map_[id] = std::move(item_delegate);
 }
diff --git a/ash/common/shelf/wm_shelf.cc b/ash/common/shelf/wm_shelf.cc
index d1d09c0..94c8a38 100644
--- a/ash/common/shelf/wm_shelf.cc
+++ b/ash/common/shelf/wm_shelf.cc
@@ -283,7 +283,8 @@
 }
 
 void WmShelf::NotifyShelfIconPositionsChanged() {
-  FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged());
+  for (auto& observer : observers_)
+    observer.OnShelfIconPositionsChanged();
 }
 
 StatusAreaWidget* WmShelf::GetStatusAreaWidget() const {
@@ -313,21 +314,21 @@
 }
 
 void WmShelf::WillChangeVisibilityState(ShelfVisibilityState new_state) {
-  FOR_EACH_OBSERVER(WmShelfObserver, observers_,
-                    WillChangeVisibilityState(new_state));
+  for (auto& observer : observers_)
+    observer.WillChangeVisibilityState(new_state);
 }
 
 void WmShelf::OnAutoHideStateChanged(ShelfAutoHideState new_state) {
-  FOR_EACH_OBSERVER(WmShelfObserver, observers_,
-                    OnAutoHideStateChanged(new_state));
+  for (auto& observer : observers_)
+    observer.OnAutoHideStateChanged(new_state);
 }
 
 void WmShelf::OnBackgroundUpdated(ShelfBackgroundType background_type,
                                   BackgroundAnimatorChangeType change_type) {
   if (background_type == GetBackgroundType())
     return;
-  FOR_EACH_OBSERVER(WmShelfObserver, observers_,
-                    OnBackgroundTypeChanged(background_type, change_type));
+  for (auto& observer : observers_)
+    observer.OnBackgroundTypeChanged(background_type, change_type);
 }
 
 }  // namespace ash
diff --git a/ash/common/shell_delegate.h b/ash/common/shell_delegate.h
index f0d6170..e7f15a22 100644
--- a/ash/common/shell_delegate.h
+++ b/ash/common/shell_delegate.h
@@ -27,12 +27,12 @@
 class KeyboardUI;
 }
 
-namespace ui {
-class MenuModel;
+namespace service_manager {
+class Connector;
 }
 
-namespace shell {
-class Connector;
+namespace ui {
+class MenuModel;
 }
 
 namespace views {
@@ -62,7 +62,7 @@
   virtual ~ShellDelegate() {}
 
   // Returns the connector for the mojo service manager. Returns null in tests.
-  virtual ::shell::Connector* GetShellConnector() const = 0;
+  virtual service_manager::Connector* GetShellConnector() const = 0;
 
   // Returns true if this is the first time that the shell has been run after
   // the system has booted.  false is returned after the shell has been
diff --git a/ash/common/system/chromeos/network/tray_vpn.cc b/ash/common/system/chromeos/network/tray_vpn.cc
index 8d9ba35..53bba39 100644
--- a/ash/common/system/chromeos/network/tray_vpn.cc
+++ b/ash/common/system/chromeos/network/tray_vpn.cc
@@ -43,14 +43,16 @@
   }
 
   static bool ShouldShow() {
+    VPNDelegate* vpn_delegate =
+        WmShell::Get()->system_tray_delegate()->GetVPNDelegate();
+    // Tests may not have a VPN delegate. They should not show the VPN entry.
+    if (!vpn_delegate)
+      return false;
+
     // Show the VPN entry in the ash tray bubble if at least one third-party VPN
     // provider is installed.
-    if (WmShell::Get()
-            ->system_tray_delegate()
-            ->GetVPNDelegate()
-            ->HaveThirdPartyVPNProviders()) {
+    if (vpn_delegate->HaveThirdPartyVPNProviders())
       return true;
-    }
 
     // Also show the VPN entry if at least one VPN network is configured.
     NetworkStateHandler* const handler =
diff --git a/ash/common/system/chromeos/network/vpn_delegate.cc b/ash/common/system/chromeos/network/vpn_delegate.cc
index df37000b..00eb3e2 100644
--- a/ash/common/system/chromeos/network/vpn_delegate.cc
+++ b/ash/common/system/chromeos/network/vpn_delegate.cc
@@ -48,7 +48,8 @@
 }
 
 void VPNDelegate::NotifyObservers() {
-  FOR_EACH_OBSERVER(Observer, observer_list_, OnVPNProvidersChanged());
+  for (auto& observer : observer_list_)
+    observer.OnVPNProvidersChanged();
 }
 
 }  // namespace ash
diff --git a/ash/common/system/chromeos/power/power_status.cc b/ash/common/system/chromeos/power/power_status.cc
index 1966398..f7356e14 100644
--- a/ash/common/system/chromeos/power/power_status.cc
+++ b/ash/common/system/chromeos/power/power_status.cc
@@ -511,7 +511,8 @@
     const power_manager::PowerSupplyProperties& proto) {
   proto_ = proto;
   SanitizeProto(&proto_);
-  FOR_EACH_OBSERVER(Observer, observers_, OnPowerStatusChanged());
+  for (auto& observer : observers_)
+    observer.OnPowerStatusChanged();
 }
 
 }  // namespace ash
diff --git a/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc b/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc
index 997038c..820baf1 100644
--- a/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc
+++ b/ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc
@@ -8,8 +8,8 @@
 #include "ash/common/system/chromeos/screen_security/screen_share_tray_item.h"
 #include "ash/common/system/tray/system_tray_notifier.h"
 #include "ash/common/system/tray/tray_item_view.h"
+#include "ash/common/test/ash_test.h"
 #include "ash/common/wm_shell.h"
-#include "ash/test/ash_test_base.h"
 #include "base/callback.h"
 #include "base/strings/utf_string_conversions.h"
 #include "ui/events/event.h"
@@ -34,7 +34,7 @@
       ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE));
 }
 
-class ScreenTrayItemTest : public ash::test::AshTestBase {
+class ScreenTrayItemTest : public AshTest {
  public:
   ScreenTrayItemTest() : tray_item_(NULL), stop_callback_hit_count_(0) {}
   ~ScreenTrayItemTest() override {}
@@ -45,7 +45,7 @@
   int stop_callback_hit_count() const { return stop_callback_hit_count_; }
 
   void SetUp() override {
-    test::AshTestBase::SetUp();
+    AshTest::SetUp();
     TrayItemView::DisableAnimationsForTest();
   }
 
@@ -117,6 +117,7 @@
 TEST_F(ScreenCaptureTest, StartAndStop) {
   TestStartAndStop(this);
 }
+
 TEST_F(ScreenShareTest, StartAndStop) {
   TestStartAndStop(this);
 }
@@ -179,6 +180,7 @@
 TEST_F(ScreenCaptureTest, NotificationView) {
   TestNotificationView(this);
 }
+
 TEST_F(ScreenShareTest, NotificationView) {
   TestNotificationView(this);
 }
@@ -188,7 +190,7 @@
   EXPECT_FALSE(tray_item->tray_view()->visible());
 
   const std::vector<SystemTrayItem*>& tray_items =
-      test::AshTestBase::GetPrimarySystemTray()->GetTrayItems();
+      AshTest::GetPrimarySystemTray()->GetTrayItems();
   EXPECT_NE(std::find(tray_items.begin(), tray_items.end(), tray_item),
             tray_items.end());
 
@@ -196,16 +198,16 @@
   EXPECT_TRUE(tray_item->tray_view()->visible());
 
   // The default view should be created in a new bubble.
-  test::AshTestBase::GetPrimarySystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
+  AshTest::GetPrimarySystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
   EXPECT_TRUE(tray_item->default_view());
-  test::AshTestBase::GetPrimarySystemTray()->CloseSystemBubble();
+  AshTest::GetPrimarySystemTray()->CloseSystemBubble();
   EXPECT_FALSE(tray_item->default_view());
 
   test->StopSession();
   EXPECT_FALSE(tray_item->tray_view()->visible());
 
   // The default view should not be visible because session is stopped.
-  test::AshTestBase::GetPrimarySystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
+  AshTest::GetPrimarySystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
   EXPECT_FALSE(tray_item->default_view()->visible());
 }
 
diff --git a/ash/common/system/tray/system_tray_controller.cc b/ash/common/system/tray/system_tray_controller.cc
index 7b96277..43ef4fa 100644
--- a/ash/common/system/tray/system_tray_controller.cc
+++ b/ash/common/system/tray/system_tray_controller.cc
@@ -8,11 +8,12 @@
 #include "ash/common/wm_shell.h"
 #include "base/bind.h"
 #include "base/bind_helpers.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace ash {
 
-SystemTrayController::SystemTrayController(shell::Connector* connector)
+SystemTrayController::SystemTrayController(
+    service_manager::Connector* connector)
     : connector_(connector), hour_clock_type_(base::GetHourClockType()) {}
 
 SystemTrayController::~SystemTrayController() {}
@@ -77,6 +78,11 @@
     system_tray_client_->ShowPublicAccountInfo();
 }
 
+void SystemTrayController::ShowNetworkConfigure(const std::string& network_id) {
+  if (ConnectToSystemTrayClient())
+    system_tray_client_->ShowNetworkConfigure(network_id);
+}
+
 void SystemTrayController::ShowNetworkSettings(const std::string& network_id) {
   if (ConnectToSystemTrayClient())
     system_tray_client_->ShowNetworkSettings(network_id);
diff --git a/ash/common/system/tray/system_tray_controller.h b/ash/common/system/tray/system_tray_controller.h
index 0a59503..fda64b6f 100644
--- a/ash/common/system/tray/system_tray_controller.h
+++ b/ash/common/system/tray/system_tray_controller.h
@@ -5,12 +5,14 @@
 #ifndef ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_
 #define ASH_COMMON_SYSTEM_TRAY_SYSTEM_TRAY_CONTROLLER_H_
 
+#include "ash/ash_export.h"
 #include "ash/public/interfaces/system_tray.mojom.h"
+#include "base/compiler_specific.h"
 #include "base/i18n/time_formatting.h"
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -29,9 +31,10 @@
 //
 // TODO: Consider renaming this to SystemTrayClient or renaming the current
 // SystemTray to SystemTrayView and making this class SystemTray.
-class SystemTrayController : public mojom::SystemTray {
+class ASH_EXPORT SystemTrayController
+    : NON_EXPORTED_BASE(public mojom::SystemTray) {
  public:
-  explicit SystemTrayController(shell::Connector* connector);
+  explicit SystemTrayController(service_manager::Connector* connector);
   ~SystemTrayController() override;
 
   base::HourClockType hour_clock_type() const { return hour_clock_type_; }
@@ -49,6 +52,7 @@
   void ShowPaletteHelp();
   void ShowPaletteSettings();
   void ShowPublicAccountInfo();
+  void ShowNetworkConfigure(const std::string& network_id);
   void ShowNetworkSettings(const std::string& network_id);
   void ShowProxySettings();
 
@@ -67,7 +71,7 @@
   void SetUse24HourClock(bool use_24_hour) override;
 
   // May be null in unit tests.
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
 
   // Client interface in chrome browser. Only bound on Chrome OS.
   mojom::SystemTrayClientPtr system_tray_client_;
diff --git a/ash/common/system/tray/system_tray_notifier.cc b/ash/common/system/tray/system_tray_notifier.cc
index 3629b1bd..b424aa0 100644
--- a/ash/common/system/tray/system_tray_notifier.cc
+++ b/ash/common/system/tray/system_tray_notifier.cc
@@ -44,8 +44,8 @@
 
 void SystemTrayNotifier::NotifyAccessibilityModeChanged(
     AccessibilityNotificationVisibility notify) {
-  FOR_EACH_OBSERVER(AccessibilityObserver, accessibility_observers_,
-                    OnAccessibilityModeChanged(notify));
+  for (auto& observer : accessibility_observers_)
+    observer.OnAccessibilityModeChanged(notify);
 }
 
 void SystemTrayNotifier::AddAudioObserver(AudioObserver* observer) {
@@ -58,28 +58,29 @@
 
 void SystemTrayNotifier::NotifyAudioOutputVolumeChanged(uint64_t node_id,
                                                         double volume) {
-  FOR_EACH_OBSERVER(AudioObserver, audio_observers_,
-                    OnOutputNodeVolumeChanged(node_id, volume));
+  for (auto& observer : audio_observers_)
+    observer.OnOutputNodeVolumeChanged(node_id, volume);
 }
 
 void SystemTrayNotifier::NotifyAudioOutputMuteChanged(bool mute_on,
                                                       bool system_adjust) {
-  FOR_EACH_OBSERVER(AudioObserver, audio_observers_,
-                    OnOutputMuteChanged(mute_on, system_adjust));
+  for (auto& observer : audio_observers_)
+    observer.OnOutputMuteChanged(mute_on, system_adjust);
 }
 
 void SystemTrayNotifier::NotifyAudioNodesChanged() {
-  FOR_EACH_OBSERVER(AudioObserver, audio_observers_, OnAudioNodesChanged());
+  for (auto& observer : audio_observers_)
+    observer.OnAudioNodesChanged();
 }
 
 void SystemTrayNotifier::NotifyAudioActiveOutputNodeChanged() {
-  FOR_EACH_OBSERVER(AudioObserver, audio_observers_,
-                    OnActiveOutputNodeChanged());
+  for (auto& observer : audio_observers_)
+    observer.OnActiveOutputNodeChanged();
 }
 
 void SystemTrayNotifier::NotifyAudioActiveInputNodeChanged() {
-  FOR_EACH_OBSERVER(AudioObserver, audio_observers_,
-                    OnActiveInputNodeChanged());
+  for (auto& observer : audio_observers_)
+    observer.OnActiveInputNodeChanged();
 }
 
 void SystemTrayNotifier::AddClockObserver(ClockObserver* observer) {
@@ -91,21 +92,23 @@
 }
 
 void SystemTrayNotifier::NotifyRefreshClock() {
-  FOR_EACH_OBSERVER(ClockObserver, clock_observers_, Refresh());
+  for (auto& observer : clock_observers_)
+    observer.Refresh();
 }
 
 void SystemTrayNotifier::NotifyDateFormatChanged() {
-  FOR_EACH_OBSERVER(ClockObserver, clock_observers_, OnDateFormatChanged());
+  for (auto& observer : clock_observers_)
+    observer.OnDateFormatChanged();
 }
 
 void SystemTrayNotifier::NotifySystemClockTimeUpdated() {
-  FOR_EACH_OBSERVER(ClockObserver, clock_observers_,
-                    OnSystemClockTimeUpdated());
+  for (auto& observer : clock_observers_)
+    observer.OnSystemClockTimeUpdated();
 }
 
 void SystemTrayNotifier::NotifySystemClockCanSetTimeChanged(bool can_set_time) {
-  FOR_EACH_OBSERVER(ClockObserver, clock_observers_,
-                    OnSystemClockCanSetTimeChanged(can_set_time));
+  for (auto& observer : clock_observers_)
+    observer.OnSystemClockCanSetTimeChanged(can_set_time);
 }
 
 void SystemTrayNotifier::AddIMEObserver(IMEObserver* observer) {
@@ -117,12 +120,13 @@
 }
 
 void SystemTrayNotifier::NotifyRefreshIME() {
-  FOR_EACH_OBSERVER(IMEObserver, ime_observers_, OnIMERefresh());
+  for (auto& observer : ime_observers_)
+    observer.OnIMERefresh();
 }
 
 void SystemTrayNotifier::NotifyRefreshIMEMenu(bool is_active) {
-  FOR_EACH_OBSERVER(IMEObserver, ime_observers_,
-                    OnIMEMenuActivationChanged(is_active));
+  for (auto& observer : ime_observers_)
+    observer.OnIMEMenuActivationChanged(is_active);
 }
 
 void SystemTrayNotifier::AddLocaleObserver(LocaleObserver* observer) {
@@ -137,9 +141,8 @@
                                              const std::string& cur_locale,
                                              const std::string& from_locale,
                                              const std::string& to_locale) {
-  FOR_EACH_OBSERVER(
-      LocaleObserver, locale_observers_,
-      OnLocaleChanged(delegate, cur_locale, from_locale, to_locale));
+  for (auto& observer : locale_observers_)
+    observer.OnLocaleChanged(delegate, cur_locale, from_locale, to_locale);
 }
 
 void SystemTrayNotifier::AddUpdateObserver(UpdateObserver* observer) {
@@ -151,8 +154,8 @@
 }
 
 void SystemTrayNotifier::NotifyUpdateRecommended(const UpdateInfo& info) {
-  FOR_EACH_OBSERVER(UpdateObserver, update_observers_,
-                    OnUpdateRecommended(info));
+  for (auto& observer : update_observers_)
+    observer.OnUpdateRecommended(info);
 }
 
 void SystemTrayNotifier::AddUserObserver(UserObserver* observer) {
@@ -164,11 +167,13 @@
 }
 
 void SystemTrayNotifier::NotifyUserUpdate() {
-  FOR_EACH_OBSERVER(UserObserver, user_observers_, OnUserUpdate());
+  for (auto& observer : user_observers_)
+    observer.OnUserUpdate();
 }
 
 void SystemTrayNotifier::NotifyUserAddedToSession() {
-  FOR_EACH_OBSERVER(UserObserver, user_observers_, OnUserAddedToSession());
+  for (auto& observer : user_observers_)
+    observer.OnUserAddedToSession();
 }
 
 #if defined(OS_CHROMEOS)
@@ -182,13 +187,13 @@
 }
 
 void SystemTrayNotifier::NotifyRefreshBluetooth() {
-  FOR_EACH_OBSERVER(BluetoothObserver, bluetooth_observers_,
-                    OnBluetoothRefresh());
+  for (auto& observer : bluetooth_observers_)
+    observer.OnBluetoothRefresh();
 }
 
 void SystemTrayNotifier::NotifyBluetoothDiscoveringChanged() {
-  FOR_EACH_OBSERVER(BluetoothObserver, bluetooth_observers_,
-                    OnBluetoothDiscoveringChanged());
+  for (auto& observer : bluetooth_observers_)
+    observer.OnBluetoothDiscoveringChanged();
 }
 
 void SystemTrayNotifier::AddEnterpriseDomainObserver(
@@ -202,8 +207,8 @@
 }
 
 void SystemTrayNotifier::NotifyEnterpriseDomainChanged() {
-  FOR_EACH_OBSERVER(EnterpriseDomainObserver, enterprise_domain_observers_,
-                    OnEnterpriseDomainChanged());
+  for (auto& observer : enterprise_domain_observers_)
+    observer.OnEnterpriseDomainChanged();
 }
 
 void SystemTrayNotifier::AddLastWindowClosedObserver(
@@ -217,8 +222,8 @@
 }
 
 void SystemTrayNotifier::NotifyLastWindowClosed() {
-  FOR_EACH_OBSERVER(LastWindowClosedObserver, last_window_closed_observers_,
-                    OnLastWindowClosed());
+  for (auto& observer : last_window_closed_observers_)
+    observer.OnLastWindowClosed();
 }
 
 void SystemTrayNotifier::AddLogoutButtonObserver(
@@ -232,14 +237,14 @@
 }
 
 void SystemTrayNotifier::NotifyShowLoginButtonChanged(bool show_login_button) {
-  FOR_EACH_OBSERVER(LogoutButtonObserver, logout_button_observers_,
-                    OnShowLogoutButtonInTrayChanged(show_login_button));
+  for (auto& observer : logout_button_observers_)
+    observer.OnShowLogoutButtonInTrayChanged(show_login_button);
 }
 
 void SystemTrayNotifier::NotifyLogoutDialogDurationChanged(
     base::TimeDelta duration) {
-  FOR_EACH_OBSERVER(LogoutButtonObserver, logout_button_observers_,
-                    OnLogoutDialogDurationChanged(duration));
+  for (auto& observer : logout_button_observers_)
+    observer.OnLogoutDialogDurationChanged(duration);
 }
 
 void SystemTrayNotifier::AddMediaCaptureObserver(
@@ -253,8 +258,8 @@
 }
 
 void SystemTrayNotifier::NotifyMediaCaptureChanged() {
-  FOR_EACH_OBSERVER(MediaCaptureObserver, media_capture_observers_,
-                    OnMediaCaptureChanged());
+  for (auto& observer : media_capture_observers_)
+    observer.OnMediaCaptureChanged();
 }
 
 void SystemTrayNotifier::AddNetworkObserver(NetworkObserver* observer) {
@@ -266,7 +271,8 @@
 }
 
 void SystemTrayNotifier::NotifyRequestToggleWifi() {
-  FOR_EACH_OBSERVER(NetworkObserver, network_observers_, RequestToggleWifi());
+  for (auto& observer : network_observers_)
+    observer.RequestToggleWifi();
 }
 
 void SystemTrayNotifier::AddNetworkPortalDetectorObserver(
@@ -281,9 +287,8 @@
 
 void SystemTrayNotifier::NotifyOnCaptivePortalDetected(
     const std::string& service_path) {
-  FOR_EACH_OBSERVER(NetworkPortalDetectorObserver,
-                    network_portal_detector_observers_,
-                    OnCaptivePortalDetected(service_path));
+  for (auto& observer : network_portal_detector_observers_)
+    observer.OnCaptivePortalDetected(service_path);
 }
 
 void SystemTrayNotifier::AddScreenCaptureObserver(
@@ -299,13 +304,13 @@
 void SystemTrayNotifier::NotifyScreenCaptureStart(
     const base::Closure& stop_callback,
     const base::string16& sharing_app_name) {
-  FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
-                    OnScreenCaptureStart(stop_callback, sharing_app_name));
+  for (auto& observer : screen_capture_observers_)
+    observer.OnScreenCaptureStart(stop_callback, sharing_app_name);
 }
 
 void SystemTrayNotifier::NotifyScreenCaptureStop() {
-  FOR_EACH_OBSERVER(ScreenCaptureObserver, screen_capture_observers_,
-                    OnScreenCaptureStop());
+  for (auto& observer : screen_capture_observers_)
+    observer.OnScreenCaptureStop();
 }
 
 void SystemTrayNotifier::AddScreenShareObserver(ScreenShareObserver* observer) {
@@ -320,13 +325,13 @@
 void SystemTrayNotifier::NotifyScreenShareStart(
     const base::Closure& stop_callback,
     const base::string16& helper_name) {
-  FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
-                    OnScreenShareStart(stop_callback, helper_name));
+  for (auto& observer : screen_share_observers_)
+    observer.OnScreenShareStart(stop_callback, helper_name);
 }
 
 void SystemTrayNotifier::NotifyScreenShareStop() {
-  FOR_EACH_OBSERVER(ScreenShareObserver, screen_share_observers_,
-                    OnScreenShareStop());
+  for (auto& observer : screen_share_observers_)
+    observer.OnScreenShareStop();
 }
 
 void SystemTrayNotifier::AddSessionLengthLimitObserver(
@@ -340,13 +345,13 @@
 }
 
 void SystemTrayNotifier::NotifySessionStartTimeChanged() {
-  FOR_EACH_OBSERVER(SessionLengthLimitObserver, session_length_limit_observers_,
-                    OnSessionStartTimeChanged());
+  for (auto& observer : session_length_limit_observers_)
+    observer.OnSessionStartTimeChanged();
 }
 
 void SystemTrayNotifier::NotifySessionLengthLimitChanged() {
-  FOR_EACH_OBSERVER(SessionLengthLimitObserver, session_length_limit_observers_,
-                    OnSessionLengthLimitChanged());
+  for (auto& observer : session_length_limit_observers_)
+    observer.OnSessionLengthLimitChanged();
 }
 
 void SystemTrayNotifier::AddTracingObserver(TracingObserver* observer) {
@@ -358,8 +363,8 @@
 }
 
 void SystemTrayNotifier::NotifyTracingModeChanged(bool value) {
-  FOR_EACH_OBSERVER(TracingObserver, tracing_observers_,
-                    OnTracingModeChanged(value));
+  for (auto& observer : tracing_observers_)
+    observer.OnTracingModeChanged(value);
 }
 
 void SystemTrayNotifier::AddVirtualKeyboardObserver(
@@ -374,8 +379,8 @@
 
 void SystemTrayNotifier::NotifyVirtualKeyboardSuppressionChanged(
     bool suppressed) {
-  FOR_EACH_OBSERVER(VirtualKeyboardObserver, virtual_keyboard_observers_,
-                    OnKeyboardSuppressionChanged(suppressed));
+  for (auto& observer : virtual_keyboard_observers_)
+    observer.OnKeyboardSuppressionChanged(suppressed);
 }
 
 #endif  // defined(OS_CHROMEOS)
diff --git a/ash/common/wallpaper/wallpaper_controller.cc b/ash/common/wallpaper/wallpaper_controller.cc
index 76864c6e..895f471 100644
--- a/ash/common/wallpaper/wallpaper_controller.cc
+++ b/ash/common/wallpaper/wallpaper_controller.cc
@@ -79,8 +79,8 @@
       image, GetMaxDisplaySizeInNative(), layout, task_runner_));
   current_wallpaper_->StartResize();
 
-  FOR_EACH_OBSERVER(WallpaperControllerObserver, observers_,
-                    OnWallpaperDataChanged());
+  for (auto& observer : observers_)
+    observer.OnWallpaperDataChanged();
   wallpaper_mode_ = WALLPAPER_IMAGE;
   InstallDesktopControllerForAllWindows();
   return true;
diff --git a/ash/common/wm/dock/docked_window_layout_manager.cc b/ash/common/wm/dock/docked_window_layout_manager.cc
index 18081762..f25f09d 100644
--- a/ash/common/wm/dock/docked_window_layout_manager.cc
+++ b/ash/common/wm/dock/docked_window_layout_manager.cc
@@ -1297,8 +1297,8 @@
       dock_container_->GetBounds().y(), dock_inset, work_area.height());
   docked_bounds_ =
       bounds + dock_container_->GetBoundsInScreen().OffsetFromOrigin();
-  FOR_EACH_OBSERVER(DockedWindowLayoutManagerObserver, observer_list_,
-                    OnDockBoundsChanging(bounds, reason));
+  for (auto& observer : observer_list_)
+    observer.OnDockBoundsChanging(bounds, reason);
   // Show or hide background for docked area.
   gfx::Rect background_bounds(docked_bounds_);
   if (shelf_observer_)
diff --git a/ash/common/wm/window_state.cc b/ash/common/wm/window_state.cc
index e3b5cbb..c6654c0 100644
--- a/ash/common/wm/window_state.cc
+++ b/ash/common/wm/window_state.cc
@@ -351,14 +351,14 @@
 
 void WindowState::NotifyPreStateTypeChange(
     WindowStateType old_window_state_type) {
-  FOR_EACH_OBSERVER(WindowStateObserver, observer_list_,
-                    OnPreWindowStateTypeChange(this, old_window_state_type));
+  for (auto& observer : observer_list_)
+    observer.OnPreWindowStateTypeChange(this, old_window_state_type);
 }
 
 void WindowState::NotifyPostStateTypeChange(
     WindowStateType old_window_state_type) {
-  FOR_EACH_OBSERVER(WindowStateObserver, observer_list_,
-                    OnPostWindowStateTypeChange(this, old_window_state_type));
+  for (auto& observer : observer_list_)
+    observer.OnPostWindowStateTypeChange(this, old_window_state_type);
 }
 
 void WindowState::SetBoundsDirect(const gfx::Rect& bounds) {
diff --git a/ash/common/wm_shell.cc b/ash/common/wm_shell.cc
index 513f5662..b78a7939 100644
--- a/ash/common/wm_shell.cc
+++ b/ash/common/wm_shell.cc
@@ -151,11 +151,13 @@
 }
 
 void WmShell::OnMaximizeModeStarted() {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted());
+  for (auto& observer : shell_observers_)
+    observer.OnMaximizeModeStarted();
 }
 
 void WmShell::OnMaximizeModeEnded() {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded());
+  for (auto& observer : shell_observers_)
+    observer.OnMaximizeModeEnded();
 }
 
 void WmShell::UpdateAfterLoginStatusChange(LoginStatus status) {
@@ -167,33 +169,33 @@
 
 void WmShell::NotifyFullscreenStateChanged(bool is_fullscreen,
                                            WmWindow* root_window) {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_,
-                    OnFullscreenStateChanged(is_fullscreen, root_window));
+  for (auto& observer : shell_observers_)
+    observer.OnFullscreenStateChanged(is_fullscreen, root_window);
 }
 
 void WmShell::NotifyPinnedStateChanged(WmWindow* pinned_window) {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_,
-                    OnPinnedStateChanged(pinned_window));
+  for (auto& observer : shell_observers_)
+    observer.OnPinnedStateChanged(pinned_window);
 }
 
 void WmShell::NotifyVirtualKeyboardActivated(bool activated) {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_,
-                    OnVirtualKeyboardStateChanged(activated));
+  for (auto& observer : shell_observers_)
+    observer.OnVirtualKeyboardStateChanged(activated);
 }
 
 void WmShell::NotifyShelfCreatedForRootWindow(WmWindow* root_window) {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_,
-                    OnShelfCreatedForRootWindow(root_window));
+  for (auto& observer : shell_observers_)
+    observer.OnShelfCreatedForRootWindow(root_window);
 }
 
 void WmShell::NotifyShelfAlignmentChanged(WmWindow* root_window) {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_,
-                    OnShelfAlignmentChanged(root_window));
+  for (auto& observer : shell_observers_)
+    observer.OnShelfAlignmentChanged(root_window);
 }
 
 void WmShell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) {
-  FOR_EACH_OBSERVER(ShellObserver, shell_observers_,
-                    OnShelfAutoHideBehaviorChanged(root_window));
+  for (auto& observer : shell_observers_)
+    observer.OnShelfAutoHideBehaviorChanged(root_window);
 }
 
 void WmShell::AddShellObserver(ShellObserver* observer) {
@@ -205,8 +207,8 @@
 }
 
 void WmShell::OnLockStateEvent(LockStateObserver::EventType event) {
-  FOR_EACH_OBSERVER(LockStateObserver, lock_state_observers_,
-                    OnLockStateEvent(event));
+  for (auto& observer : lock_state_observers_)
+    observer.OnLockStateEvent(event);
 }
 
 void WmShell::AddLockStateObserver(LockStateObserver* observer) {
diff --git a/ash/common/wm_shell.h b/ash/common/wm_shell.h
index c6d79223..f1e45dd 100644
--- a/ash/common/wm_shell.h
+++ b/ash/common/wm_shell.h
@@ -34,7 +34,7 @@
 class Point;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -181,7 +181,7 @@
     return window_selector_controller_.get();
   }
 
-  // Returns true when ash is running as a shell::Service.
+  // Returns true when ash is running as a service_manager::Service.
   virtual bool IsRunningInMash() const = 0;
 
   virtual WmWindow* NewWindow(ui::wm::WindowType window_type,
diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc
index 8ee9091..cbd04b3d 100644
--- a/ash/magnifier/magnification_controller.cc
+++ b/ash/magnifier/magnification_controller.cc
@@ -653,8 +653,11 @@
       SwitchTargetRootWindow(current_root, true);
     }
 
-    if (IsMagnified() && event->type() == ui::ET_MOUSE_MOVED)
+    if (IsMagnified() && event->type() == ui::ET_MOUSE_MOVED &&
+        event->pointer_details().pointer_type !=
+            ui::EventPointerType::POINTER_TYPE_PEN) {
       OnMouseMove(event->root_location());
+    }
   }
 }
 
diff --git a/ash/mus/BUILD.gn b/ash/mus/BUILD.gn
index da85a67..ee65a3d 100644
--- a/ash/mus/BUILD.gn
+++ b/ash/mus/BUILD.gn
@@ -4,8 +4,8 @@
 
 import("//build/config/ui.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//tools/grit/repack.gni")
 
 source_set("lib") {
@@ -106,7 +106,7 @@
     "//mash/public/interfaces",
     "//mash/session/public/interfaces",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
     "//services/ui/common:mus_common",
     "//services/ui/public/cpp",
@@ -131,6 +131,8 @@
 
   if (is_chromeos) {
     sources += [
+      "network_connect_delegate_mus.cc",
+      "network_connect_delegate_mus.h",
       "system_tray_delegate_mus.cc",
       "system_tray_delegate_mus.h",
       "vpn_delegate_mus.cc",
@@ -157,7 +159,7 @@
     ":lib",
     ":resources",
     ":resources_200",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 
   # TODO(beng): This target relies on //mash/session, but there is a cycle so we
@@ -262,7 +264,7 @@
     "//base/test:test_config",
     "//base/test:test_support",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:service_test_support",
     "//services/ui/common:mus_common",
     "//services/ui/public/cpp",
     "//services/ui/public/cpp/tests:test_support",
diff --git a/ash/mus/DEPS b/ash/mus/DEPS
index 07ce914d..c1d99ba 100644
--- a/ash/mus/DEPS
+++ b/ash/mus/DEPS
@@ -13,7 +13,7 @@
   "+mojo/common",
   "+mojo/public",
   "+services/catalog/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+services/tracing/public",
 ]
 # Shelf code is being moved into //ash/common. Please ask jamescook@ or msw@
diff --git a/ash/mus/accelerators/accelerator_controller_delegate_mus.cc b/ash/mus/accelerators/accelerator_controller_delegate_mus.cc
index 803916c..47588024 100644
--- a/ash/mus/accelerators/accelerator_controller_delegate_mus.cc
+++ b/ash/mus/accelerators/accelerator_controller_delegate_mus.cc
@@ -12,7 +12,7 @@
 namespace mus {
 
 AcceleratorControllerDelegateMus::AcceleratorControllerDelegateMus(
-    shell::Connector* connector)
+    service_manager::Connector* connector)
     : connector_(connector) {
 #if !defined(OS_CHROMEOS)
   // To avoid trybot complaining that |connector_| is not being
diff --git a/ash/mus/accelerators/accelerator_controller_delegate_mus.h b/ash/mus/accelerators/accelerator_controller_delegate_mus.h
index 6699d75..3e058ba 100644
--- a/ash/mus/accelerators/accelerator_controller_delegate_mus.h
+++ b/ash/mus/accelerators/accelerator_controller_delegate_mus.h
@@ -7,7 +7,7 @@
 
 #include "ash/common/accelerators/accelerator_controller_delegate.h"
 #include "base/macros.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace ash {
 namespace mus {
@@ -16,7 +16,8 @@
 
 class AcceleratorControllerDelegateMus : public AcceleratorControllerDelegate {
  public:
-  explicit AcceleratorControllerDelegateMus(shell::Connector* connector);
+  explicit AcceleratorControllerDelegateMus(
+      service_manager::Connector* connector);
   ~AcceleratorControllerDelegateMus() override;
 
   // AcceleratorControllerDelegate:
@@ -32,7 +33,7 @@
                                              int new_shortcut_id) override;
 
  private:
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
 
   DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerDelegateMus);
 };
diff --git a/ash/mus/accelerators/accelerator_registrar_unittest.cc b/ash/mus/accelerators/accelerator_registrar_unittest.cc
index f35bfb0..2f8d74e 100644
--- a/ash/mus/accelerators/accelerator_registrar_unittest.cc
+++ b/ash/mus/accelerators/accelerator_registrar_unittest.cc
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "base/run_loop.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/common/event_matcher_util.h"
 #include "services/ui/public/cpp/window.h"
 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h"
@@ -67,9 +67,10 @@
   DISALLOW_COPY_AND_ASSIGN(TestAcceleratorHandler);
 };
 
-class AcceleratorRegistrarTest : public shell::test::ServiceTest {
+class AcceleratorRegistrarTest : public service_manager::test::ServiceTest {
  public:
-  AcceleratorRegistrarTest() : shell::test::ServiceTest("exe:mash_unittests") {}
+  AcceleratorRegistrarTest()
+      : service_manager::test::ServiceTest("exe:mash_unittests") {}
   ~AcceleratorRegistrarTest() override {}
 
  protected:
diff --git a/ash/mus/accessibility_delegate_mus.cc b/ash/mus/accessibility_delegate_mus.cc
index 9beb36c..871e119 100644
--- a/ash/mus/accessibility_delegate_mus.cc
+++ b/ash/mus/accessibility_delegate_mus.cc
@@ -4,11 +4,12 @@
 
 #include "ash/mus/accessibility_delegate_mus.h"
 
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace ash {
 
-AccessibilityDelegateMus::AccessibilityDelegateMus(shell::Connector* connector)
+AccessibilityDelegateMus::AccessibilityDelegateMus(
+    service_manager::Connector* connector)
     : connector_(connector) {}
 
 AccessibilityDelegateMus::~AccessibilityDelegateMus() {}
diff --git a/ash/mus/accessibility_delegate_mus.h b/ash/mus/accessibility_delegate_mus.h
index 1238626..a6f13813 100644
--- a/ash/mus/accessibility_delegate_mus.h
+++ b/ash/mus/accessibility_delegate_mus.h
@@ -9,7 +9,7 @@
 #include "base/macros.h"
 #include "services/ui/public/interfaces/accessibility_manager.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -17,7 +17,7 @@
 
 class AccessibilityDelegateMus : public DefaultAccessibilityDelegate {
  public:
-  explicit AccessibilityDelegateMus(shell::Connector* connector);
+  explicit AccessibilityDelegateMus(service_manager::Connector* connector);
   ~AccessibilityDelegateMus() override;
 
  private:
@@ -27,7 +27,7 @@
   void ToggleHighContrast() override;
 
   ui::mojom::AccessibilityManagerPtr accessibility_manager_ptr_;
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
 
   DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateMus);
 };
diff --git a/ash/mus/app_launch_unittest.cc b/ash/mus/app_launch_unittest.cc
index 7f17487..6a23147 100644
--- a/ash/mus/app_launch_unittest.cc
+++ b/ash/mus/app_launch_unittest.cc
@@ -5,7 +5,7 @@
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/run_loop.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/public/interfaces/window_server_test.mojom.h"
 
 namespace ash {
@@ -16,7 +16,7 @@
   callback.Run();
 }
 
-class AppLaunchTest : public shell::test::ServiceTest {
+class AppLaunchTest : public service_manager::test::ServiceTest {
  public:
   AppLaunchTest() : ServiceTest("exe:mash_unittests") {}
   ~AppLaunchTest() override {}
diff --git a/ash/mus/app_list_presenter_mus.cc b/ash/mus/app_list_presenter_mus.cc
index 7b7fa8d..613df6c 100644
--- a/ash/mus/app_list_presenter_mus.cc
+++ b/ash/mus/app_list_presenter_mus.cc
@@ -4,7 +4,7 @@
 
 #include "ash/mus/app_list_presenter_mus.h"
 
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace ash {
 
@@ -16,7 +16,7 @@
 
 }  // namespace
 
-AppListPresenterMus::AppListPresenterMus(::shell::Connector* connector)
+AppListPresenterMus::AppListPresenterMus(service_manager::Connector* connector)
     : connector_(connector) {}
 
 AppListPresenterMus::~AppListPresenterMus() {}
diff --git a/ash/mus/app_list_presenter_mus.h b/ash/mus/app_list_presenter_mus.h
index 61651ae..2ed64ee8 100644
--- a/ash/mus/app_list_presenter_mus.h
+++ b/ash/mus/app_list_presenter_mus.h
@@ -9,7 +9,7 @@
 #include "ui/app_list/presenter/app_list_presenter.h"
 #include "ui/app_list/presenter/app_list_presenter.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -19,7 +19,7 @@
 // talks to the app list service in chrome.
 class AppListPresenterMus : public app_list::AppListPresenter {
  public:
-  explicit AppListPresenterMus(::shell::Connector* connector);
+  explicit AppListPresenterMus(service_manager::Connector* connector);
   ~AppListPresenterMus() override;
 
   // app_list::AppListPresenter:
@@ -34,7 +34,7 @@
   // been established or has an error.
   void ConnectIfNeeded();
 
-  ::shell::Connector* connector_;
+  service_manager::Connector* connector_;
   app_list::mojom::AppListPresenterPtr presenter_;
 
   DISALLOW_COPY_AND_ASSIGN(AppListPresenterMus);
diff --git a/ash/mus/bridge/wm_shell_mus.h b/ash/mus/bridge/wm_shell_mus.h
index 6507124..316c301 100644
--- a/ash/mus/bridge/wm_shell_mus.h
+++ b/ash/mus/bridge/wm_shell_mus.h
@@ -15,10 +15,6 @@
 #include "base/observer_list.h"
 #include "services/ui/public/cpp/window_tree_client_observer.h"
 
-namespace shell {
-class Connector;
-}
-
 namespace ui {
 class WindowTreeClient;
 }
diff --git a/ash/mus/keyboard_ui_mus.cc b/ash/mus/keyboard_ui_mus.cc
index 1dff4b8..ade175f 100644
--- a/ash/mus/keyboard_ui_mus.cc
+++ b/ash/mus/keyboard_ui_mus.cc
@@ -6,11 +6,11 @@
 
 #include "ash/common/keyboard/keyboard_ui_observer.h"
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace ash {
 
-KeyboardUIMus::KeyboardUIMus(::shell::Connector* connector)
+KeyboardUIMus::KeyboardUIMus(service_manager::Connector* connector)
     : is_enabled_(false), observer_binding_(this) {
   if (connector) {
     // TODO(sky): should be something like mojo:keyboard, but need mapping.
@@ -23,7 +23,7 @@
 
 // static
 std::unique_ptr<KeyboardUI> KeyboardUIMus::Create(
-    ::shell::Connector* connector) {
+    service_manager::Connector* connector) {
   return base::MakeUnique<KeyboardUIMus>(connector);
 }
 
diff --git a/ash/mus/keyboard_ui_mus.h b/ash/mus/keyboard_ui_mus.h
index d6a90be..4c31f30 100644
--- a/ash/mus/keyboard_ui_mus.h
+++ b/ash/mus/keyboard_ui_mus.h
@@ -12,7 +12,7 @@
 #include "mojo/public/cpp/bindings/binding.h"
 #include "ui/keyboard/keyboard.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -21,10 +21,11 @@
 class KeyboardUIMus : public KeyboardUI,
                       public keyboard::mojom::KeyboardObserver {
  public:
-  explicit KeyboardUIMus(::shell::Connector* connector);
+  explicit KeyboardUIMus(service_manager::Connector* connector);
   ~KeyboardUIMus() override;
 
-  static std::unique_ptr<KeyboardUI> Create(::shell::Connector* connector);
+  static std::unique_ptr<KeyboardUI> Create(
+      service_manager::Connector* connector);
 
   // KeyboardUI:
   void Hide() override;
diff --git a/ash/mus/main.cc b/ash/mus/main.cc
index aa93e54..e3aa4de 100644
--- a/ash/mus/main.cc
+++ b/ash/mus/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "ash/mus/window_manager_application.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new ash::mus::WindowManagerApplication);
+  service_manager::ServiceRunner runner(new ash::mus::WindowManagerApplication);
   return runner.Run(service_request_handle);
 }
diff --git a/ash/mus/manifest.json b/ash/mus/manifest.json
index fc7833f..76ffade 100644
--- a/ash/mus/manifest.json
+++ b/ash/mus/manifest.json
@@ -12,11 +12,11 @@
       "mus:window_manager" : [ "ui::mojom::AcceleratorRegistrar" ]
     },
     "required": {
-      "*": { "classes": [ "accessibility", "app" ] },
-      "service:content_browser" : { "classes": [ "content_browser:ash" ] },
-      "service:mash_session": { "classes": [ "mash_session:session" ] },
-      "service:ui": { "classes": [ "ui:window_manager" ] },
-      "service:touch_hud": { "classes": [ "mash:launchable" ] }
+      "*": [ "accessibility", "app" ],
+      "service:content_browser" : [ "content_browser:ash" ],
+      "service:mash_session": [ "mash_session:session" ],
+      "service:ui": [ "ui:window_manager" ],
+      "service:touch_hud": [ "mash:launchable" ]
     }
   }
 }
diff --git a/ash/mus/network_connect_delegate_mus.cc b/ash/mus/network_connect_delegate_mus.cc
new file mode 100644
index 0000000..3e4075a
--- /dev/null
+++ b/ash/mus/network_connect_delegate_mus.cc
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/mus/network_connect_delegate_mus.h"
+
+#include "ash/common/system/tray/system_tray_controller.h"
+#include "ash/common/wm_shell.h"
+#include "base/logging.h"
+
+namespace ash {
+namespace mus {
+
+NetworkConnectDelegateMus::NetworkConnectDelegateMus() {}
+
+NetworkConnectDelegateMus::~NetworkConnectDelegateMus() {}
+
+void NetworkConnectDelegateMus::ShowNetworkConfigure(
+    const std::string& service_path) {
+  WmShell::Get()->system_tray_controller()->ShowNetworkConfigure(service_path);
+}
+
+void NetworkConnectDelegateMus::ShowNetworkSettingsForGuid(
+    const std::string& network_id) {
+  WmShell::Get()->system_tray_controller()->ShowNetworkSettings(network_id);
+}
+
+bool NetworkConnectDelegateMus::ShowEnrollNetwork(
+    const std::string& network_id) {
+  // TODO(mash): http://crbug.com/644355
+  NOTIMPLEMENTED();
+  return false;
+}
+
+void NetworkConnectDelegateMus::ShowMobileSimDialog() {
+  // TODO(mash): http://crbug.com/644355
+  NOTIMPLEMENTED();
+}
+
+void NetworkConnectDelegateMus::ShowMobileSetupDialog(
+    const std::string& service_path) {
+  // TODO(mash): http://crbug.com/644355
+  NOTIMPLEMENTED();
+}
+
+}  // namespace mus
+}  // namespace ash
diff --git a/ash/mus/network_connect_delegate_mus.h b/ash/mus/network_connect_delegate_mus.h
new file mode 100644
index 0000000..1cd5a278
--- /dev/null
+++ b/ash/mus/network_connect_delegate_mus.h
@@ -0,0 +1,37 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_MUS_NETWORK_CONNECT_DELEGATE_MUS_H_
+#define ASH_MUS_NETWORK_CONNECT_DELEGATE_MUS_H_
+
+#include "base/macros.h"
+#include "ui/chromeos/network/network_connect.h"
+
+namespace ash {
+namespace mus {
+
+// Routes requests to show network config UI over the mojom::SystemTrayClient
+// interface.
+// TODO(mash): Replace ui::NetworkConnect::Delegate with a client interface on
+// a mojo NetworkConfig service. http://crbug.com/644355
+class NetworkConnectDelegateMus : public ui::NetworkConnect::Delegate {
+ public:
+  NetworkConnectDelegateMus();
+  ~NetworkConnectDelegateMus() override;
+
+  // ui::NetworkConnect::Delegate:
+  void ShowNetworkConfigure(const std::string& service_path) override;
+  void ShowNetworkSettingsForGuid(const std::string& network_id) override;
+  bool ShowEnrollNetwork(const std::string& network_id) override;
+  void ShowMobileSimDialog() override;
+  void ShowMobileSetupDialog(const std::string& service_path) override;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(NetworkConnectDelegateMus);
+};
+
+}  // namespace mus
+}  // namespace ash
+
+#endif  // ASH_MUS_NETWORK_CONNECT_DELEGATE_MUS_H_
diff --git a/ash/mus/new_window_delegate_mus.cc b/ash/mus/new_window_delegate_mus.cc
index 07e40774..c288691e 100644
--- a/ash/mus/new_window_delegate_mus.cc
+++ b/ash/mus/new_window_delegate_mus.cc
@@ -5,7 +5,7 @@
 #include "ash/mus/new_window_delegate_mus.h"
 
 #include "base/logging.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace ash {
 namespace mus {
diff --git a/ash/mus/root_window_controller.cc b/ash/mus/root_window_controller.cc
index b8fe088..a201bac 100644
--- a/ash/mus/root_window_controller.cc
+++ b/ash/mus/root_window_controller.cc
@@ -32,7 +32,7 @@
 #include "base/command_line.h"
 #include "base/memory/ptr_util.h"
 #include "mojo/public/cpp/bindings/type_converter.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/common/switches.h"
 #include "services/ui/common/util.h"
 #include "services/ui/public/cpp/property_type_converters.h"
@@ -84,7 +84,7 @@
   wm_root_window_controller_->CloseChildWindows();
 }
 
-shell::Connector* RootWindowController::GetConnector() {
+service_manager::Connector* RootWindowController::GetConnector() {
   return window_manager_->connector();
 }
 
diff --git a/ash/mus/root_window_controller.h b/ash/mus/root_window_controller.h
index 59f7d96..325a4adc 100644
--- a/ash/mus/root_window_controller.h
+++ b/ash/mus/root_window_controller.h
@@ -17,7 +17,7 @@
 class Insets;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -46,7 +46,7 @@
 
   void Shutdown();
 
-  shell::Connector* GetConnector();
+  service_manager::Connector* GetConnector();
 
   ui::Window* root() { return root_; }
   WmRootWindowControllerMus* wm_root_window_controller() {
diff --git a/ash/mus/shell_delegate_mus.cc b/ash/mus/shell_delegate_mus.cc
index 8dd3c02..df9d36e 100644
--- a/ash/mus/shell_delegate_mus.cc
+++ b/ash/mus/shell_delegate_mus.cc
@@ -108,14 +108,14 @@
 
 }  // namespace
 
-ShellDelegateMus::ShellDelegateMus(shell::Connector* connector)
+ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector)
     : connector_(connector), app_list_presenter_(connector) {
   // |connector_| may be null in tests.
 }
 
 ShellDelegateMus::~ShellDelegateMus() {}
 
-::shell::Connector* ShellDelegateMus::GetShellConnector() const {
+service_manager::Connector* ShellDelegateMus::GetShellConnector() const {
   return connector_;
 }
 
diff --git a/ash/mus/shell_delegate_mus.h b/ash/mus/shell_delegate_mus.h
index a933a08..db25abe 100644
--- a/ash/mus/shell_delegate_mus.h
+++ b/ash/mus/shell_delegate_mus.h
@@ -11,7 +11,7 @@
 #include "ash/mus/app_list_presenter_mus.h"
 #include "base/macros.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -19,11 +19,11 @@
 
 class ShellDelegateMus : public ShellDelegate {
  public:
-  explicit ShellDelegateMus(shell::Connector* connector);
+  explicit ShellDelegateMus(service_manager::Connector* connector);
   ~ShellDelegateMus() override;
 
   // ShellDelegate:
-  ::shell::Connector* GetShellConnector() const override;
+  service_manager::Connector* GetShellConnector() const override;
   bool IsFirstRunAfterBoot() const override;
   bool IsIncognitoAllowed() const override;
   bool IsMultiProfilesEnabled() const override;
@@ -51,7 +51,7 @@
   gfx::Image GetDeprecatedAcceleratorImage() const override;
 
  private:
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
   AppListPresenterMus app_list_presenter_;
 
   DISALLOW_COPY_AND_ASSIGN(ShellDelegateMus);
diff --git a/ash/mus/wallpaper_delegate_mus.cc b/ash/mus/wallpaper_delegate_mus.cc
index 18d59fc7..a6dedd2 100644
--- a/ash/mus/wallpaper_delegate_mus.cc
+++ b/ash/mus/wallpaper_delegate_mus.cc
@@ -7,7 +7,7 @@
 #include "ash/common/wallpaper/wallpaper_controller.h"
 #include "ash/common/wm_shell.h"
 #include "components/wallpaper/wallpaper_layout.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/wm/core/window_animations.h"
 
 namespace {
@@ -33,7 +33,8 @@
 
 namespace ash {
 
-WallpaperDelegateMus::WallpaperDelegateMus(shell::Connector* connector)
+WallpaperDelegateMus::WallpaperDelegateMus(
+    service_manager::Connector* connector)
     : connector_(connector) {}
 
 WallpaperDelegateMus::~WallpaperDelegateMus() {}
diff --git a/ash/mus/wallpaper_delegate_mus.h b/ash/mus/wallpaper_delegate_mus.h
index cfdda18c..fe3dbb38 100644
--- a/ash/mus/wallpaper_delegate_mus.h
+++ b/ash/mus/wallpaper_delegate_mus.h
@@ -9,7 +9,7 @@
 #include "ash/public/interfaces/wallpaper.mojom.h"
 #include "base/macros.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -18,7 +18,7 @@
 class WallpaperDelegateMus : public WallpaperDelegate,
                              public mojom::WallpaperController {
  public:
-  explicit WallpaperDelegateMus(shell::Connector* connector);
+  explicit WallpaperDelegateMus(service_manager::Connector* connector);
   ~WallpaperDelegateMus() override;
 
  private:
@@ -38,7 +38,7 @@
   void SetWallpaper(const SkBitmap& wallpaper,
                     mojom::WallpaperLayout layout) override;
 
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
 
   DISALLOW_COPY_AND_ASSIGN(WallpaperDelegateMus);
 };
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc
index 66a388d..a03a986e 100644
--- a/ash/mus/window_manager.cc
+++ b/ash/mus/window_manager.cc
@@ -42,7 +42,7 @@
 namespace ash {
 namespace mus {
 
-WindowManager::WindowManager(shell::Connector* connector)
+WindowManager::WindowManager(service_manager::Connector* connector)
     : connector_(connector) {}
 
 WindowManager::~WindowManager() {
diff --git a/ash/mus/window_manager.h b/ash/mus/window_manager.h
index ad05ba0..f5cde47 100644
--- a/ash/mus/window_manager.h
+++ b/ash/mus/window_manager.h
@@ -27,7 +27,7 @@
 class ScreenBase;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -53,7 +53,7 @@
 class WindowManager : public ui::WindowManagerDelegate,
                       public ui::WindowTreeClientDelegate {
  public:
-  explicit WindowManager(shell::Connector* connector);
+  explicit WindowManager(service_manager::Connector* connector);
   ~WindowManager() override;
 
   void Init(std::unique_ptr<ui::WindowTreeClient> window_tree_client,
@@ -71,7 +71,7 @@
     return window_manager_client_;
   }
 
-  shell::Connector* connector() { return connector_; }
+  service_manager::Connector* connector() { return connector_; }
 
   void SetScreenLocked(bool is_locked);
 
@@ -149,7 +149,7 @@
   ui::mojom::EventResult OnAccelerator(uint32_t id,
                                        const ui::Event& event) override;
 
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
 
   std::unique_ptr<ui::WindowTreeClient> window_tree_client_;
 
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc
index 05298708..12f597e 100644
--- a/ash/mus/window_manager_application.cc
+++ b/ash/mus/window_manager_application.cc
@@ -15,8 +15,8 @@
 #include "ash/mus/window_manager.h"
 #include "base/bind.h"
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/ui/common/event_matcher_util.h"
 #include "services/ui/public/cpp/gpu_service.h"
@@ -30,6 +30,7 @@
 
 #if defined(OS_CHROMEOS)
 #include "ash/common/system/chromeos/power/power_status.h"
+#include "ash/mus/network_connect_delegate_mus.h"
 #include "chromeos/audio/cras_audio_handler.h"
 #include "chromeos/dbus/dbus_thread_manager.h"
 #include "chromeos/network/network_handler.h"
@@ -41,28 +42,6 @@
 namespace ash {
 namespace mus {
 
-#if defined(OS_CHROMEOS)
-// TODO(mash): Replace ui::NetworkConnect::Delegate with a mojo interface on a
-// NetworkConfig service. http://crbug.com/644355
-class WindowManagerApplication::StubNetworkConnectDelegate
-    : public ui::NetworkConnect::Delegate {
- public:
-  StubNetworkConnectDelegate() {}
-  ~StubNetworkConnectDelegate() override {}
-
-  void ShowNetworkConfigure(const std::string& network_id) override {}
-  void ShowNetworkSettingsForGuid(const std::string& network_id) override {}
-  bool ShowEnrollNetwork(const std::string& network_id) override {
-    return false;
-  }
-  void ShowMobileSimDialog() override {}
-  void ShowMobileSetupDialog(const std::string& service_path) override {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(StubNetworkConnectDelegate);
-};
-#endif  // OS_CHROMEOS
-
 WindowManagerApplication::WindowManagerApplication()
     : screenlock_state_listener_binding_(this) {}
 
@@ -130,7 +109,7 @@
       chromeos::DBusThreadManager::Get()->GetSystemBus(),
       chromeos::DBusThreadManager::Get()->IsUsingFakes());
   chromeos::NetworkHandler::Initialize();
-  network_connect_delegate_.reset(new StubNetworkConnectDelegate());
+  network_connect_delegate_.reset(new NetworkConnectDelegateMus());
   ui::NetworkConnect::Initialize(network_connect_delegate_.get());
   // TODO(jamescook): Initialize real audio handler.
   chromeos::CrasAudioHandler::InitializeForTesting();
@@ -151,7 +130,8 @@
   message_center::MessageCenter::Shutdown();
 }
 
-void WindowManagerApplication::OnStart(const shell::Identity& identity) {
+void WindowManagerApplication::OnStart(
+    const service_manager::Identity& identity) {
   aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak",
                                        "ash_mus_resources_200.pak"));
   gpu_service_ = ui::GpuService::Create(connector());
@@ -177,8 +157,9 @@
   InitWindowManager(std::move(window_tree_client), blocking_pool_);
 }
 
-bool WindowManagerApplication::OnConnect(const shell::Identity& remote_identity,
-                                         shell::InterfaceRegistry* registry) {
+bool WindowManagerApplication::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   // Register services used in both classic ash and mash.
   mojo_interface_factory::RegisterInterfaces(
       registry, base::ThreadTaskRunnerHandle::Get());
@@ -194,7 +175,7 @@
 }
 
 void WindowManagerApplication::Create(
-    const ::shell::Identity& remote_identity,
+    const ::service_manager::Identity& remote_identity,
     mojom::WallpaperControllerRequest request) {
   mojom::WallpaperController* wallpaper_controller =
       static_cast<WallpaperDelegateMus*>(WmShell::Get()->wallpaper_delegate());
@@ -204,7 +185,7 @@
 }
 
 void WindowManagerApplication::Create(
-    const shell::Identity& remote_identity,
+    const service_manager::Identity& remote_identity,
     ui::mojom::AcceleratorRegistrarRequest request) {
   if (!window_manager_->window_manager_client())
     return;  // Can happen during shutdown.
diff --git a/ash/mus/window_manager_application.h b/ash/mus/window_manager_application.h
index 687bd1f..4e21b9af 100644
--- a/ash/mus/window_manager_application.h
+++ b/ash/mus/window_manager_application.h
@@ -16,7 +16,7 @@
 #include "mash/session/public/interfaces/session.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/ui/common/types.h"
 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h"
@@ -47,13 +47,14 @@
 
 class AcceleratorRegistrarImpl;
 class NativeWidgetFactoryMus;
+class NetworkConnectDelegateMus;
 class WindowManager;
 
 // Hosts the window manager and the ash system user interface for mash.
 class WindowManagerApplication
-    : public shell::Service,
-      public shell::InterfaceFactory<mojom::WallpaperController>,
-      public shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>,
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::WallpaperController>,
+      public service_manager::InterfaceFactory<ui::mojom::AcceleratorRegistrar>,
       public mash::session::mojom::ScreenlockStateListener {
  public:
   WindowManagerApplication();
@@ -77,17 +78,17 @@
   void InitializeComponents();
   void ShutdownComponents();
 
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // InterfaceFactory<mojom::WallpaperController>:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               mojom::WallpaperControllerRequest request) override;
 
-  // shell::InterfaceFactory<ui::mojom::AcceleratorRegistrar>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<ui::mojom::AcceleratorRegistrar>:
+  void Create(const service_manager::Identity& remote_identity,
               ui::mojom::AcceleratorRegistrarRequest request) override;
 
   // session::mojom::ScreenlockStateListener:
@@ -115,8 +116,7 @@
       screenlock_state_listener_binding_;
 
 #if defined(OS_CHROMEOS)
-  class StubNetworkConnectDelegate;
-  std::unique_ptr<StubNetworkConnectDelegate> network_connect_delegate_;
+  std::unique_ptr<NetworkConnectDelegateMus> network_connect_delegate_;
   std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider>
       statistics_provider_;
 #endif
diff --git a/ash/mus/window_manager_unittest.cc b/ash/mus/window_manager_unittest.cc
index 2819364..7ffe427 100644
--- a/ash/mus/window_manager_unittest.cc
+++ b/ash/mus/window_manager_unittest.cc
@@ -6,7 +6,7 @@
 
 #include "base/bind.h"
 #include "base/macros.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/public/cpp/window.h"
 #include "services/ui/public/cpp/window_tree_client.h"
 #include "services/ui/public/cpp/window_tree_client_delegate.h"
@@ -31,9 +31,10 @@
   DISALLOW_COPY_AND_ASSIGN(WindowTreeClientDelegate);
 };
 
-class WindowManagerTest : public shell::test::ServiceTest {
+class WindowManagerTest : public service_manager::test::ServiceTest {
  public:
-  WindowManagerTest() : shell::test::ServiceTest("exe:mash_unittests") {}
+  WindowManagerTest()
+      : service_manager::test::ServiceTest("exe:mash_unittests") {}
   ~WindowManagerTest() override {}
 
  private:
diff --git a/ash/public/interfaces/system_tray.mojom b/ash/public/interfaces/system_tray.mojom
index 3cdb3e1b..d98d351 100644
--- a/ash/public/interfaces/system_tray.mojom
+++ b/ash/public/interfaces/system_tray.mojom
@@ -54,6 +54,10 @@
 
   // TODO(crbug.com/647412): ShowEnterpriseInfo();
 
+  // Shows UI to configure or activate the network specified by |service_path|,
+  // which may include showing payment or captive portal UI when appropriate.
+  ShowNetworkConfigure(string service_path);
+
   // Shows settings related to networking. If |network_id| is empty, shows
   // general settings. Otherwise shows settings for the individual network.
   // On devices |network_id| is a GUID, but on Linux desktop and in tests it can
diff --git a/ash/resources/vector_icons/palette_tray_icon_capture_region.icon b/ash/resources/vector_icons/palette_tray_icon_capture_region.icon
index 09b9f10..9b723d2 100644
--- a/ash/resources/vector_icons/palette_tray_icon_capture_region.icon
+++ b/ash/resources/vector_icons/palette_tray_icon_capture_region.icon
@@ -3,60 +3,90 @@
 // found in the LICENSE file.
 
 CANVAS_DIMENSIONS, 32,
-MOVE_TO, 24.45f, 25.91f,
-LINE_TO, 26.65f, 28,
-LINE_TO, 28, 26.48f,
-R_LINE_TO, -2.11f, -2.01f,
-CUBIC_TO, 26.59f, 23.49f, 27, 22.29f, 27, 21,
-CUBIC_TO, 27, 17.69f, 24.31f, 15, 21, 15,
-R_CUBIC_TO, -3.31f, 0, -6, 2.69f, -6, 6,
-CUBIC_TO, 15, 24.31f, 17.69f, 27, 21, 27,
-R_CUBIC_TO, 1.28f, 0, 2.48f, -0.41f, 3.45f, -1.09f,
+MOVE_TO, 26, 28,
+CUBIC_TO, 27.1f, 28, 28, 27.1f, 28, 26,
+LINE_TO, 26, 26,
+LINE_TO, 26, 28,
 CLOSE,
-R_MOVE_TO, -8.94f, -11.47f,
-R_LINE_TO, -1.48f, -1.48f,
+MOVE_TO, 26, 25,
+LINE_TO, 28, 25,
+LINE_TO, 28, 23,
+LINE_TO, 26, 23,
+LINE_TO, 26, 25,
+CLOSE,
+MOVE_TO, 19, 28,
+CUBIC_TO, 17.9f, 28, 17, 26.96f, 17, 26,
+LINE_TO, 19, 26,
+LINE_TO, 19, 28,
+CLOSE,
+MOVE_TO, 17, 23.98f,
+LINE_TO, 19, 23.98f,
+LINE_TO, 19, 21.98f,
+LINE_TO, 17, 21.98f,
+LINE_TO, 17, 23.98f,
+CLOSE,
+MOVE_TO, 21, 28,
+LINE_TO, 23, 28,
+LINE_TO, 23, 26,
+LINE_TO, 21, 26,
+LINE_TO, 21, 28,
+CLOSE,
+MOVE_TO, 26, 22,
+LINE_TO, 28, 22,
+LINE_TO, 28, 20,
+LINE_TO, 26, 20,
+LINE_TO, 26, 22,
+CLOSE,
+MOVE_TO, 23, 19,
+LINE_TO, 25, 19,
+LINE_TO, 25, 17,
+LINE_TO, 23, 17,
+LINE_TO, 23, 19,
+CLOSE,
+MOVE_TO, 28, 19,
+LINE_TO, 26.03f, 19,
+LINE_TO, 26.03f, 17.03f,
+CUBIC_TO, 27.11f, 17.03f, 28, 17.98f, 28, 19,
+LINE_TO, 28, 19,
+CLOSE,
+MOVE_TO, 19, 17,
+LINE_TO, 19, 15,
+LINE_TO, 17, 15,
+LINE_TO, 17, 17,
+LINE_TO, 15, 17,
+LINE_TO, 15, 18.97f,
+LINE_TO, 17, 18.97f,
+LINE_TO, 17, 21,
+LINE_TO, 19, 21,
+LINE_TO, 19, 19,
+LINE_TO, 21, 19,
+LINE_TO, 21, 17,
+LINE_TO, 19, 17,
+CLOSE,
+MOVE_TO, 14.04f, 12.96f,
 LINE_TO, 4, 23,
-R_V_LINE_TO, 5,
-R_H_LINE_TO, 4.99f,
-LINE_TO, 13.09f, 23.9f,
-R_CUBIC_TO, -0.42f, -0.97f, -0.65f, -2.04f, -0.65f, -3.16f,
-R_CUBIC_TO, 0, -2.56f, 1.21f, -4.83f, 3.08f, -6.3f,
+LINE_TO, 4, 28,
+LINE_TO, 8.98f, 28,
+LINE_TO, 13.97f, 22.76f,
+LINE_TO, 13.97f, 16.5f,
+CUBIC_TO, 13.97f, 15.62f, 14.39f, 14.88f, 15, 14.33f,
+LINE_TO, 14.04f, 12.96f,
 CLOSE,
-R_MOVE_TO, 8.1f, -1.04f,
-R_LINE_TO, 4, -4,
-R_CUBIC_TO, 0.52f, -0.52f, 0.51f, -1.37f, -0.01f, -1.89f,
-R_LINE_TO, -3.12f, -3.11f,
-R_CUBIC_TO, -0.52f, -0.52f, -1.37f, -0.52f, -1.88f, 0,
-R_LINE_TO, -1.89f, 1.88f,
-R_LINE_TO, -1.89f, -1.88f,
-R_CUBIC_TO, -0.51f, -0.52f, -1.37f, -0.53f, -1.89f, -0.01f,
-R_LINE_TO, -8.49f, 8.48f,
-R_LINE_TO, 1.87f, 1.87f,
-LINE_TO, 17.85f, 7.19f,
-R_LINE_TO, 0.97f, 0.97f,
-R_LINE_TO, -3.37f, 3.37f,
-R_LINE_TO, 1.85f, 1.85f,
-R_CUBIC_TO, 0.97f, -0.41f, 2.03f, -0.64f, 3.14f, -0.64f,
-R_CUBIC_TO, 1.13f, 0, 2.2f, 0.24f, 3.18f, 0.66f,
-CLOSE,
-MOVE_TO, 21, 17.01f,
-R_CUBIC_TO, -2.2f, 0, -3.99f, 1.79f, -3.99f, 3.99f,
-R_CUBIC_TO, 0, 2.2f, 1.79f, 3.99f, 3.99f, 3.99f,
-R_CUBIC_TO, 2.2f, 0, 3.99f, -1.79f, 3.99f, -3.99f,
-R_CUBIC_TO, 0, -2.2f, -1.79f, -3.99f, -3.99f, -3.99f,
-CLOSE,
-MOVE_TO, 24, 20,
-R_H_LINE_TO, -2,
-R_V_LINE_TO, -2,
-R_H_LINE_TO, -2,
-R_V_LINE_TO, 2,
-R_H_LINE_TO, -2,
-R_V_LINE_TO, 2,
-R_H_LINE_TO, 2,
-R_V_LINE_TO, 2,
-R_H_LINE_TO, 2,
-R_V_LINE_TO, -2,
-R_H_LINE_TO, 2,
-R_V_LINE_TO, -2,
+MOVE_TO, 18.82f, 8.16f,
+LINE_TO, 15.45f, 11.53f,
+LINE_TO, 17.99f, 13.99f,
+LINE_TO, 18.82f, 13.99f,
+LINE_TO, 23.35f, 13.99f,
+LINE_TO, 27.62f, 9.4f,
+CUBIC_TO, 28.14f, 8.88f, 28.12f, 8.02f, 27.6f, 7.5f,
+LINE_TO, 24.48f, 4.4f,
+CUBIC_TO, 23.96f, 3.88f, 23.11f, 3.88f, 22.61f, 4.4f,
+LINE_TO, 20.71f, 6.28f,
+LINE_TO, 18.82f, 4.4f,
+CUBIC_TO, 18.31f, 3.88f, 17.45f, 3.86f, 16.93f, 4.38f,
+LINE_TO, 8.44f, 12.86f,
+LINE_TO, 10.3f, 14.73f,
+LINE_TO, 17.85f, 7.18f,
+LINE_TO, 18.82f, 8.16f,
 CLOSE,
 END
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 046458f..509fd3d 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -196,7 +196,7 @@
 
 ShellDelegateImpl::~ShellDelegateImpl() {}
 
-::shell::Connector* ShellDelegateImpl::GetShellConnector() const {
+::service_manager::Connector* ShellDelegateImpl::GetShellConnector() const {
   return nullptr;
 }
 
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index 651bbaa4..8952203 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -29,7 +29,7 @@
   ~ShellDelegateImpl() override;
 
   // ShellDelegate:
-  ::shell::Connector* GetShellConnector() const override;
+  ::service_manager::Connector* GetShellConnector() const override;
   bool IsFirstRunAfterBoot() const override;
   bool IsIncognitoAllowed() const override;
   bool IsMultiProfilesEnabled() const override;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index b870bd3..9835b47 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -112,7 +112,7 @@
 
 TestShellDelegate::~TestShellDelegate() {}
 
-::shell::Connector* TestShellDelegate::GetShellConnector() const {
+::service_manager::Connector* TestShellDelegate::GetShellConnector() const {
   return nullptr;
 }
 
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 8f7588c..f90db63 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -35,7 +35,7 @@
   }
 
   // Overridden from ShellDelegate:
-  ::shell::Connector* GetShellConnector() const override;
+  ::service_manager::Connector* GetShellConnector() const override;
   bool IsFirstRunAfterBoot() const override;
   bool IsIncognitoAllowed() const override;
   bool IsMultiProfilesEnabled() const override;
diff --git a/ash/touch_hud/mus/BUILD.gn b/ash/touch_hud/mus/BUILD.gn
index 47aea01..9a5520c5 100644
--- a/ash/touch_hud/mus/BUILD.gn
+++ b/ash/touch_hud/mus/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 
 source_set("lib") {
@@ -20,8 +20,8 @@
     "//mash/public/interfaces",
     "//mojo/common",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
     "//ui/views",
@@ -42,8 +42,8 @@
     ":lib",
     "//base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
     "//ui/views/mus:for_mojo_application",
   ]
 
diff --git a/ash/touch_hud/mus/DEPS b/ash/touch_hud/mus/DEPS
index c9a349d..15fcfe2 100644
--- a/ash/touch_hud/mus/DEPS
+++ b/ash/touch_hud/mus/DEPS
@@ -4,6 +4,6 @@
   "+ash/touch_hud",
   "+mash/public/interfaces",
   "+mojo/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+services/ui/public",
 ]
diff --git a/ash/touch_hud/mus/main.cc b/ash/touch_hud/mus/main.cc
index 3d334d6..ed08bca7 100644
--- a/ash/touch_hud/mus/main.cc
+++ b/ash/touch_hud/mus/main.cc
@@ -3,10 +3,11 @@
 // found in the LICENSE file.
 
 #include "ash/touch_hud/mus/touch_hud_application.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new ash::touch_hud::TouchHudApplication);
+  service_manager::ServiceRunner runner(
+      new ash::touch_hud::TouchHudApplication);
   return runner.Run(service_request_handle);
 }
diff --git a/ash/touch_hud/mus/manifest.json b/ash/touch_hud/mus/manifest.json
index 21bb66c..61faee7 100644
--- a/ash/touch_hud/mus/manifest.json
+++ b/ash/touch_hud/mus/manifest.json
@@ -3,10 +3,10 @@
   "name": "service:touch_hud",
   "display_name": "Touch Hud",
   "capabilities": {
-    "provided": { "mash:launchable": ["mash::mojom::Launchable"] },
+    "provided": { "mash:launchable": [ "mash::mojom::Launchable" ] },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:shell": { "classes": [ "shell:service_manager" ] }
+      "*": [ "app" ],
+      "service:shell": [ "shell:service_manager" ]
     }
   }
 }
diff --git a/ash/touch_hud/mus/touch_hud_application.cc b/ash/touch_hud/mus/touch_hud_application.cc
index 7bfc6cc6..de4f6db 100644
--- a/ash/touch_hud/mus/touch_hud_application.cc
+++ b/ash/touch_hud/mus/touch_hud_application.cc
@@ -8,7 +8,7 @@
 #include "ash/touch_hud/touch_hud_renderer.h"
 #include "base/macros.h"
 #include "base/strings/utf_string_conversions.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
 #include "ui/views/mus/aura_init.h"
@@ -64,14 +64,15 @@
 TouchHudApplication::TouchHudApplication() : binding_(this) {}
 TouchHudApplication::~TouchHudApplication() {}
 
-void TouchHudApplication::OnStart(const shell::Identity& identity) {
+void TouchHudApplication::OnStart(const service_manager::Identity& identity) {
   aura_init_.reset(new views::AuraInit(connector(), "views_mus_resources.pak"));
   window_manager_connection_ =
       views::WindowManagerConnection::Create(connector(), identity);
 }
 
-bool TouchHudApplication::OnConnect(const shell::Identity& remote_identity,
-                                    shell::InterfaceRegistry* registry) {
+bool TouchHudApplication::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mash::mojom::Launchable>(this);
   return true;
 }
@@ -105,8 +106,9 @@
   }
 }
 
-void TouchHudApplication::Create(const shell::Identity& remote_identity,
-                                 mash::mojom::LaunchableRequest request) {
+void TouchHudApplication::Create(
+    const service_manager::Identity& remote_identity,
+    mash::mojom::LaunchableRequest request) {
   binding_.Close();
   binding_.Bind(std::move(request));
 }
diff --git a/ash/touch_hud/mus/touch_hud_application.h b/ash/touch_hud/mus/touch_hud_application.h
index 0d9144e..94266be 100644
--- a/ash/touch_hud/mus/touch_hud_application.h
+++ b/ash/touch_hud/mus/touch_hud_application.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace views {
 class AuraInit;
@@ -22,24 +22,24 @@
 namespace touch_hud {
 
 class TouchHudApplication
-    : public shell::Service,
+    : public service_manager::Service,
       public mash::mojom::Launchable,
-      public shell::InterfaceFactory<mash::mojom::Launchable> {
+      public service_manager::InterfaceFactory<mash::mojom::Launchable> {
  public:
   TouchHudApplication();
   ~TouchHudApplication() override;
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Launchable:
   void Launch(uint32_t what, mash::mojom::LaunchMode how) override;
 
-  // shell::InterfaceFactory<mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mash::mojom::LaunchableRequest request) override;
 
   mojo::Binding<mash::mojom::Launchable> binding_;
diff --git a/base/BUILD.gn b/base/BUILD.gn
index c1577b0..154c068 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -793,8 +793,6 @@
     "task_scheduler/scheduler_lock.h",
     "task_scheduler/scheduler_lock_impl.cc",
     "task_scheduler/scheduler_lock_impl.h",
-    "task_scheduler/scheduler_service_thread.cc",
-    "task_scheduler/scheduler_service_thread.h",
     "task_scheduler/scheduler_worker.cc",
     "task_scheduler/scheduler_worker.h",
     "task_scheduler/scheduler_worker_pool.h",
@@ -893,6 +891,8 @@
     "timer/mock_timer.h",
     "timer/timer.cc",
     "timer/timer.h",
+    "trace_event/auto_open_close_event.cc",
+    "trace_event/auto_open_close_event.h",
     "trace_event/blame_context.cc",
     "trace_event/blame_context.h",
     "trace_event/common/trace_event_common.h",
@@ -1934,7 +1934,6 @@
     "task_scheduler/delayed_task_manager_unittest.cc",
     "task_scheduler/priority_queue_unittest.cc",
     "task_scheduler/scheduler_lock_unittest.cc",
-    "task_scheduler/scheduler_service_thread_unittest.cc",
     "task_scheduler/scheduler_worker_pool_impl_unittest.cc",
     "task_scheduler/scheduler_worker_stack_unittest.cc",
     "task_scheduler/scheduler_worker_unittest.cc",
diff --git a/base/android/java/src/org/chromium/base/LocaleUtils.java b/base/android/java/src/org/chromium/base/LocaleUtils.java
index 5c26e7a5..35d04a9 100644
--- a/base/android/java/src/org/chromium/base/LocaleUtils.java
+++ b/base/android/java/src/org/chromium/base/LocaleUtils.java
@@ -19,14 +19,23 @@
     }
 
     /**
-     * @return the string for the given locale, translating
-     * Android deprecated language codes into the modern ones
-     * used by Chromium.
+     * @return The string for the given locale, translating Android deprecated language codes
+     *         into the modern ones used by Chromium.
      */
     public static String getLocale(Locale locale) {
-        String language = locale.getLanguage();
+        String language = getLanguage(locale);
         String country = locale.getCountry();
 
+        return country.isEmpty() ? language : language + "-" + country;
+    }
+
+    /**
+     * @return The language for the given locale, translating Android deprecated languages codes
+     *         into modern ones used by Chromium.
+     */
+    public static String getLanguage(Locale locale) {
+        String language = locale.getLanguage();
+
         // Android uses deprecated lanuages codes for Hebrew and Indonesian but Chromium uses the
         // updated codes. Also, Android uses "tl" while Chromium uses "fil" for Tagalog/Filipino.
         // So apply a mapping.
@@ -38,12 +47,12 @@
         } else if ("tl".equals(language)) {
             language = "fil";
         }
-        return country.isEmpty() ? language : language + "-" + country;
+        return language;
     }
 
     /**
-     * @return the default locale, translating Android deprecated
-     * language codes into the modern ones used by Chromium.
+     * @return The default locale, translating Android deprecated language codes into the modern
+     *         ones used by Chromium.
      */
     @CalledByNative
     public static String getDefaultLocale() {
@@ -51,8 +60,7 @@
     }
 
     /**
-     * Get the default country code set during install.
-     * @return country code.
+     * @return The default country code set during install.
      */
     @CalledByNative
     private static String getDefaultCountryCode() {
diff --git a/base/android/java/src/org/chromium/base/ResourceExtractor.java b/base/android/java/src/org/chromium/base/ResourceExtractor.java
index 26db654..6de87fe3 100644
--- a/base/android/java/src/org/chromium/base/ResourceExtractor.java
+++ b/base/android/java/src/org/chromium/base/ResourceExtractor.java
@@ -4,7 +4,6 @@
 
 package org.chromium.base;
 
-import android.content.Context;
 import android.content.SharedPreferences;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
@@ -12,8 +11,6 @@
 import android.os.Handler;
 import android.os.Looper;
 
-import org.chromium.base.annotations.SuppressFBWarnings;
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -21,6 +18,7 @@
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 
@@ -35,23 +33,7 @@
     private static final String V8_NATIVES_DATA_FILENAME = "natives_blob.bin";
     private static final String V8_SNAPSHOT_DATA_FILENAME = "snapshot_blob.bin";
     private static final String APP_VERSION_PREF = "org.chromium.base.ResourceExtractor.Version";
-
-    private static ResourceEntry[] sResourcesToExtract = new ResourceEntry[0];
-
-    /**
-     * Holds information about a res/raw file (e.g. locale .pak files).
-     */
-    public static final class ResourceEntry {
-        public final int resourceId;
-        public final String pathWithinApk;
-        public final String extractedFileName;
-
-        public ResourceEntry(int resourceId, String pathWithinApk, String extractedFileName) {
-            this.resourceId = resourceId;
-            this.pathWithinApk = pathWithinApk;
-            this.extractedFileName = extractedFileName;
-        }
-    }
+    private static final String FALLBACK_LOCALE = "en-US";
 
     private class ExtractTask extends AsyncTask<Void, Void, Void> {
         private static final int BUFFER_SIZE = 16 * 1024;
@@ -107,16 +89,16 @@
             TraceEvent.begin("WalkAssets");
             byte[] buffer = new byte[BUFFER_SIZE];
             try {
-                for (ResourceEntry entry : sResourcesToExtract) {
-                    File output = new File(outputDir, entry.extractedFileName);
+                for (String assetName : mAssetsToExtract) {
+                    File output = new File(outputDir, assetName);
                     // TODO(agrieve): It would be better to check that .length == expectedLength.
                     //     http://crbug.com/606413
                     if (output.length() != 0) {
                         continue;
                     }
                     TraceEvent.begin("ExtractResource");
-                    InputStream inputStream = mContext.getResources().openRawResource(
-                            entry.resourceId);
+                    InputStream inputStream =
+                            ContextUtils.getApplicationContext().getAssets().open(assetName);
                     try {
                         extractResourceHelper(inputStream, output, buffer);
                     } finally {
@@ -128,7 +110,7 @@
                 // Try to recover here, can we try again after deleting files instead of
                 // returning null? It might be useful to gather UMA here too to track if
                 // this happens with regularity.
-                Log.w(TAG, "Exception unpacking required pak resources: %s", e.getMessage());
+                Log.w(TAG, "Exception unpacking required pak asset: %s", e.getMessage());
                 deleteFiles();
                 return;
             } finally {
@@ -166,10 +148,11 @@
 
         /** Returns a number that is different each time the apk changes. */
         private long getApkVersion() {
-            PackageManager pm = mContext.getPackageManager();
+            PackageManager pm = ContextUtils.getApplicationContext().getPackageManager();
             try {
                 // More appropriate would be versionCode, but it doesn't change while developing.
-                PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), 0);
+                PackageInfo pi =
+                        pm.getPackageInfo(ContextUtils.getApplicationContext().getPackageName(), 0);
                 return pi.lastUpdateTime;
             } catch (PackageManager.NameNotFoundException e) {
                 throw new RuntimeException(e);
@@ -177,31 +160,29 @@
         }
     }
 
-    private final Context mContext;
     private ExtractTask mExtractTask;
+    private final String[] mAssetsToExtract = detectFilesToExtract();
 
     private static ResourceExtractor sInstance;
 
-    public static ResourceExtractor get(Context context) {
+    public static ResourceExtractor get() {
         if (sInstance == null) {
-            sInstance = new ResourceExtractor(context);
+            sInstance = new ResourceExtractor();
         }
         return sInstance;
     }
 
-    /**
-     * Specifies the files that should be extracted from the APK.
-     * and moved to {@link #getOutputDir()}.
-     */
-    @SuppressFBWarnings("EI_EXPOSE_STATIC_REP2")
-    public static void setResourcesToExtract(ResourceEntry[] entries) {
-        assert (sInstance == null || sInstance.mExtractTask == null)
-                : "Must be called before startExtractingResources is called";
-        sResourcesToExtract = entries;
-    }
-
-    private ResourceExtractor(Context context) {
-        mContext = context.getApplicationContext();
+    private static String[] detectFilesToExtract() {
+        String language = LocaleUtils.getLanguage(Locale.getDefault());
+        // Currenty (Oct 2016), this array can be as big as 4 entries, so using a capacity
+        // that allows a bit of growth, but is still in the right ballpark..
+        ArrayList<String> activeLocalePakFiles = new ArrayList<String>(6);
+        for (String locale : BuildConfig.COMPRESSED_LOCALES) {
+            if (locale.startsWith(language)) {
+                activeLocalePakFiles.add(locale + ".pak");
+            }
+        }
+        return activeLocalePakFiles.toArray(new String[activeLocalePakFiles.size()]);
     }
 
     /**
@@ -329,6 +310,6 @@
      * Pak extraction not necessarily required by the embedder.
      */
     private static boolean shouldSkipPakExtraction() {
-        return sResourcesToExtract.length == 0;
+        return get().mAssetsToExtract.length == 0;
     }
 }
diff --git a/base/android/java/templates/BuildConfig.template b/base/android/java/templates/BuildConfig.template
index e135e240..16f02f6 100644
--- a/base/android/java/templates/BuildConfig.template
+++ b/base/android/java/templates/BuildConfig.template
@@ -29,4 +29,21 @@
     public static final boolean DCHECK_IS_ON = false;
 #endif
 
+    // Sorted list of locales that have a compressed .pak within assets.
+    // Stored as an array because AssetManager.list() is slow.
+    public static final String[] COMPRESSED_LOCALES =
+#if defined(COMPRESSED_LOCALE_LIST)
+      COMPRESSED_LOCALE_LIST;
+#else
+      {};
+#endif
+
+    // Sorted list of locales that have an uncompressed .pak within assets.
+    // Stored as an array because AssetManager.list() is slow.
+    public static final String[] UNCOMPRESSED_LOCALES =
+#if defined(UNCOMPRESSED_LOCALE_LIST)
+      UNCOMPRESSED_LOCALE_LIST;
+#else
+      {};
+#endif
 }
diff --git a/base/debug/activity_analyzer_unittest.cc b/base/debug/activity_analyzer_unittest.cc
index 953a52f..7333656 100644
--- a/base/debug/activity_analyzer_unittest.cc
+++ b/base/debug/activity_analyzer_unittest.cc
@@ -104,7 +104,7 @@
 
     {
       AutoLock auto_lock(lock_);
-      ready_.store(true, std::memory_order_relaxed);
+      ready_.store(true, std::memory_order_release);
       while (!exit_.load(std::memory_order_relaxed))
         exit_condition_.Wait();
     }
@@ -121,7 +121,7 @@
   }
 
   void WaitReady() {
-    SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(ready_.load(std::memory_order_relaxed));
+    SPIN_FOR_1_SECOND_OR_UNTIL_TRUE(ready_.load(std::memory_order_acquire));
   }
 
  private:
diff --git a/base/debug/activity_tracker_unittest.cc b/base/debug/activity_tracker_unittest.cc
index 26c0b51..41328488 100644
--- a/base/debug/activity_tracker_unittest.cc
+++ b/base/debug/activity_tracker_unittest.cc
@@ -74,6 +74,7 @@
     GlobalActivityTracker* global_tracker = GlobalActivityTracker::Get();
     if (!global_tracker)
       return 0;
+    base::AutoLock autolock(global_tracker->thread_tracker_allocator_lock_);
     return global_tracker->thread_tracker_allocator_.cache_used();
   }
 
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index e92d5a5..32555523 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -18,6 +18,8 @@
 #include <vector>
 
 #include "base/macros.h"
+#include "base/threading/platform_thread.h"
+#include "base/time/time.h"
 #include "build/build_config.h"
 
 #if defined(__GLIBCXX__)
diff --git a/base/memory/memory_pressure_listener.cc b/base/memory/memory_pressure_listener.cc
index 11859ada..27e70018 100644
--- a/base/memory/memory_pressure_listener.cc
+++ b/base/memory/memory_pressure_listener.cc
@@ -38,8 +38,8 @@
     async_observers_->Notify(FROM_HERE,
         &MemoryPressureListener::Notify, memory_pressure_level);
     AutoLock lock(sync_observers_lock_);
-    FOR_EACH_OBSERVER(MemoryPressureListener, *sync_observers_,
-        MemoryPressureListener::SyncNotify(memory_pressure_level));
+    for (auto& observer : *sync_observers_)
+      observer.MemoryPressureListener::SyncNotify(memory_pressure_level);
   }
 
  private:
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index 8df5bca..1581f6c 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -124,8 +124,8 @@
   DCHECK(!did_work);
 
   // Let interested parties have one last shot at accessing this.
-  FOR_EACH_OBSERVER(DestructionObserver, destruction_observers_,
-                    WillDestroyCurrentMessageLoop());
+  for (auto& observer : destruction_observers_)
+    observer.WillDestroyCurrentMessageLoop();
 
   thread_task_runner_handle_.reset();
 
@@ -278,11 +278,13 @@
 
 void MessageLoop::AddTaskObserver(TaskObserver* task_observer) {
   DCHECK_EQ(this, current());
+  CHECK(allow_task_observers_);
   task_observers_.AddObserver(task_observer);
 }
 
 void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
   DCHECK_EQ(this, current());
+  CHECK(allow_task_observers_);
   task_observers_.RemoveObserver(task_observer);
 }
 
@@ -406,11 +408,11 @@
 
   TRACE_TASK_EXECUTION("MessageLoop::RunTask", *pending_task);
 
-  FOR_EACH_OBSERVER(TaskObserver, task_observers_,
-                    WillProcessTask(*pending_task));
+  for (auto& observer : task_observers_)
+    observer.WillProcessTask(*pending_task);
   task_annotator_.RunTask("MessageLoop::PostTask", pending_task);
-  FOR_EACH_OBSERVER(TaskObserver, task_observers_,
-                    DidProcessTask(*pending_task));
+  for (auto& observer : task_observers_)
+    observer.DidProcessTask(*pending_task);
 
   nestable_tasks_allowed_ = true;
 }
@@ -483,8 +485,8 @@
 }
 
 void MessageLoop::NotifyBeginNestedLoop() {
-  FOR_EACH_OBSERVER(NestingObserver, nesting_observers_,
-                    OnBeginNestedMessageLoop());
+  for (auto& observer : nesting_observers_)
+    observer.OnBeginNestedMessageLoop();
 }
 
 bool MessageLoop::DoWork() {
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 450aef0..ac7a303 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -320,6 +320,10 @@
   // Add/RemoveNestingObserver() on this MessageLoop will crash.
   void DisallowNesting() { allow_nesting_ = false; }
 
+  // Disallow task observers. After this is called, calling
+  // Add/RemoveTaskObserver() on this MessageLoop will crash.
+  void DisallowTaskObservers() { allow_task_observers_ = false; }
+
   //----------------------------------------------------------------------------
  protected:
   std::unique_ptr<MessagePump> pump_;
@@ -458,6 +462,9 @@
   // Whether nesting is allowed.
   bool allow_nesting_ = true;
 
+  // Whether task observers are allowed.
+  bool allow_task_observers_ = true;
+
   DISALLOW_COPY_AND_ASSIGN(MessageLoop);
 };
 
diff --git a/base/observer_list.h b/base/observer_list.h
index 7543a981..8f0be2d 100644
--- a/base/observer_list.h
+++ b/base/observer_list.h
@@ -92,9 +92,6 @@
     explicit Iter(ContainerType* list);
     ~Iter();
 
-    // Deprecated.
-    ObserverType* GetNext();
-
     // A workaround for C2244. MSVC requires fully qualified type name for
     // return type on a function definition to match a function declaration.
     using ThisType =
@@ -273,15 +270,6 @@
 }
 
 template <class ObserverType>
-template <class ContainerType>
-ObserverType* ObserverListBase<ObserverType>::Iter<ContainerType>::GetNext() {
-  EnsureValidIndex();
-  ObserverType* current = GetCurrent();
-  operator++();
-  return current;
-}
-
-template <class ObserverType>
 void ObserverListBase<ObserverType>::AddObserver(ObserverType* obs) {
   DCHECK(obs);
   if (ContainsValue(observers_, obs)) {
diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h
index 49dc859..eb15cd4 100644
--- a/base/observer_list_threadsafe.h
+++ b/base/observer_list_threadsafe.h
@@ -222,11 +222,8 @@
         return;
     }
 
-    {
-      typename ObserverList<ObserverType>::Iterator it(&context->list);
-      ObserverType* obs;
-      while ((obs = it.GetNext()) != nullptr)
-        method.Run(obs);
+    for (auto& observer : context->list) {
+      method.Run(&observer);
     }
 
     // If there are no more observers on the list, we can now delete it.
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 299a33f..33f0f328 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -201,7 +201,8 @@
   EXPECT_TRUE(observer_list.HasObserver(&a));
   EXPECT_FALSE(observer_list.HasObserver(&c));
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(10));
+  for (auto& observer : observer_list)
+    observer.Observe(10);
 
   observer_list.AddObserver(&evil);
   observer_list.AddObserver(&c);
@@ -210,7 +211,8 @@
   // Removing an observer not in the list should do nothing.
   observer_list.RemoveObserver(&e);
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(10));
+  for (auto& observer : observer_list)
+    observer.Observe(10);
 
   EXPECT_EQ(20, a.total);
   EXPECT_EQ(-20, b.total);
@@ -227,13 +229,15 @@
   observer_list.AddObserver(&a);
   observer_list.AddObserver(&b);
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(10));
+  for (auto& observer : observer_list)
+    observer.Observe(10);
 
   observer_list.AddObserver(&evil);
   observer_list.AddObserver(&c);
   observer_list.AddObserver(&d);
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(10));
+  for (auto& observer : observer_list)
+    observer.Observe(10);
 
   EXPECT_EQ(20, a.total);
   EXPECT_EQ(-20, b.total);
@@ -252,8 +256,10 @@
   observer_list.AddObserver(&c);
   observer_list.AddObserver(&d);
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(10));
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(10));
+  for (auto& observer : observer_list)
+    observer.Observe(10);
+  for (auto& observer : observer_list)
+    observer.Observe(10);
 
   EXPECT_EQ(20, a.total);
   EXPECT_EQ(-10, b.total);
@@ -495,7 +501,8 @@
   observer_list.AddObserver(&a);
   observer_list.AddObserver(&b);
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(1));
+  for (auto& observer : observer_list)
+    observer.Observe(1);
 
   EXPECT_FALSE(b.to_add_);
   // B's adder should not have been notified because it was added during
@@ -503,7 +510,8 @@
   EXPECT_EQ(0, c.total);
 
   // Notify again to make sure b's adder is notified.
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(1));
+  for (auto& observer : observer_list)
+    observer.Observe(1);
   EXPECT_EQ(1, c.total);
 }
 
@@ -561,7 +569,8 @@
 
   observer_list.AddObserver(&a);
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(1));
+  for (auto& observer : observer_list)
+    observer.Observe(1);
   EXPECT_TRUE(a.added());
   EXPECT_EQ(1, a.adder().total)
       << "Adder should observe once and have sum of 1.";
@@ -573,7 +582,8 @@
 
   observer_list.AddObserver(&a);
 
-  FOR_EACH_OBSERVER(Foo, observer_list, Observe(1));
+  for (auto& observer : observer_list)
+    observer.Observe(1);
   EXPECT_TRUE(a.added());
   EXPECT_EQ(0, a.adder().total)
       << "Adder should not observe, so sum should still be 0.";
@@ -905,10 +915,18 @@
   a.SetToAdd(&b);
   observer_list.AddObserver(&a);
 
-  FooList::Iterator it(&observer_list);
-  Foo* foo;
-  while ((foo = it.GetNext()) != nullptr)
-    foo->Observe(10);
+  auto it = observer_list.begin();
+  while (it != observer_list.end()) {
+    auto& observer = *it;
+    // Intentionally increment the iterator before calling Observe(). The
+    // ObserverList starts with only one observer, and it == observer_list.end()
+    // should be true after the next line.
+    ++it;
+    // However, the first Observe() call will add a second observer: at this
+    // point, it != observer_list.end() should be true, and Observe() should be
+    // called on the newly added observer on the next iteration of the loop.
+    observer.Observe(10);
+  }
 
   EXPECT_EQ(-10, b.total);
 }
diff --git a/base/process/port_provider_mac.cc b/base/process/port_provider_mac.cc
index ac13949a..23d214c 100644
--- a/base/process/port_provider_mac.cc
+++ b/base/process/port_provider_mac.cc
@@ -21,7 +21,8 @@
 
 void PortProvider::NotifyObservers(ProcessHandle process) {
   base::AutoLock l(lock_);
-  FOR_EACH_OBSERVER(Observer, observer_list_, OnReceivedTaskPort(process));
+  for (auto& observer : observer_list_)
+    observer.OnReceivedTaskPort(process);
 }
 
 }  // namespace base
diff --git a/base/strings/string_number_conversions_unittest.cc b/base/strings/string_number_conversions_unittest.cc
index 6b2bd97..68e86db 100644
--- a/base/strings/string_number_conversions_unittest.cc
+++ b/base/strings/string_number_conversions_unittest.cc
@@ -745,6 +745,8 @@
     {"9e307", 9e307, true},
     {"1.7976e308", 1.7976e308, true},
     {"1.7977e308", HUGE_VAL, false},
+    {"1.797693134862315807e+308", HUGE_VAL, true},
+    {"1.797693134862315808e+308", HUGE_VAL, false},
     {"9e308", HUGE_VAL, false},
     {"9e309", HUGE_VAL, false},
     {"9e999", HUGE_VAL, false},
@@ -754,6 +756,8 @@
     {"-9e307", -9e307, true},
     {"-1.7976e308", -1.7976e308, true},
     {"-1.7977e308", -HUGE_VAL, false},
+    {"-1.797693134862315807e+308", -HUGE_VAL, true},
+    {"-1.797693134862315808e+308", -HUGE_VAL, false},
     {"-9e308", -HUGE_VAL, false},
     {"-9e309", -HUGE_VAL, false},
     {"-9e999", -HUGE_VAL, false},
@@ -769,6 +773,7 @@
     {"-1E-7", -0.0000001, true},
     {"01e02", 100, true},
     {"2.3e15", 2.3e15, true},
+    {"100e-309", 100e-309, true},
 
     // Test some invalid cases.
     {"\t\n\v\f\r -123.45e2", -12345.0, false},
diff --git a/base/task_scheduler/delayed_task_manager.cc b/base/task_scheduler/delayed_task_manager.cc
index d648b9d4..1cc928b0 100644
--- a/base/task_scheduler/delayed_task_manager.cc
+++ b/base/task_scheduler/delayed_task_manager.cc
@@ -6,49 +6,18 @@
 
 #include <utility>
 
+#include "base/bind.h"
 #include "base/logging.h"
+#include "base/task_runner.h"
 #include "base/task_scheduler/scheduler_worker_pool.h"
 
 namespace base {
 namespace internal {
 
-struct DelayedTaskManager::DelayedTask {
-  DelayedTask(std::unique_ptr<Task> task,
-              scoped_refptr<Sequence> sequence,
-              SchedulerWorker* worker,
-              SchedulerWorkerPool* worker_pool,
-              uint64_t index)
-      : task(std::move(task)),
-        sequence(std::move(sequence)),
-        worker(worker),
-        worker_pool(worker_pool),
-        index(index) {}
-
-  DelayedTask(DelayedTask&& other) = default;
-
-  ~DelayedTask() = default;
-
-  DelayedTask& operator=(DelayedTask&& other) = default;
-
-  // |task| will be posted to |worker_pool| with |sequence| and |worker|
-  // when it becomes ripe for execution.
-  std::unique_ptr<Task> task;
-  scoped_refptr<Sequence> sequence;
-  SchedulerWorker* worker;
-  SchedulerWorkerPool* worker_pool;
-
-  // Ensures that tasks that have the same |delayed_run_time| are sorted
-  // according to the order in which they were added to the DelayedTaskManager.
-  uint64_t index;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(DelayedTask);
-};
-
 DelayedTaskManager::DelayedTaskManager(
-    const Closure& on_delayed_run_time_updated)
-    : on_delayed_run_time_updated_(on_delayed_run_time_updated) {
-  DCHECK(!on_delayed_run_time_updated_.is_null());
+    scoped_refptr<TaskRunner> service_thread_task_runner)
+    : service_thread_task_runner_(std::move(service_thread_task_runner)) {
+  DCHECK(service_thread_task_runner_);
 }
 
 DelayedTaskManager::~DelayedTaskManager() = default;
@@ -61,92 +30,16 @@
   DCHECK(sequence);
   DCHECK(worker_pool);
 
-  const TimeTicks new_task_delayed_run_time = task->delayed_run_time;
-  TimeTicks current_delayed_run_time;
+  const TimeDelta delay = task->delay;
+  DCHECK(!delay.is_zero());
 
-  {
-    AutoSchedulerLock auto_lock(lock_);
-
-    if (!delayed_tasks_.empty())
-      current_delayed_run_time = delayed_tasks_.top().task->delayed_run_time;
-
-    delayed_tasks_.emplace(std::move(task), std::move(sequence), worker,
-                           worker_pool, ++delayed_task_index_);
-  }
-
-  if (current_delayed_run_time.is_null() ||
-      new_task_delayed_run_time < current_delayed_run_time) {
-    on_delayed_run_time_updated_.Run();
-  }
-}
-
-void DelayedTaskManager::PostReadyTasks() {
-  const TimeTicks now = Now();
-
-  // Move delayed tasks that are ready for execution into |ready_tasks|. Don't
-  // post them right away to avoid imposing an unecessary lock dependency on
-  // PostTaskNowHelper.
-  std::vector<DelayedTask> ready_tasks;
-
-  {
-    AutoSchedulerLock auto_lock(lock_);
-    while (!delayed_tasks_.empty() &&
-           delayed_tasks_.top().task->delayed_run_time <= now) {
-      // The const_cast for std::move is okay since we're immediately popping
-      // the task from |delayed_tasks_|. See DelayedTaskComparator::operator()
-      // for minor debug-check implications.
-      ready_tasks.push_back(
-          std::move(const_cast<DelayedTask&>(delayed_tasks_.top())));
-      delayed_tasks_.pop();
-    }
-  }
-
-  // Post delayed tasks that are ready for execution.
-  for (auto& delayed_task : ready_tasks) {
-    delayed_task.worker_pool->PostTaskWithSequenceNow(
-        std::move(delayed_task.task), std::move(delayed_task.sequence),
-        delayed_task.worker);
-  }
-}
-
-TimeTicks DelayedTaskManager::GetDelayedRunTime() const {
-  AutoSchedulerLock auto_lock(lock_);
-
-  if (delayed_tasks_.empty())
-    return TimeTicks();
-
-  return delayed_tasks_.top().task->delayed_run_time;
-}
-
-// In std::priority_queue, the largest element is on top. Therefore, this
-// comparator returns true if the delayed run time of |right| is earlier than
-// the delayed run time of |left|.
-bool DelayedTaskManager::DelayedTaskComparator::operator()(
-    const DelayedTask& left,
-    const DelayedTask& right) const {
-#ifndef NDEBUG
-  // Due to STL consistency checks in Windows and const_cast'ing right before
-  // popping the DelayedTask, a null task can be passed to this comparator in
-  // Debug builds. To satisfy these consistency checks, this comparator
-  // considers null tasks to be the larger than anything.
-  DCHECK(left.task || right.task);
-  if (!left.task)
-    return false;
-  if (!right.task)
-    return true;
-#else
-  DCHECK(left.task);
-  DCHECK(right.task);
-#endif  // NDEBUG
-  if (left.task->delayed_run_time > right.task->delayed_run_time)
-    return true;
-  if (left.task->delayed_run_time < right.task->delayed_run_time)
-    return false;
-  return left.index > right.index;
-}
-
-TimeTicks DelayedTaskManager::Now() const {
-  return TimeTicks::Now();
+  // TODO(fdoray): Use |task->delayed_run_time| on the service thread
+  // MessageLoop rather than recomputing it from |delay|.
+  service_thread_task_runner_->PostDelayedTask(
+      FROM_HERE, Bind(&SchedulerWorkerPool::PostTaskWithSequenceNow,
+                      Unretained(worker_pool), Passed(std::move(task)),
+                      std::move(sequence), Unretained(worker)),
+      delay);
 }
 
 }  // namespace internal
diff --git a/base/task_scheduler/delayed_task_manager.h b/base/task_scheduler/delayed_task_manager.h
index d773fe5..3bfb355 100644
--- a/base/task_scheduler/delayed_task_manager.h
+++ b/base/task_scheduler/delayed_task_manager.h
@@ -5,40 +5,37 @@
 #ifndef BASE_TASK_SCHEDULER_DELAYED_TASK_MANAGER_H_
 #define BASE_TASK_SCHEDULER_DELAYED_TASK_MANAGER_H_
 
-#include <stdint.h>
-
 #include <memory>
-#include <queue>
-#include <vector>
 
 #include "base/base_export.h"
-#include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/task_scheduler/scheduler_lock.h"
-#include "base/task_scheduler/sequence.h"
-#include "base/task_scheduler/task.h"
 #include "base/time/time.h"
 
 namespace base {
+
+class TaskRunner;
+
 namespace internal {
 
 class SchedulerWorker;
 class SchedulerWorkerPool;
+class Sequence;
+struct Task;
 
-// A DelayedTaskManager holds delayed Tasks until they become ripe for
-// execution. This class is thread-safe.
+// A DelayedTaskManager forwards Tasks to a SchedulerWorkerPool when they become
+// ripe for execution. This class is thread-safe.
 class BASE_EXPORT DelayedTaskManager {
  public:
-  // |on_delayed_run_time_updated| is invoked when the delayed run time is
-  // updated as a result of adding a delayed task to the manager.
-  explicit DelayedTaskManager(const Closure& on_delayed_run_time_updated);
+  // |service_thread_task_runner| posts tasks to the TaskScheduler service
+  // thread.
+  explicit DelayedTaskManager(
+      scoped_refptr<TaskRunner> service_thread_task_runner);
   ~DelayedTaskManager();
 
-  // Adds |task| to a queue of delayed tasks. The task will be posted to
-  // |worker_pool| with |sequence| and |worker| the first time that
-  // PostReadyTasks() is called while Now() is passed |task->delayed_run_time|.
-  // |worker| is a SchedulerWorker owned by |worker_pool| or nullptr.
+  // Posts |task|. The task will be forwarded to |worker_pool| with |sequence|
+  // and |worker| when it becomes ripe for execution. |worker| is a
+  // SchedulerWorker owned by |worker_pool| or nullptr.
   //
   // TODO(robliao): Find a concrete way to manage the memory of |worker| and
   // |worker_pool|. These objects are never deleted in production, but it is
@@ -48,36 +45,8 @@
                       SchedulerWorker* worker,
                       SchedulerWorkerPool* worker_pool);
 
-  // Posts delayed tasks that are ripe for execution.
-  void PostReadyTasks();
-
-  // Returns the next time at which a delayed task will become ripe for
-  // execution, or a null TimeTicks if there are no pending delayed tasks.
-  TimeTicks GetDelayedRunTime() const;
-
-  // Returns the current time. Can be overridden for tests.
-  virtual TimeTicks Now() const;
-
  private:
-  struct DelayedTask;
-  struct DelayedTaskComparator {
-    bool operator()(const DelayedTask& left, const DelayedTask& right) const;
-  };
-
-  const Closure on_delayed_run_time_updated_;
-
-  // Synchronizes access to all members below.
-  mutable SchedulerLock lock_;
-
-  // Priority queue of delayed tasks. The delayed task with the smallest
-  // |task->delayed_run_time| is in front of the priority queue.
-  using DelayedTaskQueue = std::priority_queue<DelayedTask,
-                                               std::vector<DelayedTask>,
-                                               DelayedTaskComparator>;
-  DelayedTaskQueue delayed_tasks_;
-
-  // The index to assign to the next delayed task added to the manager.
-  uint64_t delayed_task_index_ = 0;
+  const scoped_refptr<TaskRunner> service_thread_task_runner_;
 
   DISALLOW_COPY_AND_ASSIGN(DelayedTaskManager);
 };
diff --git a/base/task_scheduler/delayed_task_manager_unittest.cc b/base/task_scheduler/delayed_task_manager_unittest.cc
index c1c85ef..d79947b74 100644
--- a/base/task_scheduler/delayed_task_manager_unittest.cc
+++ b/base/task_scheduler/delayed_task_manager_unittest.cc
@@ -8,13 +8,12 @@
 #include <utility>
 
 #include "base/bind.h"
-#include "base/bind_helpers.h"
 #include "base/logging.h"
 #include "base/memory/ref_counted.h"
-#include "base/task_scheduler/scheduler_lock.h"
 #include "base/task_scheduler/scheduler_worker_pool.h"
 #include "base/task_scheduler/sequence.h"
 #include "base/task_scheduler/task.h"
+#include "base/test/test_mock_time_task_runner.h"
 #include "base/time/time.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -23,25 +22,7 @@
 namespace internal {
 namespace {
 
-class TestDelayedTaskManager : public DelayedTaskManager {
- public:
-  TestDelayedTaskManager()
-      : DelayedTaskManager(
-            Bind(&TestDelayedTaskManager::OnDelayedRunTimeUpdated,
-                 Unretained(this))) {}
-
-  void SetCurrentTime(TimeTicks now) { now_ = now; }
-
-  // DelayedTaskManager:
-  TimeTicks Now() const override { return now_; }
-
-  MOCK_METHOD0(OnDelayedRunTimeUpdated, void());
-
- private:
-  TimeTicks now_ = TimeTicks::Now();
-
-  DISALLOW_COPY_AND_ASSIGN(TestDelayedTaskManager);
-};
+constexpr TimeDelta kLongDelay = TimeDelta::FromHours(1);
 
 class MockSchedulerWorkerPool : public SchedulerWorkerPool {
  public:
@@ -79,166 +60,93 @@
 
 }  // namespace
 
-// Verify that GetDelayedRunTime() returns a null TimeTicks when there are
-// no pending delayed tasks.
-TEST(TaskSchedulerDelayedTaskManagerTest,
-     GetDelayedRunTimeNoPendingDelayedTasks) {
-  TestDelayedTaskManager manager;
-  EXPECT_EQ(TimeTicks(), manager.GetDelayedRunTime());
-}
-
-// Verify that a delayed task isn't posted before it is ripe for execution.
-TEST(TaskSchedulerDelayedTaskManagerTest, PostReadyTaskBeforeDelayedRunTime) {
-  testing::StrictMock<TestDelayedTaskManager> manager;
+// Verify that a delayed task isn't forwarded to its SchedulerWorkerPool before
+// it is ripe for execution.
+TEST(TaskSchedulerDelayedTaskManagerTest, DelayedTaskDoesNotRunTooEarly) {
+  scoped_refptr<TestMockTimeTaskRunner> service_thread_task_runner(
+      new TestMockTimeTaskRunner);
+  DelayedTaskManager manager(service_thread_task_runner);
 
   std::unique_ptr<Task> task(
-      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), TimeDelta()));
-  task->delayed_run_time = manager.Now() + TimeDelta::FromSeconds(1);
+      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), kLongDelay));
+  scoped_refptr<Sequence> sequence(new Sequence);
+  testing::StrictMock<MockSchedulerWorkerPool> worker_pool;
+
+  // Send |task| to the DelayedTaskManager.
+  manager.AddDelayedTask(std::move(task), sequence, nullptr, &worker_pool);
+
+  // Run tasks that are ripe for execution on the service thread. Don't expect
+  // any call to the mock method of |worker_pool|.
+  service_thread_task_runner->RunUntilIdle();
+}
+
+// Verify that a delayed task is forwarded to its SchedulerWorkerPool when it is
+// ripe for execution.
+TEST(TaskSchedulerDelayedTaskManagerTest, DelayedTaskRunsAfterDelay) {
+  scoped_refptr<TestMockTimeTaskRunner> service_thread_task_runner(
+      new TestMockTimeTaskRunner);
+  DelayedTaskManager manager(service_thread_task_runner);
+
+  std::unique_ptr<Task> task(
+      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), kLongDelay));
   const Task* task_raw = task.get();
   scoped_refptr<Sequence> sequence(new Sequence);
   testing::StrictMock<MockSchedulerWorkerPool> worker_pool;
 
-  // Add |task| to the DelayedTaskManager.
-  EXPECT_CALL(manager, OnDelayedRunTimeUpdated());
+  // Send |task| to the DelayedTaskManager.
   manager.AddDelayedTask(std::move(task), sequence, nullptr, &worker_pool);
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(task_raw->delayed_run_time, manager.GetDelayedRunTime());
 
-  // Ask the DelayedTaskManager to post tasks that are ripe for execution. Don't
-  // expect any call to the mock method of |worker_pool|.
-  manager.PostReadyTasks();
-
-  // The delayed run time shouldn't have changed.
-  EXPECT_EQ(task_raw->delayed_run_time, manager.GetDelayedRunTime());
-}
-
-// Verify that a delayed task is posted when PostReadyTasks() is called with the
-// current time equal to the task's delayed run time.
-TEST(TaskSchedulerDelayedTaskManagerTest, PostReadyTasksAtDelayedRunTime) {
-  testing::StrictMock<TestDelayedTaskManager> manager;
-
-  std::unique_ptr<Task> task(
-      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), TimeDelta()));
-  task->delayed_run_time = manager.Now() + TimeDelta::FromSeconds(1);
-  const Task* task_raw = task.get();
-  scoped_refptr<Sequence> sequence(new Sequence);
-  testing::StrictMock<MockSchedulerWorkerPool> worker_pool;
-
-  // Add |task| to the DelayedTaskManager.
-  EXPECT_CALL(manager, OnDelayedRunTimeUpdated());
-  manager.AddDelayedTask(std::move(task), sequence, nullptr, &worker_pool);
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(task_raw->delayed_run_time, manager.GetDelayedRunTime());
-
-  // Fast-forward time to |task_raw|'s delayed run time.
-  manager.SetCurrentTime(task_raw->delayed_run_time);
-
-  // Ask the DelayedTaskManager to post tasks that are ripe for execution.
+  // Fast-forward time. Expect a call to the mock method of |worker_pool|.
   EXPECT_CALL(worker_pool,
               PostTaskWithSequenceNowMock(task_raw, sequence.get(), nullptr));
-  manager.PostReadyTasks();
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(TimeTicks(), manager.GetDelayedRunTime());
+  service_thread_task_runner->FastForwardBy(kLongDelay);
 }
 
-// Verify that a delayed task is posted when PostReadyTasks() is called with the
-// current time greater than the task's delayed run time.
-TEST(TaskSchedulerDelayedTaskManagerTest, PostReadyTasksAfterDelayedRunTime) {
-  testing::StrictMock<TestDelayedTaskManager> manager;
-
-  std::unique_ptr<Task> task(
-      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), TimeDelta()));
-  task->delayed_run_time = manager.Now() + TimeDelta::FromSeconds(1);
-  const Task* task_raw = task.get();
-  scoped_refptr<Sequence> sequence(new Sequence);
-  testing::StrictMock<MockSchedulerWorkerPool> worker_pool;
-
-  // Add |task| to the DelayedTaskManager.
-  EXPECT_CALL(manager, OnDelayedRunTimeUpdated());
-  manager.AddDelayedTask(std::move(task), sequence, nullptr, &worker_pool);
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(task_raw->delayed_run_time, manager.GetDelayedRunTime());
-
-  // Fast-forward time to |task_raw|'s delayed run time.
-  manager.SetCurrentTime(task_raw->delayed_run_time +
-                         TimeDelta::FromSeconds(10));
-
-  // Ask the DelayedTaskManager to post tasks that are ripe for execution.
-  EXPECT_CALL(worker_pool,
-              PostTaskWithSequenceNowMock(task_raw, sequence.get(), nullptr));
-  manager.PostReadyTasks();
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(TimeTicks(), manager.GetDelayedRunTime());
-}
-
-// Verify that when multiple tasks are added to a DelayedTaskManager, they are
-// posted when they become ripe for execution.
-TEST(TaskSchedulerDelayedTaskManagerTest, AddAndPostReadyTasks) {
-  testing::StrictMock<TestDelayedTaskManager> manager;
+// Verify that multiple delayed task are forwarded to their SchedulerWorkerPool
+// when they are ripe for execution.
+TEST(TaskSchedulerDelayedTaskManagerTest, DelayedTasksRunAfterDelay) {
+  scoped_refptr<TestMockTimeTaskRunner> service_thread_task_runner(
+      new TestMockTimeTaskRunner);
+  DelayedTaskManager manager(service_thread_task_runner);
 
   scoped_refptr<Sequence> sequence(new Sequence);
   testing::StrictMock<MockSchedulerWorkerPool> worker_pool;
 
-  std::unique_ptr<Task> task_a(
-      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), TimeDelta()));
-  task_a->delayed_run_time = manager.Now() + TimeDelta::FromSeconds(2);
+  std::unique_ptr<Task> task_a(new Task(FROM_HERE, Bind(&DoNothing),
+                                        TaskTraits(), TimeDelta::FromHours(1)));
   const Task* task_a_raw = task_a.get();
 
-  std::unique_ptr<Task> task_b(
-      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), TimeDelta()));
-  task_b->delayed_run_time = manager.Now() + TimeDelta::FromSeconds(2);
+  std::unique_ptr<Task> task_b(new Task(FROM_HERE, Bind(&DoNothing),
+                                        TaskTraits(), TimeDelta::FromHours(2)));
   const Task* task_b_raw = task_b.get();
 
-  std::unique_ptr<Task> task_c(
-      new Task(FROM_HERE, Bind(&DoNothing), TaskTraits(), TimeDelta()));
-  task_c->delayed_run_time = manager.Now() + TimeDelta::FromSeconds(1);
+  std::unique_ptr<Task> task_c(new Task(FROM_HERE, Bind(&DoNothing),
+                                        TaskTraits(), TimeDelta::FromHours(1)));
   const Task* task_c_raw = task_c.get();
 
-  // Add |task_a| to the DelayedTaskManager. The delayed run time should be
-  // updated to |task_a|'s delayed run time.
-  EXPECT_CALL(manager, OnDelayedRunTimeUpdated());
+  // Send tasks to the DelayedTaskManager.
   manager.AddDelayedTask(std::move(task_a), sequence, nullptr, &worker_pool);
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(task_a_raw->delayed_run_time, manager.GetDelayedRunTime());
-
-  // Add |task_b| to the DelayedTaskManager. The delayed run time shouldn't
-  // change.
   manager.AddDelayedTask(std::move(task_b), sequence, nullptr, &worker_pool);
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(task_a_raw->delayed_run_time, manager.GetDelayedRunTime());
-
-  // Add |task_c| to the DelayedTaskManager. The delayed run time should be
-  // updated to |task_c|'s delayed run time.
-  EXPECT_CALL(manager, OnDelayedRunTimeUpdated());
   manager.AddDelayedTask(std::move(task_c), sequence, nullptr, &worker_pool);
-  testing::Mock::VerifyAndClear(&manager);
-  EXPECT_EQ(task_c_raw->delayed_run_time, manager.GetDelayedRunTime());
 
-  // Fast-forward time to |task_c_raw|'s delayed run time.
-  manager.SetCurrentTime(task_c_raw->delayed_run_time);
+  // Run tasks that are ripe for execution on the service thread. Don't expect
+  // any call to the mock method of |worker_pool|.
+  service_thread_task_runner->RunUntilIdle();
 
-  // Ask the DelayedTaskManager to post tasks that are ripe for execution.
-  // |task_c_raw| should be posted and the delayed run time should become
-  // |task_a_raw|'s delayed run time.
-  EXPECT_CALL(worker_pool,
-              PostTaskWithSequenceNowMock(task_c_raw, sequence.get(), nullptr));
-  manager.PostReadyTasks();
-  testing::Mock::VerifyAndClear(&worker_pool);
-  EXPECT_EQ(task_a_raw->delayed_run_time, manager.GetDelayedRunTime());
-
-  // Fast-forward time to |task_a_raw|'s delayed run time.
-  manager.SetCurrentTime(task_a_raw->delayed_run_time);
-
-  // Ask the DelayedTaskManager to post tasks that are ripe for execution.
-  // |task_a_raw| and |task_b_raw| should be posted and the delayed run time
-  // should become a null TimeTicks.
+  // Fast-forward time. Expect |task_a_raw| and |task_c_raw| to be forwarded to
+  // the worker pool.
   EXPECT_CALL(worker_pool,
               PostTaskWithSequenceNowMock(task_a_raw, sequence.get(), nullptr));
   EXPECT_CALL(worker_pool,
-              PostTaskWithSequenceNowMock(task_b_raw, sequence.get(), nullptr));
-  manager.PostReadyTasks();
+              PostTaskWithSequenceNowMock(task_c_raw, sequence.get(), nullptr));
+  service_thread_task_runner->FastForwardBy(TimeDelta::FromHours(1));
   testing::Mock::VerifyAndClear(&worker_pool);
-  EXPECT_EQ(TimeTicks(), manager.GetDelayedRunTime());
+
+  // Fast-forward time. Expect |task_b_raw| to be forwarded to the worker pool.
+  EXPECT_CALL(worker_pool,
+              PostTaskWithSequenceNowMock(task_b_raw, sequence.get(), nullptr));
+  service_thread_task_runner->FastForwardBy(TimeDelta::FromHours(1));
+  testing::Mock::VerifyAndClear(&worker_pool);
 }
 
 }  // namespace internal
diff --git a/base/task_scheduler/scheduler_service_thread.cc b/base/task_scheduler/scheduler_service_thread.cc
deleted file mode 100644
index e592907..0000000
--- a/base/task_scheduler/scheduler_service_thread.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/task_scheduler/scheduler_service_thread.h"
-
-#include <utility>
-
-#include "base/logging.h"
-#include "base/memory/ptr_util.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/task_scheduler/delayed_task_manager.h"
-#include "base/task_scheduler/scheduler_worker.h"
-#include "base/task_scheduler/sequence.h"
-#include "base/threading/thread_checker.h"
-#include "base/time/time.h"
-
-namespace base {
-namespace internal {
-namespace {
-
-class ServiceThreadDelegate : public SchedulerWorker::Delegate {
- public:
-  ServiceThreadDelegate(DelayedTaskManager* delayed_task_manager)
-      : delayed_task_manager_(delayed_task_manager) {}
-
-  // SchedulerWorker::Delegate:
-  void OnMainEntry(SchedulerWorker* worker,
-                   const TimeDelta& detach_duration) override {
-    DCHECK(detach_duration.is_max());
-  }
-
-  scoped_refptr<Sequence> GetWork(SchedulerWorker* worker) override {
-    delayed_task_manager_->PostReadyTasks();
-    return nullptr;
-  }
-
-  void DidRunTaskWithPriority(TaskPriority task_priority,
-                              const TimeDelta& task_latency) override {
-    NOTREACHED()
-        << "GetWork() never returns a sequence so no task should ever run.";
-  }
-
-  void ReEnqueueSequence(scoped_refptr<Sequence> sequence) override {
-    NOTREACHED() <<
-        "GetWork() never returns a sequence so there's nothing to reenqueue.";
-  }
-
-  TimeDelta GetSleepTimeout() override {
-    const TimeTicks next_time = delayed_task_manager_->GetDelayedRunTime();
-    if (next_time.is_null())
-      return TimeDelta::Max();
-
-    // For delayed tasks with delays that are really close to each other, it is
-    // possible for the current time to advance beyond the required
-    // GetDelayedWaitTime. Return a minimum of TimeDelta() in the event that
-    // happens.
-    TimeDelta sleep_time = next_time - delayed_task_manager_->Now();
-    const TimeDelta zero_delta;
-    return sleep_time < zero_delta ? zero_delta : sleep_time;
-  }
-
-  bool CanDetach(SchedulerWorker* worker) override {
-    return false;
-  }
-
- private:
-  DelayedTaskManager* const delayed_task_manager_;
-
-  DISALLOW_COPY_AND_ASSIGN(ServiceThreadDelegate);
-};
-
-}  // namespace
-
-SchedulerServiceThread::~SchedulerServiceThread() = default;
-
-// static
-std::unique_ptr<SchedulerServiceThread> SchedulerServiceThread::Create(
-    TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager) {
-  std::unique_ptr<SchedulerWorker> worker = SchedulerWorker::Create(
-      ThreadPriority::NORMAL,
-      MakeUnique<ServiceThreadDelegate>(delayed_task_manager), task_tracker,
-      SchedulerWorker::InitialState::ALIVE);
-  if (!worker)
-    return nullptr;
-
-  return WrapUnique(new SchedulerServiceThread(std::move(worker)));
-}
-
-void SchedulerServiceThread::WakeUp() {
-  worker_->WakeUp();
-}
-
-void SchedulerServiceThread::JoinForTesting() {
-  worker_->JoinForTesting();
-}
-
-SchedulerServiceThread::SchedulerServiceThread(
-    std::unique_ptr<SchedulerWorker> worker) : worker_(std::move(worker)) {}
-
-}  // namespace internal
-}  // namespace base
diff --git a/base/task_scheduler/scheduler_service_thread.h b/base/task_scheduler/scheduler_service_thread.h
deleted file mode 100644
index e6c9fd0c..0000000
--- a/base/task_scheduler/scheduler_service_thread.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_TASK_SCHEDULER_SERVICE_THREAD_H_
-#define BASE_TASK_SCHEDULER_SERVICE_THREAD_H_
-
-#include <memory>
-
-#include "base/base_export.h"
-#include "base/macros.h"
-
-namespace base {
-namespace internal {
-
-class DelayedTaskManager;
-class SchedulerWorker;
-class TaskTracker;
-
-// A thread dedicated to performing Task Scheduler related work.
-class BASE_EXPORT SchedulerServiceThread {
- public:
-  ~SchedulerServiceThread();
-
-  // Creates a SchedulerServiceThread. |task_tracker| and |delayed_task_manager|
-  // are passed through to the underlying SchedulerWorker. Returns a nullptr on
-  // failure.
-  static std::unique_ptr<SchedulerServiceThread> Create(
-      TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager);
-
-  // Wakes the SchedulerServiceThread if it wasn't already awake. This also has
-  // the impact of updating the amount of time the thread sleeps for delayed
-  // tasks.
-  void WakeUp();
-
-  // Joins this SchedulerServiceThread. This can only be called once.
-  void JoinForTesting();
-
- private:
-  SchedulerServiceThread(std::unique_ptr<SchedulerWorker> worker);
-
-  const std::unique_ptr<SchedulerWorker> worker_;
-
-  DISALLOW_COPY_AND_ASSIGN(SchedulerServiceThread);
-};
-
-}  // namespace internal
-}  // namespace base
-
-#endif  // BASE_TASK_SCHEDULER_SERVICE_THREAD_H_
diff --git a/base/task_scheduler/scheduler_service_thread_unittest.cc b/base/task_scheduler/scheduler_service_thread_unittest.cc
deleted file mode 100644
index 65690b00..0000000
--- a/base/task_scheduler/scheduler_service_thread_unittest.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/task_scheduler/scheduler_service_thread.h"
-
-#include <memory>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/location.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/task_scheduler/delayed_task_manager.h"
-#include "base/task_scheduler/scheduler_worker_pool_impl.h"
-#include "base/task_scheduler/scheduler_worker_pool_params.h"
-#include "base/task_scheduler/sequence.h"
-#include "base/task_scheduler/task.h"
-#include "base/task_scheduler/task_tracker.h"
-#include "base/task_scheduler/task_traits.h"
-#include "base/time/time.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace base {
-namespace internal {
-namespace {
-
-// The goal of the tests here is to verify the behavior of the Service Thread.
-// Some tests may be better part of DelayedTaskManager unit tests depending on
-// the nature of the test.
-//
-// Timed waits are inherent in the service thread because one of its main
-// purposes is to tell the delayed task manager when to post ready tasks.
-// This also makes writing tests tricky since the goal isn't to test if
-// WaitableEvent works but rather do the correct callbacks occur at the right
-// time.
-//
-// As a result, there are a few assumptions that are made in the test:
-// 1) Tests execute with balanced context switching. This means that there isn't
-//    an adversary that context switches test main thread for an extended period
-//    of time when the test main thread isn't waiting.
-// 2) Time proceeds normally. Since timed waits determine how long the service
-//    thread will wait, and timed waits is currently not mockable, time needs to
-//    proceed in a forward fashion. If time is frozen (e.g. TimeTicks::Now()
-//    doesn't advance), some tests below may fail.
-// 3) Short waits sufficiently cover longer waits. Having tests run quickly is
-//    desirable. Since the tests can't change the behavior of timed waiting, the
-//    delay durations should be reasonably short on the order of hundreds of
-//    milliseconds.
-class TaskSchedulerServiceThreadTest : public testing::Test {
- protected:
-  TaskSchedulerServiceThreadTest() : delayed_task_manager_(Bind(&DoNothing)) {}
-
-  void SetUp() override {
-    scheduler_worker_pool_ = SchedulerWorkerPoolImpl::Create(
-        SchedulerWorkerPoolParams("TestWorkerPoolForSchedulerServiceThread",
-                                  ThreadPriority::BACKGROUND,
-                                  SchedulerWorkerPoolParams::IORestriction::
-                                      DISALLOWED,
-                                  1u,
-                                  TimeDelta::Max()),
-        Bind(&ReEnqueueSequenceCallback), &task_tracker_,
-        &delayed_task_manager_);
-    ASSERT_TRUE(scheduler_worker_pool_);
-    service_thread_ = SchedulerServiceThread::Create(
-        &task_tracker_, &delayed_task_manager_);
-    ASSERT_TRUE(service_thread_);
-  }
-
-  void TearDown() override {
-    scheduler_worker_pool_->JoinForTesting();
-    service_thread_->JoinForTesting();
-  }
-
-  SchedulerServiceThread* service_thread() {
-    return service_thread_.get();
-  }
-
-  DelayedTaskManager& delayed_task_manager() {
-    return delayed_task_manager_;
-  }
-
-  SchedulerWorkerPoolImpl* worker_pool() {
-    return scheduler_worker_pool_.get();
-  }
-
- private:
-  static void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence) {
-    ADD_FAILURE() << "This test only expects one task per sequence.";
-  }
-
-  DelayedTaskManager delayed_task_manager_;
-  TaskTracker task_tracker_;
-  std::unique_ptr<SchedulerWorkerPoolImpl> scheduler_worker_pool_;
-  std::unique_ptr<SchedulerServiceThread> service_thread_;
-
-  DISALLOW_COPY_AND_ASSIGN(TaskSchedulerServiceThreadTest);
-};
-
-}  // namespace
-
-// Tests that the service thread can handle a single delayed task.
-TEST_F(TaskSchedulerServiceThreadTest, RunSingleDelayedTask) {
-  WaitableEvent event(WaitableEvent::ResetPolicy::MANUAL,
-                      WaitableEvent::InitialState::NOT_SIGNALED);
-  delayed_task_manager().AddDelayedTask(
-      WrapUnique(new Task(FROM_HERE,
-                          Bind(&WaitableEvent::Signal, Unretained(&event)),
-                          TaskTraits(), TimeDelta::FromMilliseconds(100))),
-      make_scoped_refptr(new Sequence), nullptr, worker_pool());
-  // Waking the service thread shouldn't cause the task to be executed per its
-  // delay not having expired (racy in theory, see test-fixture meta-comment).
-  service_thread()->WakeUp();
-  // Yield to increase the likelihood of catching a bug where these tasks would
-  // be released before their delay is passed.
-  PlatformThread::YieldCurrentThread();
-  EXPECT_FALSE(event.IsSignaled());
-  // When the delay expires, the delayed task is posted, signaling |event|.
-  event.Wait();
-}
-
-// Tests that the service thread can handle more than one delayed task with
-// different delays.
-TEST_F(TaskSchedulerServiceThreadTest, RunMultipleDelayedTasks) {
-  const TimeTicks test_begin_time = TimeTicks::Now();
-  const TimeDelta delay1 = TimeDelta::FromMilliseconds(100);
-  const TimeDelta delay2 = TimeDelta::FromMilliseconds(200);
-
-  WaitableEvent event1(WaitableEvent::ResetPolicy::MANUAL,
-                       WaitableEvent::InitialState::NOT_SIGNALED);
-  delayed_task_manager().AddDelayedTask(
-      WrapUnique(new Task(FROM_HERE,
-                          Bind(&WaitableEvent::Signal, Unretained(&event1)),
-                          TaskTraits(), delay1)),
-      make_scoped_refptr(new Sequence), nullptr, worker_pool());
-
-  WaitableEvent event2(WaitableEvent::ResetPolicy::MANUAL,
-                       WaitableEvent::InitialState::NOT_SIGNALED);
-  delayed_task_manager().AddDelayedTask(
-      WrapUnique(new Task(FROM_HERE,
-                          Bind(&WaitableEvent::Signal, Unretained(&event2)),
-                          TaskTraits(), delay2)),
-      make_scoped_refptr(new Sequence), nullptr, worker_pool());
-
-  // Adding the task shouldn't have caused them to be executed.
-  EXPECT_FALSE(event1.IsSignaled());
-  EXPECT_FALSE(event2.IsSignaled());
-
-  // Waking the service thread shouldn't cause the tasks to be executed per
-  // their delays not having expired (note: this is racy if the delay somehow
-  // expires before this runs but 100ms is a long time in a unittest...). It
-  // should instead cause the service thread to schedule itself for wakeup when
-  // |delay1| expires.
-  service_thread()->WakeUp();
-  // Yield to increase the likelihood of catching a bug where these tasks would
-  // be released before their delay is passed.
-  PlatformThread::YieldCurrentThread();
-  EXPECT_FALSE(event1.IsSignaled());
-  EXPECT_FALSE(event2.IsSignaled());
-
-  // Confirm the above assumption about the evolution of time in the test.
-  EXPECT_LT(TimeTicks::Now() - test_begin_time, delay1);
-
-  // Wait until |delay1| expires and service thread wakes up to schedule the
-  // first task, signalling |event1|.
-  event1.Wait();
-
-  // Only the first task should have been released.
-  EXPECT_TRUE(event1.IsSignaled());
-  EXPECT_FALSE(event2.IsSignaled());
-
-  // At least |delay1| should have passed for |event1| to fire.
-  EXPECT_GE(TimeTicks::Now() - test_begin_time, delay1);
-
-  // And assuming a sane test timeline |delay2| shouldn't have expired yet.
-  EXPECT_LT(TimeTicks::Now() - test_begin_time, delay2);
-
-  // Now wait for the second task to be fired.
-  event2.Wait();
-
-  // Which should only have fired after |delay2| was expired.
-  EXPECT_GE(TimeTicks::Now() - test_begin_time, delay2);
-}
-
-}  // namespace internal
-}  // namespace base
diff --git a/base/task_scheduler/scheduler_worker_pool_impl.cc b/base/task_scheduler/scheduler_worker_pool_impl.cc
index f14e5f9..4a9ee43f 100644
--- a/base/task_scheduler/scheduler_worker_pool_impl.cc
+++ b/base/task_scheduler/scheduler_worker_pool_impl.cc
@@ -416,7 +416,7 @@
 
   // Confirm that |task| is ready to run (its delayed run time is either null or
   // in the past).
-  DCHECK_LE(task->delayed_run_time, delayed_task_manager_->Now());
+  DCHECK_LE(task->delayed_run_time, TimeTicks::Now());
 
   // Because |worker| belongs to this worker pool, we know that the type
   // of its delegate is SchedulerWorkerDelegateImpl.
diff --git a/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc b/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc
index b67847a..fdfe41c 100644
--- a/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc
+++ b/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc
@@ -31,8 +31,11 @@
 #include "base/task_scheduler/task_tracker.h"
 #include "base/task_scheduler/test_task_factory.h"
 #include "base/test/gtest_util.h"
+#include "base/test/test_simple_task_runner.h"
+#include "base/test/test_timeouts.h"
 #include "base/threading/platform_thread.h"
 #include "base/threading/simple_thread.h"
+#include "base/threading/thread.h"
 #include "base/threading/thread_checker_impl.h"
 #include "base/threading/thread_local_storage.h"
 #include "base/threading/thread_restrictions.h"
@@ -56,51 +59,44 @@
 
 using IORestriction = SchedulerWorkerPoolParams::IORestriction;
 
-class TestDelayedTaskManager : public DelayedTaskManager {
- public:
-  TestDelayedTaskManager() : DelayedTaskManager(Bind(&DoNothing)) {}
-
-  void SetCurrentTime(TimeTicks now) { now_ = now; }
-
-  // DelayedTaskManager:
-  TimeTicks Now() const override { return now_; }
-
- private:
-  TimeTicks now_ = TimeTicks::Now();
-
-  DISALLOW_COPY_AND_ASSIGN(TestDelayedTaskManager);
-};
-
 class TaskSchedulerWorkerPoolImplTest
     : public testing::TestWithParam<ExecutionMode> {
  protected:
-  TaskSchedulerWorkerPoolImplTest() = default;
+  TaskSchedulerWorkerPoolImplTest()
+      : service_thread_("TaskSchedulerServiceThread") {}
 
   void SetUp() override {
     InitializeWorkerPool(TimeDelta::Max(), kNumWorkersInWorkerPool);
   }
 
   void TearDown() override {
+    service_thread_.Stop();
     worker_pool_->WaitForAllWorkersIdleForTesting();
     worker_pool_->JoinForTesting();
   }
 
   void InitializeWorkerPool(const TimeDelta& suggested_reclaim_time,
                             size_t num_workers) {
+    ASSERT_FALSE(worker_pool_);
+    ASSERT_FALSE(delayed_task_manager_);
+    service_thread_.Start();
+    delayed_task_manager_ =
+        base::MakeUnique<DelayedTaskManager>(service_thread_.task_runner());
     worker_pool_ = SchedulerWorkerPoolImpl::Create(
         SchedulerWorkerPoolParams("TestWorkerPool", ThreadPriority::NORMAL,
                                   IORestriction::ALLOWED, num_workers,
                                   suggested_reclaim_time),
         Bind(&TaskSchedulerWorkerPoolImplTest::ReEnqueueSequenceCallback,
              Unretained(this)),
-        &task_tracker_, &delayed_task_manager_);
+        &task_tracker_, delayed_task_manager_.get());
     ASSERT_TRUE(worker_pool_);
   }
 
   std::unique_ptr<SchedulerWorkerPoolImpl> worker_pool_;
 
   TaskTracker task_tracker_;
-  TestDelayedTaskManager delayed_task_manager_;
+  Thread service_thread_;
+  std::unique_ptr<DelayedTaskManager> delayed_task_manager_;
 
  private:
   void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence) {
@@ -306,32 +302,38 @@
   EXPECT_FALSE(task_runner->PostTask(FROM_HERE, Bind(&ShouldNotRunCallback)));
 }
 
-// Verify that a Task posted with a delay is added to the DelayedTaskManager and
-// doesn't run before its delay expires.
-TEST_P(TaskSchedulerWorkerPoolImplTest, PostDelayedTask) {
-  EXPECT_TRUE(delayed_task_manager_.GetDelayedRunTime().is_null());
+// Verify that a Task doesn't run before its delay expires.
+TEST_P(TaskSchedulerWorkerPoolImplTest, PostDelayedTaskNeverRuns) {
+  // Post a task with a very long delay.
+  EXPECT_TRUE(worker_pool_->CreateTaskRunnerWithTraits(TaskTraits(), GetParam())
+                  ->PostDelayedTask(FROM_HERE, Bind([]() {
+                                      ADD_FAILURE()
+                                          << "The delayed task should not run.";
+                                    }),
+                                    TimeDelta::FromDays(30)));
 
-  // Post a delayed task.
+  // Wait a few milliseconds. The test will fail if the delayed task runs.
+  PlatformThread::Sleep(TestTimeouts::tiny_timeout());
+}
+
+// Verify that a Task runs shortly after its delay expires.
+TEST_P(TaskSchedulerWorkerPoolImplTest, PostDelayedTask) {
+  TimeTicks start_time = TimeTicks::Now();
+
+  // Post a task with a short delay.
   WaitableEvent task_ran(WaitableEvent::ResetPolicy::MANUAL,
                          WaitableEvent::InitialState::NOT_SIGNALED);
   EXPECT_TRUE(worker_pool_->CreateTaskRunnerWithTraits(TaskTraits(), GetParam())
                   ->PostDelayedTask(FROM_HERE, Bind(&WaitableEvent::Signal,
                                                     Unretained(&task_ran)),
-                                    TimeDelta::FromSeconds(10)));
+                                    TestTimeouts::tiny_timeout()));
 
-  // The task should have been added to the DelayedTaskManager.
-  EXPECT_FALSE(delayed_task_manager_.GetDelayedRunTime().is_null());
-
-  // The task shouldn't run.
-  EXPECT_FALSE(task_ran.IsSignaled());
-
-  // Fast-forward time and post tasks that are ripe for execution.
-  delayed_task_manager_.SetCurrentTime(
-      delayed_task_manager_.GetDelayedRunTime());
-  delayed_task_manager_.PostReadyTasks();
-
-  // The task should run.
+  // Wait until the task runs.
   task_ran.Wait();
+
+  // Expect the task to run less than 250 ms after its delay expires.
+  EXPECT_LT(TimeTicks::Now() - start_time,
+            TimeDelta::FromMilliseconds(250) + TestTimeouts::tiny_timeout());
 }
 
 // Verify that the RunsTasksOnCurrentThread() method of a SEQUENCED TaskRunner
@@ -403,7 +405,8 @@
 
 TEST_P(TaskSchedulerWorkerPoolImplIORestrictionTest, IORestriction) {
   TaskTracker task_tracker;
-  DelayedTaskManager delayed_task_manager(Bind(&DoNothing));
+  DelayedTaskManager delayed_task_manager(
+      make_scoped_refptr(new TestSimpleTaskRunner));
 
   auto worker_pool = SchedulerWorkerPoolImpl::Create(
       SchedulerWorkerPoolParams("TestWorkerPoolWithParam",
diff --git a/base/task_scheduler/task.cc b/base/task_scheduler/task.cc
index 5a17b7f2..7314099 100644
--- a/base/task_scheduler/task.cc
+++ b/base/task_scheduler/task.cc
@@ -22,7 +22,8 @@
                          TaskShutdownBehavior::BLOCK_SHUTDOWN
                  ? TaskTraits(traits).WithShutdownBehavior(
                        TaskShutdownBehavior::SKIP_ON_SHUTDOWN)
-                 : traits) {}
+                 : traits),
+      delay(delay) {}
 
 Task::~Task() = default;
 
diff --git a/base/task_scheduler/task.h b/base/task_scheduler/task.h
index b2fa766..c014671 100644
--- a/base/task_scheduler/task.h
+++ b/base/task_scheduler/task.h
@@ -36,6 +36,9 @@
   // The TaskTraits of this task.
   const TaskTraits traits;
 
+  // The delay that must expire before the task runs.
+  const TimeDelta delay;
+
   // The time at which the task was inserted in its sequence. For an undelayed
   // task, this happens at post time. For a delayed task, this happens some
   // time after the task's delay has expired. If the task hasn't been inserted
diff --git a/base/task_scheduler/task_scheduler_impl.cc b/base/task_scheduler/task_scheduler_impl.cc
index af9639b..a3fc0d3 100644
--- a/base/task_scheduler/task_scheduler_impl.cc
+++ b/base/task_scheduler/task_scheduler_impl.cc
@@ -9,7 +9,6 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/memory/ptr_util.h"
-#include "base/task_scheduler/scheduler_service_thread.h"
 #include "base/task_scheduler/scheduler_worker_pool_params.h"
 #include "base/task_scheduler/sequence_sort_key.h"
 #include "base/task_scheduler/task.h"
@@ -67,7 +66,7 @@
 #endif
   for (const auto& worker_pool : worker_pools_)
     worker_pool->JoinForTesting();
-  service_thread_->JoinForTesting();
+  service_thread_.Stop();
 #if DCHECK_IS_ON()
   join_for_testing_returned_.Set();
 #endif
@@ -75,11 +74,9 @@
 
 TaskSchedulerImpl::TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback&
                                          worker_pool_index_for_traits_callback)
-    : delayed_task_manager_(
-          Bind(&TaskSchedulerImpl::OnDelayedRunTimeUpdated, Unretained(this))),
+    : service_thread_("TaskSchedulerServiceThread"),
       worker_pool_index_for_traits_callback_(
-          worker_pool_index_for_traits_callback)
-{
+          worker_pool_index_for_traits_callback) {
   DCHECK(!worker_pool_index_for_traits_callback_.is_null());
 }
 
@@ -87,23 +84,36 @@
     const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector) {
   DCHECK(!worker_pool_params_vector.empty());
 
+  // Start the service thread.
+  constexpr MessageLoop::Type kServiceThreadMessageLoopType =
+#if defined(OS_POSIX)
+      MessageLoop::TYPE_IO;
+#else
+      MessageLoop::TYPE_DEFAULT;
+#endif
+  constexpr size_t kDefaultStackSize = 0;
+  CHECK(service_thread_.StartWithOptions(
+      Thread::Options(kServiceThreadMessageLoopType, kDefaultStackSize)));
+
   const SchedulerWorkerPoolImpl::ReEnqueueSequenceCallback
       re_enqueue_sequence_callback =
           Bind(&TaskSchedulerImpl::ReEnqueueSequenceCallback, Unretained(this));
 
+  // Instantiate the DelayedTaskManager. The service thread must be started
+  // before its TaskRunner is available.
+  delayed_task_manager_ =
+      base::MakeUnique<DelayedTaskManager>(service_thread_.task_runner());
+
+  // Start worker pools.
   for (const auto& worker_pool_params : worker_pool_params_vector) {
     // Passing pointers to objects owned by |this| to
     // SchedulerWorkerPoolImpl::Create() is safe because a TaskSchedulerImpl
     // can't be deleted before all its worker pools have been joined.
     worker_pools_.push_back(SchedulerWorkerPoolImpl::Create(
         worker_pool_params, re_enqueue_sequence_callback, &task_tracker_,
-        &delayed_task_manager_));
+        delayed_task_manager_.get()));
     CHECK(worker_pools_.back());
   }
-
-  service_thread_ = SchedulerServiceThread::Create(&task_tracker_,
-                                                   &delayed_task_manager_);
-  CHECK(service_thread_);
 }
 
 SchedulerWorkerPool* TaskSchedulerImpl::GetWorkerPoolForTraits(
@@ -129,9 +139,5 @@
                                                     sort_key);
 }
 
-void TaskSchedulerImpl::OnDelayedRunTimeUpdated() {
-  service_thread_->WakeUp();
-}
-
 }  // namespace internal
 }  // namespace base
diff --git a/base/task_scheduler/task_scheduler_impl.h b/base/task_scheduler/task_scheduler_impl.h
index f49cccc..9fea54a4 100644
--- a/base/task_scheduler/task_scheduler_impl.h
+++ b/base/task_scheduler/task_scheduler_impl.h
@@ -79,15 +79,11 @@
   // worker pops a Task from it.
   void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence);
 
-  // Callback invoked when the delayed run time is changed from the
-  // DelayedTaskManager.
-  void OnDelayedRunTimeUpdated();
-
   TaskTracker task_tracker_;
-  DelayedTaskManager delayed_task_manager_;
+  Thread service_thread_;
+  std::unique_ptr<DelayedTaskManager> delayed_task_manager_;
   const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_;
   std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_;
-  std::unique_ptr<SchedulerServiceThread> service_thread_;
 
 #if DCHECK_IS_ON()
   // Set once JoinForTesting() has returned.
diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
index be560bc..ab4e056 100644
--- a/base/third_party/dmg_fp/dtoa.cc
+++ b/base/third_party/dmg_fp/dtoa.cc
@@ -2675,9 +2675,9 @@
 				L = c - '0';
 				s1 = s;
 				while((c = *++s) >= '0' && c <= '9') {
-					L = 10*L + c - '0';
-					if (L > DBL_MAX_10_EXP)
-						break;
+					if (L < (INT_MAX - 10) / 10) {
+						L = 10*L + c - '0';
+					}
 				}
 				if (s - s1 > 8 || L > 19999)
 					/* Avoid confusion from exponents
diff --git a/base/third_party/dmg_fp/exp_length.patch b/base/third_party/dmg_fp/exp_length.patch
index 65d033a..7a6d691 100644
--- a/base/third_party/dmg_fp/exp_length.patch
+++ b/base/third_party/dmg_fp/exp_length.patch
@@ -1,16 +1,17 @@
 diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
-index 502c16c..f3d793e 100644
+index c0a51c2..ab4e056 100644
 --- a/base/third_party/dmg_fp/dtoa.cc
 +++ b/base/third_party/dmg_fp/dtoa.cc
-@@ -2597,8 +2597,11 @@ strtod
+@@ -2674,8 +2674,11 @@ strtod
  			if (c > '0' && c <= '9') {
  				L = c - '0';
  				s1 = s;
 -				while((c = *++s) >= '0' && c <= '9')
+-					L = 10*L + c - '0';
 +				while((c = *++s) >= '0' && c <= '9') {
- 					L = 10*L + c - '0';
-+					if (L > DBL_MAX_10_EXP)
-+						break;
++					if (L < (INT_MAX - 10) / 10) {
++						L = 10*L + c - '0';
++					}
 +				}
  				if (s - s1 > 8 || L > 19999)
  					/* Avoid confusion from exponents
diff --git a/base/trace_event/auto_open_close_event.cc b/base/trace_event/auto_open_close_event.cc
new file mode 100644
index 0000000..f2794f4
--- /dev/null
+++ b/base/trace_event/auto_open_close_event.cc
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/trace_event/auto_open_close_event.h"
+
+#include "base/macros.h"
+#include "base/time/time.h"
+#include "base/trace_event/trace_event.h"
+
+namespace base {
+namespace trace_event {
+
+AutoOpenCloseEvent::AutoOpenCloseEvent(AutoOpenCloseEvent::Type type,
+  const char* category, const char* event_name):
+  category_(category),
+  event_name_(event_name),
+  weak_factory_(this) {
+  base::trace_event::TraceLog::GetInstance()->AddAsyncEnabledStateObserver(
+      weak_factory_.GetWeakPtr());
+}
+
+AutoOpenCloseEvent::~AutoOpenCloseEvent() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  base::trace_event::TraceLog::GetInstance()->RemoveAsyncEnabledStateObserver(
+      this);
+}
+
+void AutoOpenCloseEvent::Begin() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  start_time_ = base::TimeTicks::Now();
+  TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(
+      category_, event_name_, static_cast<void*>(this), start_time_);
+}
+
+void AutoOpenCloseEvent::End() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  TRACE_EVENT_ASYNC_END0(category_, event_name_, static_cast<void*>(this));
+  start_time_ = base::TimeTicks();
+}
+
+void AutoOpenCloseEvent::OnTraceLogEnabled() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  if (start_time_.ToInternalValue() != 0)
+    TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(
+        category_, event_name_, static_cast<void*>(this), start_time_);
+}
+
+void AutoOpenCloseEvent::OnTraceLogDisabled() {}
+
+}  // namespace trace_event
+}  // namespace base
\ No newline at end of file
diff --git a/base/trace_event/auto_open_close_event.h b/base/trace_event/auto_open_close_event.h
new file mode 100644
index 0000000..795a4948
--- /dev/null
+++ b/base/trace_event/auto_open_close_event.h
@@ -0,0 +1,57 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_AUTO_OPEN_CLOSE_EVENT_H_
+#define BASE_AUTO_OPEN_CLOSE_EVENT_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "base/time/time.h"
+#include "base/trace_event/trace_event.h"
+
+namespace base {
+namespace trace_event {
+
+// Class for tracing events that support "auto-opening" and "auto-closing".
+// "auto-opening" = if the trace event is started (call Begin() before
+// tracing is started,the trace event will be opened, with the start time
+// being the time that the trace event was actually started.
+// "auto-closing" = if the trace event is started but not ended by the time
+// tracing ends, then the trace event will be automatically closed at the
+// end of tracing.
+class BASE_EXPORT AutoOpenCloseEvent
+    : public TraceLog::AsyncEnabledStateObserver {
+ public:
+  enum Type {
+    ASYNC
+  };
+
+  // As in the rest of the tracing macros, the const char* arguments here
+  // must be pointers to indefinitely lived strings (e.g. hard-coded string
+  // literals are okay, but not strings created by c_str())
+  AutoOpenCloseEvent(Type type, const char* category, const char* event_name);
+  ~AutoOpenCloseEvent() override;
+
+  void Begin();
+  void End();
+
+  // AsyncEnabledStateObserver implementation
+  void OnTraceLogEnabled() override;
+  void OnTraceLogDisabled() override;
+
+ private:
+  const char* const category_;
+  const char* const event_name_;
+  base::TimeTicks start_time_;
+  base::ThreadChecker thread_checker_;
+  WeakPtrFactory<AutoOpenCloseEvent> weak_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(AutoOpenCloseEvent);
+};
+
+}  // namespace trace_event
+}  // namespace base
+
+#endif  // BASE_AUTO_OPEN_CLOSE_EVENT_H_
\ No newline at end of file
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
index 26eb923..7d0cb579 100644
--- a/base/trace_event/malloc_dump_provider.cc
+++ b/base/trace_event/malloc_dump_provider.cc
@@ -105,7 +105,18 @@
 
 bool GetHeapInformation(WinHeapInfo* heap_info,
                         const std::set<void*>& block_to_skip) {
-  CHECK(::HeapLock(heap_info->heap_id) == TRUE);
+  // NOTE: crbug.com/464430
+  // As a part of the Client/Server Runtine Subsystem (CSRSS) lockdown in the
+  // referenced bug, it will invalidate the heap used by CSRSS. The author has
+  // not found a way to clean up an invalid heap handle, so it will be left in
+  // the process's heap list. Therefore we need to support when there is this
+  // invalid heap handle in the heap list.
+  // HeapLock implicitly checks certain aspects of the HEAP structure, such as
+  // the signature. If this passes, we assume that this heap is valid and is
+  // not the one owned by CSRSS.
+  if (!::HeapLock(heap_info->heap_id)) {
+    return false;
+  }
   PROCESS_HEAP_ENTRY heap_entry;
   heap_entry.lpData = nullptr;
   // Walk over all the entries in this heap.
@@ -161,15 +172,21 @@
   block_to_skip.insert(all_heaps.get());
 
   // Retrieves some metrics about each heap.
+  size_t heap_info_errors = 0;
   for (size_t i = 0; i < number_of_heaps; ++i) {
     WinHeapInfo heap_info = {0};
     heap_info.heap_id = all_heaps[i];
-    GetHeapInformation(&heap_info, block_to_skip);
-
-    all_heap_info->allocated_size += heap_info.allocated_size;
-    all_heap_info->committed_size += heap_info.committed_size;
-    all_heap_info->uncommitted_size += heap_info.uncommitted_size;
-    all_heap_info->block_count += heap_info.block_count;
+    if (GetHeapInformation(&heap_info, block_to_skip)) {
+      all_heap_info->allocated_size += heap_info.allocated_size;
+      all_heap_info->committed_size += heap_info.committed_size;
+      all_heap_info->uncommitted_size += heap_info.uncommitted_size;
+      all_heap_info->block_count += heap_info.block_count;
+    } else {
+      ++heap_info_errors;
+      // See notes in GetHeapInformation() but we only expect 1 heap to not be
+      // able to be read.
+      CHECK_EQ(1u, heap_info_errors);
+    }
   }
 }
 #endif  // defined(OS_WIN)
diff --git a/base/trace_event/memory_infra_background_whitelist.cc b/base/trace_event/memory_infra_background_whitelist.cc
index 88d6d5b..21bff69 100644
--- a/base/trace_event/memory_infra_background_whitelist.cc
+++ b/base/trace_event/memory_infra_background_whitelist.cc
@@ -17,6 +17,7 @@
 // providers can be added here only if the background mode dump has very
 // less performance and memory overhead.
 const char* const kDumpProviderWhitelist[] = {
+    "android::ResourceManagerImpl",
     "BlinkGC",
     "ChildDiscardableSharedMemoryManager",
     "DOMStorage",
@@ -78,6 +79,7 @@
     "skia/sk_glyph_cache",
     "skia/sk_resource_cache",
     "sqlite",
+    "ui/resource_manager_0x?",
     "v8/isolate_0x?/heap_spaces",
     "v8/isolate_0x?/heap_spaces/code_space",
     "v8/isolate_0x?/heap_spaces/large_object_space",
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc
index 9bb7a8a..9ceaa2f7 100644
--- a/base/trace_event/trace_log.cc
+++ b/base/trace_event/trace_log.cc
@@ -1368,7 +1368,7 @@
   ThreadTicks thread_now = ThreadNow();
 
   ThreadLocalEventBuffer* thread_local_event_buffer = nullptr;
-  if (enabled_modes_ & RECORDING_MODE) {
+  if (*category_group_enabled & RECORDING_MODE) {
     // |thread_local_event_buffer_| can be null if the current thread doesn't
     // have a message loop or the message loop is blocked.
     InitializeThreadLocalEventBufferIfSupported();
diff --git a/blimp/BUILD.gn b/blimp/BUILD.gn
index 569bcd9..cdc5752 100644
--- a/blimp/BUILD.gn
+++ b/blimp/BUILD.gn
@@ -102,6 +102,7 @@
       "//ipc:ipc_tests",
       "//net:net_unittests",
       "//sandbox/linux:sandbox_linux_unittests",
+      "//blimp/test/fake_engine:fake_engine_app",
     ]
 
     write_runtime_deps = _blimp_engine_env_tests_runtime_deps
diff --git a/blimp/client/app/BUILD.gn b/blimp/client/app/BUILD.gn
index 5e200eda..8da4cb8 100644
--- a/blimp/client/app/BUILD.gn
+++ b/blimp/client/app/BUILD.gn
@@ -145,7 +145,7 @@
       "//blimp/client/core/session",
       "//blimp/net",
       "//net",
-      "//services/shell/public/cpp",
+      "//services/service_manager/public/cpp",
 
       # TODO(khushalsagar|scottmg): Remove this dependency from browser to
       # blink. See https://crbug.com/608114.
diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpApplication.java b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpApplication.java
index c00ca86..44b9d0b 100644
--- a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpApplication.java
+++ b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpApplication.java
@@ -11,7 +11,6 @@
 import org.chromium.base.CommandLineInitUtil;
 import org.chromium.base.ContextUtils;
 import org.chromium.base.PathUtils;
-import org.chromium.base.ResourceExtractor;
 
 /**
  * The {@link Application} for the Blimp client.
@@ -29,7 +28,6 @@
     @Override
     public void onCreate() {
         super.onCreate();
-        ResourceExtractor.setResourcesToExtract(new ResourceExtractor.ResourceEntry[0]);
         PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
         initCommandLine();
     }
diff --git a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpLibraryLoader.java b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpLibraryLoader.java
index 756b247..6136dc9 100644
--- a/blimp/client/app/android/java/src/org/chromium/blimp/BlimpLibraryLoader.java
+++ b/blimp/client/app/android/java/src/org/chromium/blimp/BlimpLibraryLoader.java
@@ -6,7 +6,6 @@
 
 import android.os.Handler;
 
-import org.chromium.base.ContextUtils;
 import org.chromium.base.ObserverList;
 import org.chromium.base.ResourceExtractor;
 import org.chromium.base.ThreadUtils;
@@ -81,7 +80,7 @@
         if (sLoadAttempted) return;
         sLoadAttempted = true;
 
-        ResourceExtractor extractor = ResourceExtractor.get(ContextUtils.getApplicationContext());
+        ResourceExtractor extractor = ResourceExtractor.get();
         extractor.startExtractingResources();
         LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
 
diff --git a/blimp/client/support/compositor/blimp_embedder_compositor.cc b/blimp/client/support/compositor/blimp_embedder_compositor.cc
index df43a62..f8116dc 100644
--- a/blimp/client/support/compositor/blimp_embedder_compositor.cc
+++ b/blimp/client/support/compositor/blimp_embedder_compositor.cc
@@ -88,7 +88,7 @@
   void ApplyExternalStencil() override {}
 
  private:
-  void SwapBuffersCallback() { client_->DidSwapBuffersComplete(); }
+  void SwapBuffersCallback() { client_->DidReceiveSwapBuffersAck(); }
 
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
   base::WeakPtrFactory<DisplayOutputSurface> weak_ptr_factory_;
diff --git a/blimp/engine/BUILD.gn b/blimp/engine/BUILD.gn
index 53a3e8b..a4dc49e 100644
--- a/blimp/engine/BUILD.gn
+++ b/blimp/engine/BUILD.gn
@@ -343,7 +343,7 @@
     "//components/web_cache/renderer",
     "//content/public/common",
     "//content/public/renderer",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//third_party/libwebp",
     "//ui/gfx/geometry",
diff --git a/blimp/engine/DEPS b/blimp/engine/DEPS
index c16b6ed..52d1018 100644
--- a/blimp/engine/DEPS
+++ b/blimp/engine/DEPS
@@ -13,7 +13,7 @@
   "+device/geolocation",
   "+mojo/public",
   "+net",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/blimp_fonts",
   "+third_party/khronos/GLES2/gl2.h",
   "+third_party/WebKit/public/web/WebInputEvent.h",
diff --git a/blimp/engine/app/blimp_content_browser_client.cc b/blimp/engine/app/blimp_content_browser_client.cc
index bb47498d..bc2068f 100644
--- a/blimp/engine/app/blimp_content_browser_client.cc
+++ b/blimp/engine/app/blimp_content_browser_client.cc
@@ -10,7 +10,7 @@
 #include "blimp/engine/mojo/blob_channel_service.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/common/service_names.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/base/resource/resource_bundle.h"
 
 namespace blimp {
@@ -45,7 +45,7 @@
 }
 
 void BlimpContentBrowserClient::ExposeInterfacesToRenderer(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     content::RenderProcessHost* render_process_host) {
   registry->AddInterface<mojom::BlobChannel>(base::Bind(
       &BlobChannelService::BindRequest,
diff --git a/blimp/engine/app/blimp_content_browser_client.h b/blimp/engine/app/blimp_content_browser_client.h
index e14f6c71..a586f9d4 100644
--- a/blimp/engine/app/blimp_content_browser_client.h
+++ b/blimp/engine/app/blimp_content_browser_client.h
@@ -33,7 +33,7 @@
   void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
                            content::WebPreferences* prefs) override;
   void ExposeInterfacesToRenderer(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       content::RenderProcessHost* render_process_host) override;
   std::unique_ptr<base::Value> GetServiceManifestOverlay(
       const std::string& name) override;
diff --git a/blimp/engine/renderer/blob_channel_sender_proxy.cc b/blimp/engine/renderer/blob_channel_sender_proxy.cc
index 4c466ab..ba62580 100644
--- a/blimp/engine/renderer/blob_channel_sender_proxy.cc
+++ b/blimp/engine/renderer/blob_channel_sender_proxy.cc
@@ -9,7 +9,7 @@
 
 #include "blimp/common/blob_cache/id_util.h"
 #include "content/public/renderer/render_thread.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace blimp {
 namespace engine {
diff --git a/build/android/gyp/locale_pak_resources.py b/build/android/gyp/locale_pak_resources.py
deleted file mode 100755
index 73f44051..0000000
--- a/build/android/gyp/locale_pak_resources.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""Creates a resources.zip for locale .pak files.
-
-Places the locale.pak files into appropriate resource configs
-(e.g. en-GB.pak -> res/raw-en/en_gb.lpak). Also generates a locale_paks
-TypedArray so that resource files can be enumerated at runtime.
-"""
-
-import collections
-import optparse
-import os
-import sys
-import zipfile
-
-from util import build_utils
-
-
-# This should stay in sync with:
-# base/android/java/src/org/chromium/base/LocaleUtils.java
-_CHROME_TO_ANDROID_LOCALE_MAP = {
-    'he': 'iw',
-    'id': 'in',
-    'fil': 'tl',
-}
-
-
-def ToResourceFileName(name):
-  """Returns the resource-compatible file name for the given file."""
-  # Resources file names must consist of [a-z0-9_.].
-  # Changes extension to .lpak so that compression can be toggled separately for
-  # locale pak files vs other pak files.
-  return name.replace('-', '_').replace('.pak', '.lpak').lower()
-
-
-def CreateLocalePaksXml(names):
-  """Creates the contents for the locale-paks.xml files."""
-  VALUES_FILE_TEMPLATE = '''<?xml version="1.0" encoding="utf-8"?>
-<resources>
-  <array name="locale_paks">%s
-  </array>
-</resources>
-'''
-  VALUES_ITEM_TEMPLATE = '''
-    <item>@raw/%s</item>'''
-
-  res_names = (os.path.splitext(name)[0] for name in names)
-  items = ''.join((VALUES_ITEM_TEMPLATE % name for name in res_names))
-  return VALUES_FILE_TEMPLATE % items
-
-
-def ComputeMappings(sources):
-  """Computes the mappings of sources -> resources.
-
-  Returns a tuple of:
-    - mappings: List of (src, dest) paths
-    - lang_to_locale_map: Map of language -> list of resource names
-      e.g. "en" -> ["en_gb.lpak"]
-  """
-  lang_to_locale_map = collections.defaultdict(list)
-  mappings = []
-  for src_path in sources:
-    basename = os.path.basename(src_path)
-    name = os.path.splitext(basename)[0]
-    res_name = ToResourceFileName(basename)
-    if name == 'en-US':
-      dest_dir = 'raw'
-    else:
-      # Chrome's uses different region mapping logic from Android, so include
-      # all regions for each language.
-      android_locale = _CHROME_TO_ANDROID_LOCALE_MAP.get(name, name)
-      lang = android_locale[0:2]
-      dest_dir = 'raw-' + lang
-      lang_to_locale_map[lang].append(res_name)
-    mappings.append((src_path, os.path.join(dest_dir, res_name)))
-  return mappings, lang_to_locale_map
-
-
-def main():
-  parser = optparse.OptionParser()
-  build_utils.AddDepfileOption(parser)
-  parser.add_option('--locale-paks', help='List of files for res/raw-LOCALE')
-  parser.add_option('--resources-zip', help='Path to output resources.zip')
-  parser.add_option('--print-languages',
-      action='store_true',
-      help='Print out the list of languages that cover the given locale paks '
-           '(using Android\'s language codes)')
-
-  options, _ = parser.parse_args()
-  build_utils.CheckOptions(options, parser,
-                           required=['locale_paks'])
-
-  sources = build_utils.ParseGnList(options.locale_paks)
-
-  if options.depfile:
-    assert options.resources_zip
-    build_utils.WriteDepfile(options.depfile, options.resources_zip, sources)
-
-  mappings, lang_to_locale_map = ComputeMappings(sources)
-  if options.print_languages:
-    print '\n'.join(sorted(lang_to_locale_map))
-
-  if options.resources_zip:
-    with zipfile.ZipFile(options.resources_zip, 'w', zipfile.ZIP_STORED) as out:
-      for mapping in mappings:
-        out.write(mapping[0], mapping[1])
-
-      # Create TypedArray resources so ResourceExtractor can enumerate files.
-      def WriteValuesFile(lang, names):
-        dest_dir = 'values'
-        if lang:
-          dest_dir += '-' + lang
-        # Always extract en-US.lpak since it's the fallback.
-        xml = CreateLocalePaksXml(names + ['en_us.lpak'])
-        out.writestr(os.path.join(dest_dir, 'locale-paks.xml'), xml)
-
-      for lang, names in lang_to_locale_map.iteritems():
-        WriteValuesFile(lang, names)
-      WriteValuesFile(None, [])
-
-
-if __name__ == '__main__':
-  sys.exit(main())
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py
index c17bfcb4..8f4580ea 100755
--- a/build/android/gyp/write_build_config.py
+++ b/build/android/gyp/write_build_config.py
@@ -209,12 +209,21 @@
   ret.reverse()
   return ret
 
+
 def _CreateJavaLibrariesList(library_paths):
-  """ Create a java literal array with the "base" library names:
+  """Returns a java literal array with the "base" library names:
   e.g. libfoo.so -> foo
   """
   return ('{%s}' % ','.join(['"%s"' % s[3:-3] for s in library_paths]))
 
+
+def _CreateLocalePaksAssetJavaList(assets):
+  """Returns a java literal array from a list of assets in the form src:dst."""
+  names_only = (a.split(':')[1][:-4] for a in assets if a.endswith('.pak'))
+  locales_only = (a for a in names_only if '-' in a or len(a) == 2)
+  return '{%s}' % ','.join(sorted('"%s"' % a for a in locales_only))
+
+
 def main(argv):
   parser = optparse.OptionParser()
   build_utils.AddDepfileOption(parser)
@@ -233,8 +242,6 @@
   parser.add_option('--package-name',
       help='Java package name for these resources.')
   parser.add_option('--android-manifest', help='Path to android manifest.')
-  parser.add_option('--is-locale-resource', action='store_true',
-                    help='Whether it is locale resource.')
   parser.add_option('--resource-dirs', action='append', default=[],
                     help='GYP-list of resource dirs')
 
@@ -290,8 +297,6 @@
       help='GYP-list of proguard flag files to use in final apk.')
   parser.add_option('--proguard-info',
       help='Path to the proguard .info output for this apk.')
-  parser.add_option('--has-alternative-locale-resource', action='store_true',
-      help='Whether there is alternative-locale-resource in direct deps')
   parser.add_option('--fail',
       help='GYP-list of error message lines to fail with.')
 
@@ -339,21 +344,6 @@
   deps = Deps(direct_deps_config_paths)
   all_inputs = deps.AllConfigPaths()
 
-  # Remove other locale resources if there is alternative_locale_resource in
-  # direct deps.
-  if options.has_alternative_locale_resource:
-    alternative = [r['path'] for r in deps.Direct('android_resources')
-                   if r.get('is_locale_resource')]
-    # We can only have one locale resources in direct deps.
-    if len(alternative) != 1:
-      raise Exception('The number of locale resource in direct deps is wrong %d'
-                       % len(alternative))
-    unwanted = [r['path'] for r in deps.All('android_resources')
-                if r.get('is_locale_resource') and r['path'] not in alternative]
-    for p in unwanted:
-      deps.RemoveNonDirectDep(p)
-
-
   direct_library_deps = deps.Direct('java_library')
   all_library_deps = deps.All('java_library')
 
@@ -485,8 +475,6 @@
       deps_info['package_name'] = options.package_name
     if options.r_text:
       deps_info['r_text'] = options.r_text
-    if options.is_locale_resource:
-      deps_info['is_locale_resource'] = True
 
     deps_info['resources_dirs'] = []
     if options.resource_dirs:
@@ -658,6 +646,10 @@
     }
     config['assets'], config['uncompressed_assets'] = (
         _MergeAssets(deps.All('android_assets')))
+    config['compressed_locales_java_list'] = (
+        _CreateLocalePaksAssetJavaList(config['assets']))
+    config['uncompressed_locales_java_list'] = (
+        _CreateLocalePaksAssetJavaList(config['uncompressed_assets']))
 
   build_utils.WriteJson(config, options.build_config, only_if_changed=True)
 
diff --git a/build/android/pylib/local/device/local_device_perf_test_run.py b/build/android/pylib/local/device/local_device_perf_test_run.py
index 44dd7b6..fe8a1329 100644
--- a/build/android/pylib/local/device/local_device_perf_test_run.py
+++ b/build/android/pylib/local/device/local_device_perf_test_run.py
@@ -322,7 +322,7 @@
 
 class LocalDevicePerfTestRun(local_device_test_run.LocalDeviceTestRun):
 
-  _DEFAULT_TIMEOUT = 60 * 60
+  _DEFAULT_TIMEOUT = 3 * 60 * 60  # 3 hours.
   _CONFIG_VERSION = 1
 
   def __init__(self, env, test_instance):
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py
index 64ce719..6c77ec3 100755
--- a/build/android/resource_sizes.py
+++ b/build/android/resource_sizes.py
@@ -185,11 +185,15 @@
   FILE_GROUPS = (
       FileGroup('Native code', r'\.so$', lambda f: 'crazy' not in f),
       FileGroup('Java code', r'\.dex$', YES),
-      FileGroup('Native resources (no l10n)', r'\.pak$', NO),
+      FileGroup('Native resources (no l10n)',
+                r'^assets/.*(resources|percent)\.pak$', NO),
       # For locale paks, assume only english paks are extracted.
-      FileGroup('Native resources (l10n)', r'\.lpak$', lambda f: 'en_' in f),
-      FileGroup('ICU (i18n library) data', r'assets/icudtl\.dat$', NO),
-      FileGroup('V8 Snapshots', r'\.bin$', NO),
+      # Handles locale paks as bother resources or assets (.lpak or .pak).
+      FileGroup('Native resources (l10n)',
+                r'\.lpak$|^assets/.*(?!resources|percent)\.pak$',
+                lambda f: 'en_' in f or 'en-' in f),
+      FileGroup('ICU (i18n library) data', r'^assets/icudtl\.dat$', NO),
+      FileGroup('V8 Snapshots', r'^assets/.*\.bin$', NO),
       FileGroup('PNG drawables', r'\.png$', NO),
       FileGroup('Non-compiled Android resources', r'^res/', NO),
       FileGroup('Compiled Android resources', r'\.arsc$', NO),
@@ -221,13 +225,18 @@
   total_install_size = total_apk_size
 
   for group in FILE_GROUPS:
-    uncompressed_size = sum(member.file_size for member in found_files[group])
-    packed_size = sum(member.compress_size for member in found_files[group])
-    install_size = packed_size
-    install_bytes = sum(member.file_size for member in found_files[group]
-                        if group.extracted(member.filename))
-    install_size += install_bytes
-    total_install_size += install_bytes
+    uncompressed_size = 0
+    packed_size = 0
+    extracted_size = 0
+    for member in found_files[group]:
+      uncompressed_size += member.file_size
+      packed_size += member.compress_size
+      # Assume that if a file is not compressed, then it is not extracted.
+      is_compressed = member.compress_type != zipfile.ZIP_STORED
+      if is_compressed and group.extracted(member.filename):
+        extracted_size += member.file_size
+    install_size = packed_size + extracted_size
+    total_install_size += extracted_size
 
     ReportPerfResult(chartjson, apk_basename + '_Breakdown',
                      group.name + ' size', packed_size, 'bytes')
diff --git a/build/build_config.h b/build/build_config.h
index 5785abf6..e8e987a 100644
--- a/build/build_config.h
+++ b/build/build_config.h
@@ -111,6 +111,31 @@
 #define ARCH_CPU_X86 1
 #define ARCH_CPU_32_BITS 1
 #define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__s390x__)
+#define ARCH_CPU_S390_FAMILY 1
+#define ARCH_CPU_S390X 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__s390__)
+#define ARCH_CPU_S390_FAMILY 1
+#define ARCH_CPU_S390 1
+#define ARCH_CPU_31_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__PPC64__) && defined(__BIG_ENDIAN__)
+#define ARCH_CPU_PPC64_FAMILY 1
+#define ARCH_CPU_PPC64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__PPC64__) && defined(__LITTLE_ENDIAN__)
+#define ARCH_CPU_PPC64_FAMILY 1
+#define ARCH_CPU_PPC64 1
+#define ARCH_CPU_64_BITS 1
+#define ARCH_CPU_LITTLE_ENDIAN 1
+#elif defined(__PPC__)
+#define ARCH_CPU_PPC_FAMILY 1
+#define ARCH_CPU_PPC 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
 #elif defined(__ARMEL__)
 #define ARCH_CPU_ARM_FAMILY 1
 #define ARCH_CPU_ARMEL 1
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
index 7e4d768..23d2285 100644
--- a/build/config/BUILD.gn
+++ b/build/config/BUILD.gn
@@ -198,9 +198,6 @@
   if (enable_rlz) {
     defines += [ "ENABLE_RLZ" ]
   }
-  if (enable_app_list) {
-    defines += [ "ENABLE_APP_LIST=1" ]
-  }
   if (enable_supervised_users) {
     defines += [ "ENABLE_SUPERVISED_USERS=1" ]
   }
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index 14b21d75..f656ea6 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -275,13 +275,6 @@
           rebase_path(invoker.r_text, root_build_dir),
         ]
       }
-      if (defined(invoker.is_locale_resource) && invoker.is_locale_resource) {
-        args += [ "--is-locale-resource" ]
-      }
-      if (defined(invoker.has_alternative_locale_resource) &&
-          invoker.has_alternative_locale_resource) {
-        args += [ "--has-alternative-locale-resource" ]
-      }
     }
 
     if (is_android_resources && defined(invoker.resource_dirs)) {
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index f23df290..faf5a96 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -607,69 +607,6 @@
     }
   }
 
-  # Creates a resources.zip with locale.pak files placed into appropriate
-  # resource configs (e.g. en-GB.pak -> res/raw-en/en_gb.pak). Also generates
-  # a locale_paks TypedArray so that resource files can be enumerated at runtime.
-  #
-  # If this target is included in the deps of an android resources/library/apk,
-  # the resources will be included with that target.
-  #
-  # Variables:
-  #   sources: List of .pak files. Names must be of the form "en.pak" or
-  #       "en-US.pak".
-  #   deps: (optional) List of dependencies that might be needed to generate
-  #       the .pak files.
-  #
-  # Example
-  #   locale_pak_resources("locale_paks") {
-  #     sources = [ "path/en-US.pak", "path/fr.pak", ... ]
-  #   }
-  template("locale_pak_resources") {
-    set_sources_assignment_filter([])
-    assert(defined(invoker.sources))
-
-    _base_path = "$target_gen_dir/$target_name"
-    _resources_zip = _base_path + ".resources.zip"
-    _build_config = _base_path + ".build_config"
-
-    write_build_config("${target_name}__build_config") {
-      build_config = _build_config
-      resources_zip = _resources_zip
-      type = "android_resources"
-      is_locale_resource = true
-    }
-
-    action("${target_name}__create_resources_zip") {
-      forward_variables_from(invoker,
-                             [
-                               "deps",
-                               "sources",
-                             ])
-      script = "//build/android/gyp/locale_pak_resources.py"
-      depfile = "$target_gen_dir/$target_name.d"
-
-      outputs = [
-        _resources_zip,
-      ]
-
-      _rebased_sources = rebase_path(sources, root_build_dir)
-      args = [
-        "--locale-paks=${_rebased_sources}",
-        "--resources-zip",
-        rebase_path(_resources_zip, root_build_dir),
-        "--depfile",
-        rebase_path(depfile, root_build_dir),
-      ]
-    }
-
-    group(target_name) {
-      public_deps = [
-        ":${target_name}__build_config",
-        ":${target_name}__create_resources_zip",
-      ]
-    }
-  }
-
   # Declare an Android resources target
   #
   # This creates a resources zip file that will be used when building an Android
@@ -1431,8 +1368,6 @@
   #   testonly: Marks this target as "test-only".
   #   write_asset_list: Adds an extra file to the assets, which contains a list of
   #     all other asset files.
-  #   alternative_locale_resource_dep: The locale resource target which overrides
-  #     any exsting locale resources in dep graph.
   #   requires_sdk_api_level_23: If defined and true, the apk is intended for
   #     installation only on Android M or later. In these releases the system
   #     linker does relocation unpacking, so we can enable it unconditionally.
@@ -1665,11 +1600,6 @@
         possible_config_deps = invoker.deps
       }
 
-      if (defined(invoker.alternative_locale_resource_dep)) {
-        possible_config_deps += [ invoker.alternative_locale_resource_dep ]
-        has_alternative_locale_resource = true
-      }
-
       # Added emma to the target's classpath via its .build_config.
       if (emma_coverage && !_emma_never_instrument) {
         possible_config_deps += [ "//third_party/android_tools:emma_device" ]
@@ -1720,9 +1650,6 @@
       if (defined(invoker.deps)) {
         deps += invoker.deps
       }
-      if (defined(invoker.alternative_locale_resource_dep)) {
-        deps += [ invoker.alternative_locale_resource_dep ]
-      }
     }
     _srcjar_deps += [ ":$process_resources_target" ]
 
@@ -1793,6 +1720,9 @@
         sources = [
           "//base/android/java/templates/BuildConfig.template",
         ]
+        deps = [
+          ":$build_config_target",
+        ]
 
         defines = []
         if (enable_multidex) {
@@ -1801,6 +1731,12 @@
         if (is_java_debug || dcheck_always_on) {
           defines += [ "_DCHECK_IS_ON" ]
         }
+        defines += [
+          "COMPRESSED_LOCALE_LIST=" +
+              "@FileArg($_rebased_build_config:compressed_locales_java_list)",
+          "UNCOMPRESSED_LOCALE_LIST=" +
+              "@FileArg($_rebased_build_config:uncompressed_locales_java_list)",
+        ]
       }
       _srcjar_deps += [ ":${_template_name}__build_config_java" ]
     }
diff --git a/build/config/features.gni b/build/config/features.gni
index dcaa5cf..304fafc 100644
--- a/build/config/features.gni
+++ b/build/config/features.gni
@@ -57,8 +57,6 @@
   # Android stores them separately on the Java side.
   enable_session_service = !is_android && !is_ios && !is_chromecast
 
-  enable_app_list = is_chromeos
-
   enable_supervised_users = !is_ios && !is_chromecast
 
   # Variable safe_browsing is used to control the build time configuration for
diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py
index 5263ccfc..d538f3d 100755
--- a/build/linux/sysroot_scripts/install-sysroot.py
+++ b/build/linux/sysroot_scripts/install-sysroot.py
@@ -38,39 +38,39 @@
 
 SYSROOTS = {
     ('Wheezy', 'amd64'): {
-        'Revision' : '76b5bff8f195819fe17b2e0f773d0a5b427c75f5',
+        'Revision' : 'e964581657e61f47a74b7e2e34e33744ac53d5a6',
         'Tarball' : 'debian_wheezy_amd64_sysroot.tgz',
-        'Sha1Sum' : '9fdebab9633a0337a5b0e6d1c01ab15e25a5dbc7',
+        'Sha1Sum' : 'd67377aedc8ca477a50cc75aeb59542c8cd98894',
         'SysrootDir' : 'debian_wheezy_amd64-sysroot'
     },
     ('Wheezy', 'arm'): {
-        'Revision' : '76b5bff8f195819fe17b2e0f773d0a5b427c75f5',
+        'Revision' : 'e964581657e61f47a74b7e2e34e33744ac53d5a6',
         'Tarball' : 'debian_wheezy_arm_sysroot.tgz',
-        'Sha1Sum' : '0abadf3af78ce18147426bd017933899bae3f0ad',
+        'Sha1Sum' : 'ab538d29171823951a330ba7f8ac1502f3670ebe',
         'SysrootDir' : 'debian_wheezy_arm-sysroot'
     },
     ('Wheezy', 'i386'): {
-        'Revision' : '76b5bff8f195819fe17b2e0f773d0a5b427c75f5',
+        'Revision' : 'e964581657e61f47a74b7e2e34e33744ac53d5a6',
         'Tarball' : 'debian_wheezy_i386_sysroot.tgz',
-        'Sha1Sum' : '970d5e7eb9c43f20f862690fc88577aacaada27e',
+        'Sha1Sum' : '8d7f58fc77be09cad83f246a5d730de45ac48efb',
         'SysrootDir' : 'debian_wheezy_i386-sysroot'
     },
     ('Wheezy', 'mips'): {
-        'Revision' : '76b5bff8f195819fe17b2e0f773d0a5b427c75f5',
+        'Revision' : 'e964581657e61f47a74b7e2e34e33744ac53d5a6',
         'Tarball' : 'debian_wheezy_mips_sysroot.tgz',
-        'Sha1Sum' : 'df5adf99d64a65eec7e93c4ea2bfec21aab3ae63',
+        'Sha1Sum' : '9960b7398487038709bdb8419c144ebee5eff061',
         'SysrootDir' : 'debian_wheezy_mips-sysroot'
     },
     ('Jessie', 'arm64'): {
-        'Revision' : '76b5bff8f195819fe17b2e0f773d0a5b427c75f5',
+        'Revision' : 'e964581657e61f47a74b7e2e34e33744ac53d5a6',
         'Tarball' : 'debian_jessie_arm64_sysroot.tgz',
-        'Sha1Sum' : 'a485259703842bf24c81b05e94f7d09e5dd3a8a2',
+        'Sha1Sum' : '035e6abf3bd8e6c5e8ce27cf62b6502cbffefe6b',
         'SysrootDir' : 'debian_jessie_arm64-sysroot'
     },
     ('Precise', 'amd64'): {
-        'Revision' : '76b5bff8f195819fe17b2e0f773d0a5b427c75f5',
+        'Revision' : 'e964581657e61f47a74b7e2e34e33744ac53d5a6',
         'Tarball' : 'ubuntu_precise_amd64_sysroot.tgz',
-        'Sha1Sum' : 'a3dba43c6be4410df7bd0e251fe7483936c62e32',
+        'Sha1Sum' : '9f13ac5b78027082ff7e7c34d55533dcb85a2c01',
         'SysrootDir' : 'ubuntu_precise_amd64-sysroot'
     }
 }
diff --git a/build/linux/sysroot_scripts/packagelist.jessie.amd64 b/build/linux/sysroot_scripts/packagelist.jessie.amd64
index 8a6c613..00e8031 100644
--- a/build/linux/sysroot_scripts/packagelist.jessie.amd64
+++ b/build/linux/sysroot_scripts/packagelist.jessie.amd64
@@ -133,10 +133,13 @@
 main/libx/libxtst/libxtst6_1.2.2-1+b1_amd64.deb
 main/libx/libxtst/libxtst-dev_1.2.2-1+b1_amd64.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.3-1+b1_amd64.deb
-main/l/linux/linux-libc-dev_3.16.36-1+deb8u1_amd64.deb
+main/l/linux/linux-libc-dev_3.16.7-ckt25-2_amd64.deb
+main/m/mesa/libegl1-mesa_10.3.2-1+deb8u1_amd64.deb
+main/m/mesa/libegl1-mesa-dev_10.3.2-1+deb8u1_amd64.deb
 main/m/mesa/libgl1-mesa-dev_10.3.2-1+deb8u1_amd64.deb
 main/m/mesa/libgl1-mesa-glx_10.3.2-1+deb8u1_amd64.deb
 main/m/mesa/libglapi-mesa_10.3.2-1+deb8u1_amd64.deb
+main/m/mesa/libwayland-egl1-mesa_10.3.2-1+deb8u1_amd64.deb
 main/m/mesa/mesa-common-dev_10.3.2-1+deb8u1_amd64.deb
 main/n/nspr/libnspr4_4.10.7-1+deb8u1_amd64.deb
 main/n/nspr/libnspr4-dev_4.10.7-1+deb8u1_amd64.deb
@@ -169,6 +172,10 @@
 main/s/speech-dispatcher/speech-dispatcher_0.8-7_amd64.deb
 main/s/systemd/libudev1_215-17+deb8u5_amd64.deb
 main/s/systemd/libudev-dev_215-17+deb8u5_amd64.deb
+main/w/wayland/libwayland-client0_1.6.0-2_amd64.deb
+main/w/wayland/libwayland-cursor0_1.6.0-2_amd64.deb
+main/w/wayland/libwayland-dev_1.6.0-2_amd64.deb
+main/w/wayland/libwayland-server0_1.6.0-2_amd64.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.26-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.jessie.arm b/build/linux/sysroot_scripts/packagelist.jessie.arm
index 6455073..a49b4787 100644
--- a/build/linux/sysroot_scripts/packagelist.jessie.arm
+++ b/build/linux/sysroot_scripts/packagelist.jessie.arm
@@ -130,10 +130,13 @@
 main/libx/libxtst/libxtst6_1.2.2-1+b1_armhf.deb
 main/libx/libxtst/libxtst-dev_1.2.2-1+b1_armhf.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.3-1+b1_armhf.deb
-main/l/linux/linux-libc-dev_3.16.36-1+deb8u1_armhf.deb
+main/l/linux/linux-libc-dev_3.16.7-ckt25-2_armhf.deb
+main/m/mesa/libegl1-mesa_10.3.2-1+deb8u1_armhf.deb
+main/m/mesa/libegl1-mesa-dev_10.3.2-1+deb8u1_armhf.deb
 main/m/mesa/libgl1-mesa-dev_10.3.2-1+deb8u1_armhf.deb
 main/m/mesa/libgl1-mesa-glx_10.3.2-1+deb8u1_armhf.deb
 main/m/mesa/libglapi-mesa_10.3.2-1+deb8u1_armhf.deb
+main/m/mesa/libwayland-egl1-mesa_10.3.2-1+deb8u1_armhf.deb
 main/m/mesa/mesa-common-dev_10.3.2-1+deb8u1_armhf.deb
 main/n/nspr/libnspr4_4.10.7-1+deb8u1_armhf.deb
 main/n/nspr/libnspr4-dev_4.10.7-1+deb8u1_armhf.deb
@@ -166,6 +169,10 @@
 main/s/speech-dispatcher/speech-dispatcher_0.8-7_armhf.deb
 main/s/systemd/libudev1_215-17+deb8u5_armhf.deb
 main/s/systemd/libudev-dev_215-17+deb8u5_armhf.deb
+main/w/wayland/libwayland-client0_1.6.0-2_armhf.deb
+main/w/wayland/libwayland-cursor0_1.6.0-2_armhf.deb
+main/w/wayland/libwayland-dev_1.6.0-2_armhf.deb
+main/w/wayland/libwayland-server0_1.6.0-2_armhf.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.26-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.jessie.arm64 b/build/linux/sysroot_scripts/packagelist.jessie.arm64
index e7a0a7b..ec3c1c1 100644
--- a/build/linux/sysroot_scripts/packagelist.jessie.arm64
+++ b/build/linux/sysroot_scripts/packagelist.jessie.arm64
@@ -130,10 +130,13 @@
 main/libx/libxtst/libxtst6_1.2.2-1+b1_arm64.deb
 main/libx/libxtst/libxtst-dev_1.2.2-1+b1_arm64.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.3-1+b1_arm64.deb
-main/l/linux/linux-libc-dev_3.16.36-1+deb8u1_arm64.deb
+main/l/linux/linux-libc-dev_3.16.7-ckt25-2_arm64.deb
+main/m/mesa/libegl1-mesa_10.3.2-1+deb8u1_arm64.deb
+main/m/mesa/libegl1-mesa-dev_10.3.2-1+deb8u1_arm64.deb
 main/m/mesa/libgl1-mesa-dev_10.3.2-1+deb8u1_arm64.deb
 main/m/mesa/libgl1-mesa-glx_10.3.2-1+deb8u1_arm64.deb
 main/m/mesa/libglapi-mesa_10.3.2-1+deb8u1_arm64.deb
+main/m/mesa/libwayland-egl1-mesa_10.3.2-1+deb8u1_arm64.deb
 main/m/mesa/mesa-common-dev_10.3.2-1+deb8u1_arm64.deb
 main/n/nettle/libhogweed2_2.7.1-5+deb8u1_arm64.deb
 main/n/nettle/libnettle4_2.7.1-5+deb8u1_arm64.deb
@@ -168,6 +171,10 @@
 main/s/speech-dispatcher/speech-dispatcher_0.8-7_arm64.deb
 main/s/systemd/libudev1_215-17+deb8u5_arm64.deb
 main/s/systemd/libudev-dev_215-17+deb8u5_arm64.deb
+main/w/wayland/libwayland-client0_1.6.0-2_arm64.deb
+main/w/wayland/libwayland-cursor0_1.6.0-2_arm64.deb
+main/w/wayland/libwayland-dev_1.6.0-2_arm64.deb
+main/w/wayland/libwayland-server0_1.6.0-2_arm64.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.26-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.jessie.i386 b/build/linux/sysroot_scripts/packagelist.jessie.i386
index 1e9bc34..291ff03 100644
--- a/build/linux/sysroot_scripts/packagelist.jessie.i386
+++ b/build/linux/sysroot_scripts/packagelist.jessie.i386
@@ -131,10 +131,13 @@
 main/libx/libxtst/libxtst6_1.2.2-1+b1_i386.deb
 main/libx/libxtst/libxtst-dev_1.2.2-1+b1_i386.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.3-1+b1_i386.deb
-main/l/linux/linux-libc-dev_3.16.36-1+deb8u1_i386.deb
+main/l/linux/linux-libc-dev_3.16.7-ckt25-2_i386.deb
+main/m/mesa/libegl1-mesa_10.3.2-1+deb8u1_i386.deb
+main/m/mesa/libegl1-mesa-dev_10.3.2-1+deb8u1_i386.deb
 main/m/mesa/libgl1-mesa-dev_10.3.2-1+deb8u1_i386.deb
 main/m/mesa/libgl1-mesa-glx_10.3.2-1+deb8u1_i386.deb
 main/m/mesa/libglapi-mesa_10.3.2-1+deb8u1_i386.deb
+main/m/mesa/libwayland-egl1-mesa_10.3.2-1+deb8u1_i386.deb
 main/m/mesa/mesa-common-dev_10.3.2-1+deb8u1_i386.deb
 main/n/nspr/libnspr4_4.10.7-1+deb8u1_i386.deb
 main/n/nspr/libnspr4-dev_4.10.7-1+deb8u1_i386.deb
@@ -167,6 +170,10 @@
 main/s/speech-dispatcher/speech-dispatcher_0.8-7_i386.deb
 main/s/systemd/libudev1_215-17+deb8u5_i386.deb
 main/s/systemd/libudev-dev_215-17+deb8u5_i386.deb
+main/w/wayland/libwayland-client0_1.6.0-2_i386.deb
+main/w/wayland/libwayland-cursor0_1.6.0-2_i386.deb
+main/w/wayland/libwayland-dev_1.6.0-2_i386.deb
+main/w/wayland/libwayland-server0_1.6.0-2_i386.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.26-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.jessie.mipsel b/build/linux/sysroot_scripts/packagelist.jessie.mipsel
index 220618c4..1cd4d5d3 100644
--- a/build/linux/sysroot_scripts/packagelist.jessie.mipsel
+++ b/build/linux/sysroot_scripts/packagelist.jessie.mipsel
@@ -125,10 +125,13 @@
 main/libx/libxtst/libxtst6_1.2.2-1+b1_mipsel.deb
 main/libx/libxtst/libxtst-dev_1.2.2-1+b1_mipsel.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.3-1+b1_mipsel.deb
-main/l/linux/linux-libc-dev_3.16.36-1+deb8u1_mipsel.deb
+main/l/linux/linux-libc-dev_3.16.7-ckt25-2_mipsel.deb
+main/m/mesa/libegl1-mesa_10.3.2-1+deb8u1_mipsel.deb
+main/m/mesa/libegl1-mesa-dev_10.3.2-1+deb8u1_mipsel.deb
 main/m/mesa/libgl1-mesa-dev_10.3.2-1+deb8u1_mipsel.deb
 main/m/mesa/libgl1-mesa-glx_10.3.2-1+deb8u1_mipsel.deb
 main/m/mesa/libglapi-mesa_10.3.2-1+deb8u1_mipsel.deb
+main/m/mesa/libwayland-egl1-mesa_10.3.2-1+deb8u1_mipsel.deb
 main/m/mesa/mesa-common-dev_10.3.2-1+deb8u1_mipsel.deb
 main/n/nspr/libnspr4_4.10.7-1+deb8u1_mipsel.deb
 main/n/nspr/libnspr4-dev_4.10.7-1+deb8u1_mipsel.deb
@@ -161,6 +164,10 @@
 main/s/speech-dispatcher/speech-dispatcher_0.8-7_mipsel.deb
 main/s/systemd/libudev1_215-17+deb8u5_mipsel.deb
 main/s/systemd/libudev-dev_215-17+deb8u5_mipsel.deb
+main/w/wayland/libwayland-client0_1.6.0-2_mipsel.deb
+main/w/wayland/libwayland-cursor0_1.6.0-2_mipsel.deb
+main/w/wayland/libwayland-dev_1.6.0-2_mipsel.deb
+main/w/wayland/libwayland-server0_1.6.0-2_mipsel.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.26-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.precise.amd64 b/build/linux/sysroot_scripts/packagelist.precise.amd64
index 82f9dca..82b95cc 100644
--- a/build/linux/sysroot_scripts/packagelist.precise.amd64
+++ b/build/linux/sysroot_scripts/packagelist.precise.amd64
@@ -124,6 +124,9 @@
 main/libx/libxtst/libxtst-dev_1.2.0-4ubuntu0.1_amd64.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.1-2ubuntu0.1_amd64.deb
 main/l/linux/linux-libc-dev_3.2.0-111.153_amd64.deb
+main/m/mesa/libegl1-mesa_8.0.4-0ubuntu0.7_amd64.deb
+main/m/mesa/libegl1-mesa-dev_8.0.4-0ubuntu0.7_amd64.deb
+main/m/mesa/libegl1-mesa-drivers_8.0.4-0ubuntu0.7_amd64.deb
 main/m/mesa/libgl1-mesa-dev_8.0.4-0ubuntu0.7_amd64.deb
 main/m/mesa/libgl1-mesa-glx_8.0.4-0ubuntu0.7_amd64.deb
 main/m/mesa/libglapi-mesa_8.0.4-0ubuntu0.7_amd64.deb
@@ -153,6 +156,8 @@
 main/s/speech-dispatcher/libspeechd2_0.7.1-6ubuntu3_amd64.deb
 main/s/speech-dispatcher/libspeechd-dev_0.7.1-6ubuntu3_amd64.deb
 main/s/speech-dispatcher/speech-dispatcher_0.7.1-6ubuntu3_amd64.deb
+main/w/wayland/libwayland0_0.85.0-1ubuntu2_amd64.deb
+main/w/wayland/libwayland-dev_0.85.0-1ubuntu2_amd64.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.22-1ubuntu0.2_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.wheezy.amd64 b/build/linux/sysroot_scripts/packagelist.wheezy.amd64
index e46c7fe..f1b923e 100644
--- a/build/linux/sysroot_scripts/packagelist.wheezy.amd64
+++ b/build/linux/sysroot_scripts/packagelist.wheezy.amd64
@@ -124,6 +124,9 @@
 main/libx/libxtst/libxtst-dev_1.2.1-1+deb7u1_amd64.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.2-1+deb7u1_amd64.deb
 main/l/linux/linux-libc-dev_3.2.78-1_amd64.deb
+main/m/mesa/libegl1-mesa_8.0.5-4+deb7u2_amd64.deb
+main/m/mesa/libegl1-mesa-dev_8.0.5-4+deb7u2_amd64.deb
+main/m/mesa/libegl1-mesa-drivers_8.0.5-4+deb7u2_amd64.deb
 main/m/mesa/libgl1-mesa-dev_8.0.5-4+deb7u2_amd64.deb
 main/m/mesa/libgl1-mesa-glx_8.0.5-4+deb7u2_amd64.deb
 main/m/mesa/libglapi-mesa_8.0.5-4+deb7u2_amd64.deb
@@ -155,6 +158,8 @@
 main/s/speech-dispatcher/speech-dispatcher_0.7.1-6.2_amd64.deb
 main/u/udev/libudev0_175-7.2_amd64.deb
 main/u/udev/libudev-dev_175-7.2_amd64.deb
+main/w/wayland/libwayland0_0.85.0-2_amd64.deb
+main/w/wayland/libwayland-dev_0.85.0-2_amd64.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.23-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.wheezy.arm b/build/linux/sysroot_scripts/packagelist.wheezy.arm
index ae91267..33a63f8 100644
--- a/build/linux/sysroot_scripts/packagelist.wheezy.arm
+++ b/build/linux/sysroot_scripts/packagelist.wheezy.arm
@@ -123,6 +123,9 @@
 main/libx/libxtst/libxtst-dev_1.2.1-1+deb7u1_armhf.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.2-1+deb7u1_armhf.deb
 main/l/linux/linux-libc-dev_3.2.78-1_armhf.deb
+main/m/mesa/libegl1-mesa_8.0.5-4+deb7u2_armhf.deb
+main/m/mesa/libegl1-mesa-dev_8.0.5-4+deb7u2_armhf.deb
+main/m/mesa/libegl1-mesa-drivers_8.0.5-4+deb7u2_armhf.deb
 main/m/mesa/libgl1-mesa-dev_8.0.5-4+deb7u2_armhf.deb
 main/m/mesa/libgl1-mesa-glx_8.0.5-4+deb7u2_armhf.deb
 main/m/mesa/libglapi-mesa_8.0.5-4+deb7u2_armhf.deb
@@ -154,6 +157,8 @@
 main/s/speech-dispatcher/speech-dispatcher_0.7.1-6.2_armhf.deb
 main/u/udev/libudev0_175-7.2_armhf.deb
 main/u/udev/libudev-dev_175-7.2_armhf.deb
+main/w/wayland/libwayland0_0.85.0-2_armhf.deb
+main/w/wayland/libwayland-dev_0.85.0-2_armhf.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.23-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.wheezy.i386 b/build/linux/sysroot_scripts/packagelist.wheezy.i386
index 8e4b308..9c849d9c 100644
--- a/build/linux/sysroot_scripts/packagelist.wheezy.i386
+++ b/build/linux/sysroot_scripts/packagelist.wheezy.i386
@@ -124,6 +124,9 @@
 main/libx/libxtst/libxtst-dev_1.2.1-1+deb7u1_i386.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.2-1+deb7u1_i386.deb
 main/l/linux/linux-libc-dev_3.2.78-1_i386.deb
+main/m/mesa/libegl1-mesa_8.0.5-4+deb7u2_i386.deb
+main/m/mesa/libegl1-mesa-dev_8.0.5-4+deb7u2_i386.deb
+main/m/mesa/libegl1-mesa-drivers_8.0.5-4+deb7u2_i386.deb
 main/m/mesa/libgl1-mesa-dev_8.0.5-4+deb7u2_i386.deb
 main/m/mesa/libgl1-mesa-glx_8.0.5-4+deb7u2_i386.deb
 main/m/mesa/libglapi-mesa_8.0.5-4+deb7u2_i386.deb
@@ -155,6 +158,8 @@
 main/s/speech-dispatcher/speech-dispatcher_0.7.1-6.2_i386.deb
 main/u/udev/libudev0_175-7.2_i386.deb
 main/u/udev/libudev-dev_175-7.2_i386.deb
+main/w/wayland/libwayland0_0.85.0-2_i386.deb
+main/w/wayland/libwayland-dev_0.85.0-2_i386.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.23-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/packagelist.wheezy.mipsel b/build/linux/sysroot_scripts/packagelist.wheezy.mipsel
index 2282ca5..23da9374 100644
--- a/build/linux/sysroot_scripts/packagelist.wheezy.mipsel
+++ b/build/linux/sysroot_scripts/packagelist.wheezy.mipsel
@@ -122,6 +122,9 @@
 main/libx/libxtst/libxtst-dev_1.2.1-1+deb7u1_mipsel.deb
 main/libx/libxxf86vm/libxxf86vm1_1.1.2-1+deb7u1_mipsel.deb
 main/l/linux/linux-libc-dev_3.2.78-1_mipsel.deb
+main/m/mesa/libegl1-mesa_8.0.5-4+deb7u2_mipsel.deb
+main/m/mesa/libegl1-mesa-dev_8.0.5-4+deb7u2_mipsel.deb
+main/m/mesa/libegl1-mesa-drivers_8.0.5-4+deb7u2_mipsel.deb
 main/m/mesa/libgl1-mesa-dev_8.0.5-4+deb7u2_mipsel.deb
 main/m/mesa/libgl1-mesa-glx_8.0.5-4+deb7u2_mipsel.deb
 main/m/mesa/libglapi-mesa_8.0.5-4+deb7u2_mipsel.deb
@@ -153,6 +156,8 @@
 main/s/speech-dispatcher/speech-dispatcher_0.7.1-6.2_mipsel.deb
 main/u/udev/libudev0_175-7.2_mipsel.deb
 main/u/udev/libudev-dev_175-7.2_mipsel.deb
+main/w/wayland/libwayland0_0.85.0-2_mipsel.deb
+main/w/wayland/libwayland-dev_0.85.0-2_mipsel.deb
 main/x/x11proto-composite/x11proto-composite-dev_0.4.2-2_all.deb
 main/x/x11proto-core/x11proto-core-dev_7.0.23-1_all.deb
 main/x/x11proto-damage/x11proto-damage-dev_1.2.1-2_all.deb
diff --git a/build/linux/sysroot_scripts/sysroot-creator-jessie.sh b/build/linux/sysroot_scripts/sysroot-creator-jessie.sh
index 8685c47..50be019 100755
--- a/build/linux/sysroot_scripts/sysroot-creator-jessie.sh
+++ b/build/linux/sysroot_scripts/sysroot-creator-jessie.sh
@@ -59,6 +59,8 @@
   libdrm-dev
   libdrm-nouveau2
   libdrm-radeon1
+  libegl1-mesa
+  libegl1-mesa-dev
   libelf1
   libelf-dev
   libexpat1
@@ -148,6 +150,11 @@
   libtasn1-6
   libudev-dev
   libudev1
+  libwayland-client0
+  libwayland-cursor0
+  libwayland-dev
+  libwayland-egl1-mesa
+  libwayland-server0
   libx11-6
   libx11-dev
   libx11-xcb1
diff --git a/build/linux/sysroot_scripts/sysroot-creator-precise.sh b/build/linux/sysroot_scripts/sysroot-creator-precise.sh
index 7c92047..06da64ba 100755
--- a/build/linux/sysroot_scripts/sysroot-creator-precise.sh
+++ b/build/linux/sysroot_scripts/sysroot-creator-precise.sh
@@ -56,6 +56,9 @@
   libdrm-nouveau2
   libdrm-radeon1
   libdrm2
+  libegl1-mesa
+  libegl1-mesa-dev
+  libegl1-mesa-drivers
   libelf1
   libelf-dev
   libexpat1
@@ -134,6 +137,8 @@
   libstdc++6
   libstdc++6-4.6-dev
   libtasn1-3
+  libwayland0
+  libwayland-dev
   libx11-6
   libx11-dev
   libx11-xcb1
diff --git a/build/linux/sysroot_scripts/sysroot-creator-wheezy.sh b/build/linux/sysroot_scripts/sysroot-creator-wheezy.sh
index c0ddc5a..919e52d 100755
--- a/build/linux/sysroot_scripts/sysroot-creator-wheezy.sh
+++ b/build/linux/sysroot_scripts/sysroot-creator-wheezy.sh
@@ -53,6 +53,9 @@
   libdrm-dev
   libdrm-nouveau1a
   libdrm-radeon1
+  libegl1-mesa
+  libegl1-mesa-dev
+  libegl1-mesa-drivers
   libelf1
   libelf-dev
   libexpat1
@@ -133,6 +136,8 @@
   libtasn1-3
   libudev-dev
   libudev0
+  libwayland0
+  libwayland-dev
   libx11-6
   libx11-dev
   libx11-xcb1
diff --git a/build/win/syzygy/OWNERS b/build/win/syzygy/OWNERS
index eb5a1c7..6d61b635 100644
--- a/build/win/syzygy/OWNERS
+++ b/build/win/syzygy/OWNERS
@@ -1,3 +1,3 @@
 chrisha@chromium.org
-sebmarchand@chromiun.org
+sebmarchand@chromium.org
 siggi@chromium.org
diff --git a/cc/blimp/layer_tree_host_remote.cc b/cc/blimp/layer_tree_host_remote.cc
index 6ce9710..df457b7 100644
--- a/cc/blimp/layer_tree_host_remote.cc
+++ b/cc/blimp/layer_tree_host_remote.cc
@@ -185,12 +185,6 @@
                << " does not support single-thread since it is out of process";
 }
 
-void LayerTreeHostRemote::SetNeedsRedraw() {
-  // The engine shouldn't need to care about draws. CompositorFrames are never
-  // used here.
-  NOTREACHED();
-}
-
 void LayerTreeHostRemote::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
   // The engine shouldn't need to care about draws. CompositorFrames are never
   // used here.
diff --git a/cc/blimp/layer_tree_host_remote.h b/cc/blimp/layer_tree_host_remote.h
index 37420a8..347ffb1 100644
--- a/cc/blimp/layer_tree_host_remote.h
+++ b/cc/blimp/layer_tree_host_remote.h
@@ -75,7 +75,6 @@
   void SetDeferCommits(bool defer_commits) override;
   void LayoutAndUpdateLayers() override;
   void Composite(base::TimeTicks frame_begin_time) override;
-  void SetNeedsRedraw() override;
   void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
   void SetNextCommitForcesRedraw() override;
   void NotifyInputThrottledUntilCommit() override;
diff --git a/cc/debug/devtools_instrumentation.h b/cc/debug/devtools_instrumentation.h
index 127c9a9..9195a31 100644
--- a/cc/debug/devtools_instrumentation.h
+++ b/cc/debug/devtools_instrumentation.h
@@ -10,6 +10,7 @@
 #include <memory>
 
 #include "base/macros.h"
+#include "base/metrics/histogram_macros.h"
 #include "base/trace_event/trace_event.h"
 #include "base/trace_event/trace_event_argument.h"
 
@@ -57,15 +58,32 @@
 
 class ScopedImageDecodeTask {
  public:
-  explicit ScopedImageDecodeTask(const void* imagePtr) {
+  enum Type { SOFTWARE, GPU };
+
+  ScopedImageDecodeTask(const void* imagePtr, Type type)
+      : type_(type), start_time_(base::TimeTicks::Now()) {
     TRACE_EVENT_BEGIN1(internal::kCategory, internal::kImageDecodeTask,
                        internal::kPixelRefId,
                        reinterpret_cast<uint64_t>(imagePtr));
   }
   ~ScopedImageDecodeTask() {
     TRACE_EVENT_END0(internal::kCategory, internal::kImageDecodeTask);
+    base::TimeDelta duration = base::TimeTicks::Now() - start_time_;
+    switch (type_) {
+      case SOFTWARE:
+        UMA_HISTOGRAM_COUNTS_1M("Renderer4.ImageDecodeTaskDurationUs.Software",
+                                duration.InMicroseconds());
+        break;
+      case GPU:
+        UMA_HISTOGRAM_COUNTS_1M("Renderer4.ImageDecodeTaskDurationUs.Gpu",
+                                duration.InMicroseconds());
+        break;
+    }
   }
+
  private:
+  const Type type_;
+  const base::TimeTicks start_time_;
   DISALLOW_COPY_AND_ASSIGN(ScopedImageDecodeTask);
 };
 
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h
index c104564..4b6c1121 100644
--- a/cc/output/output_surface.h
+++ b/cc/output/output_surface.h
@@ -118,10 +118,9 @@
   // when the framebuffer is bound via BindFramebuffer().
   virtual uint32_t GetFramebufferCopyTextureFormat() = 0;
 
-  // The implementation may destroy or steal the contents of the CompositorFrame
-  // passed in (though it will not take ownership of the CompositorFrame
-  // itself). For successful swaps, the implementation must call
-  // OutputSurfaceClient::DidSwapBuffersComplete() eventually.
+  // Swaps the current backbuffer to the screen. For successful swaps, the
+  // implementation must call OutputSurfaceClient::DidReceiveSwapBuffersAck()
+  // after returning from this method in order to unblock the next frame.
   virtual void SwapBuffers(OutputSurfaceFrame frame) = 0;
 
  protected:
diff --git a/cc/output/output_surface_client.h b/cc/output/output_surface_client.h
index cd91919e..4fe6b64 100644
--- a/cc/output/output_surface_client.h
+++ b/cc/output/output_surface_client.h
@@ -25,51 +25,22 @@
 
 class CC_EXPORT OutputSurfaceClient {
  public:
-  // ============== DISPLAY COMPOSITOR ONLY =======================
+  // A notification that the swap of the backbuffer to the hardware is complete
+  // and is now visible to the user.
+  virtual void DidReceiveSwapBuffersAck() = 0;
 
-  // From surfaceless/ozone browser compositor output surface.
+  // The OutputSurface is lost when the ContextProviders held by it
+  // encounter an error. In this case the OutputSurface (and the
+  // ContextProviders) must be recreated.
+  virtual void DidLoseOutputSurface() = 0;
+
+  // For surfaceless/ozone implementations to create damage for the next frame.
   virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0;
+
   // For overlays.
   virtual void DidReceiveTextureInUseResponses(
       const gpu::TextureInUseResponses& responses) = 0;
 
-  // ============== LAYER TREE COMPOSITOR ONLY ====================
-
-  // Pass the begin frame source for the client to observe.  Client does not own
-  // the BeginFrameSource.  OutputSurface should call this once after binding to
-  // the client and then call again with a null while detaching.
-  virtual void SetBeginFrameSource(BeginFrameSource* source) = 0;
-  virtual void ReclaimResources(const ReturnedResourceArray& resources) = 0;
-  // For WebView.
-  virtual void SetExternalTilePriorityConstraints(
-      const gfx::Rect& viewport_rect,
-      const gfx::Transform& transform) = 0;
-  // If set, |callback| will be called subsequent to each new tree activation,
-  // regardless of the compositor visibility or damage. |callback| must remain
-  // valid for the lifetime of the OutputSurfaceClient or until unregisted --
-  // use SetTreeActivationCallback(base::Closure()) to unregister it.
-  virtual void SetTreeActivationCallback(const base::Closure& callback) = 0;
-  // This allows the output surface to ask its client for a draw.
-  virtual void OnDraw(const gfx::Transform& transform,
-                      const gfx::Rect& viewport,
-                      bool resourceless_software_draw) = 0;
-  // For SynchronousCompositor (WebView) to set how much memory the compositor
-  // can use without changing visibility.
-  virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) = 0;
-
-  // ============== BOTH TYPES OF COMPOSITOR ======================
-
-  // For LayerTreeHostImpl, this is more of a OnSwapBuffersAck from the display
-  // compositor that it received and will use the frame, unblocking it from
-  // producing more frames.
-  // For the display compositor this is literally a notification that the swap
-  // to the hardware is complete.
-  virtual void DidSwapBuffersComplete() = 0;
-
-  // Needs thought, if LTHI has only context providers, it needs to register a
-  // lost callback, so we need to support multiple callbacks.
-  virtual void DidLoseOutputSurface() = 0;
-
  protected:
   virtual ~OutputSurfaceClient() {}
 };
diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc
index 053f75d..2c40578 100644
--- a/cc/output/output_surface_unittest.cc
+++ b/cc/output/output_surface_unittest.cc
@@ -36,7 +36,7 @@
                const gfx::ColorSpace& color_space,
                bool has_alpha) override {}
   void SwapBuffers(OutputSurfaceFrame frame) override {
-    client_->DidSwapBuffersComplete();
+    client_->DidReceiveSwapBuffersAck();
   }
   uint32_t GetFramebufferCopyTextureFormat() override {
     // TestContextProvider has no real framebuffer, just use RGB.
@@ -51,7 +51,9 @@
   bool HasExternalStencilTest() const override { return false; }
   void ApplyExternalStencil() override {}
 
-  void OnSwapBuffersCompleteForTesting() { client_->DidSwapBuffersComplete(); }
+  void OnSwapBuffersCompleteForTesting() {
+    client_->DidReceiveSwapBuffersAck();
+  }
 
  protected:
 };
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc
index bb265e4d..01c14e0 100644
--- a/cc/output/overlay_unittest.cc
+++ b/cc/output/overlay_unittest.cc
@@ -181,7 +181,7 @@
   unsigned GetOverlayTextureId() const override { return 10000; }
   bool SurfaceIsSuspendForRecycle() const override { return false; }
 
-  void OnSwapBuffersComplete() { client_->DidSwapBuffersComplete(); }
+  void OnSwapBuffersComplete() { client_->DidReceiveSwapBuffersAck(); }
 
   void set_is_displayed_as_overlay_plane(bool value) {
     is_displayed_as_overlay_plane_ = value;
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 9e18e88..14d5e69 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -317,9 +317,11 @@
   // before the missed frame task runs.
   missed_begin_frame_task_.Cancel();
 
+  base::TimeTicks now = Now();
+
   // Discard missed begin frames if they are too late.
   if (adjusted_args.type == BeginFrameArgs::MISSED &&
-      Now() > adjusted_args.deadline) {
+      now > adjusted_args.deadline) {
     begin_frame_source_->DidFinishFrame(this, 0);
     return;
   }
@@ -379,7 +381,7 @@
 
   bool can_activate_before_deadline =
       CanBeginMainFrameAndActivateBeforeDeadline(adjusted_args,
-                                                 bmf_to_activate_estimate);
+                                                 bmf_to_activate_estimate, now);
 
   if (ShouldRecoverMainLatency(adjusted_args, can_activate_before_deadline)) {
     TRACE_EVENT_INSTANT0("cc", "SkipBeginMainFrameToReduceLatency",
@@ -739,11 +741,11 @@
 
 bool Scheduler::CanBeginMainFrameAndActivateBeforeDeadline(
     const BeginFrameArgs& args,
-    base::TimeDelta bmf_to_activate_estimate) const {
+    base::TimeDelta bmf_to_activate_estimate,
+    base::TimeTicks now) const {
   // Check if the main thread computation and commit can be finished before the
   // impl thread's deadline.
-  base::TimeTicks estimated_draw_time =
-      args.frame_time + bmf_to_activate_estimate;
+  base::TimeTicks estimated_draw_time = now + bmf_to_activate_estimate;
 
   return estimated_draw_time < args.deadline;
 }
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 856e212b..afc2247 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -188,7 +188,8 @@
                                 bool can_activate_before_deadline) const;
   bool CanBeginMainFrameAndActivateBeforeDeadline(
       const BeginFrameArgs& args,
-      base::TimeDelta bmf_to_activate_estimate) const;
+      base::TimeDelta bmf_to_activate_estimate,
+      base::TimeTicks now) const;
   void AdvanceCommitStateIfPossible();
   bool IsBeginMainFrameSentOrStarted() const;
   void BeginImplFrameWithDeadline(const BeginFrameArgs& args);
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 14796e6..ace12c6 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -415,6 +415,7 @@
     return fake_external_begin_frame_source_.get();
   }
 
+  void AdvanceAndMissOneFrame();
   void CheckMainFrameSkippedAfterLateCommit(bool expect_send_begin_main_frame);
   void ImplFrameSkippedAfterLateAck(bool receive_ack_before_deadline);
   void ImplFrameNotSkippedAfterLateAck();
@@ -1282,8 +1283,7 @@
   EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 2, 3);
 }
 
-void SchedulerTest::CheckMainFrameSkippedAfterLateCommit(
-    bool expect_send_begin_main_frame) {
+void SchedulerTest::AdvanceAndMissOneFrame() {
   // Impl thread hits deadline before commit finishes.
   scheduler_->SetNeedsBeginMainFrame();
   EXPECT_FALSE(scheduler_->MainThreadMissedLastDeadline());
@@ -1300,8 +1300,13 @@
   EXPECT_ACTION("ScheduledActionCommit", client_, 3, 5);
   EXPECT_ACTION("ScheduledActionActivateSyncTree", client_, 4, 5);
   EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
-
   client_->Reset();
+}
+
+void SchedulerTest::CheckMainFrameSkippedAfterLateCommit(
+    bool expect_send_begin_main_frame) {
+  AdvanceAndMissOneFrame();
+
   scheduler_->SetNeedsBeginMainFrame();
   EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
   EXPECT_SCOPED(AdvanceFrame());
@@ -1314,6 +1319,33 @@
             client_->HasAction("ScheduledActionSendBeginMainFrame"));
 }
 
+TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateBeginFrame) {
+  // If a begin frame is delivered extremely late (because the browser has
+  // some contention), make sure that the main frame is not skipped even
+  // if it can activate before the deadline.
+  SetUpScheduler(EXTERNAL_BFS);
+  fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
+
+  AdvanceAndMissOneFrame();
+  EXPECT_TRUE(scheduler_->MainThreadMissedLastDeadline());
+  scheduler_->SetNeedsBeginMainFrame();
+
+  // Advance frame and create a begin frame.
+  now_src_->Advance(BeginFrameArgs::DefaultInterval());
+  BeginFrameArgs args =
+      CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, now_src());
+
+  // Deliver this begin frame super late.
+  now_src_->Advance(BeginFrameArgs::DefaultInterval() * 100);
+  fake_external_begin_frame_source_->TestOnBeginFrame(args);
+
+  task_runner().RunTasksWhile(client_->InsideBeginImplFrame(true));
+  EXPECT_EQ(true, scheduler_->MainThreadMissedLastDeadline());
+  EXPECT_ACTION("WillBeginImplFrame", client_, 0, 3);
+  EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 3);
+  EXPECT_ACTION("ScheduledActionDrawIfPossible", client_, 2, 3);
+}
+
 TEST_F(SchedulerTest, MainFrameSkippedAfterLateCommit) {
   SetUpScheduler(EXTERNAL_BFS);
   fake_compositor_timing_history_->SetAllEstimatesTo(kFastDuration);
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index 1b2b36a..3550a39e 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -330,7 +330,7 @@
                                 frame.metadata.latency_info.end());
     if (scheduler_) {
       scheduler_->DidSwapBuffers();
-      scheduler_->DidSwapBuffersComplete();
+      scheduler_->DidReceiveSwapBuffersAck();
     }
   }
 
@@ -338,9 +338,9 @@
   return true;
 }
 
-void Display::DidSwapBuffersComplete() {
+void Display::DidReceiveSwapBuffersAck() {
   if (scheduler_)
-    scheduler_->DidSwapBuffersComplete();
+    scheduler_->DidReceiveSwapBuffersAck();
   if (renderer_)
     renderer_->SwapBuffersComplete();
 }
@@ -351,43 +351,12 @@
     renderer_->DidReceiveTextureInUseResponses(responses);
 }
 
-void Display::SetBeginFrameSource(BeginFrameSource* source) {
-  // The BeginFrameSource is set from the constructor, it doesn't come
-  // from the OutputSurface for the Display.
-  NOTREACHED();
-}
-
-void Display::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
-  // This is only for LayerTreeHostImpl.
-  NOTREACHED();
-}
-
-void Display::OnDraw(const gfx::Transform& transform,
-                     const gfx::Rect& viewport,
-                     bool resourceless_software_draw) {
-  NOTREACHED();
-}
-
 void Display::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
   aggregator_->SetFullDamageForSurface(current_surface_id_);
   if (scheduler_)
     scheduler_->SurfaceDamaged(current_surface_id_);
 }
 
-void Display::ReclaimResources(const ReturnedResourceArray& resources) {
-  NOTREACHED();
-}
-
-void Display::SetExternalTilePriorityConstraints(
-    const gfx::Rect& viewport_rect,
-    const gfx::Transform& transform) {
-  NOTREACHED();
-}
-
-void Display::SetTreeActivationCallback(const base::Closure& callback) {
-  NOTREACHED();
-}
-
 void Display::OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) {
   if (aggregator_ &&
       aggregator_->previous_contained_surfaces().count(surface_id)) {
diff --git a/cc/surfaces/display.h b/cc/surfaces/display.h
index 40973fc..fd847f4 100644
--- a/cc/surfaces/display.h
+++ b/cc/surfaces/display.h
@@ -83,21 +83,11 @@
   bool DrawAndSwap() override;
 
   // OutputSurfaceClient implementation.
-  void SetBeginFrameSource(BeginFrameSource* source) override;
   void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
-  void DidSwapBuffersComplete() override;
+  void DidReceiveSwapBuffersAck() override;
   void DidReceiveTextureInUseResponses(
       const gpu::TextureInUseResponses& responses) override;
-  void ReclaimResources(const ReturnedResourceArray& resources) override;
   void DidLoseOutputSurface() override;
-  void SetExternalTilePriorityConstraints(
-      const gfx::Rect& viewport_rect,
-      const gfx::Transform& transform) override;
-  void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
-  void SetTreeActivationCallback(const base::Closure& callback) override;
-  void OnDraw(const gfx::Transform& transform,
-              const gfx::Rect& viewport,
-              bool resourceless_software_draw) override;
 
   // SurfaceObserver implementation.
   void OnSurfaceDamaged(const SurfaceId& surface, bool* changed) override;
diff --git a/cc/surfaces/display_scheduler.cc b/cc/surfaces/display_scheduler.cc
index 6a5e1632d..229bc630 100644
--- a/cc/surfaces/display_scheduler.cc
+++ b/cc/surfaces/display_scheduler.cc
@@ -360,7 +360,7 @@
                            "pending_frames", pending_swaps_);
 }
 
-void DisplayScheduler::DidSwapBuffersComplete() {
+void DisplayScheduler::DidReceiveSwapBuffersAck() {
   pending_swaps_--;
   TRACE_EVENT_ASYNC_END1("cc", "DisplayScheduler:pending_swaps", this,
                          "pending_frames", pending_swaps_);
diff --git a/cc/surfaces/display_scheduler.h b/cc/surfaces/display_scheduler.h
index 8ad9145..a6a7b467d 100644
--- a/cc/surfaces/display_scheduler.h
+++ b/cc/surfaces/display_scheduler.h
@@ -45,7 +45,7 @@
   virtual void SurfaceDamaged(const SurfaceId& surface_id);
 
   virtual void DidSwapBuffers();
-  void DidSwapBuffersComplete();
+  void DidReceiveSwapBuffersAck();
 
   void OutputSurfaceLost();
 
diff --git a/cc/surfaces/display_scheduler_unittest.cc b/cc/surfaces/display_scheduler_unittest.cc
index d7a78df..1a5cbe4 100644
--- a/cc/surfaces/display_scheduler_unittest.cc
+++ b/cc/surfaces/display_scheduler_unittest.cc
@@ -478,7 +478,7 @@
   base::TimeTicks expected_deadline =
       scheduler_.LastUsedBeginFrameArgs().deadline -
       BeginFrameArgs::DefaultEstimatedParentDrawTime();
-  scheduler_.DidSwapBuffersComplete();
+  scheduler_.DidReceiveSwapBuffersAck();
   BeginFrameForTest();
   EXPECT_EQ(expected_deadline,
             scheduler_.DesiredBeginFrameDeadlineTimeForTest());
@@ -529,7 +529,7 @@
   BeginFrameForTest();
   EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count());
 
-  scheduler_.DidSwapBuffersComplete();
+  scheduler_.DidReceiveSwapBuffersAck();
   EXPECT_EQ(++count, scheduler_.scheduler_begin_frame_deadline_count());
 
   scheduler_.DisplayResized();
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc
index 757c28d..362c59d 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -53,12 +53,12 @@
   }
 
   base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::Bind(&FakeOutputSurface::SwapBuffersCallback,
+      FROM_HERE, base::Bind(&FakeOutputSurface::SwapBuffersAck,
                             weak_ptr_factory_.GetWeakPtr()));
 }
 
-void FakeOutputSurface::SwapBuffersCallback() {
-  client_->DidSwapBuffersComplete();
+void FakeOutputSurface::SwapBuffersAck() {
+  client_->DidReceiveSwapBuffersAck();
 }
 
 void FakeOutputSurface::BindFramebuffer() {
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h
index 5e4aab4..674b00a2 100644
--- a/cc/test/fake_output_surface.h
+++ b/cc/test/fake_output_surface.h
@@ -125,7 +125,7 @@
   gfx::Rect last_swap_rect_;
 
  private:
-  void SwapBuffersCallback();
+  void SwapBuffersAck();
 
   base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_;
 };
diff --git a/cc/test/fake_output_surface_client.cc b/cc/test/fake_output_surface_client.cc
index f50beaa..8e3bf6e 100644
--- a/cc/test/fake_output_surface_client.cc
+++ b/cc/test/fake_output_surface_client.cc
@@ -2,12 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "cc/output/output_surface.h"
 #include "cc/test/fake_output_surface_client.h"
 
 namespace cc {
 
-void FakeOutputSurfaceClient::DidSwapBuffersComplete() {
+void FakeOutputSurfaceClient::DidReceiveSwapBuffersAck() {
   swap_count_++;
 }
 
@@ -15,9 +14,4 @@
   did_lose_output_surface_called_ = true;
 }
 
-void FakeOutputSurfaceClient::SetMemoryPolicy(
-    const ManagedMemoryPolicy& policy) {
-  memory_policy_ = policy;
-}
-
 }  // namespace cc
diff --git a/cc/test/fake_output_surface_client.h b/cc/test/fake_output_surface_client.h
index 0bc6e38..682a9b0 100644
--- a/cc/test/fake_output_surface_client.h
+++ b/cc/test/fake_output_surface_client.h
@@ -5,7 +5,6 @@
 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_
 #define CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_
 
-#include "cc/output/managed_memory_policy.h"
 #include "cc/output/output_surface_client.h"
 
 namespace cc {
@@ -14,26 +13,13 @@
 
 class FakeOutputSurfaceClient : public OutputSurfaceClient {
  public:
-  FakeOutputSurfaceClient()
-      : swap_count_(0),
-        did_lose_output_surface_called_(false),
-        memory_policy_(0) {}
+  FakeOutputSurfaceClient() = default;
 
-  void SetBeginFrameSource(BeginFrameSource* source) override {}
   void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override {}
-  void DidSwapBuffersComplete() override;
+  void DidReceiveSwapBuffersAck() override;
   void DidReceiveTextureInUseResponses(
       const gpu::TextureInUseResponses& responses) override {}
-  void ReclaimResources(const ReturnedResourceArray& resources) override {}
   void DidLoseOutputSurface() override;
-  void SetExternalTilePriorityConstraints(
-      const gfx::Rect& viewport_rect_for_tile_priority,
-      const gfx::Transform& transform_for_tile_priority) override {}
-  void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
-  void SetTreeActivationCallback(const base::Closure&) override {}
-  void OnDraw(const gfx::Transform& transform,
-              const gfx::Rect& viewport,
-              bool resourceless_software_draw) override {}
 
   int swap_count() { return swap_count_; }
 
@@ -41,12 +27,9 @@
     return did_lose_output_surface_called_;
   }
 
-  const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; }
-
  private:
-  int swap_count_;
-  bool did_lose_output_surface_called_;
-  ManagedMemoryPolicy memory_policy_;
+  int swap_count_ = 0;
+  bool did_lose_output_surface_called_ = false;
 };
 
 }  // namespace cc
diff --git a/cc/test/layer_tree_host_remote_for_testing.cc b/cc/test/layer_tree_host_remote_for_testing.cc
index d2769284..edba23d 100644
--- a/cc/test/layer_tree_host_remote_for_testing.cc
+++ b/cc/test/layer_tree_host_remote_for_testing.cc
@@ -174,11 +174,6 @@
   return layer_tree_host_in_process_->ReleaseCompositorFrameSink();
 }
 
-void LayerTreeHostRemoteForTesting::SetNeedsRedraw() {
-  // Draw requests pass through to the InProcessHost.
-  layer_tree_host_in_process_->SetNeedsRedraw();
-}
-
 void LayerTreeHostRemoteForTesting::SetNeedsRedrawRect(
     const gfx::Rect& damage_rect) {
   // Draw requests pass through to the InProcessHost.
diff --git a/cc/test/layer_tree_host_remote_for_testing.h b/cc/test/layer_tree_host_remote_for_testing.h
index 8a404f3..14389b9 100644
--- a/cc/test/layer_tree_host_remote_for_testing.h
+++ b/cc/test/layer_tree_host_remote_for_testing.h
@@ -47,7 +47,6 @@
   void SetCompositorFrameSink(
       std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override;
   std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink() override;
-  void SetNeedsRedraw() override;
   void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
   void SetNextCommitForcesRedraw() override;
   void NotifyInputThrottledUntilCommit() override;
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index c7c41ae..6d429b057 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -788,7 +788,8 @@
 void LayerTreeTest::DispatchSetNeedsRedraw() {
   DCHECK(main_task_runner_->BelongsToCurrentThread());
   if (layer_tree_host_)
-    layer_tree_host_->SetNeedsRedraw();
+    DispatchSetNeedsRedrawRect(
+        gfx::Rect(layer_tree_host_->GetLayerTree()->device_viewport_size()));
 }
 
 void LayerTreeTest::DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect) {
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index 8707170f..4ee4744 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -102,20 +102,6 @@
 
   void RealEndTest();
 
-  virtual void DispatchAddAnimationToPlayer(
-      AnimationPlayer* player_to_receive_animation,
-      double animation_duration);
-  void DispatchSetDeferCommits(bool defer_commits);
-  void DispatchSetNeedsCommit();
-  void DispatchSetNeedsUpdateLayers();
-  void DispatchSetNeedsRedraw();
-  void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect);
-  void DispatchSetVisible(bool visible);
-  void DispatchSetNextCommitForcesRedraw();
-  void DispatchDidAddAnimation();
-  void DispatchCompositeImmediately();
-  void DispatchNextCommitWaitsForActivation();
-
   std::unique_ptr<CompositorFrameSink>
   ReleaseCompositorFrameSinkOnLayerTreeHost();
   void SetVisibleOnLayerTreeHost(bool visible);
@@ -174,6 +160,20 @@
   gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl);
 
  private:
+  virtual void DispatchAddAnimationToPlayer(
+      AnimationPlayer* player_to_receive_animation,
+      double animation_duration);
+  void DispatchSetDeferCommits(bool defer_commits);
+  void DispatchSetNeedsCommit();
+  void DispatchSetNeedsUpdateLayers();
+  void DispatchSetNeedsRedraw();
+  void DispatchSetNeedsRedrawRect(const gfx::Rect& damage_rect);
+  void DispatchSetVisible(bool visible);
+  void DispatchSetNextCommitForcesRedraw();
+  void DispatchDidAddAnimation();
+  void DispatchCompositeImmediately();
+  void DispatchNextCommitWaitsForActivation();
+
   LayerTreeSettings settings_;
 
   CompositorMode mode_;
diff --git a/cc/test/pixel_test_output_surface.cc b/cc/test/pixel_test_output_surface.cc
index e9c6b79a..05cfc420 100644
--- a/cc/test/pixel_test_output_surface.cc
+++ b/cc/test/pixel_test_output_surface.cc
@@ -62,7 +62,7 @@
 }
 
 void PixelTestOutputSurface::SwapBuffersCallback() {
-  client_->DidSwapBuffersComplete();
+  client_->DidReceiveSwapBuffersAck();
 }
 
 OverlayCandidateValidator*
diff --git a/cc/tiles/gpu_image_decode_controller.cc b/cc/tiles/gpu_image_decode_controller.cc
index 7ce94b16..6bdd9ced 100644
--- a/cc/tiles/gpu_image_decode_controller.cc
+++ b/cc/tiles/gpu_image_decode_controller.cc
@@ -161,6 +161,9 @@
   void RunOnWorkerThread() override {
     TRACE_EVENT2("cc", "ImageDecodeTaskImpl::RunOnWorkerThread", "mode", "gpu",
                  "source_prepare_tiles_id", tracing_info_.prepare_tiles_id);
+    devtools_instrumentation::ScopedImageDecodeTask image_decode_task(
+        image_.image().get(),
+        devtools_instrumentation::ScopedImageDecodeTask::GPU);
     controller_->DecodeImage(image_);
   }
 
diff --git a/cc/tiles/software_image_decode_controller.cc b/cc/tiles/software_image_decode_controller.cc
index af3551b..155082c 100644
--- a/cc/tiles/software_image_decode_controller.cc
+++ b/cc/tiles/software_image_decode_controller.cc
@@ -104,7 +104,8 @@
                  "software", "source_prepare_tiles_id",
                  tracing_info_.prepare_tiles_id);
     devtools_instrumentation::ScopedImageDecodeTask image_decode_task(
-        image_.image().get());
+        image_.image().get(),
+        devtools_instrumentation::ScopedImageDecodeTask::SOFTWARE);
     controller_->DecodeImage(image_key_, image_);
   }
 
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index ad13182..4eeeec4 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -226,6 +226,7 @@
 
 static ConditionalClip ComputeAccumulatedClip(
     const PropertyTrees* property_trees,
+    bool include_clip_applied_by_target,
     int local_clip_id,
     int target_id) {
   const ClipTree& clip_tree = property_trees->clip_tree;
@@ -241,25 +242,26 @@
 
   // If target is not direct ancestor of clip, this will find least common
   // ancestor between the target and the clip.
-  while (true) {
-    while (target_node->clip_id > clip_node->id ||
-           target_node->has_unclipped_descendants) {
-      target_node = effect_tree.Node(target_node->target_id);
-    }
-    if (target_node->clip_id == clip_node->id)
-      break;
-    while (target_node->clip_id < clip_node->id) {
-      parent_chain.push(clip_node);
-      clip_node = clip_tree.parent(clip_node);
-    }
-    if (target_node->clip_id == clip_node->id) {
-      // Target is responsible for applying this clip_node (id equals to
-      // target_node's clip id), no need to accumulate this as part of clip
-      // rect.
-      clip_node = parent_chain.top();
-      parent_chain.pop();
-      break;
-    }
+  while (target_node->clip_id > clip_node->id ||
+         target_node->has_unclipped_descendants) {
+    target_node = effect_tree.Node(target_node->target_id);
+  }
+
+  // Collect clip nodes up to the least common ancestor.
+  while (target_node->clip_id < clip_node->id) {
+    parent_chain.push(clip_node);
+    clip_node = clip_tree.parent(clip_node);
+  }
+  DCHECK_EQ(target_node->clip_id, clip_node->id);
+
+  if (!include_clip_applied_by_target && parent_chain.size() == 0) {
+    // There aren't any clips to apply.
+    return ConditionalClip{false, gfx::RectF()};
+  }
+
+  if (!include_clip_applied_by_target) {
+    clip_node = parent_chain.top();
+    parent_chain.pop();
   }
 
   // TODO(weiliangc): If we don't create clip for render surface, we don't need
@@ -304,20 +306,12 @@
     const PropertyTrees* property_trees,
     int local_clip_id) {
   const int root_effect_id = EffectTree::kContentsRootNodeId;
+  bool include_clip_applied_by_target = true;
   ConditionalClip accumulated_clip =
-      ComputeAccumulatedClip(property_trees, local_clip_id, root_effect_id);
-
-  gfx::RectF accumulated_clip_rect = accumulated_clip.clip_rect;
-  const ClipNode* root_effect_node =
-      property_trees->clip_tree.Node(root_effect_id);
-  if (accumulated_clip.is_clipped) {
-    accumulated_clip_rect.Intersect(root_effect_node->clip_in_target_space);
-  } else {
-    // In this case, we need only the viewport clip as the accumulated clip is
-    // unclipped.
-    accumulated_clip_rect = root_effect_node->clip_in_target_space;
-  }
-  return accumulated_clip_rect;
+      ComputeAccumulatedClip(property_trees, include_clip_applied_by_target,
+                             local_clip_id, root_effect_id);
+  DCHECK(accumulated_clip.is_clipped);
+  return accumulated_clip.clip_rect;
 }
 
 void CalculateClipRects(const std::vector<LayerImpl*>& visible_layer_list,
@@ -386,9 +380,10 @@
         effect_tree.ClosestAncestorWithCopyRequest(layer->effect_tree_index());
     if (effect_ancestor_with_copy_request > 1) {
       // Non root copy request.
-      ConditionalClip accumulated_clip_rect =
-          ComputeAccumulatedClip(property_trees, layer->clip_tree_index(),
-                                 effect_ancestor_with_copy_request);
+      bool include_clip_applied_by_target = false;
+      ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip(
+          property_trees, include_clip_applied_by_target,
+          layer->clip_tree_index(), effect_ancestor_with_copy_request);
       if (!accumulated_clip_rect.is_clipped) {
         layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
         continue;
@@ -997,8 +992,10 @@
   for (int i = 2; i < static_cast<int>(effect_tree->size()); ++i) {
     EffectNode* effect_node = effect_tree->Node(i);
     const EffectNode* target_node = effect_tree->Node(effect_node->target_id);
-    ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip(
-        property_trees, effect_node->clip_id, target_node->id);
+    bool include_clip_applied_by_target = false;
+    ConditionalClip accumulated_clip_rect =
+        ComputeAccumulatedClip(property_trees, include_clip_applied_by_target,
+                               effect_node->clip_id, target_node->id);
     gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect;
     const RenderSurfaceImpl* render_surface = effect_node->render_surface;
     if (render_surface && render_surface->is_clipped()) {
@@ -1027,8 +1024,10 @@
     target_node = effect_tree->Node(1);
   }
 
-  ConditionalClip accumulated_clip_rect = ComputeAccumulatedClip(
-      property_trees, layer->clip_tree_index(), target_node->id);
+  bool include_clip_applied_by_target = false;
+  ConditionalClip accumulated_clip_rect =
+      ComputeAccumulatedClip(property_trees, include_clip_applied_by_target,
+                             layer->clip_tree_index(), target_node->id);
 
   gfx::RectF accumulated_clip = accumulated_clip_rect.clip_rect;
 
@@ -1209,9 +1208,10 @@
   gfx::Rect layer_content_rect = gfx::Rect(layer->bounds());
   gfx::RectF accumulated_clip_in_root_space;
   if (non_root_copy_request) {
-    ConditionalClip accumulated_clip =
-        ComputeAccumulatedClip(property_trees, layer->clip_tree_index(),
-                               effect_ancestor_with_copy_request);
+    bool include_clip_applied_by_target = false;
+    ConditionalClip accumulated_clip = ComputeAccumulatedClip(
+        property_trees, include_clip_applied_by_target,
+        layer->clip_tree_index(), effect_ancestor_with_copy_request);
     if (!accumulated_clip.is_clipped)
       return layer_content_rect;
     accumulated_clip_in_root_space = accumulated_clip.clip_rect;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 5f02fefd..7caead73c 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -143,9 +143,6 @@
   // scheduling is disabled.
   virtual void Composite(base::TimeTicks frame_begin_time) = 0;
 
-  // Requests a redraw (compositor frame) for the complete viewport.
-  virtual void SetNeedsRedraw() = 0;
-
   // Requests a redraw (compositor frame) for the given rect.
   virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) = 0;
 
diff --git a/cc/trees/layer_tree_host_in_process.cc b/cc/trees/layer_tree_host_in_process.cc
index e59898a3..bc72f510 100644
--- a/cc/trees/layer_tree_host_in_process.cc
+++ b/cc/trees/layer_tree_host_in_process.cc
@@ -611,10 +611,6 @@
   proxy_->SetNeedsCommit();
 }
 
-void LayerTreeHostInProcess::SetNeedsRedraw() {
-  SetNeedsRedrawRect(gfx::Rect(layer_tree_->device_viewport_size()));
-}
-
 void LayerTreeHostInProcess::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
   proxy_->SetNeedsRedraw(damage_rect);
 }
diff --git a/cc/trees/layer_tree_host_in_process.h b/cc/trees/layer_tree_host_in_process.h
index 9770d54..805fb59 100644
--- a/cc/trees/layer_tree_host_in_process.h
+++ b/cc/trees/layer_tree_host_in_process.h
@@ -151,7 +151,6 @@
   void SetDeferCommits(bool defer_commits) override;
   void LayoutAndUpdateLayers() override;
   void Composite(base::TimeTicks frame_begin_time) override;
-  void SetNeedsRedraw() override;
   void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
   void SetNextCommitForcesRedraw() override;
   void NotifyInputThrottledUntilCommit() override;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 4a920616..0cf3b4c0 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -3004,7 +3004,8 @@
       case 2:
         // Round 2 done.
         EXPECT_EQ(1, frame_);
-        layer_tree_host()->SetNeedsRedraw();
+        layer_tree_host()->SetNeedsRedrawRect(
+            gfx::Rect(layer_tree()->device_viewport_size()));
         break;
     }
   }
diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc
index 561a92a..33ff66f 100644
--- a/cc/trees/layer_tree_host_unittest_damage.cc
+++ b/cc/trees/layer_tree_host_unittest_damage.cc
@@ -43,7 +43,8 @@
   void DidCommitAndDrawFrame() override {
     switch (layer_tree_host()->SourceFrameNumber()) {
       case 1:
-        layer_tree_host()->SetNeedsRedraw();
+        layer_tree_host()->SetNeedsRedrawRect(
+            gfx::Rect(layer_tree()->device_viewport_size()));
         break;
     }
   }
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index 4304913..813a756 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -1067,7 +1067,7 @@
       ]
       if (!use_system_xcode) {
         args += [
-          "--developer-dir",
+          "--developer_dir",
           hermetic_xcode_path,
         ]
       }
diff --git a/chrome/VERSION b/chrome/VERSION
index d54c991..93c9113 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
 MAJOR=56
 MINOR=0
-BUILD=2891
+BUILD=2892
 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
index 718992a..01fff6e 100644
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -67,24 +67,12 @@
   ]
 }
 
-locale_pak_resources("chrome_locale_paks") {
-  sources = []
-  foreach(_locale, locales - android_chrome_omitted_locales) {
-    sources += [ "$root_out_dir/locales/$_locale.pak" ]
-  }
-
-  deps = [
-    "//chrome:packed_resources",
-  ]
-}
-
 android_resources("chrome_java_resources") {
   resource_dirs = [
     "java/res",
     "//chrome/android/java/res_chromium",
   ]
   deps = [
-    ":chrome_locale_paks",
     ":chrome_strings_grd",
     "//chrome/app:java_strings_grd",
     "//components/autofill/android:autofill_java_resources",
@@ -176,8 +164,8 @@
     "//mojo/public/java:system",
     "//net/android:net_java",
     "//printing:printing_java",
-    "//services/shell/public/interfaces:interfaces_java",
-    "//services/shell/public/java:shell_java",
+    "//services/service_manager/public/interfaces:interfaces_java",
+    "//services/service_manager/public/java:service_manager_java",
     "//third_party/WebKit/public:android_mojo_bindings_java",
     "//third_party/WebKit/public:blink_headers_java",
     "//third_party/android_data_chart:android_data_chart_java",
@@ -468,14 +456,6 @@
   ]
 }
 
-# TODO(agrieve): Delete once downstream no longer references this target.
-java_group("chrome_public_apk_assets") {
-  deps = [
-    ":chrome_public_non_pak_assets",
-    ":chrome_public_pak_assets",
-  ]
-}
-
 java_group("chrome_public_non_pak_assets") {
   deps = [
     "//chrome/android/webapk/libs/runtime_library:runtime_library_assets",
@@ -492,6 +472,7 @@
   disable_compression = true
 
   deps = [
+    ":chrome_public_locale_pak_assets",
     "//chrome:packed_resources",
     "//chrome/android/webapk/libs/runtime_library:runtime_library_assets",
     "//third_party/icu:icu_assets",
@@ -499,6 +480,19 @@
   ]
 }
 
+# This target is separate from chrome_public_pak_assets because it does not
+# disable compression.
+android_assets("chrome_public_locale_pak_assets") {
+  sources = []
+  foreach(_locale, locales - android_chrome_omitted_locales) {
+    sources += [ "$root_out_dir/locales/$_locale.pak" ]
+  }
+
+  deps = [
+    "//chrome:packed_resources",
+  ]
+}
+
 jinja_template_resources("chrome_public_apk_template_resources") {
   resources = [
     "java/res_template/xml/chromebackupscheme.xml",
@@ -575,11 +569,15 @@
     }
   }
 
-  locale_pak_resources("monochrome_locale_paks") {
-    sources = []
+  android_assets("monochrome_pak_assets") {
+    sources = [
+      "$target_gen_dir/monochrome_paks/chrome_100_percent.pak",
+      "$target_gen_dir/monochrome_paks/resources.pak",
+    ]
     foreach(_locale, locales) {
       sources += [ "$target_gen_dir/monochrome_paks/locales/$_locale.pak" ]
     }
+    disable_compression = true
 
     deps = [
       ":monochrome_paks",
@@ -587,17 +585,6 @@
   }
 }  # current_toolchain == host_toolchain
 
-android_assets("monochrome_pak_assets") {
-  sources = [
-    "$target_gen_dir/monochrome_paks/chrome_100_percent.pak",
-    "$target_gen_dir/monochrome_paks/resources.pak",
-  ]
-  deps = [
-    ":monochrome_paks",
-  ]
-  disable_compression = true
-}
-
 #
 # Only 32-bit //chrome/android/monochrome is needed, beside
 # being built with 32-bit default toolchain, it is also built
@@ -653,11 +640,11 @@
     forward_variables_from(invoker, "*")
 
     native_lib_version_rule = "//build/util:chrome_version_json"
-
     deps += [
       ":chrome_java",
-      ":chrome_public_apk_assets",
       ":chrome_public_apk_resources",
+      ":chrome_public_non_pak_assets",
+      ":chrome_public_pak_assets",
       "//base:base_java",
     ]
   }
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni
index 0b35cd8..c6f48fc4 100644
--- a/chrome/android/chrome_public_apk_tmpl.gni
+++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -90,8 +90,6 @@
           [ "//chrome/android:monochrome_secondary_abi_lib" ]
     }
 
-    alternative_locale_resource_dep = "//chrome/android:monochrome_locale_paks"
-
     alternative_android_sdk_jar = webview_framework_jar
     app_as_shared_lib = true
     use_chromium_linker = false
diff --git a/chrome/android/java/DEPS b/chrome/android/java/DEPS
index 88dd402..01b0f04 100644
--- a/chrome/android/java/DEPS
+++ b/chrome/android/java/DEPS
@@ -14,5 +14,5 @@
   "+components/web_contents_delegate_android",
   "+components/web_restrictions",
   "+content/public/android/java",
-  "+services/shell/public/java",
+  "+services/service_manager/public/java",
 ]
diff --git a/chrome/android/java/res/drawable-hdpi/offline_pin.png b/chrome/android/java/res/drawable-hdpi/offline_pin.png
index 61cab7c..d12639f 100644
--- a/chrome/android/java/res/drawable-hdpi/offline_pin.png
+++ b/chrome/android/java/res/drawable-hdpi/offline_pin.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/offline_pin.png b/chrome/android/java/res/drawable-mdpi/offline_pin.png
index 6c4bd2b5..21f99f1 100644
--- a/chrome/android/java/res/drawable-mdpi/offline_pin.png
+++ b/chrome/android/java/res/drawable-mdpi/offline_pin.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/offline_pin.png b/chrome/android/java/res/drawable-xhdpi/offline_pin.png
index 2067c3e..f2d1db02 100644
--- a/chrome/android/java/res/drawable-xhdpi/offline_pin.png
+++ b/chrome/android/java/res/drawable-xhdpi/offline_pin.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/offline_pin.png b/chrome/android/java/res/drawable-xxhdpi/offline_pin.png
index a52e1bc..f8b2844d 100644
--- a/chrome/android/java/res/drawable-xxhdpi/offline_pin.png
+++ b/chrome/android/java/res/drawable-xxhdpi/offline_pin.png
Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/offline_pin.png b/chrome/android/java/res/drawable-xxxhdpi/offline_pin.png
index 3e1cdc4..299be6e 100644
--- a/chrome/android/java/res/drawable-xxxhdpi/offline_pin.png
+++ b/chrome/android/java/res/drawable-xxxhdpi/offline_pin.png
Binary files differ
diff --git a/chrome/android/java/res/values/colors.xml b/chrome/android/java/res/values/colors.xml
index 056e66a..8a27e1d2 100644
--- a/chrome/android/java/res/values/colors.xml
+++ b/chrome/android/java/res/values/colors.xml
@@ -16,6 +16,7 @@
     <color name="descriptive_text_color">#646464</color>
     <color name="error_text_color">#c53929</color>
     <color name="google_blue_700">#3367d6</color>
+    <color name="google_blue_grey_500">#607D8B</color>
     <color name="google_red_700">#c53929</color>
     <color name="google_green_700">#0b8043</color>
     <color name="google_grey_100">#f5f5f5</color>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
index 9ce6c96..11668e2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java
@@ -18,13 +18,11 @@
 import org.chromium.base.ApplicationStatus;
 import org.chromium.base.CommandLineInitUtil;
 import org.chromium.base.ContextUtils;
-import org.chromium.base.ResourceExtractor;
 import org.chromium.base.ThreadUtils;
 import org.chromium.base.TraceEvent;
 import org.chromium.base.annotations.CalledByNative;
 import org.chromium.base.annotations.SuppressFBWarnings;
 import org.chromium.base.library_loader.ProcessInitException;
-import org.chromium.chrome.R;
 import org.chromium.chrome.browser.banners.AppDetailsDelegate;
 import org.chromium.chrome.browser.customtabs.CustomTabsConnection;
 import org.chromium.chrome.browser.datausage.ExternalDataUseObserver;
@@ -70,7 +68,6 @@
 import org.chromium.policy.AppRestrictionsProvider;
 import org.chromium.policy.CombinedPolicyProvider;
 import org.chromium.printing.PrintingController;
-import org.chromium.ui.base.ResourceBundle;
 
 /**
  * Basic application functionality that should be shared among all browser applications that use
@@ -161,14 +158,6 @@
     }
 
     @Override
-    protected void initializeLibraryDependencies() {
-        // The ResourceExtractor is only needed by the browser process, but this will have no
-        // impact on the renderer process construction.
-        ResourceBundle.initializeLocalePaks(this, R.array.locale_paks);
-        ResourceExtractor.setResourcesToExtract(ResourceBundle.getActiveLocaleResources());
-    }
-
-    @Override
     public void initCommandLine() {
         CommandLineInitUtil.initCommandLine(this, COMMAND_LINE_FILE);
     }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java
index 45677771..6543a19 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/SwipeRefreshHandler.java
@@ -8,9 +8,9 @@
 import android.view.ViewGroup.LayoutParams;
 
 import org.chromium.base.TraceEvent;
-import org.chromium.base.annotations.JNINamespace;
 import org.chromium.base.metrics.RecordUserAction;
 import org.chromium.chrome.R;
+import org.chromium.chrome.browser.tab.Tab;
 import org.chromium.content.browser.ContentViewCore;
 import org.chromium.content.browser.OverscrollRefreshHandler;
 import org.chromium.third_party.android.swiperefresh.SwipeRefreshLayout;
@@ -19,7 +19,6 @@
  * An overscroll handler implemented in terms a modified version of the Android
  * compat library's SwipeRefreshLayout effect.
  */
-@JNINamespace("content")
 public class SwipeRefreshHandler implements OverscrollRefreshHandler {
     // Synthetic delay between the {@link #didStopRefreshing()} signal and the
     // call to stop the refresh animation.
@@ -33,6 +32,9 @@
     // logic, rendering and animation.
     private final SwipeRefreshLayout mSwipeRefreshLayout;
 
+    // The Tab where the swipe occurs.
+    private Tab mTab;
+
     // The ContentViewCore with which the handler is associated. The handler
     // will set/unset itself as the default OverscrollRefreshHandler as the
     // association changes.
@@ -53,8 +55,12 @@
      * Simple constructor to use when creating an OverscrollRefresh instance from code.
      *
      * @param context The associated context.
+     * @param tab The Tab where the swipe occurs.
      */
-    public SwipeRefreshHandler(Context context) {
+    public SwipeRefreshHandler(Context context, Tab tab) {
+        mTab = tab;
+        mContentViewCore = mTab.getContentViewCore();
+
         mSwipeRefreshLayout = new SwipeRefreshLayout(context);
         mSwipeRefreshLayout.setLayoutParams(
                 new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
@@ -62,26 +68,6 @@
         // SwipeRefreshLayout.LARGE layouts appear broken on JellyBean.
         mSwipeRefreshLayout.setSize(SwipeRefreshLayout.DEFAULT);
         mSwipeRefreshLayout.setEnabled(false);
-    }
-
-    /**
-     * Pair the effect with a given ContentViewCore instance. If that instance is null,
-     * the effect will be disabled.
-     * @param contentViewCore The associated ContentViewCore instance.
-     */
-    public void setContentViewCore(final ContentViewCore contentViewCore) {
-        if (mContentViewCore == contentViewCore) return;
-
-        if (mContentViewCore != null) {
-            setEnabled(false);
-            cancelStopRefreshingRunnable();
-            mSwipeRefreshLayout.setOnRefreshListener(null);
-            mContentViewCore.setOverscrollRefreshHandler(null);
-        }
-
-        mContentViewCore = contentViewCore;
-
-        if (mContentViewCore == null) return;
 
         setEnabled(true);
         mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@@ -93,11 +79,10 @@
                 if (mAccessibilityRefreshString == null) {
                     int resId = R.string.accessibility_swipe_refresh;
                     mAccessibilityRefreshString =
-                            contentViewCore.getContext().getResources().getString(resId);
+                            mContentViewCore.getContext().getResources().getString(resId);
                 }
                 mSwipeRefreshLayout.announceForAccessibility(mAccessibilityRefreshString);
-                contentViewCore.getWebContents().getNavigationController().reloadToRefreshContent(
-                        true);
+                mTab.reload();
                 RecordUserAction.record("MobilePullGestureReload");
             }
         });
@@ -116,7 +101,17 @@
             }
         });
 
-        contentViewCore.setOverscrollRefreshHandler(this);
+        mContentViewCore.setOverscrollRefreshHandler(this);
+    }
+
+    /**
+     * Destroys and cleans up itself.
+     */
+    public void destroy() {
+        setEnabled(false);
+        cancelStopRefreshingRunnable();
+        mSwipeRefreshLayout.setOnRefreshListener(null);
+        mContentViewCore.setOverscrollRefreshHandler(null);
     }
 
     /**
@@ -192,7 +187,6 @@
     // with composited SurfaceView content.
     private void attachSwipeRefreshLayoutIfNecessary() {
         cancelDetachLayoutRunnable();
-        if (mContentViewCore == null) return;
         if (mSwipeRefreshLayout.getParent() == null) {
             mContentViewCore.getContainerView().addView(mSwipeRefreshLayout);
         }
@@ -200,7 +194,6 @@
 
     private void detachSwipeRefreshLayoutIfNecessary() {
         cancelDetachLayoutRunnable();
-        if (mContentViewCore == null) return;
         if (mSwipeRefreshLayout.getParent() != null) {
             mContentViewCore.getContainerView().removeView(mSwipeRefreshLayout);
         }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
index 0ef1053..ce46b4b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
@@ -429,6 +429,7 @@
         // the right MIME type from the file extension (if any):
         if (mimeType == null || mimeType.isEmpty() || "text/plain".equals(mimeType)
                 || "application/octet-stream".equals(mimeType)
+                || "binary/octet-stream".equals(mimeType)
                 || "octet/stream".equals(mimeType)
                 || "application/force-download".equals(mimeType)
                 || "application/unknown".equals(mimeType)) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
index 42aab0dc..8a6c2077 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
@@ -1530,8 +1530,12 @@
     private void addDownloadItemToList(List<DownloadItem> list, String guid, String displayName,
             String filepath, String url, String mimeType, long startTimestamp, long totalBytes,
             boolean hasBeenExternallyRemoved) {
+        // Remap the MIME type first.
+        File file = new File(filepath);
+        String newMimeType =
+                ChromeDownloadDelegate.remapGenericMimeType(mimeType, url, file.getName());
         list.add(createDownloadItem(
-                guid, displayName, filepath, url, mimeType, startTimestamp, totalBytes,
+                guid, displayName, filepath, url, newMimeType, startTimestamp, totalBytes,
                 hasBeenExternallyRemoved));
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
index 80fe1b6..16983bc7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
@@ -14,12 +14,20 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.drawable.shapes.OvalShape;
 import android.os.Binder;
 import android.os.Build;
 import android.os.IBinder;
 import android.support.v4.app.NotificationCompat;
 import android.text.TextUtils;
 
+import org.chromium.base.ApiCompatibilityUtils;
 import org.chromium.base.ContextUtils;
 import org.chromium.base.Log;
 import org.chromium.base.VisibleForTesting;
@@ -85,6 +93,7 @@
     private int mNextNotificationId;
     private int mNumAutoResumptionAttemptLeft;
     private boolean mStopPostingProgressNotifications;
+    private Bitmap mDownloadSuccessLargeIcon;
 
    /**
      * Class for clients to access.
@@ -355,6 +364,12 @@
         intent.setComponent(component);
         builder.setContentIntent(PendingIntent.getBroadcast(
                 mContext, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT));
+        if (mDownloadSuccessLargeIcon == null) {
+            Bitmap bitmap = BitmapFactory.decodeResource(
+                    mContext.getResources(), R.drawable.offline_pin);
+            mDownloadSuccessLargeIcon = getLargeNotificationIcon(bitmap);
+        }
+        builder.setLargeIcon(mDownloadSuccessLargeIcon);
         updateNotification(notificationId, builder.build());
         removeSharedPreferenceEntry(downloadGuid);
         mDownloadsInProgress.remove(downloadGuid);
@@ -457,6 +472,32 @@
         return builder;
     }
 
+    private Bitmap getLargeNotificationIcon(Bitmap bitmap) {
+        Resources resources = mContext.getResources();
+        int height = (int) resources.getDimension(android.R.dimen.notification_large_icon_height);
+        int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width);
+        final OvalShape circle = new OvalShape();
+        circle.resize(width, height);
+        final Paint paint = new Paint();
+        paint.setColor(ApiCompatibilityUtils.getColor(resources, R.color.google_blue_grey_500));
+
+        final Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(result);
+        circle.draw(canvas, paint);
+        float leftOffset = (width - bitmap.getWidth()) / 2f;
+        float topOffset = (height - bitmap.getHeight()) / 2f;
+        if (leftOffset >= 0 && topOffset >= 0) {
+            canvas.drawBitmap(bitmap, leftOffset, topOffset, null);
+        } else {
+            // Scale down the icon into the notification icon dimensions
+            canvas.drawBitmap(bitmap,
+                    new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()),
+                    new Rect(0, 0, width, height),
+                    null);
+        }
+        return result;
+    }
+
     /**
      * Retrives DownloadSharedPreferenceEntry from a download action intent.
      * @param intent Intent that contains the download action.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
index 25bcc25..019a203 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
@@ -208,7 +208,7 @@
         // Check to see if we need to extract any new resources from the APK. This could
         // be on first run when we need to extract all the .pak files we need, or after
         // the user has switched locale, in which case we want new locale resources.
-        ResourceExtractor.get(mApplication).startExtractingResources();
+        ResourceExtractor.get().startExtractingResources();
 
         mPostInflationStartupComplete = true;
     }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageCallback.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageCallback.java
new file mode 100644
index 0000000..4eb9ec3
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageCallback.java
@@ -0,0 +1,19 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.media.ui;
+
+import android.graphics.Bitmap;
+
+/**
+ * The callback when an image is downloaded. This class is different with
+ * {@link ImageDownloadCallback} and is only used by {@link MediaImageManager}.
+ */
+public interface MediaImageCallback {
+    /**
+     * Called when image downloading is complete.
+     * @param bitmap The downloaded image.
+     */
+    void onImageDownloaded(Bitmap image);
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java
new file mode 100644
index 0000000..e298e01f
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java
@@ -0,0 +1,227 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.media.ui;
+
+import static org.chromium.content_public.common.MediaMetadata.MediaImage;
+
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+import android.text.TextUtils;
+
+import org.chromium.content_public.browser.ImageDownloadCallback;
+import org.chromium.content_public.browser.WebContents;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * A class for managing the MediaImage download process.
+ *
+ * The manager takes a list of {@link MediaMetadata.MediaImage} as input, and
+ * selects one of them based on scoring and start download through
+ * {@link WebContents} asynchronously. When the download successfully finishes,
+ * the manager runs the callback function to notify the completion and pass the
+ * downloaded Bitmap.
+ *
+ * The scoring works as follows:
+ * - A image score is computed by multiplying the type score with the size score.
+ * - The type score lies in [0, 1] and is based on the image MIME type/file extension.
+ *   - PNG and JPEG are prefered than others.
+ *   - If unspecified, use the default type score (0.6).
+ * - The size score lies in [0, 1] and is computed using |mMimumSize| and |mIdealSize|
+ *   - If size < |mMinimumSize| (too small), the size score is 0.
+ *   - If size > 4 * |mIdealSize| (too large), the size score lies is 0.
+ *   - If |mMinimumSize| <= size <= |mIdealSize|, the score increases linearly from 0.2 to 1.
+ *   - If |mIdealSize| < size <= 4 * |mIdealSize|, the score drops linearly from 1 to 0.6.
+ *   - When the size is "any", the size score is 0.8.
+ *   - If unspecified, use the default size score (0.4).
+ */
+public class MediaImageManager implements ImageDownloadCallback {
+    // The default score of unknown image size.
+    private static final double DEFAULT_IMAGE_SIZE_SCORE = 0.4;
+    // The scores for different image types. Keep them sorted by value.
+    private static final double TYPE_SCORE_DEFAULT = 0.6;
+    private static final double TYPE_SCORE_PNG = 1.0;
+    private static final double TYPE_SCORE_JPEG = 0.7;
+    private static final double TYPE_SCORE_BMP = 0.5;
+    private static final double TYPE_SCORE_XICON = 0.4;
+    private static final double TYPE_SCORE_GIF = 0.3;
+
+    private static final Object LOCK = new Object();
+
+    // Map from file extension to type score.
+    private static HashMap<String, Double> sFileExtentionScores;
+    // Map from MIME type to type score.
+    private static HashMap<String, Double> sMIMETypeScores;
+
+    private WebContents mWebContents;
+    // The minimum image size. Images that are smaller than |mMinimumSize| will be ignored.
+    final int mMinimumSize;
+    // The ideal image size. Images that are too large than |mIdealSize| will be ignored.
+    final int mIdealSize;
+    // The pending download image request id, which is set when calling
+    // {@link WebContents#downloadImage()}, and reset when image download completes or
+    // {@link #clearRequests()} is called.
+    private int mRequestId;
+    // The callback to be called when the pending download image request completes.
+    private MediaImageCallback mCallback;
+
+    /**
+     * MediaImageManager constructor.
+     * @param minimumSize The minimum size of images to download.
+     * @param idealSize The ideal size of images to download.
+     */
+    public MediaImageManager(int minimumSize, int idealSize) {
+        synchronized (LOCK) {
+            if (sFileExtentionScores == null) {
+                sFileExtentionScores = new HashMap<String, Double>();
+                sFileExtentionScores.put("bmp", TYPE_SCORE_BMP);
+                sFileExtentionScores.put("gif", TYPE_SCORE_GIF);
+                sFileExtentionScores.put("icon", TYPE_SCORE_XICON);
+                sFileExtentionScores.put("jpeg", TYPE_SCORE_JPEG);
+                sFileExtentionScores.put("jpg", TYPE_SCORE_JPEG);
+                sFileExtentionScores.put("png", TYPE_SCORE_PNG);
+            }
+            if (sMIMETypeScores == null) {
+                sMIMETypeScores = new HashMap<String, Double>();
+                sMIMETypeScores.put("image/bmp", TYPE_SCORE_BMP);
+                sMIMETypeScores.put("image/gif", TYPE_SCORE_GIF);
+                sMIMETypeScores.put("image/jpeg", TYPE_SCORE_JPEG);
+                sMIMETypeScores.put("image/png", TYPE_SCORE_PNG);
+                sMIMETypeScores.put("image/x-icon", TYPE_SCORE_XICON);
+            }
+        }
+
+        mMinimumSize = minimumSize;
+        mIdealSize = idealSize;
+        clearRequests();
+    }
+
+    /**
+     * Called when the WebContent changes.
+     * @param contents The new WebContents.
+     */
+    public void setWebContents(WebContents contents) {
+        mWebContents = contents;
+        clearRequests();
+    }
+
+    /**
+     * Select the best image from |images| and start download.
+     * @param images The list of images to choose from.
+     * @param callback The callback when image download completes.
+     */
+    public void downloadImage(List<MediaImage> images, MediaImageCallback callback) {
+        if (mWebContents == null) return;
+
+        mCallback = callback;
+        MediaImage image = selectImage(images);
+        if (image == null) return;
+
+        mRequestId = mWebContents.downloadImage(
+            image.getSrc(), false, 8 * mIdealSize, false, this);
+    }
+
+    /**
+     * Clear previous requests.
+     */
+    public void clearRequests() {
+        mRequestId = -1;
+        mCallback = null;
+    }
+
+    /**
+     * ImageDownloadCallback implementation. This method is called when an download image request is
+     * completed. The class will only keep the latest request. If some call to this method is
+     * corresponding to a previous request, it will be ignored.
+     */
+    @Override
+    public void onFinishDownloadImage(int id, int httpStatusCode, String imageUrl,
+            List<Bitmap> bitmaps, List<Rect> originalImageSizes) {
+        if (id != mRequestId) return;
+        if (httpStatusCode < 200 || httpStatusCode >= 300) return;
+
+        Iterator<Bitmap> iterBitmap = bitmaps.iterator();
+        Iterator<Rect> iterSize = originalImageSizes.iterator();
+
+        Bitmap bestBitmap = null;
+        double bestScore = 0;
+        while (iterBitmap.hasNext() && iterSize.hasNext()) {
+            Bitmap bitmap = iterBitmap.next();
+            Rect size = iterSize.next();
+            double newScore = getImageSizeScore(size);
+            if (bestScore < newScore) {
+                bestBitmap = bitmap;
+                bestScore = newScore;
+            }
+        }
+        if (bestBitmap != null) mCallback.onImageDownloaded(bestBitmap);
+        clearRequests();
+    }
+
+    /**
+     * Select the best image from the |images|.
+     * @param images The list of images to select from.
+     */
+    private MediaImage selectImage(List<MediaImage> images) {
+        MediaImage selectedImage = null;
+        double bestScore = 0;
+        for (MediaImage image : images) {
+            double newScore = getImageScore(image);
+            if (newScore > bestScore) {
+                bestScore = newScore;
+                selectedImage = image;
+            }
+        }
+        return selectedImage;
+    }
+
+    private double getImageScore(MediaImage image) {
+        if (image == null) return 0;
+        if (image.getSizes().isEmpty()) return DEFAULT_IMAGE_SIZE_SCORE;
+
+        double bestSizeScore = 0;
+        for (Rect size : image.getSizes()) {
+            bestSizeScore = Math.max(bestSizeScore, getImageSizeScore(size));
+        }
+        double typeScore = getImageTypeScore(image.getSrc(), image.getType());
+        return bestSizeScore * typeScore;
+    }
+
+    private double getImageSizeScore(Rect size) {
+        int dominantSize = Math.max(size.width(), size.height());
+
+        // When the size is "any".
+        if (dominantSize == 0) return 0.8;
+        // Ignore images that are too small.
+        if (dominantSize < mMinimumSize) return 0;
+        // Ignore images that are too large.
+        if (dominantSize > 4 * mIdealSize) return 0;
+
+        if (dominantSize <= mIdealSize) {
+            return 0.8 * (dominantSize - mMinimumSize) / (mIdealSize - mMinimumSize) + 0.2;
+        }
+        return 0.4 * (dominantSize - mIdealSize) / (3 * mIdealSize) + 0.6;
+    }
+
+    private double getImageTypeScore(String url, String type) {
+        String extension = getExtension(url);
+
+        if (sFileExtentionScores.containsKey(extension)) {
+            return sFileExtentionScores.get(extension);
+        }
+        if (sMIMETypeScores.containsKey(type)) return sMIMETypeScores.get(type);
+
+        return TYPE_SCORE_DEFAULT;
+    }
+
+    private String getExtension(String url) {
+        int index = TextUtils.lastIndexOf(url, '.');
+        if (index == -1) return "";
+        return url.substring(index + 1).toLowerCase(Locale.US);
+    }
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
index 8bd36d8b..2a4f0e2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java
@@ -367,16 +367,7 @@
     public static Bitmap scaleIconForDisplay(Bitmap icon) {
         if (icon == null) return null;
 
-        int largeIconSizePx;
-        if (isRunningN()) {
-            largeIconSizePx = (int) TypedValue.applyDimension(
-                    TypedValue.COMPLEX_UNIT_DIP, N_LARGE_ICON_SIZE_DP,
-                    ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
-        } else {
-            largeIconSizePx = (int) TypedValue.applyDimension(
-                    TypedValue.COMPLEX_UNIT_DIP, PRE_N_LARGE_ICON_SIZE_DP,
-                    ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
-        }
+        int largeIconSizePx = getMaximumLargeIconSize();
 
         if (icon.getWidth() > largeIconSizePx || icon.getHeight() > largeIconSizePx) {
             return icon.createScaledBitmap(
@@ -386,6 +377,24 @@
         return icon;
     }
 
+    /**
+     * @return Prefered maximum large icon size. If the large icon is larger than this size, then it
+     * needs to be scaled.
+     */
+    public static int getMaximumLargeIconSize() {
+        int maxLargeIconSizePx;
+        if (isRunningN()) {
+            maxLargeIconSizePx = (int) TypedValue.applyDimension(
+                TypedValue.COMPLEX_UNIT_DIP, N_LARGE_ICON_SIZE_DP,
+                ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
+        } else {
+            maxLargeIconSizePx = (int) TypedValue.applyDimension(
+                TypedValue.COMPLEX_UNIT_DIP, PRE_N_LARGE_ICON_SIZE_DP,
+                ContextUtils.getApplicationContext().getResources().getDisplayMetrics());
+        }
+        return maxLargeIconSizePx;
+    }
+
     private static MediaNotificationManager getManager(int notificationId) {
         if (sManagers == null) return null;
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
index 9bac136..19252e1 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
@@ -31,14 +31,16 @@
  * A tab helper responsible for enabling/disabling media controls and passing
  * media actions from the controls to the {@link org.chromium.content.browser.MediaSession}
  */
-public class MediaSessionTabHelper {
+public class MediaSessionTabHelper implements MediaImageCallback {
     private static final String TAG = "MediaSession";
 
     private static final String UNICODE_PLAY_CHARACTER = "\u25B6";
     private static final int MINIMAL_FAVICON_SIZE = 114;
 
     private Tab mTab;
+    private Bitmap mPageMediaImage = null;
     private Bitmap mFavicon = null;
+    private Bitmap mCurrentMediaImage = null;
     private String mOrigin = null;
     private WebContents mWebContents;
     private WebContentsObserver mWebContentsObserver;
@@ -50,6 +52,7 @@
     private MediaMetadata mPageMetadata = null;
     // The currently showing metadata.
     private MediaMetadata mCurrentMetadata = null;
+    private MediaImageManager mMediaImageManager = null;
 
     private MediaNotificationListener mControlsListener = new MediaNotificationListener() {
         @Override
@@ -111,6 +114,7 @@
                 }
 
                 mCurrentMetadata = getMetadata();
+                mCurrentMediaImage = getNotificationImage();
                 mNotificationInfoBuilder =
                         new MediaNotificationInfo.Builder()
                                 .setMetadata(mCurrentMetadata)
@@ -119,7 +123,7 @@
                                 .setTabId(mTab.getId())
                                 .setPrivate(mTab.isIncognito())
                                 .setIcon(R.drawable.audio_playing)
-                                .setLargeIcon(mFavicon)
+                                .setLargeIcon(mCurrentMediaImage)
                                 .setDefaultLargeIcon(R.drawable.audio_playing_square)
                                 .setActions(MediaNotificationInfo.ACTION_PLAY_PAUSE
                                         | MediaNotificationInfo.ACTION_SWIPEAWAY)
@@ -139,6 +143,10 @@
             @Override
             public void mediaSessionMetadataChanged(MediaMetadata metadata) {
                 mPageMetadata = metadata;
+                if (mPageMetadata != null) {
+                    mMediaImageManager.downloadImage(mPageMetadata.getArtwork(),
+                            MediaSessionTabHelper.this);
+                }
                 updateNotificationMetadata();
             }
         };
@@ -150,6 +158,7 @@
         cleanupWebContents();
         mWebContents = webContents;
         if (mWebContents != null) mWebContentsObserver = createWebContentsObserver(mWebContents);
+        mMediaImageManager.setWebContents(mWebContents);
     }
 
     private void cleanupWebContents() {
@@ -171,11 +180,7 @@
 
             if (!updateFavicon(icon)) return;
 
-            if (mNotificationInfoBuilder == null) return;
-
-            mNotificationInfoBuilder.setLargeIcon(mFavicon);
-            MediaNotificationManager.show(
-                    ContextUtils.getApplicationContext(), mNotificationInfoBuilder.build());
+            updateNotificationImage();
         }
 
         @Override
@@ -193,6 +198,7 @@
             if (mOrigin != null && mOrigin.equals(origin)) return;
             mOrigin = origin;
             mFavicon = null;
+            mPageMediaImage = null;
 
             if (mNotificationInfoBuilder == null) return;
 
@@ -227,6 +233,8 @@
     private MediaSessionTabHelper(Tab tab) {
         mTab = tab;
         mTab.addObserver(mTabObserver);
+        mMediaImageManager = new MediaImageManager(
+            MINIMAL_FAVICON_SIZE, MediaNotificationManager.getMaximumLargeIconSize());
         if (mTab.getWebContents() != null) setWebContents(tab.getWebContents());
 
         Activity activity = getActivityFromTab(mTab);
@@ -340,4 +348,26 @@
 
         return new MediaMetadata(title, artist, album);
     }
+
+    @Override
+    public void onImageDownloaded(Bitmap image) {
+        mPageMediaImage = image;
+        updateNotificationImage();
+    }
+
+    private void updateNotificationImage() {
+        Bitmap newMediaImage = getNotificationImage();
+        if (mCurrentMediaImage == newMediaImage) return;
+
+        mCurrentMediaImage = newMediaImage;
+
+        if (mNotificationInfoBuilder == null) return;
+        mNotificationInfoBuilder.setLargeIcon(mCurrentMediaImage);
+        MediaNotificationManager.show(
+                ContextUtils.getApplicationContext(), mNotificationInfoBuilder.build());
+    }
+
+    private Bitmap getNotificationImage() {
+        return (mPageMediaImage != null) ? mPageMediaImage : mFavicon;
+    }
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/mojo/ChromeInterfaceRegistrar.java b/chrome/android/java/src/org/chromium/chrome/browser/mojo/ChromeInterfaceRegistrar.java
index 2d7b327..0442a6f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/mojo/ChromeInterfaceRegistrar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/mojo/ChromeInterfaceRegistrar.java
@@ -10,7 +10,7 @@
 import org.chromium.content_public.browser.InterfaceRegistrar;
 import org.chromium.content_public.browser.WebContents;
 import org.chromium.payments.mojom.PaymentRequest;
-import org.chromium.services.shell.InterfaceRegistry;
+import org.chromium.services.service_manager.InterfaceRegistry;
 import org.chromium.webshare.mojom.ShareService;
 
 /** Registers mojo interface implementations exposed to C++ code at the Chrome layer. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/evaluation/OfflinePageEvaluationBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/evaluation/OfflinePageEvaluationBridge.java
new file mode 100644
index 0000000..d58497ae
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/evaluation/OfflinePageEvaluationBridge.java
@@ -0,0 +1,195 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.offlinepages.evaluation;
+
+import org.chromium.base.Callback;
+import org.chromium.base.ObserverList;
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.chrome.browser.offlinepages.ClientId;
+import org.chromium.chrome.browser.offlinepages.OfflinePageItem;
+import org.chromium.chrome.browser.offlinepages.SavePageRequest;
+import org.chromium.chrome.browser.profiles.Profile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Class used for offline page evaluation testing tools.
+ */
+@JNINamespace("offline_pages::android")
+public class OfflinePageEvaluationBridge {
+    /**
+     * Observer class for notifications on changes to save page requests or offline page model which
+     * are used for testing.
+     */
+    public abstract static class OfflinePageEvaluationObserver {
+        /**
+         * Event fired when the offline page model is loaded.
+         */
+        public void offlinePageModelLoaded() {}
+
+        /**
+         * Event fired when a new request is added.
+         * @param request The newly added save page request.
+         */
+        public void savePageRequestAdded(SavePageRequest request) {}
+
+        /**
+         * Event fired when a request is completed.
+         * @param request The completed request.
+         * @param status The status of the completion, see
+         * org.chromium.components.offlinepages.BackgroundSavePageResult.
+         */
+        public void savePageRequestCompleted(SavePageRequest request, int status) {}
+
+        /**
+         * Event fired when a new request is changed.
+         * @param request The changed request.
+         */
+        public void savePageRequestChanged(SavePageRequest request) {}
+    }
+
+    public static OfflinePageEvaluationBridge getForProfile(Profile profile) {
+        ThreadUtils.assertOnUiThread();
+        return nativeGetBridgeForProfile(profile);
+    }
+
+    private long mNativeOfflinePageEvaluationBridge;
+    private boolean mIsOfflinePageModelLoaded;
+    private ObserverList<OfflinePageEvaluationObserver> mObservers =
+            new ObserverList<OfflinePageEvaluationObserver>();
+
+    /**
+     * Creates an offline page evalutaion bridge for a given profile.
+     */
+    OfflinePageEvaluationBridge(long nativeOfflinePageEvaluationBridge) {
+        mNativeOfflinePageEvaluationBridge = nativeOfflinePageEvaluationBridge;
+    }
+
+    /**
+     * Called by the native OfflinePageEvaluationBridge.
+     */
+    @CalledByNative
+    private static OfflinePageEvaluationBridge create(long nativeOfflinePageEvaluationBridge) {
+        return new OfflinePageEvaluationBridge(nativeOfflinePageEvaluationBridge);
+    }
+
+    /**
+     * Add an observer of the evaluation events.
+     */
+    public void addObserver(OfflinePageEvaluationObserver observer) {
+        mObservers.addObserver(observer);
+    }
+
+    /**
+     * Remove an observer of evaluation events.
+     */
+    public void removeObserver(OfflinePageEvaluationObserver observer) {
+        mObservers.removeObserver(observer);
+    }
+
+    /**
+     * Gets all pages in offline page model.
+     * @param callback The callback would be invoked after the action completes and return with a
+     *                 list of pages.
+     */
+    public void getAllPages(final Callback<List<OfflinePageItem>> callback) {
+        List<OfflinePageItem> result = new ArrayList<>();
+        nativeGetAllPages(mNativeOfflinePageEvaluationBridge, result, callback);
+    }
+
+    /**
+     * Saves a url as offline page async.
+     * @param url The url of the web page.
+     * @param namespace The namespace to which the page belongs.
+     * @param userRequest True if it's user-requested page.
+     */
+    public void savePageLater(final String url, final String namespace, boolean userRequested) {
+        ClientId clientId = ClientId.createGuidClientIdForNamespace(namespace);
+        nativeSavePageLater(mNativeOfflinePageEvaluationBridge, url, namespace, clientId.getId(),
+                userRequested);
+    }
+
+    /**
+     * Force request coordinator to process the requests in the queue.
+     * @param callback The callback would be invoked after the operation completes.
+     */
+    public void pushRequestProcessing(final Callback<Boolean> callback) {
+        nativePushRequestProcessing(mNativeOfflinePageEvaluationBridge, callback);
+    }
+
+    /**
+     * @return True if the offline page model has fully loaded.
+     */
+    public boolean isOfflinePageModelLoaded() {
+        return mIsOfflinePageModelLoaded;
+    }
+
+    @CalledByNative
+    void savePageRequestAdded(SavePageRequest request) {
+        for (OfflinePageEvaluationObserver observer : mObservers) {
+            observer.savePageRequestAdded(request);
+        }
+    }
+
+    @CalledByNative
+    void savePageRequestCompleted(SavePageRequest request, int status) {
+        for (OfflinePageEvaluationObserver observer : mObservers) {
+            observer.savePageRequestCompleted(request, status);
+        }
+    }
+
+    @CalledByNative
+    void savePageRequestChanged(SavePageRequest request) {
+        for (OfflinePageEvaluationObserver observer : mObservers) {
+            observer.savePageRequestChanged(request);
+        }
+    }
+
+    @CalledByNative
+    void offlinePageModelLoaded() {
+        mIsOfflinePageModelLoaded = true;
+        for (OfflinePageEvaluationObserver observer : mObservers) {
+            observer.offlinePageModelLoaded();
+        }
+    }
+
+    @CalledByNative
+    private void offlinePageEvaluationBridgeDestroyed() {
+        ThreadUtils.assertOnUiThread();
+        assert mNativeOfflinePageEvaluationBridge != 0;
+
+        mNativeOfflinePageEvaluationBridge = 0;
+        mIsOfflinePageModelLoaded = false;
+
+        mObservers.clear();
+    }
+
+    @CalledByNative
+    private static void createOfflinePageAndAddToList(List<OfflinePageItem> offlinePagesList,
+            String url, long offlineId, String clientNamespace, String clientId, String filePath,
+            long fileSize, long creationTime, int accessCount, long lastAccessTimeMs) {
+        offlinePagesList.add(createOfflinePageItem(url, offlineId, clientNamespace, clientId,
+                filePath, fileSize, creationTime, accessCount, lastAccessTimeMs));
+    }
+
+    private static OfflinePageItem createOfflinePageItem(String url, long offlineId,
+            String clientNamespace, String clientId, String filePath, long fileSize,
+            long creationTime, int accessCount, long lastAccessTimeMs) {
+        return new OfflinePageItem(url, offlineId, clientNamespace, clientId, filePath, fileSize,
+                creationTime, accessCount, lastAccessTimeMs);
+    }
+
+    private static native OfflinePageEvaluationBridge nativeGetBridgeForProfile(Profile profile);
+
+    private native void nativeGetAllPages(long nativeOfflinePageEvaluationBridge,
+            List<OfflinePageItem> offlinePages, final Callback<List<OfflinePageItem>> callback);
+    private native void nativeSavePageLater(long nativeOfflinePageEvaluationBridge, String url,
+            String clientNamespace, String clientId, boolean userRequested);
+    private native void nativePushRequestProcessing(
+            long nativeOfflinePageEvaluationBridge, Callback<Boolean> callback);
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java
index c4328ef..e5d6462 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestFactory.java
@@ -17,7 +17,7 @@
 import org.chromium.payments.mojom.PaymentOptions;
 import org.chromium.payments.mojom.PaymentRequest;
 import org.chromium.payments.mojom.PaymentRequestClient;
-import org.chromium.services.shell.InterfaceFactory;
+import org.chromium.services.service_manager.InterfaceFactory;
 import org.chromium.ui.base.WindowAndroid;
 
 /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentInformation.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentInformation.java
index a08bbf9..2f055d16f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentInformation.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentInformation.java
@@ -72,6 +72,16 @@
     }
 
     /**
+     * Returns the tertiary label for the selected shipping address.
+     *
+     * @return The tertiary label for the selected shipping address or null.
+     */
+    public String getSelectedShippingAddressTertiaryLabel() {
+        PaymentOption address = mShippingAddresses.getSelectedItem();
+        return address != null ? address.getTertiaryLabel() : null;
+    }
+
+    /**
      * Returns the shipping options.
      *
      * @return The shipping options.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java
index cac942a..315ceb17 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestSection.java
@@ -456,44 +456,73 @@
     }
 
     /**
-     * Section with a secondary TextView beneath the summary to show additional details.
+     * Section with three extra TextViews beneath the summary to show additional details.
      *
      * ............................................................................
-     * . TITLE                                                          | CHEVRON .
+     * . TITLE                                                          |         .
+     * .................................................................|         .
+     * . LEFT SUMMARY TEXT                        |  RIGHT SUMMARY TEXT | CHEVRON .
      * .................................................................|    or   .
-     * . LEFT SUMMARY TEXT                        |  RIGHT SUMMARY TEXT |   ADD   .
+     * . EXTRA TEXT ONE                                                 |   ADD   .
      * .................................................................|    or   .
-     * . EXTRA TEXT                                                     |  SELECT .
+     * . EXTRA TEXT TWO                                                 |  SELECT .
+     * .................................................................|         .
+     * . EXTRA TEXT THREE                                               |         .
      * ............................................................................
      */
-    public static class ExtraTextSection extends PaymentRequestSection {
-        private TextView mExtraTextView;
+    public static class ExtraTextsSection extends PaymentRequestSection {
+        private TextView[] mExtraTextViews;
         private int mEditButtonState = EDIT_BUTTON_GONE;
 
-        public ExtraTextSection(Context context, String sectionName, SectionDelegate delegate) {
+        public ExtraTextsSection(Context context, String sectionName, SectionDelegate delegate) {
             super(context, sectionName, delegate);
-            setExtraText(null);
+            setExtraTexts(new String[] {null, null, null});
         }
 
         @Override
         protected void createMainSectionContent(LinearLayout mainSectionLayout) {
             Context context = mainSectionLayout.getContext();
 
-            mExtraTextView = new TextView(context);
-            ApiCompatibilityUtils.setTextAppearance(
-                    mExtraTextView, R.style.PaymentsUiSectionDescriptiveTextEndAligned);
-            mainSectionLayout.addView(mExtraTextView, new LinearLayout.LayoutParams(
-                    LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
+            mExtraTextViews = new TextView[3];
+            for (int i = 0; i < mExtraTextViews.length; i++) {
+                mExtraTextViews[i] = new TextView(context);
+                ApiCompatibilityUtils.setTextAppearance(
+                        mExtraTextViews[i], R.style.PaymentsUiSectionDefaultText);
+                mainSectionLayout.addView(
+                        mExtraTextViews[i], new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+                                                    LayoutParams.WRAP_CONTENT));
+            }
         }
 
         /**
-         * Sets the CharSequence that is displayed in the secondary TextView.
+         * Sets the CharSequences that are displayed in the extra TextViews.
          *
-         * @param text Text to display.
+         * @param extraTexts Texts to display in the extra TextViews.
          */
-        public void setExtraText(CharSequence text) {
-            mExtraTextView.setText(text);
-            mExtraTextView.setVisibility(TextUtils.isEmpty(text) ? GONE : VISIBLE);
+        public void setExtraTexts(CharSequence[] extraTexts) {
+            assert extraTexts.length == mExtraTextViews.length;
+
+            for (int i = 0; i < mExtraTextViews.length; i++) {
+                mExtraTextViews[i].setText(extraTexts[i]);
+                mExtraTextViews[i].setVisibility(TextUtils.isEmpty(extraTexts[i]) ? GONE : VISIBLE);
+            }
+        }
+
+        /**
+         * Sets how the extra texts should be displayed.
+         *
+         * @param textsTruncate How to truncate the extra texts. Set the element to null to clear.
+         * @param textsAreSingleLine Whether the extra texts should be displayed in a single line.
+         */
+        public void setExtraTextsProperties(
+                TruncateAt[] textsTruncate, boolean[] textsAreSingleLine) {
+            assert textsTruncate.length == mExtraTextViews.length;
+            assert textsAreSingleLine.length == mExtraTextViews.length;
+
+            for (int i = 0; i < mExtraTextViews.length; i++) {
+                mExtraTextViews[i].setEllipsize(textsTruncate[i]);
+                mExtraTextViews[i].setSingleLine(textsAreSingleLine[i]);
+            }
         }
 
         /** Sets the state of the edit button. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
index af60933..ba2101c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
@@ -42,7 +42,7 @@
 import org.chromium.base.Callback;
 import org.chromium.base.VisibleForTesting;
 import org.chromium.chrome.R;
-import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.ExtraTextSection;
+import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.ExtraTextsSection;
 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.LineItemBreakdownSection;
 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.OptionSection;
 import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.SectionSeparator;
@@ -280,7 +280,7 @@
     private View mSpinnyLayout;
 
     private LineItemBreakdownSection mOrderSummarySection;
-    private ExtraTextSection mShippingSummarySection;
+    private ExtraTextsSection mShippingSummarySection;
     private OptionSection mShippingAddressSection;
     private OptionSection mShippingOptionSection;
     private OptionSection mContactDetailsSection;
@@ -416,8 +416,9 @@
                     updateSection(TYPE_SHIPPING_ADDRESSES, result.getShippingAddresses());
                     updateSection(TYPE_SHIPPING_OPTIONS, result.getShippingOptions());
 
-                    String selectedShippingAddress = result.getSelectedShippingAddressLabel();
-                    String selectedShippingName = result.getSelectedShippingAddressSublabel();
+                    String selectedShippingName = result.getSelectedShippingAddressLabel();
+                    String selectedShippingAddress = result.getSelectedShippingAddressSublabel();
+                    String selectedShippingPhone = result.getSelectedShippingAddressTertiaryLabel();
                     String selectedShippingOptionLabel = result.getSelectedShippingOptionLabel();
 
                     if (selectedShippingAddress == null || selectedShippingOptionLabel == null) {
@@ -431,14 +432,18 @@
                                         ? mShippingOptionSection : mShippingAddressSection;
                         mShippingSummarySection.setEditButtonState(section.getEditButtonState());
                     } else {
-                        // Show the shipping address and the name in the summary section.
-                        mShippingSummarySection.setSummaryText(
-                                selectedShippingAddress, selectedShippingName);
+                        // Show the shipping name in the summary section.
+                        mShippingSummarySection.setSummaryText(selectedShippingName, null);
                         mShippingSummarySection.setSummaryProperties(
-                                TruncateAt.MIDDLE, true, null, true);
+                                TruncateAt.END, true, null, false);
 
-                        // Indicate the shipping option below the address.
-                        mShippingSummarySection.setExtraText(selectedShippingOptionLabel);
+                        // Show the shipping address, phone and option below the summary.
+                        mShippingSummarySection.setExtraTexts(new String[] {selectedShippingAddress,
+                                selectedShippingPhone, selectedShippingOptionLabel});
+                        mShippingSummarySection.setExtraTextsProperties(
+                                new TruncateAt[] {
+                                        TruncateAt.MIDDLE, TruncateAt.END, TruncateAt.END},
+                                new boolean[] {true, true, true});
                     }
                 }
 
@@ -501,7 +506,7 @@
                 (LinearLayout) mRequestView.findViewById(R.id.payment_container_layout);
         mOrderSummarySection = new LineItemBreakdownSection(
                 activity, activity.getString(R.string.payments_order_summary_label), this);
-        mShippingSummarySection = new ExtraTextSection(
+        mShippingSummarySection = new ExtraTextsSection(
                 activity, activity.getString(R.string.payments_shipping_summary_label), this);
         mShippingAddressSection = new OptionSection(
                 activity, activity.getString(R.string.payments_shipping_address_label), this);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java
index b142a999..a63a266 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java
@@ -74,7 +74,12 @@
                              .getString(DEPRECATED_PREF_CRASH_DUMP_UPLOAD, crashDumpNeverUpload)
                              .equals(crashDumpNeverUpload));
 
+            // Remove both this preference and the related one. If the related one is not removed
+            // now, later migrations could read from it and clobber the state.
             editor.remove(DEPRECATED_PREF_CRASH_DUMP_UPLOAD);
+            if (mSharedPreferences.contains(DEPRECATED_PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR)) {
+                editor.remove(DEPRECATED_PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR);
+            }
         } else if (mSharedPreferences.contains(DEPRECATED_PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR)) {
             setUsageAndCrashReporting(mSharedPreferences.getBoolean(
                     DEPRECATED_PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR, false));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
index 2f509b68..9b2e015 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -1838,8 +1838,7 @@
             }
             mInfoBarContainer.setContentViewCore(mContentViewCore);
 
-            mSwipeRefreshHandler = new SwipeRefreshHandler(mThemedApplicationContext);
-            mSwipeRefreshHandler.setContentViewCore(mContentViewCore);
+            mSwipeRefreshHandler = new SwipeRefreshHandler(mThemedApplicationContext, this);
 
             updateThemeColorIfNeeded(false);
             notifyContentChanged();
@@ -2356,7 +2355,7 @@
             mInfoBarContainer.setContentViewCore(null);
         }
         if (mSwipeRefreshHandler != null) {
-            mSwipeRefreshHandler.setContentViewCore(null);
+            mSwipeRefreshHandler.destroy();
             mSwipeRefreshHandler = null;
         }
         mContentViewParent = null;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java
index 99f30f2f..26f5e00 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java
@@ -4,54 +4,28 @@
 
 package org.chromium.chrome.browser.vr_shell;
 
-import android.app.Activity;
-import android.os.StrictMode;
-
-import com.google.vr.ndk.base.GvrLayout;
-
-import org.chromium.base.Log;
-import org.chromium.base.annotations.UsedByReflection;
-
 /**
- * Creates an active GvrContext from a detached GvrLayout. This is used by magic window mode.
+ * Abstracts away the NonPresentingGvrContext class, which may or may not be present at runtime
+ * depending on compile flags.
  */
-@UsedByReflection("VrShellDelegate.java")
-public class NonPresentingGvrContext implements NonPresentingGvrContextInterface {
-    private static final String TAG = "NPGvrContext";
-    private GvrLayout mGvrLayout;
+public interface NonPresentingGvrContext {
+    /**
+     * Returns the native gvr context.
+     */
+    long getNativeGvrContext();
 
-    @UsedByReflection("VrShellDelegate.java")
-    public NonPresentingGvrContext(Activity activity) {
-        mGvrLayout = new GvrLayout(activity);
-    }
+    /**
+     * Must be called when activity resumes.
+     */
+    void resume();
 
-    @Override
-    public long getNativeGvrContext() {
-        long nativeGvrContext = 0;
-        StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
-        try {
-            nativeGvrContext = mGvrLayout.getGvrApi().getNativeGvrContext();
-        } catch (Exception ex) {
-            Log.e(TAG, "Unable to instantiate GvrApi", ex);
-            return 0;
-        } finally {
-            StrictMode.setThreadPolicy(oldPolicy);
-        }
-        return nativeGvrContext;
-    }
+    /**
+     * Must be called when activity pauses.
+     */
+    void pause();
 
-    @Override
-    public void resume() {
-        mGvrLayout.onResume();
-    }
-
-    @Override
-    public void pause() {
-        mGvrLayout.onPause();
-    }
-
-    @Override
-    public void shutdown() {
-        mGvrLayout.shutdown();
-    }
+    /**
+     * Shutdown the native gvr context.
+     */
+    void shutdown();
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java
new file mode 100644
index 0000000..660cd0c
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java
@@ -0,0 +1,57 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.vr_shell;
+
+import android.app.Activity;
+import android.os.StrictMode;
+
+import com.google.vr.ndk.base.GvrLayout;
+
+import org.chromium.base.Log;
+import org.chromium.base.annotations.UsedByReflection;
+
+/**
+ * Creates an active GvrContext from a detached GvrLayout. This is used by magic window mode.
+ */
+@UsedByReflection("VrShellDelegate.java")
+public class NonPresentingGvrContextImpl implements NonPresentingGvrContext {
+    private static final String TAG = "NPGvrContextImpl";
+    private GvrLayout mGvrLayout;
+
+    @UsedByReflection("VrShellDelegate.java")
+    public NonPresentingGvrContextImpl(Activity activity) {
+        mGvrLayout = new GvrLayout(activity);
+    }
+
+    @Override
+    public long getNativeGvrContext() {
+        long nativeGvrContext = 0;
+        StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+        try {
+            nativeGvrContext = mGvrLayout.getGvrApi().getNativeGvrContext();
+        } catch (Exception ex) {
+            Log.e(TAG, "Unable to instantiate GvrApi", ex);
+            return 0;
+        } finally {
+            StrictMode.setThreadPolicy(oldPolicy);
+        }
+        return nativeGvrContext;
+    }
+
+    @Override
+    public void resume() {
+        mGvrLayout.onResume();
+    }
+
+    @Override
+    public void pause() {
+        mGvrLayout.onPause();
+    }
+
+    @Override
+    public void shutdown() {
+        mGvrLayout.shutdown();
+    }
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextInterface.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextInterface.java
deleted file mode 100644
index 614e6fe6..0000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextInterface.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.vr_shell;
-
-/**
- * Abstracts away the NonPresentingGvrContext class, which may or may not be present at runtime
- * depending on compile flags.
- */
-public interface NonPresentingGvrContextInterface {
-    /**
-     * Returns the native gvr context.
-     */
-    long getNativeGvrContext();
-
-    /**
-     * Must be called when activity resumes.
-     */
-    void resume();
-
-    /**
-     * Must be called when activity pauses.
-     */
-    void pause();
-
-    /**
-     * Shutdown the native gvr context.
-     */
-    void shutdown();
-}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShell.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShell.java
index ec33e49..ceeb17e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShell.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShell.java
@@ -4,379 +4,47 @@
 
 package org.chromium.chrome.browser.vr_shell;
 
-import static android.opengl.GLES20.GL_NEAREST;
-import static android.opengl.GLES20.GL_TEXTURE_MAG_FILTER;
-import static android.opengl.GLES20.GL_TEXTURE_MIN_FILTER;
-import static android.opengl.GLES20.glBindTexture;
-import static android.opengl.GLES20.glGenTextures;
-import static android.opengl.GLES20.glTexParameteri;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.graphics.SurfaceTexture;
-import android.graphics.SurfaceTexture.OnFrameAvailableListener;
-import android.opengl.GLES11Ext;
-import android.opengl.GLSurfaceView;
-import android.os.StrictMode;
-import android.view.MotionEvent;
-import android.view.Surface;
-import android.view.View;
-import android.view.ViewGroup;
 import android.widget.FrameLayout;
 
-import com.google.vr.ndk.base.AndroidCompat;
-import com.google.vr.ndk.base.GvrLayout;
-
-import org.chromium.base.CommandLine;
-import org.chromium.base.ThreadUtils;
-import org.chromium.base.annotations.JNINamespace;
-import org.chromium.base.annotations.UsedByReflection;
-import org.chromium.chrome.browser.ChromeSwitches;
-import org.chromium.chrome.browser.ChromeVersionInfo;
-import org.chromium.chrome.browser.WebContentsFactory;
 import org.chromium.chrome.browser.tab.Tab;
-import org.chromium.content.browser.ContentView;
-import org.chromium.content.browser.ContentViewCore;
-import org.chromium.content_public.browser.WebContents;
-import org.chromium.ui.base.ViewAndroidDelegate;
-import org.chromium.ui.base.WindowAndroid;
-
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
 
 /**
- * This view extends from GvrLayout which wraps a GLSurfaceView that renders VR shell.
+ * Abstracts away the VrShell class, which may or may not be present at runtime depending on
+ * compile flags.
  */
-@JNINamespace("vr_shell")
-@UsedByReflection("VrShellDelegate.java")
-public class VrShell extends GvrLayout implements GLSurfaceView.Renderer, VrShellInterface {
-    private static final String TAG = "VrShell";
-
-    @UsedByReflection("VrShellDelegate.java")
-    public static final String VR_EXTRA = com.google.vr.sdk.base.Constants.EXTRA_VR_LAUNCH;
-
-    private Activity mActivity;
-
-    private final GLSurfaceView mGlSurfaceView;
-
-    private long mNativeVrShell = 0;
-
-    private int mContentTextureHandle;
-    private int mUiTextureHandle;
-    private FrameListener mContentFrameListener;
-    private FrameListener mUiFrameListener;
-
-    private FrameLayout mContentViewCoreContainer;
-
-    // The tab that holds the main ContentViewCore.
-    private Tab mTab;
-
-    // The ContentViewCore for the main content rect in VR.
-    private ContentViewCore mContentCVC;
-
-    // The non-VR container view for mContentCVC.
-    private ViewGroup mOriginalContentViewParent;
-
-    // TODO(mthiesse): Instead of caching these values, make tab reparenting work for this case.
-    private int mOriginalContentViewIndex;
-    private ViewGroup.LayoutParams mOriginalLayoutParams;
-    private WindowAndroid mOriginalWindowAndroid;
-
-    private VrWindowAndroid mContentVrWindowAndroid;
-
-    private WebContents mUiContents;
-    private ContentViewCore mUiCVC;
-    private VrWindowAndroid mUiVrWindowAndroid;
-
-    @UsedByReflection("VrShellDelegate.java")
-    public VrShell(Activity activity) {
-        super(activity);
-        mActivity = activity;
-        mContentViewCoreContainer = new FrameLayout(getContext()) {
-            @Override
-            public boolean dispatchTouchEvent(MotionEvent event) {
-                return true;
-            }
-        };
-        addView(mContentViewCoreContainer, 0, new FrameLayout.LayoutParams(
-                FrameLayout.LayoutParams.MATCH_PARENT,
-                FrameLayout.LayoutParams.MATCH_PARENT));
-        mGlSurfaceView = new GLSurfaceView(getContext());
-        mGlSurfaceView.setEGLContextClientVersion(2);
-        mGlSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0);
-        mGlSurfaceView.setPreserveEGLContextOnPause(true);
-        mGlSurfaceView.setRenderer(this);
-        setPresentationView(mGlSurfaceView);
-
-        if (setAsyncReprojectionEnabled(true)) {
-            AndroidCompat.setSustainedPerformanceMode(mActivity, true);
-        }
-    }
-
-    @Override
-    public void initializeNative(Tab currentTab, VrShellDelegate delegate) {
-        assert currentTab.getContentViewCore() != null;
-        mTab = currentTab;
-        mContentCVC = mTab.getContentViewCore();
-        mContentVrWindowAndroid = new VrWindowAndroid(mActivity);
-
-        mUiVrWindowAndroid = new VrWindowAndroid(mActivity);
-        mUiContents = WebContentsFactory.createWebContents(true, false);
-        mUiCVC = new ContentViewCore(mActivity, ChromeVersionInfo.getProductVersion());
-        ContentView uiContentView = ContentView.createContentView(mActivity, mUiCVC);
-        mUiCVC.initialize(ViewAndroidDelegate.createBasicDelegate(uiContentView),
-                uiContentView, mUiContents, mUiVrWindowAndroid);
-
-        mNativeVrShell = nativeInit(mContentCVC.getWebContents(),
-                mContentVrWindowAndroid.getNativePointer(),
-                mUiContents, mUiVrWindowAndroid.getNativePointer());
-        mGlSurfaceView.setOnTouchListener(new View.OnTouchListener() {
-            @Override
-            @SuppressLint("ClickableViewAccessibility")
-            public boolean onTouch(View v, MotionEvent event) {
-                if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
-                        && event.getActionMasked() == MotionEvent.ACTION_DOWN) {
-                    nativeOnTriggerEvent(mNativeVrShell);
-                    return true;
-                }
-                return false;
-            }
-        });
-
-        uiContentView.setVisibility(View.VISIBLE);
-        mUiCVC.onShow();
-        mContentViewCoreContainer.addView(uiContentView, new FrameLayout.LayoutParams(
-                FrameLayout.LayoutParams.MATCH_PARENT,
-                FrameLayout.LayoutParams.MATCH_PARENT));
-        mUiCVC.setBottomControlsHeight(0);
-        mUiCVC.setTopControlsHeight(0, false);
-        mUiVrWindowAndroid.onVisibilityChanged(true);
-
-        nativeSetDelegate(mNativeVrShell, delegate);
-
-        reparentContentWindow();
-
-        nativeUpdateCompositorLayers(mNativeVrShell);
-    }
-
-    private void reparentContentWindow() {
-        mOriginalWindowAndroid = mContentCVC.getWindowAndroid();
-
-        // TODO(mthiesse): Update the WindowAndroid in ChromeActivity too?
-        mTab.updateWindowAndroid(null);
-        mTab.updateWindowAndroid(mContentVrWindowAndroid);
-
-        ViewGroup contentContentView = mContentCVC.getContainerView();
-        mOriginalContentViewParent = ((ViewGroup) contentContentView.getParent());
-        mOriginalContentViewIndex = mOriginalContentViewParent.indexOfChild(contentContentView);
-        mOriginalLayoutParams = contentContentView.getLayoutParams();
-        mOriginalContentViewParent.removeView(contentContentView);
-
-        mContentViewCoreContainer.addView(contentContentView, new FrameLayout.LayoutParams(
-                FrameLayout.LayoutParams.MATCH_PARENT,
-                FrameLayout.LayoutParams.MATCH_PARENT));
-    }
-
-    private void restoreContentWindow() {
-        ViewGroup contentContentView = mContentCVC.getContainerView();
-        mTab.updateWindowAndroid(null);
-        mTab.updateWindowAndroid(mOriginalWindowAndroid);
-        mContentViewCoreContainer.removeView(contentContentView);
-        mOriginalContentViewParent.addView(contentContentView, mOriginalContentViewIndex,
-                mOriginalLayoutParams);
-    }
-
-    private static class FrameListener implements OnFrameAvailableListener {
-        final SurfaceTexture mSurfaceTexture;
-        final GLSurfaceView mGlSurfaceView;
-        boolean mFirstTex = true;
-
-        final Runnable mUpdateTexImage = new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    mSurfaceTexture.updateTexImage();
-                } catch (IllegalStateException e) {
-                }
-            }
-        };
-
-        public FrameListener(int textureId, GLSurfaceView glSurfaceView) {
-            mSurfaceTexture = new SurfaceTexture(textureId);
-            mSurfaceTexture.setOnFrameAvailableListener(this);
-            mGlSurfaceView = glSurfaceView;
-        }
-
-        @Override
-        public void onFrameAvailable(SurfaceTexture surfaceTexture) {
-            mFirstTex = false;
-            mGlSurfaceView.queueEvent(mUpdateTexImage);
-        }
-    }
-
-    @Override
-    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
-        final int width = mContentCVC.getContainerView().getWidth();
-        final int height = mContentCVC.getContainerView().getHeight();
-        mContentTextureHandle = createExternalTextureHandle();
-        mUiTextureHandle = createExternalTextureHandle();
-
-        mContentFrameListener = new FrameListener(mContentTextureHandle, mGlSurfaceView);
-        mUiFrameListener = new FrameListener(mUiTextureHandle, mGlSurfaceView);
-
-        mContentFrameListener.mSurfaceTexture.setDefaultBufferSize(width, height);
-        mUiFrameListener.mSurfaceTexture.setDefaultBufferSize(width, height);
-
-        ThreadUtils.postOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                nativeContentSurfaceChanged(mNativeVrShell, width, height,
-                        new Surface(mContentFrameListener.mSurfaceTexture));
-                mContentCVC.onPhysicalBackingSizeChanged(width, height);
-                nativeUiSurfaceChanged(mNativeVrShell, width, height,
-                        new Surface(mUiFrameListener.mSurfaceTexture));
-                mUiCVC.onPhysicalBackingSizeChanged(width, height);
-            }
-        });
-
-        nativeGvrInit(mNativeVrShell, getGvrApi().getNativeGvrContext());
-        nativeInitializeGl(mNativeVrShell, mContentTextureHandle, mUiTextureHandle);
-    }
-
-    @Override
-    public void onSurfaceChanged(GL10 gl, int width, int height) {}
-
-    @Override
-    public void onDrawFrame(GL10 gl) {
-        // Make sure we've updated the texture at least once. We do this because onFrameAvailable
-        // isn't guaranteed to have fired after transitioning to VR. It only fires when the texture
-        // is updated either through scrolling, resizing, etc. - none of which we're guaranteed to
-        // have done on transition.
-        if (mUiFrameListener.mFirstTex) {
-            mUiFrameListener.mSurfaceTexture.updateTexImage();
-            mUiFrameListener.mFirstTex = false;
-        }
-        if (mContentFrameListener.mFirstTex) {
-            mContentFrameListener.mSurfaceTexture.updateTexImage();
-            mContentFrameListener.mFirstTex = false;
-        }
-
-        nativeDrawFrame(mNativeVrShell);
-    }
-
-    @Override
-    public boolean dispatchTouchEvent(MotionEvent event) {
-        // Normally, touch event is dispatched to presentation view only if the phone is paired with
-        // a Cardboard viewer. This is annoying when we just want to quickly verify a Cardboard
-        // behavior. This allows us to trigger cardboard trigger event without pair to a Cardboard.
-        if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
-                && event.getActionMasked() == MotionEvent.ACTION_DOWN) {
-            nativeOnTriggerEvent(mNativeVrShell);
-        }
-        return super.dispatchTouchEvent(event);
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        if (mNativeVrShell != 0) {
-            // Refreshing the viewer profile accesses disk, so we need to temporarily allow disk
-            // reads. The GVR team promises this will be fixed when they launch.
-            StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
-            try {
-                nativeOnResume(mNativeVrShell);
-            } finally {
-                StrictMode.setThreadPolicy(oldPolicy);
-            }
-        }
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        if (mNativeVrShell != 0) {
-            nativeOnPause(mNativeVrShell);
-        }
-    }
-
-    @Override
-    public void shutdown() {
-        super.shutdown();
-        if (mNativeVrShell != 0) {
-            nativeDestroy(mNativeVrShell);
-            mNativeVrShell = 0;
-        }
-        if (mContentFrameListener != null && mContentFrameListener.mSurfaceTexture != null) {
-            mContentFrameListener.mSurfaceTexture.release();
-        }
-        if (mUiFrameListener != null && mUiFrameListener.mSurfaceTexture != null) {
-            mUiFrameListener.mSurfaceTexture.release();
-        }
-        restoreContentWindow();
-    }
-
-    @Override
-    public void pause() {
-        onPause();
-    }
-
-    @Override
-    public void resume() {
-        onResume();
-    }
-
-    @Override
-    public void teardown() {
-        shutdown();
-    }
-
-    @Override
-    public void setVrModeEnabled(boolean enabled) {
-        AndroidCompat.setVrModeEnabled(mActivity, enabled);
-    }
-
-    @Override
-    public void setWebVrModeEnabled(boolean enabled) {
-        nativeSetWebVrMode(mNativeVrShell, enabled);
-    }
-
-    @Override
-    public FrameLayout getContainer() {
-        return (FrameLayout) this;
-    }
+public interface VrShell {
+    /**
+     * Performs native VrShell initialization.
+     */
+    void initializeNative(Tab currentTab, VrShellDelegate delegate);
 
     /**
-     * Create a new GLES11Ext.GL_TEXTURE_EXTERNAL_OES texture handle.
-     * @return New texture handle.
+     * Pauses VrShell.
      */
-    private int createExternalTextureHandle() {
-        int[] textureDataHandle = new int[1];
-        glGenTextures(1, textureDataHandle, 0);
-        if (textureDataHandle[0] != 0) {
-            glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureDataHandle[0]);
-            glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-            glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-            return textureDataHandle[0];
-        } else {
-            throw new RuntimeException("Error generating texture handle.");
-        }
-    }
+    void pause();
 
-    private native long nativeInit(WebContents contentWebContents, long nativeContentWindowAndroid,
-            WebContents uiWebContents, long nativeUiWindowAndroid);
-    private native void nativeSetDelegate(long nativeVrShell, VrShellDelegate delegate);
-    private native void nativeGvrInit(long nativeVrShell, long nativeGvrApi);
-    private native void nativeDestroy(long nativeVrShell);
-    private native void nativeInitializeGl(
-            long nativeVrShell, int contentTextureHandle, int uiTextureHandle);
-    private native void nativeDrawFrame(long nativeVrShell);
-    private native void nativeOnTriggerEvent(long nativeVrShell);
-    private native void nativeOnPause(long nativeVrShell);
-    private native void nativeOnResume(long nativeVrShell);
-    private native void nativeContentSurfaceChanged(
-            long nativeVrShell, int width, int height, Surface surface);
-    private native void nativeUiSurfaceChanged(
-            long nativeVrShell, int width, int height, Surface surface);
-    private native void nativeUpdateCompositorLayers(long nativeVrShell);
-    private native void nativeSetWebVrMode(long nativeVrShell, boolean enabled);
+    /**
+     * Resumes VrShell.
+     */
+    void resume();
+
+    /**
+     * Destroys VrShell.
+     */
+    void teardown();
+
+    /**
+     * Sets Android VR Mode to |enabled|.
+     */
+    void setVrModeEnabled(boolean enabled);
+
+    /**
+     * Sets whether we're presenting WebVR content or not.
+     */
+    void setWebVrModeEnabled(boolean enabled);
+
+    /**
+     * Returns the GVRLayout as a FrameLayout.
+     */
+    FrameLayout getContainer();
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index 4ff15e4..776d2a6b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -34,10 +34,10 @@
 
     private boolean mVrEnabled;
 
-    private Class<? extends VrShellInterface> mVrShellClass;
-    private Class<? extends NonPresentingGvrContextInterface> mNonPresentingGvrContextClass;
-    private VrShellInterface mVrShell;
-    private NonPresentingGvrContextInterface mNonPresentingGvrContext;
+    private Class<? extends VrShell> mVrShellClass;
+    private Class<? extends NonPresentingGvrContext> mNonPresentingGvrContextClass;
+    private VrShell mVrShell;
+    private NonPresentingGvrContext mNonPresentingGvrContext;
     private boolean mInVr;
     private int mRestoreSystemUiVisibilityFlag = -1;
     private String mVrExtra;
@@ -70,11 +70,11 @@
     @SuppressWarnings("unchecked")
     private boolean maybeFindVrClasses() {
         try {
-            mVrShellClass = (Class<? extends VrShellInterface>) Class.forName(
-                    "org.chromium.chrome.browser.vr_shell.VrShell");
+            mVrShellClass = (Class<? extends VrShell>) Class.forName(
+                    "org.chromium.chrome.browser.vr_shell.VrShellImpl");
             mNonPresentingGvrContextClass =
-                    (Class<? extends NonPresentingGvrContextInterface>) Class.forName(
-                            "org.chromium.chrome.browser.vr_shell.NonPresentingGvrContext");
+                    (Class<? extends NonPresentingGvrContext>) Class.forName(
+                            "org.chromium.chrome.browser.vr_shell.NonPresentingGvrContextImpl");
             return true;
         } catch (ClassNotFoundException e) {
             mVrShellClass = null;
@@ -195,7 +195,7 @@
             Constructor<?> nonPresentingGvrContextConstructor =
                     mNonPresentingGvrContextClass.getConstructor(Activity.class);
             mNonPresentingGvrContext =
-                    (NonPresentingGvrContextInterface)
+                    (NonPresentingGvrContext)
                             nonPresentingGvrContextConstructor.newInstance(mActivity);
         } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
                 | InvocationTargetException | NoSuchMethodException e) {
@@ -232,7 +232,7 @@
         StrictMode.allowThreadDiskWrites();
         try {
             Constructor<?> vrShellConstructor = mVrShellClass.getConstructor(Activity.class);
-            mVrShell = (VrShellInterface) vrShellConstructor.newInstance(mActivity);
+            mVrShell = (VrShell) vrShellConstructor.newInstance(mActivity);
         } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
                 | InvocationTargetException | NoSuchMethodException e) {
             Log.e(TAG, "Unable to instantiate VrShell", e);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
new file mode 100644
index 0000000..bb3e4a1
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
@@ -0,0 +1,382 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.vr_shell;
+
+import static android.opengl.GLES20.GL_NEAREST;
+import static android.opengl.GLES20.GL_TEXTURE_MAG_FILTER;
+import static android.opengl.GLES20.GL_TEXTURE_MIN_FILTER;
+import static android.opengl.GLES20.glBindTexture;
+import static android.opengl.GLES20.glGenTextures;
+import static android.opengl.GLES20.glTexParameteri;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.graphics.SurfaceTexture;
+import android.graphics.SurfaceTexture.OnFrameAvailableListener;
+import android.opengl.GLES11Ext;
+import android.opengl.GLSurfaceView;
+import android.os.StrictMode;
+import android.view.MotionEvent;
+import android.view.Surface;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+
+import com.google.vr.ndk.base.AndroidCompat;
+import com.google.vr.ndk.base.GvrLayout;
+
+import org.chromium.base.CommandLine;
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.base.annotations.UsedByReflection;
+import org.chromium.chrome.browser.ChromeSwitches;
+import org.chromium.chrome.browser.ChromeVersionInfo;
+import org.chromium.chrome.browser.WebContentsFactory;
+import org.chromium.chrome.browser.tab.Tab;
+import org.chromium.content.browser.ContentView;
+import org.chromium.content.browser.ContentViewCore;
+import org.chromium.content_public.browser.WebContents;
+import org.chromium.ui.base.ViewAndroidDelegate;
+import org.chromium.ui.base.WindowAndroid;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+/**
+ * This view extends from GvrLayout which wraps a GLSurfaceView that renders VR shell.
+ */
+@JNINamespace("vr_shell")
+@UsedByReflection("VrShellDelegate.java")
+public class VrShellImpl extends GvrLayout implements GLSurfaceView.Renderer, VrShell {
+    private static final String TAG = "VrShellImpl";
+
+    @UsedByReflection("VrShellDelegate.java")
+    public static final String VR_EXTRA = com.google.vr.sdk.base.Constants.EXTRA_VR_LAUNCH;
+
+    private Activity mActivity;
+
+    private final GLSurfaceView mGlSurfaceView;
+
+    private long mNativeVrShell = 0;
+
+    private int mContentTextureHandle;
+    private int mUiTextureHandle;
+    private FrameListener mContentFrameListener;
+    private FrameListener mUiFrameListener;
+
+    private FrameLayout mContentViewCoreContainer;
+
+    // The tab that holds the main ContentViewCore.
+    private Tab mTab;
+
+    // The ContentViewCore for the main content rect in VR.
+    private ContentViewCore mContentCVC;
+
+    // The non-VR container view for mContentCVC.
+    private ViewGroup mOriginalContentViewParent;
+
+    // TODO(mthiesse): Instead of caching these values, make tab reparenting work for this case.
+    private int mOriginalContentViewIndex;
+    private ViewGroup.LayoutParams mOriginalLayoutParams;
+    private WindowAndroid mOriginalWindowAndroid;
+
+    private VrWindowAndroid mContentVrWindowAndroid;
+
+    private WebContents mUiContents;
+    private ContentViewCore mUiCVC;
+    private VrWindowAndroid mUiVrWindowAndroid;
+
+    @UsedByReflection("VrShellDelegate.java")
+    public VrShellImpl(Activity activity) {
+        super(activity);
+        mActivity = activity;
+        mContentViewCoreContainer = new FrameLayout(getContext()) {
+            @Override
+            public boolean dispatchTouchEvent(MotionEvent event) {
+                return true;
+            }
+        };
+        addView(mContentViewCoreContainer, 0, new FrameLayout.LayoutParams(
+                FrameLayout.LayoutParams.MATCH_PARENT,
+                FrameLayout.LayoutParams.MATCH_PARENT));
+        mGlSurfaceView = new GLSurfaceView(getContext());
+        mGlSurfaceView.setEGLContextClientVersion(2);
+        mGlSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0);
+        mGlSurfaceView.setPreserveEGLContextOnPause(true);
+        mGlSurfaceView.setRenderer(this);
+        setPresentationView(mGlSurfaceView);
+
+        if (setAsyncReprojectionEnabled(true)) {
+            AndroidCompat.setSustainedPerformanceMode(mActivity, true);
+        }
+    }
+
+    @Override
+    public void initializeNative(Tab currentTab, VrShellDelegate delegate) {
+        assert currentTab.getContentViewCore() != null;
+        mTab = currentTab;
+        mContentCVC = mTab.getContentViewCore();
+        mContentVrWindowAndroid = new VrWindowAndroid(mActivity);
+
+        mUiVrWindowAndroid = new VrWindowAndroid(mActivity);
+        mUiContents = WebContentsFactory.createWebContents(true, false);
+        mUiCVC = new ContentViewCore(mActivity, ChromeVersionInfo.getProductVersion());
+        ContentView uiContentView = ContentView.createContentView(mActivity, mUiCVC);
+        mUiCVC.initialize(ViewAndroidDelegate.createBasicDelegate(uiContentView),
+                uiContentView, mUiContents, mUiVrWindowAndroid);
+
+        mNativeVrShell = nativeInit(mContentCVC.getWebContents(),
+                mContentVrWindowAndroid.getNativePointer(),
+                mUiContents, mUiVrWindowAndroid.getNativePointer());
+        mGlSurfaceView.setOnTouchListener(new View.OnTouchListener() {
+            @Override
+            @SuppressLint("ClickableViewAccessibility")
+            public boolean onTouch(View v, MotionEvent event) {
+                if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
+                        && event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+                    nativeOnTriggerEvent(mNativeVrShell);
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        uiContentView.setVisibility(View.VISIBLE);
+        mUiCVC.onShow();
+        mContentViewCoreContainer.addView(uiContentView, new FrameLayout.LayoutParams(
+                FrameLayout.LayoutParams.MATCH_PARENT,
+                FrameLayout.LayoutParams.MATCH_PARENT));
+        mUiCVC.setBottomControlsHeight(0);
+        mUiCVC.setTopControlsHeight(0, false);
+        mUiVrWindowAndroid.onVisibilityChanged(true);
+
+        nativeSetDelegate(mNativeVrShell, delegate);
+
+        reparentContentWindow();
+
+        nativeUpdateCompositorLayers(mNativeVrShell);
+    }
+
+    private void reparentContentWindow() {
+        mOriginalWindowAndroid = mContentCVC.getWindowAndroid();
+
+        // TODO(mthiesse): Update the WindowAndroid in ChromeActivity too?
+        mTab.updateWindowAndroid(null);
+        mTab.updateWindowAndroid(mContentVrWindowAndroid);
+
+        ViewGroup contentContentView = mContentCVC.getContainerView();
+        mOriginalContentViewParent = ((ViewGroup) contentContentView.getParent());
+        mOriginalContentViewIndex = mOriginalContentViewParent.indexOfChild(contentContentView);
+        mOriginalLayoutParams = contentContentView.getLayoutParams();
+        mOriginalContentViewParent.removeView(contentContentView);
+
+        mContentViewCoreContainer.addView(contentContentView, new FrameLayout.LayoutParams(
+                FrameLayout.LayoutParams.MATCH_PARENT,
+                FrameLayout.LayoutParams.MATCH_PARENT));
+    }
+
+    private void restoreContentWindow() {
+        ViewGroup contentContentView = mContentCVC.getContainerView();
+        mTab.updateWindowAndroid(null);
+        mTab.updateWindowAndroid(mOriginalWindowAndroid);
+        mContentViewCoreContainer.removeView(contentContentView);
+        mOriginalContentViewParent.addView(contentContentView, mOriginalContentViewIndex,
+                mOriginalLayoutParams);
+    }
+
+    private static class FrameListener implements OnFrameAvailableListener {
+        final SurfaceTexture mSurfaceTexture;
+        final GLSurfaceView mGlSurfaceView;
+        boolean mFirstTex = true;
+
+        final Runnable mUpdateTexImage = new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    mSurfaceTexture.updateTexImage();
+                } catch (IllegalStateException e) {
+                }
+            }
+        };
+
+        public FrameListener(int textureId, GLSurfaceView glSurfaceView) {
+            mSurfaceTexture = new SurfaceTexture(textureId);
+            mSurfaceTexture.setOnFrameAvailableListener(this);
+            mGlSurfaceView = glSurfaceView;
+        }
+
+        @Override
+        public void onFrameAvailable(SurfaceTexture surfaceTexture) {
+            mFirstTex = false;
+            mGlSurfaceView.queueEvent(mUpdateTexImage);
+        }
+    }
+
+    @Override
+    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+        final int width = mContentCVC.getContainerView().getWidth();
+        final int height = mContentCVC.getContainerView().getHeight();
+        mContentTextureHandle = createExternalTextureHandle();
+        mUiTextureHandle = createExternalTextureHandle();
+
+        mContentFrameListener = new FrameListener(mContentTextureHandle, mGlSurfaceView);
+        mUiFrameListener = new FrameListener(mUiTextureHandle, mGlSurfaceView);
+
+        mContentFrameListener.mSurfaceTexture.setDefaultBufferSize(width, height);
+        mUiFrameListener.mSurfaceTexture.setDefaultBufferSize(width, height);
+
+        ThreadUtils.postOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                nativeContentSurfaceChanged(mNativeVrShell, width, height,
+                        new Surface(mContentFrameListener.mSurfaceTexture));
+                mContentCVC.onPhysicalBackingSizeChanged(width, height);
+                nativeUiSurfaceChanged(mNativeVrShell, width, height,
+                        new Surface(mUiFrameListener.mSurfaceTexture));
+                mUiCVC.onPhysicalBackingSizeChanged(width, height);
+            }
+        });
+
+        nativeGvrInit(mNativeVrShell, getGvrApi().getNativeGvrContext());
+        nativeInitializeGl(mNativeVrShell, mContentTextureHandle, mUiTextureHandle);
+    }
+
+    @Override
+    public void onSurfaceChanged(GL10 gl, int width, int height) {}
+
+    @Override
+    public void onDrawFrame(GL10 gl) {
+        // Make sure we've updated the texture at least once. We do this because onFrameAvailable
+        // isn't guaranteed to have fired after transitioning to VR. It only fires when the texture
+        // is updated either through scrolling, resizing, etc. - none of which we're guaranteed to
+        // have done on transition.
+        if (mUiFrameListener.mFirstTex) {
+            mUiFrameListener.mSurfaceTexture.updateTexImage();
+            mUiFrameListener.mFirstTex = false;
+        }
+        if (mContentFrameListener.mFirstTex) {
+            mContentFrameListener.mSurfaceTexture.updateTexImage();
+            mContentFrameListener.mFirstTex = false;
+        }
+
+        nativeDrawFrame(mNativeVrShell);
+    }
+
+    @Override
+    public boolean dispatchTouchEvent(MotionEvent event) {
+        // Normally, touch event is dispatched to presentation view only if the phone is paired with
+        // a Cardboard viewer. This is annoying when we just want to quickly verify a Cardboard
+        // behavior. This allows us to trigger cardboard trigger event without pair to a Cardboard.
+        if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
+                && event.getActionMasked() == MotionEvent.ACTION_DOWN) {
+            nativeOnTriggerEvent(mNativeVrShell);
+        }
+        return super.dispatchTouchEvent(event);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        if (mNativeVrShell != 0) {
+            // Refreshing the viewer profile accesses disk, so we need to temporarily allow disk
+            // reads. The GVR team promises this will be fixed when they launch.
+            StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+            try {
+                nativeOnResume(mNativeVrShell);
+            } finally {
+                StrictMode.setThreadPolicy(oldPolicy);
+            }
+        }
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        if (mNativeVrShell != 0) {
+            nativeOnPause(mNativeVrShell);
+        }
+    }
+
+    @Override
+    public void shutdown() {
+        super.shutdown();
+        if (mNativeVrShell != 0) {
+            nativeDestroy(mNativeVrShell);
+            mNativeVrShell = 0;
+        }
+        if (mContentFrameListener != null && mContentFrameListener.mSurfaceTexture != null) {
+            mContentFrameListener.mSurfaceTexture.release();
+        }
+        if (mUiFrameListener != null && mUiFrameListener.mSurfaceTexture != null) {
+            mUiFrameListener.mSurfaceTexture.release();
+        }
+        restoreContentWindow();
+    }
+
+    @Override
+    public void pause() {
+        onPause();
+    }
+
+    @Override
+    public void resume() {
+        onResume();
+    }
+
+    @Override
+    public void teardown() {
+        shutdown();
+    }
+
+    @Override
+    public void setVrModeEnabled(boolean enabled) {
+        AndroidCompat.setVrModeEnabled(mActivity, enabled);
+    }
+
+    @Override
+    public void setWebVrModeEnabled(boolean enabled) {
+        nativeSetWebVrMode(mNativeVrShell, enabled);
+    }
+
+    @Override
+    public FrameLayout getContainer() {
+        return (FrameLayout) this;
+    }
+
+    /**
+     * Create a new GLES11Ext.GL_TEXTURE_EXTERNAL_OES texture handle.
+     * @return New texture handle.
+     */
+    private int createExternalTextureHandle() {
+        int[] textureDataHandle = new int[1];
+        glGenTextures(1, textureDataHandle, 0);
+        if (textureDataHandle[0] != 0) {
+            glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureDataHandle[0]);
+            glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+            glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+            return textureDataHandle[0];
+        } else {
+            throw new RuntimeException("Error generating texture handle.");
+        }
+    }
+
+    private native long nativeInit(WebContents contentWebContents, long nativeContentWindowAndroid,
+            WebContents uiWebContents, long nativeUiWindowAndroid);
+    private native void nativeSetDelegate(long nativeVrShell, VrShellDelegate delegate);
+    private native void nativeGvrInit(long nativeVrShell, long nativeGvrApi);
+    private native void nativeDestroy(long nativeVrShell);
+    private native void nativeInitializeGl(
+            long nativeVrShell, int contentTextureHandle, int uiTextureHandle);
+    private native void nativeDrawFrame(long nativeVrShell);
+    private native void nativeOnTriggerEvent(long nativeVrShell);
+    private native void nativeOnPause(long nativeVrShell);
+    private native void nativeOnResume(long nativeVrShell);
+    private native void nativeContentSurfaceChanged(
+            long nativeVrShell, int width, int height, Surface surface);
+    private native void nativeUiSurfaceChanged(
+            long nativeVrShell, int width, int height, Surface surface);
+    private native void nativeUpdateCompositorLayers(long nativeVrShell);
+    private native void nativeSetWebVrMode(long nativeVrShell, boolean enabled);
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellInterface.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellInterface.java
deleted file mode 100644
index 0e5c77a..0000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellInterface.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.vr_shell;
-
-import android.widget.FrameLayout;
-
-import org.chromium.chrome.browser.tab.Tab;
-
-/**
- * Abstracts away the VrShell class, which may or may not be present at runtime depending on
- * compile flags.
- */
-public interface VrShellInterface {
-    /**
-     * Performs native VrShell initialization.
-     */
-    void initializeNative(Tab currentTab, VrShellDelegate delegate);
-
-    /**
-     * Pauses VrShell.
-     */
-    void pause();
-
-    /**
-     * Resumes VrShell.
-     */
-    void resume();
-
-    /**
-     * Destroys VrShell.
-     */
-    void teardown();
-
-    /**
-     * Sets Android VR Mode to |enabled|.
-     */
-    void setVrModeEnabled(boolean enabled);
-
-    /**
-     * Sets whether we're presenting WebVR content or not.
-     */
-    void setWebVrModeEnabled(boolean enabled);
-
-    /**
-     * Returns the GVRLayout as a FrameLayout.
-     */
-    FrameLayout getContainer();
-}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java
index a7b94c5..966c4da 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webshare/ShareServiceImplementationFactory.java
@@ -5,7 +5,7 @@
 package org.chromium.chrome.browser.webshare;
 
 import org.chromium.content_public.browser.WebContents;
-import org.chromium.services.shell.InterfaceFactory;
+import org.chromium.services.service_manager.InterfaceFactory;
 import org.chromium.webshare.mojom.ShareService;
 
 /**
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
index 5c28eaf..c48adbda 100644
--- a/chrome/android/java_sources.gni
+++ b/chrome/android/java_sources.gni
@@ -494,6 +494,8 @@
   "java/src/org/chromium/chrome/browser/media/router/cast/MediaSink.java",
   "java/src/org/chromium/chrome/browser/media/router/cast/MediaSource.java",
   "java/src/org/chromium/chrome/browser/media/ui/MediaButtonReceiver.java",
+  "java/src/org/chromium/chrome/browser/media/ui/MediaImageCallback.java",
+  "java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java",
   "java/src/org/chromium/chrome/browser/media/ui/MediaNotificationInfo.java",
   "java/src/org/chromium/chrome/browser/media/ui/MediaNotificationListener.java",
   "java/src/org/chromium/chrome/browser/media/ui/MediaNotificationManager.java",
@@ -982,9 +984,9 @@
   "java/src/org/chromium/chrome/browser/util/PlatformUtil.java",
   "java/src/org/chromium/chrome/browser/util/UrlUtilities.java",
   "java/src/org/chromium/chrome/browser/util/ViewUtils.java",
-  "java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextInterface.java",
+  "java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java",
   "java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java",
-  "java/src/org/chromium/chrome/browser/vr_shell/VrShellInterface.java",
+  "java/src/org/chromium/chrome/browser/vr_shell/VrShell.java",
   "java/src/org/chromium/chrome/browser/webapps/ActivityAssigner.java",
   "java/src/org/chromium/chrome/browser/webapps/AddToHomescreenDialog.java",
   "java/src/org/chromium/chrome/browser/webapps/AddToHomescreenManager.java",
@@ -1086,9 +1088,14 @@
   "java/src/org/chromium/chrome/browser/widget/newtab/NewTabButton.java",
 ]
 
+# Only used for testing, should not be shipped to end users.
+if (!is_official_build) {
+  chrome_java_sources += [ "java/src/org/chromium/chrome/browser/offlinepages/evaluation/OfflinePageEvaluationBridge.java" ]
+}
+
 chrome_vr_java_sources = [
-  "java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java",
-  "java/src/org/chromium/chrome/browser/vr_shell/VrShell.java",
+  "java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java",
+  "java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java",
   "java/src/org/chromium/chrome/browser/vr_shell/VrWindowAndroid.java",
 ]
 
diff --git a/chrome/android/monochrome_repack_locales.gni b/chrome/android/monochrome_repack_locales.gni
deleted file mode 100644
index dbaab3e..0000000
--- a/chrome/android/monochrome_repack_locales.gni
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//android_webview/webview_repack_locales_list.gni")
-import("//chrome/chrome_repack_locales.gni")
-
-#TODO(agrieve): Delete once unreferenced downstream.
-template("monochrome_repack_locales") {
-  chrome_repack_locales(target_name) {
-    forward_variables_from(invoker, "*")
-    additional_source_patterns = webview_repack_locales_source_patterns
-    deps = webview_repack_locales_deps
-  }
-}
diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn
index bbaaead..0e13fd0 100644
--- a/chrome/app/BUILD.gn
+++ b/chrome/app/BUILD.gn
@@ -4,7 +4,7 @@
 
 import("//build/config/ui.gni")
 import("//chrome/common/features.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//tools/grit/grit_rule.gni")
 
 # This target is for dependency tracking for the command ID header.
@@ -159,6 +159,7 @@
 grit("google_chrome_strings") {
   source = "google_chrome_strings.grd"
   use_qualified_include = true
+  defines = chrome_grit_defines
   output_dir = "$root_gen_dir/chrome"
   outputs = [
     "grit/google_chrome_strings.h",
@@ -222,6 +223,7 @@
 grit("chromium_strings") {
   source = "chromium_strings.grd"
   use_qualified_include = true
+  defines = chrome_grit_defines
   output_dir = "$root_gen_dir/chrome"
   outputs = [
     "grit/chromium_strings.h",
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index eca0af4..ce3ce3c 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -443,7 +443,7 @@
         </message>
       </if>
 
-      <message name="IDS_ALTERNATE_NAV_URL_VIEW_LABEL" desc="Label displayed in an infobar when a user searches for a term he may have meant to navigate to.">
+      <message name="IDS_ALTERNATE_NAV_URL_VIEW_LABEL" desc="Label displayed in an infobar when a user searches for a term they may have meant to navigate to.">
         Did you mean to go to <ph name="SITE">$1<ex>http://intranetsite/</ex></ph>?
       </message>
 
@@ -5370,6 +5370,12 @@
       <message name="IDS_FLAGS_TOP_CHROME_MD_MATERIAL_HYBRID" desc="Top Chrome material hybrid design option (for touchscreens).">
         Touch
       </message>
+      <message name="IDS_FLAGS_SITE_SETTINGS" desc="Title of the flag which enables the site settings all sites list and site details.">
+        Site settings with All sites and Site details
+      </message>
+      <message name="IDS_FLAGS_SITE_SETTINGS_DESCRIPTION" desc="Description of the flag which enables or disables the site settings all sites list and site details.">
+        Adds new ways of viewing Site settings.
+      </message>
       <message name="IDS_FLAGS_SECONDARY_UI_MD" desc="Title of the flag which enables or disables material design in the rest of the native UI of the browser (beyond top chrome).">
         Material Design in the rest of the browser's native UI
       </message>
@@ -8814,7 +8820,7 @@
         <message name="IDS_PRINT_PREVIEW_REJECT_INVITE" desc="Text for the button to reject the printer-sharing invitation.">
           Reject
         </message>
-        <message name="IDS_PRINT_PREVIEW_GROUP_INVITE_TEXT" desc="Message to show when the user has pending printer-sharing invitation for the group of users he is a manager of.">
+        <message name="IDS_PRINT_PREVIEW_GROUP_INVITE_TEXT" desc="Message to show when the user has pending printer-sharing invitation for the group of users they are a manager of.">
           &lt;strong&gt;<ph name="SENDER">$1</ph>&lt;/strong&gt; wants to share a printer &lt;strong&gt;<ph name="PRINTER_NAME">$2</ph>&lt;/strong&gt; with a group you own: &lt;strong&gt;<ph name="GROUP_NAME">$3</ph>&lt;/strong&gt;. If you accept, all group members will be able to print to the printer.
         </message>
         <message name="IDS_PRINT_PREVIEW_INVITE_TEXT" desc="Message to show when the user has pending printer-sharing invitation.">
@@ -9544,7 +9550,7 @@
         <message name="IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON" desc="The label of the 'Show Home button' checkbox">
           Show Home button
         </message>
-        <message name="IDS_OPTIONS_CHANGE_HOME_PAGE" desc="The text of the button that allows the user to change her home page">
+        <message name="IDS_OPTIONS_CHANGE_HOME_PAGE" desc="The text of the button that allows the user to change their home page">
           Change
         </message>
         <message name="IDS_OPTIONS_TOOLBAR_SHOW_BOOKMARKS_BAR" desc="The label of the 'Show bookmarks bar' checkbox">
@@ -11444,7 +11450,7 @@
         Please start <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> as a normal user. To run as root, you must specify an alternate --user-data-dir for storage of profile information.
       </message>
       <if expr="is_win">
-        <message name="IDS_PROFILE_ON_NETWORK_WARNING" desc="Warning shown to the user when she is running Chrome on Windows with a profile located on a network share.">
+        <message name="IDS_PROFILE_ON_NETWORK_WARNING" desc="Warning shown to the user when they are running Chrome on Windows with a profile located on a network share.">
           Warning: your <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> settings are stored on a network drive. This may result in slowdowns, crashes, or even loss of data.
         </message>
       </if>
@@ -13213,7 +13219,7 @@
         <message name="IDS_LEGACY_SUPERVISED_USER_ALREADY_ON_THIS_DEVICE" desc="Text shown in the list of supervised users beside the name of a supervised user that already exists on the current device.">
           (already on this device)
         </message>
-        <message name="IDS_LEGACY_SUPERVISED_USER_NO_EXISTING_ERROR" desc="Message shown to the custodian when he opens the 'supervised user import' overlay but he has no existing supervised users to import.">
+        <message name="IDS_LEGACY_SUPERVISED_USER_NO_EXISTING_ERROR" desc="Message shown to the custodian when they open the 'supervised user import' overlay but they have no existing supervised users to import.">
           Oops! Looks like you have no existing supervised users to import. Please create one or more from another device then you can import them here.
         </message>
         <message name="IDS_LEGACY_SUPERVISED_USER_IMPORT_LOCAL_ERROR" desc="Message shown when a local error (for example, a disk error) occurs during supervised user import.">
diff --git a/chrome/app/mash/BUILD.gn b/chrome/app/mash/BUILD.gn
index 2d972202..9d06a65 100644
--- a/chrome/app/mash/BUILD.gn
+++ b/chrome/app/mash/BUILD.gn
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 
 source_set("mash") {
   sources = [
@@ -16,13 +16,13 @@
     "//content/public/common",
     "//mash/package",
     "//services/catalog/public/interfaces",
-    "//services/shell",
-    "//services/shell/background:lib",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner/common",
-    "//services/shell/runner/host:child_process_base",
-    "//services/shell/runner/host:lib",
+    "//services/service_manager",
+    "//services/service_manager/background:lib",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner/common",
+    "//services/service_manager/runner/host:child_process_base",
+    "//services/service_manager/runner/host:lib",
     "//url",
   ]
   data_deps = [
diff --git a/chrome/app/mash/DEPS b/chrome/app/mash/DEPS
index 65c41d1..48485188 100644
--- a/chrome/app/mash/DEPS
+++ b/chrome/app/mash/DEPS
@@ -10,5 +10,5 @@
   "+services/ui",
   "+mash",
   "+services/catalog",
-  "+services/shell",
+  "+services/service_manager",
 ]
diff --git a/chrome/app/mash/chrome_mash_content_browser_manifest_overlay.json b/chrome/app/mash/chrome_mash_content_browser_manifest_overlay.json
index b85dcee..320cf3d 100644
--- a/chrome/app/mash/chrome_mash_content_browser_manifest_overlay.json
+++ b/chrome/app/mash/chrome_mash_content_browser_manifest_overlay.json
@@ -16,9 +16,9 @@
       ]
     },
     "required": {
-      "service:ash": { "classes": [ "ash" ] },
-      "service:accessibility_autoclick": { "classes": [ "ash:autoclick" ] },
-      "service:mash_session": { "classes": [ "app" ] }
+      "service:ash": [ "ash" ],
+      "service:accessibility_autoclick": [ "ash:autoclick" ],
+      "service:mash_session": [ "app" ]
     }
   }
 }
diff --git a/chrome/app/mash/chrome_mash_manifest.json b/chrome/app/mash/chrome_mash_manifest.json
index 7693eec..f9bc822 100644
--- a/chrome/app/mash/chrome_mash_manifest.json
+++ b/chrome/app/mash/chrome_mash_manifest.json
@@ -11,11 +11,11 @@
   "display_name": "Chrome Mash Packaged Services",
   "capabilities": {
     "provided": {
-      "shell:service_factory": [ "shell::mojom::ServiceFactory" ]
+      "shell:service_factory": [ "service_manager::mojom::ServiceFactory" ]
     },
     "required": {
-      "service:mash_session": { "classes": [ "app" ] },
-      "service:catalog": { "classes": [ "control" ] }
+      "service:mash_session": [ "app" ],
+      "service:catalog": [ "control" ]
     }
   }
 }
diff --git a/chrome/app/mash/mash_runner.cc b/chrome/app/mash/mash_runner.cc
index 5793321c..01fcac7 100644
--- a/chrome/app/mash/mash_runner.cc
+++ b/chrome/app/mash/mash_runner.cc
@@ -22,20 +22,20 @@
 #include "mash/package/mash_packaged_service.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "services/catalog/public/interfaces/catalog.mojom.h"
-#include "services/shell/background/background_shell.h"
-#include "services/shell/native_runner_delegate.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/host/child_process_base.h"
+#include "services/service_manager/background/background_shell.h"
+#include "services/service_manager/native_runner_delegate.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/host/child_process_base.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_paths.h"
 #include "ui/base/ui_base_switches.h"
 
-using shell::mojom::ServiceFactory;
+using service_manager::mojom::ServiceFactory;
 
 namespace {
 
@@ -76,15 +76,15 @@
       locale, nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
 }
 
-class NativeRunnerDelegateImpl : public shell::NativeRunnerDelegate {
+class NativeRunnerDelegateImpl : public service_manager::NativeRunnerDelegate {
  public:
   NativeRunnerDelegateImpl() {}
   ~NativeRunnerDelegateImpl() override {}
 
  private:
-  // shell::NativeRunnerDelegate:
+  // service_manager::NativeRunnerDelegate:
   void AdjustCommandLineArgumentsForTarget(
-      const shell::Identity& target,
+      const service_manager::Identity& target,
       base::CommandLine* command_line) override {
     if (target.name() != content::kBrowserServiceName) {
       // If running anything other than the browser process, launch a mash
@@ -127,19 +127,19 @@
   // shouldn't we using context as it has a lot of stuff we don't really want
   // in chrome.
   NativeRunnerDelegateImpl native_runner_delegate;
-  shell::BackgroundShell background_shell;
-  std::unique_ptr<shell::BackgroundShell::InitParams> init_params(
-      new shell::BackgroundShell::InitParams);
+  service_manager::BackgroundShell background_service_manager;
+  std::unique_ptr<service_manager::BackgroundShell::InitParams> init_params(
+      new service_manager::BackgroundShell::InitParams);
   init_params->native_runner_delegate = &native_runner_delegate;
-  background_shell.Init(std::move(init_params));
+  background_service_manager.Init(std::move(init_params));
   service_.reset(new mash::MashPackagedService);
-  service_->set_context(base::MakeUnique<shell::ServiceContext>(
+  service_->set_context(base::MakeUnique<service_manager::ServiceContext>(
       service_.get(),
-      background_shell.CreateServiceRequest(kChromeMashServiceName)));
+      background_service_manager.CreateServiceRequest(kChromeMashServiceName)));
 
   // We need to send a sync messages to the Catalog, so we wait for a completed
   // connection first.
-  std::unique_ptr<shell::Connection> catalog_connection =
+  std::unique_ptr<service_manager::Connection> catalog_connection =
       service_->connector()->Connect("service:catalog");
   {
     base::RunLoop run_loop;
@@ -171,19 +171,19 @@
 void MashRunner::RunChild() {
   base::i18n::InitializeICU();
   InitializeResources();
-  shell::ChildProcessMainWithCallback(
+  service_manager::ChildProcessMainWithCallback(
       base::Bind(&MashRunner::StartChildApp, base::Unretained(this)));
 }
 
 void MashRunner::StartChildApp(
-    shell::mojom::ServiceRequest service_request) {
+    service_manager::mojom::ServiceRequest service_request) {
   // TODO(sad): Normally, this would be a TYPE_DEFAULT message loop. However,
   // TYPE_UI is needed for mojo:ui. But it is not known whether the child app is
   // going to be mojo:ui at this point. So always create a TYPE_UI message loop
   // for now.
   base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
   service_.reset(new mash::MashPackagedService);
-  service_->set_context(base::MakeUnique<shell::ServiceContext>(
+  service_->set_context(base::MakeUnique<service_manager::ServiceContext>(
       service_.get(), std::move(service_request)));
   base::RunLoop().Run();
 }
diff --git a/chrome/app/mash/mash_runner.h b/chrome/app/mash/mash_runner.h
index c04133c8..ac1a13c 100644
--- a/chrome/app/mash/mash_runner.h
+++ b/chrome/app/mash/mash_runner.h
@@ -8,9 +8,9 @@
 #include <memory>
 
 #include "base/macros.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Service;
 }
 
@@ -26,9 +26,9 @@
   void RunMain();
   void RunChild();
 
-  void StartChildApp(shell::mojom::ServiceRequest service_request);
+  void StartChildApp(service_manager::mojom::ServiceRequest service_request);
 
-  std::unique_ptr<shell::Service> service_;
+  std::unique_ptr<service_manager::Service> service_;
 
   DISALLOW_COPY_AND_ASSIGN(MashRunner);
 };
diff --git a/chrome/app/resources/BUILD.gn b/chrome/app/resources/BUILD.gn
index 6b51660c..0085eba 100644
--- a/chrome/app/resources/BUILD.gn
+++ b/chrome/app/resources/BUILD.gn
@@ -3,11 +3,13 @@
 # found in the LICENSE file.
 
 import("//build/config/chrome_build.gni")
+import("//chrome/common/features.gni")
 import("//tools/grit/grit_rule.gni")
 
 grit("locale_settings") {
   source = "locale_settings.grd"
   use_qualified_include = true
+  defines = chrome_grit_defines
   output_dir = "$root_gen_dir/chrome"
   outputs = [
     "grit/locale_settings.h",
@@ -84,6 +86,7 @@
     source = "locale_settings_linux.grd"
   }
 
+  defines = chrome_grit_defines
   use_qualified_include = true
   outputs = [
     "grit/platform_locale_settings.h",
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
index 839ac3d..794e974 100644
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -1968,7 +1968,7 @@
     <message name="IDS_SETTINGS_PEOPLE_PASSWORD_PROMPT_INVALID_PASSWORD" desc="Text on a password field that tells the user the password is incorrect.">
       Invalid password
     </message>
-    <message name="IDS_SETTINGS_CHANGE_PICTURE_DIALOG_TITLE" desc="Title of the subpage shown when user wants to change his/her picture.">
+    <message name="IDS_SETTINGS_CHANGE_PICTURE_DIALOG_TITLE" desc="Title of the subpage shown when user wants to change their picture.">
       Change picture
     </message>
     <message name="IDS_SETTINGS_CHANGE_PICTURE_DIALOG_TEXT" desc="Text with description of what to do on Change picture subpage.">
diff --git a/chrome/app/theme/BUILD.gn b/chrome/app/theme/BUILD.gn
index 4833e38..bd60bb4 100644
--- a/chrome/app/theme/BUILD.gn
+++ b/chrome/app/theme/BUILD.gn
@@ -2,10 +2,12 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//chrome/common/features.gni")
 import("//tools/grit/grit_rule.gni")
 
 grit("theme_resources") {
   source = "theme_resources.grd"
+  defines = chrome_grit_defines
   outputs = [
     "grit/theme_resources.h",
     "grit/theme_resources_map.cc",
@@ -25,6 +27,7 @@
 
 grit("chrome_unscaled_resources") {
   source = "chrome_unscaled_resources.grd"
+  defines = chrome_grit_defines
   use_qualified_include = true
   outputs = [
     "grit/chrome_unscaled_resources.h",
diff --git a/chrome/app/theme/default_100_percent/common/infobar_media_stream_screen_share.png b/chrome/app/theme/default_100_percent/common/infobar_media_stream_screen_share.png
deleted file mode 100644
index 810b14f..0000000
--- a/chrome/app/theme/default_100_percent/common/infobar_media_stream_screen_share.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/infobar_warning.png b/chrome/app/theme/default_100_percent/common/infobar_warning.png
deleted file mode 100644
index c8fbccd0..0000000
--- a/chrome/app/theme/default_100_percent/common/infobar_warning.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/register_protocol_handler.png b/chrome/app/theme/default_100_percent/register_protocol_handler.png
deleted file mode 100644
index 679a055..0000000
--- a/chrome/app/theme/default_100_percent/register_protocol_handler.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/infobar_media_stream_screen_share.png b/chrome/app/theme/default_200_percent/common/infobar_media_stream_screen_share.png
deleted file mode 100644
index d3a6c77..0000000
--- a/chrome/app/theme/default_200_percent/common/infobar_media_stream_screen_share.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/infobar_warning.png b/chrome/app/theme/default_200_percent/common/infobar_warning.png
deleted file mode 100644
index aa8335d..0000000
--- a/chrome/app/theme/default_200_percent/common/infobar_warning.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/register_protocol_handler.png b/chrome/app/theme/default_200_percent/register_protocol_handler.png
deleted file mode 100644
index c2683e9..0000000
--- a/chrome/app/theme/default_200_percent/register_protocol_handler.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index b25786a..2cafc15 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -256,14 +256,12 @@
       <structure type="chrome_scaled_image" name="IDR_INFOBAR_3D_BLOCKED" file="common/infobar_3d_blocked.png" />
       <structure type="chrome_scaled_image" name="IDR_INFOBAR_MEDIA_STREAM_CAMERA" file="common/infobar_media_stream_camera.png" />
       <structure type="chrome_scaled_image" name="IDR_INFOBAR_MEDIA_STREAM_MIC" file="common/infobar_media_stream_mic.png" />
-      <structure type="chrome_scaled_image" name="IDR_INFOBAR_MEDIA_STREAM_SCREEN" file="common/infobar_media_stream_screen_share.png" />
       <if expr="is_android">
         <structure type="chrome_scaled_image" name="IDR_INFOBAR_SAVE_PASSWORD" file="common/infobar_save_password.png" />
       </if>
       <if expr="is_macosx or is_android">
         <structure type="chrome_scaled_image" name="IDR_INFOBAR_TRANSLATE" file="common/infobar_translate.png" />
       </if>
-      <structure type="chrome_scaled_image" name="IDR_INFOBAR_WARNING" file="common/infobar_warning.png" />
       <structure type="chrome_scaled_image" name="IDR_INPUT_ALERT" file="common/input_alert.png" />
       <structure type="chrome_scaled_image" name="IDR_INPUT_ALERT_MENU" file="common/input_alert_menu.png" />
       <if expr="is_macosx">
@@ -558,7 +556,6 @@
       </if>
       <structure type="chrome_scaled_image" name="IDR_QUESTION_MARK" file="common/question_mark.png" />
       <structure type="chrome_scaled_image" name="IDR_PROFILE_SELECTED" file="common/profile_selected.png" />
-      <structure type="chrome_scaled_image" name="IDR_REGISTER_PROTOCOL_HANDLER" file="register_protocol_handler.png" />
       <structure type="chrome_scaled_image" name="IDR_RESTORE_BUTTON_MASK" file="common/restore_button_mask.png" />
       <if expr="is_macosx">
         <structure type="chrome_scaled_image" name="IDR_SAFEBROWSING_WARNING" file="legacy/safebrowsing_warning.png" />
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 1d03f4f..e22b2d26 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -764,8 +764,6 @@
     "permissions/permission_request.h",
     "permissions/permission_request_id.cc",
     "permissions/permission_request_id.h",
-    "permissions/permission_request_impl.cc",
-    "permissions/permission_request_impl.h",
     "permissions/permission_request_manager.cc",
     "permissions/permission_request_manager.h",
     "permissions/permission_uma_util.cc",
@@ -1432,7 +1430,7 @@
     "//mojo/public/js",
     "//net:extras",
     "//net:net_with_v8",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//sql",
     "//storage/browser",
@@ -2772,6 +2770,8 @@
       "obsolete_system/obsolete_system_win.cc",
       "pdf/pdf_extension_util.cc",
       "pdf/pdf_extension_util.h",
+      "permissions/permission_request_impl.cc",
+      "permissions/permission_request_impl.h",
       "power/process_power_collector.cc",
       "power/process_power_collector.h",
       "process_singleton_modal_dialog_lock.cc",
@@ -3355,6 +3355,14 @@
         "supervised_user/child_accounts/child_account_service_android.h",
       ]
     }
+
+    # Used for testing only, should not be shipped to end users.
+    if (!is_official_build) {
+      sources += [
+        "android/offline_pages/evaluation/offline_page_evaluation_bridge.cc",
+        "android/offline_pages/evaluation/offline_page_evaluation_bridge.h",
+      ]
+    }
   }
 
   if (enable_vr_shell || enable_webvr) {
@@ -3910,6 +3918,11 @@
       "../android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java",
       "../android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java",
     ]
+
+    # Used for testing only, should not be shipped to end users.
+    if (!is_official_build) {
+      sources += [ "../android/java/src/org/chromium/chrome/browser/offlinepages/evaluation/OfflinePageEvaluationBridge.java" ]
+    }
     jni_package = "chrome"
   }
 
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 0cd88589..4da1a9a 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -35,7 +35,7 @@
   "+media/cdm/cdm_paths.h",
   "+media/midi",  # For midi switches
   "+media/mojo",  # For mojo media services.
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+services/ui/public",
   "+ppapi/c",  # For various types.
   "+ppapi/host",
@@ -43,7 +43,7 @@
   "+ppapi/shared_impl",
   "+rlz",
   "+sandbox/win/src",  # The path doesn't say it, but this is the Windows sandbox.
-  "+services/shell",
+  "+services/service_manager",
   "+skia/ext",
   "+syzygy/kasko",
   "+third_party/cros_system_api",
@@ -77,6 +77,7 @@
   "+third_party/leveldatabase",
   "+third_party/libxml",
   "+third_party/mozilla",     # Mozilla interface headers.
+  "+third_party/ocmock/gtest_support.h",
   "+third_party/protobuf/src/google/protobuf",
   "+third_party/re2",
   "+third_party/smhasher",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index dd5c76a1..b2ee923f 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -98,7 +98,7 @@
 #include "chrome/browser/ui/browser_dialogs.h"
 #endif  // OS_MACOSX
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 #include "ui/app_list/app_list_switches.h"
 #endif  // ENABLE_APP_LIST
 
@@ -816,6 +816,9 @@
     {"top-chrome-md", IDS_FLAGS_TOP_CHROME_MD,
      IDS_FLAGS_TOP_CHROME_MD_DESCRIPTION, kOsDesktop,
      MULTI_VALUE_TYPE(kTopChromeMaterialDesignChoices)},
+    {"enable-site-settings", IDS_FLAGS_SITE_SETTINGS,
+     IDS_FLAGS_SITE_SETTINGS_DESCRIPTION, kOsDesktop,
+     SINGLE_VALUE_TYPE(switches::kEnableSiteSettings)},
     {"secondary-ui-md", IDS_FLAGS_SECONDARY_UI_MD,
      IDS_FLAGS_SECONDARY_UI_MD_DESCRIPTION, kOsDesktop,
      SINGLE_VALUE_TYPE(switches::kExtendMdToSecondaryUi)},
@@ -1045,7 +1048,7 @@
      IDS_FLAGS_SUPERVISED_USER_MANAGED_BOOKMARKS_FOLDER_NAME,
      IDS_FLAGS_SUPERVISED_USER_MANAGED_BOOKMARKS_FOLDER_DESCRIPTION, kOsAll,
      SINGLE_VALUE_TYPE(switches::kEnableSupervisedUserManagedBookmarksFolder)},
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
     {"enable-sync-app-list", IDS_FLAGS_SYNC_APP_LIST_NAME,
      IDS_FLAGS_SYNC_APP_LIST_DESCRIPTION, kOsDesktop,
      ENABLE_DISABLE_VALUE_TYPE(app_list::switches::kEnableSyncAppList,
@@ -1197,7 +1200,7 @@
     {"enable-google-profile-info", IDS_FLAGS_GOOGLE_PROFILE_INFO_NAME,
      IDS_FLAGS_GOOGLE_PROFILE_INFO_DESCRIPTION, kOsMac | kOsWin | kOsLinux,
      SINGLE_VALUE_TYPE(switches::kGoogleProfileInfo)},
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
     {"reset-app-list-install-state",
      IDS_FLAGS_RESET_APP_LIST_INSTALL_STATE_NAME,
      IDS_FLAGS_RESET_APP_LIST_INSTALL_STATE_DESCRIPTION,
@@ -1522,7 +1525,7 @@
 #endif  // ENABLE_MEDIA_ROUTER) && !defined(OS_ANDROID
 // Since Drive Search is not available when app list is disabled, flag guard
 // enable-drive-search-in-chrome-launcher flag.
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
     {"enable-drive-search-in-app-launcher",
      IDS_FLAGS_DRIVE_SEARCH_IN_CHROME_LAUNCHER,
      IDS_FLAGS_DRIVE_SEARCH_IN_CHROME_LAUNCHER_DESCRIPTION, kOsCrOS,
diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc
index 3fe7eb7f..bc25123 100644
--- a/chrome/browser/android/chrome_jni_registrar.cc
+++ b/chrome/browser/android/chrome_jni_registrar.cc
@@ -181,6 +181,10 @@
 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
 #endif
 
+#if !defined(OFFICIAL_BUILD)
+#include "chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.h"
+#endif
+
 namespace android {
 
 static base::android::RegistrationMethod kChromeRegisteredMethods[] = {
@@ -312,6 +316,10 @@
     {"OfflinePageBridge", offline_pages::android::RegisterOfflinePageBridge},
     {"OfflinePageDownloadBridge",
      offline_pages::android::OfflinePageDownloadBridge::Register},
+#if !defined(OFFICIAL_BUILD)
+    {"OfflinePageEvaluationBridge",
+     offline_pages::android::OfflinePageEvaluationBridge::Register},
+#endif
     {"OmniboxPrerender", RegisterOmniboxPrerender},
     {"OmniboxUrlEmphasizer",
      OmniboxUrlEmphasizer::RegisterOmniboxUrlEmphasizer},
diff --git a/chrome/browser/android/contextualsearch/contextual_search_manager.cc b/chrome/browser/android/contextualsearch/contextual_search_manager.cc
index 6ad98f7..01dafeca 100644
--- a/chrome/browser/android/contextualsearch/contextual_search_manager.cc
+++ b/chrome/browser/android/contextualsearch/contextual_search_manager.cc
@@ -24,8 +24,8 @@
 #include "content/public/browser/web_contents.h"
 #include "jni/ContextualSearchManager_jni.h"
 #include "net/url_request/url_fetcher_impl.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 using base::android::JavaParamRef;
 using base::android::JavaRef;
diff --git a/chrome/browser/android/feedback/connectivity_checker.cc b/chrome/browser/android/feedback/connectivity_checker.cc
index 9a4154c..a499401 100644
--- a/chrome/browser/android/feedback/connectivity_checker.cc
+++ b/chrome/browser/android/feedback/connectivity_checker.cc
@@ -14,6 +14,7 @@
 #include "base/timer/timer.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/profiles/profile_android.h"
+#include "components/data_use_measurement/core/data_use_user_data.h"
 #include "jni/ConnectivityChecker_jni.h"
 #include "net/base/load_flags.h"
 #include "net/http/http_status_code.h"
@@ -141,6 +142,9 @@
 
 void ConnectivityChecker::StartAsyncCheck() {
   url_fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this);
+  data_use_measurement::DataUseUserData::AttachToFetcher(
+      url_fetcher_.get(),
+      data_use_measurement::DataUseUserData::FEEDBACK_UPLOADER);
   url_fetcher_->SetRequestContext(request_context_);
   url_fetcher_->SetStopOnRedirect(true);
   url_fetcher_->SetAutomaticallyRetryOn5xx(false);
diff --git a/chrome/browser/android/media/media_throttle_infobar_delegate.cc b/chrome/browser/android/media/media_throttle_infobar_delegate.cc
index 917bb25..10e46cf 100644
--- a/chrome/browser/android/media/media_throttle_infobar_delegate.cc
+++ b/chrome/browser/android/media/media_throttle_infobar_delegate.cc
@@ -8,6 +8,7 @@
 #include <utility>
 
 #include "base/metrics/histogram_macros.h"
+#include "chrome/browser/android/android_theme_resources.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/grit/generated_resources.h"
 #include "chrome/grit/theme_resources.h"
@@ -68,7 +69,7 @@
 }
 
 int MediaThrottleInfoBarDelegate::GetIconId() const {
-  return IDR_INFOBAR_WARNING;
+  return IDR_ANDROID_INFOBAR_WARNING;
 }
 
 base::string16 MediaThrottleInfoBarDelegate::GetButtonLabel(
diff --git a/chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.cc b/chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.cc
new file mode 100644
index 0000000..7427d14
--- /dev/null
+++ b/chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.cc
@@ -0,0 +1,215 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.h"
+
+#include "base/android/callback_android.h"
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
+#include "chrome/browser/android/offline_pages/request_coordinator_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_android.h"
+#include "components/offline_pages/background/request_coordinator.h"
+#include "components/offline_pages/background/request_notifier.h"
+#include "components/offline_pages/background/save_page_request.h"
+#include "components/offline_pages/offline_page_item.h"
+#include "components/offline_pages/offline_page_model.h"
+#include "content/public/browser/browser_context.h"
+#include "jni/OfflinePageEvaluationBridge_jni.h"
+#include "jni/SavePageRequest_jni.h"
+
+using base::android::ConvertJavaStringToUTF8;
+using base::android::ConvertUTF8ToJavaString;
+using base::android::JavaParamRef;
+using base::android::ScopedJavaGlobalRef;
+using base::android::ScopedJavaLocalRef;
+
+namespace offline_pages {
+namespace android {
+
+namespace {
+
+void ToJavaOfflinePageList(JNIEnv* env,
+                           jobject j_result_obj,
+                           const std::vector<OfflinePageItem>& offline_pages) {
+  for (const OfflinePageItem& offline_page : offline_pages) {
+    Java_OfflinePageEvaluationBridge_createOfflinePageAndAddToList(
+        env, j_result_obj,
+        ConvertUTF8ToJavaString(env, offline_page.url.spec()),
+        offline_page.offline_id,
+        ConvertUTF8ToJavaString(env, offline_page.client_id.name_space),
+        ConvertUTF8ToJavaString(env, offline_page.client_id.id),
+        ConvertUTF8ToJavaString(env, offline_page.file_path.value()),
+        offline_page.file_size, offline_page.creation_time.ToJavaTime(),
+        offline_page.access_count, offline_page.last_access_time.ToJavaTime());
+  }
+}
+
+ScopedJavaLocalRef<jobject> ToJavaSavePageRequest(
+    JNIEnv* env,
+    const SavePageRequest& request) {
+  return Java_SavePageRequest_create(
+      env, static_cast<int>(request.request_state()), request.request_id(),
+      ConvertUTF8ToJavaString(env, request.url().spec()),
+      ConvertUTF8ToJavaString(env, request.client_id().name_space),
+      ConvertUTF8ToJavaString(env, request.client_id().id));
+}
+
+void GetAllPagesCallback(
+    const ScopedJavaGlobalRef<jobject>& j_result_obj,
+    const ScopedJavaGlobalRef<jobject>& j_callback_obj,
+    const OfflinePageModel::MultipleOfflinePageItemResult& result) {
+  JNIEnv* env = base::android::AttachCurrentThread();
+  ToJavaOfflinePageList(env, j_result_obj.obj(), result);
+  base::android::RunCallbackAndroid(j_callback_obj, j_result_obj);
+}
+
+void OnPushRequestsDone(const ScopedJavaGlobalRef<jobject>& j_callback_obj,
+                        bool result) {
+  base::android::RunCallbackAndroid(j_callback_obj, result);
+}
+
+}  // namespace
+
+static ScopedJavaLocalRef<jobject> GetBridgeForProfile(
+    JNIEnv* env,
+    const JavaParamRef<jclass>& jcaller,
+    const JavaParamRef<jobject>& j_profile) {
+  Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
+
+  OfflinePageModel* offline_page_model =
+      OfflinePageModelFactory::GetForBrowserContext(profile);
+
+  RequestCoordinator* request_coordinator =
+      RequestCoordinatorFactory::GetForBrowserContext(profile);
+
+  if (offline_page_model == nullptr || request_coordinator == nullptr)
+    return ScopedJavaLocalRef<jobject>();
+
+  OfflinePageEvaluationBridge* bridge = new OfflinePageEvaluationBridge(
+      env, profile, offline_page_model, request_coordinator);
+
+  return ScopedJavaLocalRef<jobject>(bridge->java_ref());
+}
+
+// static
+bool OfflinePageEvaluationBridge::Register(JNIEnv* env) {
+  return RegisterNativesImpl(env);
+}
+
+OfflinePageEvaluationBridge::OfflinePageEvaluationBridge(
+    JNIEnv* env,
+    content::BrowserContext* browser_context,
+    OfflinePageModel* offline_page_model,
+    RequestCoordinator* request_coordinator)
+    : browser_context_(browser_context),
+      offline_page_model_(offline_page_model),
+      request_coordinator_(request_coordinator) {
+  java_ref_.Reset(Java_OfflinePageEvaluationBridge_create(
+      env, reinterpret_cast<jlong>(this)));
+
+  NotifyIfDoneLoading();
+  offline_page_model_->AddObserver(this);
+  request_coordinator_->AddObserver(this);
+}
+
+OfflinePageEvaluationBridge::~OfflinePageEvaluationBridge() {
+  JNIEnv* env = base::android::AttachCurrentThread();
+  Java_OfflinePageEvaluationBridge_offlinePageEvaluationBridgeDestroyed(
+      env, java_ref_);
+}
+
+// Implement OfflinePageModel::Observer
+void OfflinePageEvaluationBridge::OfflinePageModelLoaded(
+    OfflinePageModel* model) {
+  DCHECK_EQ(offline_page_model_, model);
+  NotifyIfDoneLoading();
+}
+
+void OfflinePageEvaluationBridge::OfflinePageModelChanged(
+    OfflinePageModel* model) {}
+
+void OfflinePageEvaluationBridge::OfflinePageDeleted(
+    int64_t offline_id,
+    const ClientId& client_id) {}
+
+// Implement RequestCoordinator::Observer
+void OfflinePageEvaluationBridge::OnAdded(const SavePageRequest& request) {
+  JNIEnv* env = base::android::AttachCurrentThread();
+  Java_OfflinePageEvaluationBridge_savePageRequestAdded(
+      env, java_ref_, ToJavaSavePageRequest(env, request));
+}
+
+void OfflinePageEvaluationBridge::OnCompleted(
+    const SavePageRequest& request,
+    RequestNotifier::BackgroundSavePageResult status) {
+  JNIEnv* env = base::android::AttachCurrentThread();
+  Java_OfflinePageEvaluationBridge_savePageRequestCompleted(
+      env, java_ref_, ToJavaSavePageRequest(env, request),
+      static_cast<int>(status));
+}
+
+void OfflinePageEvaluationBridge::OnChanged(const SavePageRequest& request) {
+  JNIEnv* env = base::android::AttachCurrentThread();
+  Java_OfflinePageEvaluationBridge_savePageRequestChanged(
+      env, java_ref_, ToJavaSavePageRequest(env, request));
+}
+
+void OfflinePageEvaluationBridge::GetAllPages(
+    JNIEnv* env,
+    const JavaParamRef<jobject>& obj,
+    const JavaParamRef<jobject>& j_result_obj,
+    const JavaParamRef<jobject>& j_callback_obj) {
+  DCHECK(j_result_obj);
+  DCHECK(j_callback_obj);
+
+  ScopedJavaGlobalRef<jobject> j_result_ref(j_result_obj);
+  ScopedJavaGlobalRef<jobject> j_callback_ref(j_callback_obj);
+
+  offline_page_model_->GetAllPages(
+      base::Bind(&GetAllPagesCallback, j_result_ref, j_callback_ref));
+}
+
+void OfflinePageEvaluationBridge::PushRequestProcessing(
+    JNIEnv* env,
+    const JavaParamRef<jobject>& obj,
+    const JavaParamRef<jobject>& j_callback_obj) {
+  ScopedJavaGlobalRef<jobject> j_callback_ref(j_callback_obj);
+  DCHECK(request_coordinator_);
+  base::android::RunCallbackAndroid(j_callback_obj, false);
+
+  net::NetworkChangeNotifier::ConnectionType connection =
+      net::NetworkChangeNotifier::GetConnectionType();
+  DeviceConditions device_conditions(false, 0, connection);
+  request_coordinator_->StartProcessing(
+      device_conditions, base::Bind(&OnPushRequestsDone, j_callback_ref));
+}
+
+void OfflinePageEvaluationBridge::SavePageLater(
+    JNIEnv* env,
+    const JavaParamRef<jobject>& obj,
+    const JavaParamRef<jstring>& j_url,
+    const JavaParamRef<jstring>& j_namespace,
+    const JavaParamRef<jstring>& j_client_id,
+    jboolean user_requested) {
+  offline_pages::ClientId client_id;
+  client_id.name_space = ConvertJavaStringToUTF8(env, j_namespace);
+  client_id.id = ConvertJavaStringToUTF8(env, j_client_id);
+
+  request_coordinator_->SavePageLater(
+      GURL(ConvertJavaStringToUTF8(env, j_url)), client_id,
+      static_cast<bool>(user_requested),
+      RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER);
+}
+
+void OfflinePageEvaluationBridge::NotifyIfDoneLoading() const {
+  if (!offline_page_model_->is_loaded())
+    return;
+  JNIEnv* env = base::android::AttachCurrentThread();
+  Java_OfflinePageEvaluationBridge_offlinePageModelLoaded(env, java_ref_);
+}
+
+}  // namespace android
+}  // namespace offline_pages
diff --git a/chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.h b/chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.h
new file mode 100644
index 0000000..72d0561
--- /dev/null
+++ b/chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.h
@@ -0,0 +1,93 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATION_BRIDGE_H_
+#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATION_BRIDGE_H_
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_weak_ref.h"
+#include "base/android/scoped_java_ref.h"
+#include "base/macros.h"
+#include "components/offline_pages/background/request_coordinator.h"
+#include "components/offline_pages/background/request_notifier.h"
+#include "components/offline_pages/offline_page_model.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace offline_pages {
+
+struct OfflinePageItem;
+
+namespace android {
+
+/**
+ * Bridge for exposing native implementation which are used by evaluation.
+ */
+class OfflinePageEvaluationBridge : public OfflinePageModel::Observer,
+                                    public RequestCoordinator::Observer {
+ public:
+  static bool Register(JNIEnv* env);
+
+  OfflinePageEvaluationBridge(JNIEnv* env,
+                              content::BrowserContext* browser_context,
+                              OfflinePageModel* offline_page_model,
+                              RequestCoordinator* request_coordinator);
+
+  ~OfflinePageEvaluationBridge() override;
+
+  // OfflinePageModel::Observer implementation.
+  void OfflinePageModelLoaded(OfflinePageModel* model) override;
+  void OfflinePageModelChanged(OfflinePageModel* model) override;
+  void OfflinePageDeleted(int64_t offline_id,
+                          const ClientId& client_id) override;
+
+  // RequestCoordinator::Observer implementation.
+  void OnAdded(const SavePageRequest& request) override;
+  void OnCompleted(const SavePageRequest& request,
+                   RequestNotifier::BackgroundSavePageResult status) override;
+  void OnChanged(const SavePageRequest& request) override;
+
+  void GetAllPages(JNIEnv* env,
+                   const base::android::JavaParamRef<jobject>& obj,
+                   const base::android::JavaParamRef<jobject>& j_result_obj,
+                   const base::android::JavaParamRef<jobject>& j_callback_obj);
+
+  void PushRequestProcessing(
+      JNIEnv* env,
+      const base::android::JavaParamRef<jobject>& obj,
+      const base::android::JavaParamRef<jobject>& j_callback_obj);
+
+  void SavePageLater(JNIEnv* env,
+                     const base::android::JavaParamRef<jobject>& obj,
+                     const base::android::JavaParamRef<jstring>& url,
+                     const base::android::JavaParamRef<jstring>& j_namespace,
+                     const base::android::JavaParamRef<jstring>& j_client_id,
+                     jboolean user_requested);
+
+  base::android::ScopedJavaGlobalRef<jobject> java_ref() { return java_ref_; }
+
+ private:
+  void NotifyIfDoneLoading() const;
+
+  base::android::ScopedJavaLocalRef<jobject> CreateClientId(
+      JNIEnv* env,
+      const ClientId& clientId) const;
+
+  base::android::ScopedJavaGlobalRef<jobject> java_ref_;
+  // Not owned.
+  content::BrowserContext* browser_context_;
+  // Not owned.
+  OfflinePageModel* offline_page_model_;
+  // Not owned.
+  RequestCoordinator* request_coordinator_;
+
+  DISALLOW_COPY_AND_ASSIGN(OfflinePageEvaluationBridge);
+};
+
+}  // namespace android
+}  // namespace offline_pages
+
+#endif  // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATION_BRIDGE_H_
diff --git a/chrome/browser/android/resource_id.h b/chrome/browser/android/resource_id.h
index 73cf2f8e..d4968cba 100644
--- a/chrome/browser/android/resource_id.h
+++ b/chrome/browser/android/resource_id.h
@@ -22,10 +22,7 @@
 LINK_RESOURCE_ID(IDR_INFOBAR_AUTOFILL_CC, R.drawable.infobar_autofill_cc)
 LINK_RESOURCE_ID(IDR_INFOBAR_MEDIA_STREAM_CAMERA, R.drawable.infobar_camera)
 LINK_RESOURCE_ID(IDR_INFOBAR_MEDIA_STREAM_MIC, R.drawable.infobar_microphone)
-LINK_RESOURCE_ID(IDR_INFOBAR_MEDIA_STREAM_SCREEN,
-                 R.drawable.infobar_screen_share)
 LINK_RESOURCE_ID(IDR_INFOBAR_SAVE_PASSWORD, R.drawable.infobar_savepassword)
-LINK_RESOURCE_ID(IDR_INFOBAR_WARNING, R.drawable.infobar_warning)
 LINK_RESOURCE_ID(IDR_INFOBAR_TRANSLATE, R.drawable.infobar_translate)
 LINK_RESOURCE_ID(IDR_BLOCKED_POPUPS, R.drawable.infobar_blocked_popups)
 
@@ -33,6 +30,8 @@
 DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_FROZEN_TAB, R.drawable.infobar_restore)
 DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_GEOLOCATION,
                     R.drawable.infobar_geolocation)
+DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_MEDIA_STREAM_SCREEN,
+                    R.drawable.infobar_screen_share)
 DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_MIDI, R.drawable.infobar_midi)
 DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_MULTIPLE_DOWNLOADS,
                     R.drawable.infobar_multiple_downloads)
@@ -43,6 +42,7 @@
                     R.drawable.infobar_protected_media_identifier)
 DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_SUBRESOURCE_FILTERING,
                     R.drawable.infobar_subresource_filtering)
+DECLARE_RESOURCE_ID(IDR_ANDROID_INFOBAR_WARNING, R.drawable.infobar_warning)
 
 // WebsiteSettingsUI images, used in ConnectionInfoPopup
 // Good:
diff --git a/chrome/browser/android/vr_shell/BUILD.gn b/chrome/browser/android/vr_shell/BUILD.gn
index 74a34ae..ae35d28 100644
--- a/chrome/browser/android/vr_shell/BUILD.gn
+++ b/chrome/browser/android/vr_shell/BUILD.gn
@@ -56,8 +56,8 @@
 
 generate_jni("vr_shell_jni_headers") {
   sources = [
-    "//chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShell.java",
     "//chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java",
+    "//chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java",
   ]
   jni_package = "vr_shell"
 }
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
index b36e9c1..9f1bb69 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -20,7 +20,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/referrer.h"
 #include "content/public/common/screen_info.h"
-#include "jni/VrShell_jni.h"
+#include "jni/VrShellImpl_jni.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 #include "ui/android/view_android.h"
 #include "ui/android/window_android.h"
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 9979e70..01449b0 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -163,13 +163,6 @@
   return base::mac::NSToCFCast(base_bundle_id);
 }
 
-// This callback synchronizes preferences (under "org.chromium.Chromium" or
-// "com.google.Chrome"), in particular, writes them out to disk.
-void PrefsSyncCallback() {
-  if (!CFPreferencesAppSynchronize(BaseBundleID_CFString()))
-    LOG(WARNING) << "Error recording application bundle path.";
-}
-
 // Record the location of the application bundle (containing the main framework)
 // from which Chromium was loaded. This is used by app mode shims to find
 // Chromium.
@@ -187,12 +180,6 @@
   CFPreferencesSetAppValue(
       base::mac::NSToCFCast(app_mode::kLastRunAppBundlePathPrefsKey),
       app_bundle_path_cfstring, BaseBundleID_CFString());
-
-  // Sync after a delay avoid I/O contention on startup; 1500 ms is plenty.
-  BrowserThread::PostDelayedTask(
-      BrowserThread::FILE, FROM_HERE,
-      base::Bind(&PrefsSyncCallback),
-      base::TimeDelta::FromMilliseconds(1500));
 }
 
 bool IsProfileSignedOut(Profile* profile) {
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 2fbad196..30cd670 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -272,7 +272,7 @@
 #if defined(USE_AURA)
 #include "chrome/browser/lifetime/application_lifetime.h"
 #include "content/public/common/service_manager_connection.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 #endif
 
 #if defined(OS_WIN) || defined(OS_MACOSX) || \
@@ -1376,7 +1376,7 @@
 void ChromeBrowserMainParts::PreMainMessageLoopRun() {
 #if defined(USE_AURA)
   if (content::ServiceManagerConnection::GetForProcess() &&
-      shell::ShellIsRemote()) {
+      service_manager::ServiceManagerIsRemote()) {
     content::ServiceManagerConnection::GetForProcess()->
         SetConnectionLostClosure(base::Bind(&chrome::SessionEnding));
   }
diff --git a/chrome/browser/chrome_browser_main_android.cc b/chrome/browser/chrome_browser_main_android.cc
index dbb1287..b8f3811 100644
--- a/chrome/browser/chrome_browser_main_android.cc
+++ b/chrome/browser/chrome_browser_main_android.cc
@@ -70,7 +70,10 @@
     crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dump_dir));
   }
 
-  ui::SetLocalePaksStoredInApk(false);
+  // Auto-detect based on en-US whether locale .pak files are store uncompressed
+  // (monochrome) vs extracted (non-monochrome).
+  ui::SetLocalePaksStoredInApk(
+      !ui::GetPathForAndroidLocalePakWithinApk("en-US").empty());
 
   return ChromeBrowserMainParts::PreCreateThreads();
 }
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 9b2ca0d..449912a 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -183,8 +183,8 @@
 #include "net/cookies/cookie_options.h"
 #include "net/ssl/ssl_cert_request_info.h"
 #include "ppapi/host/ppapi_host.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "storage/browser/fileapi/external_mount_points.h"
 #include "third_party/WebKit/public/platform/modules/payments/payment_request.mojom.h"
 #include "third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h"
@@ -262,7 +262,7 @@
 #endif
 
 #if defined(USE_AURA)
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 #include "services/ui/public/cpp/gpu_service.h"
 #include "ui/views/mus/window_manager_connection.h"
 #endif
@@ -1479,7 +1479,7 @@
 
 #if BUILDFLAG(ANDROID_JAVA_UI)
 void ForwardShareServiceRequest(
-    base::WeakPtr<shell::InterfaceProvider> interface_provider,
+    base::WeakPtr<service_manager::InterfaceProvider> interface_provider,
     blink::mojom::ShareServiceRequest request) {
   if (!interface_provider ||
       ChromeOriginTrialPolicy().IsFeatureDisabled("WebShare")) {
@@ -2884,7 +2884,7 @@
 #endif  // defined(OS_WIN)
 
 void ChromeContentBrowserClient::ExposeInterfacesToRenderer(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     content::RenderProcessHost* render_process_host) {
   scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
       content::BrowserThread::GetTaskRunnerForThread(
@@ -2908,7 +2908,7 @@
 }
 
 void ChromeContentBrowserClient::ExposeInterfacesToMediaService(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     content::RenderFrameHost* render_frame_host) {
 // TODO(xhwang): Only register this when ENABLE_MOJO_MEDIA.
 #if defined(OS_CHROMEOS)
@@ -2924,7 +2924,7 @@
 }
 
 void ChromeContentBrowserClient::RegisterRenderFrameMojoInterfaces(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     content::RenderFrameHost* render_frame_host) {
   if (base::FeatureList::IsEnabled(features::kWebUsb)
 #if defined(ENABLE_EXTENSIONS)
@@ -2987,7 +2987,7 @@
 }
 
 void ChromeContentBrowserClient::ExposeInterfacesToGpuProcess(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     content::GpuProcessHost* render_process_host) {
   registry->AddInterface(
       base::Bind(&metrics::CallStackProfileCollector::Create,
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 9b157ec..700f9c6 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -277,16 +277,16 @@
       int sandbox_type) const override;
 #endif
   void ExposeInterfacesToRenderer(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       content::RenderProcessHost* render_process_host) override;
   void ExposeInterfacesToMediaService(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       content::RenderFrameHost* render_frame_host) override;
   void RegisterRenderFrameMojoInterfaces(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       content::RenderFrameHost* render_frame_host) override;
   void ExposeInterfacesToGpuProcess(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       content::GpuProcessHost* render_process_host) override;
   void RegisterInProcessServices(StaticServiceMap* services) override;
   void RegisterOutOfProcessServices(
diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc
index 67e0be0..fdf385a 100644
--- a/chrome/browser/chrome_quota_permission_context.cc
+++ b/chrome/browser/chrome_quota_permission_context.cc
@@ -17,16 +17,17 @@
 #include "chrome/browser/tab_contents/tab_util.h"
 #include "chrome/grit/generated_resources.h"
 #include "chrome/grit/locale_settings.h"
-#include "chrome/grit/theme_resources.h"
 #include "components/url_formatter/elide_url.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/navigation_details.h"
 #include "content/public/browser/web_contents.h"
 #include "storage/common/quota/quota_types.h"
 #include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/vector_icons_public.h"
 #include "url/gurl.h"
 
 #if defined(OS_ANDROID)
+#include "chrome/browser/android/android_theme_resources.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "components/infobars/core/confirm_infobar_delegate.h"
 #include "components/infobars/core/infobar.h"
@@ -55,7 +56,7 @@
 
  private:
   // PermissionRequest:
-  int GetIconId() const override;
+  IconId GetIconId() const override;
   base::string16 GetMessageTextFragment() const override;
   GURL GetOrigin() const override;
   void PermissionGranted() override;
@@ -81,9 +82,13 @@
 
 QuotaPermissionRequest::~QuotaPermissionRequest() {}
 
-int QuotaPermissionRequest::GetIconId() const {
+PermissionRequest::IconId QuotaPermissionRequest::GetIconId() const {
   // TODO(gbillock): get the proper image here
-  return IDR_INFOBAR_WARNING;
+#if defined(OS_ANDROID)
+  return IDR_ANDROID_INFOBAR_WARNING;
+#else
+  return gfx::VectorIconId::WARNING;
+#endif
 }
 
 base::string16 QuotaPermissionRequest::GetMessageTextFragment() const {
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
index 53c8465..7cb3aa43 100644
--- a/chrome/browser/chromeos/BUILD.gn
+++ b/chrome/browser/chromeos/BUILD.gn
@@ -62,6 +62,7 @@
     "//components/feedback",
     "//components/flags_ui",
     "//components/login",
+    "//components/metrics/leak_detector",
     "//components/onc",
     "//components/ownership",
     "//components/pairing",
@@ -91,7 +92,7 @@
     "//mojo/common",
     "//net",
     "//ppapi/proxy:ipc",  # For PpapiMsg_LoadPlugin
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
 
     # TODO: care about enable_basic_printing and enable_print_preview.
     "//components/sync",
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
index d8bd5f59..69c5713 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
@@ -75,7 +75,7 @@
 #include "extensions/common/host_id.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "media/audio/sounds/sounds_manager.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/base/ime/chromeos/input_method_manager.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/keyboard/keyboard_controller.h"
@@ -600,7 +600,7 @@
   autoclick_enabled_ = enabled;
 
   if (chrome::IsRunningInMash()) {
-    shell::Connector* connector =
+    service_manager::Connector* connector =
         content::ServiceManagerConnection::GetForProcess()->GetConnector();
     mash::mojom::LaunchablePtr launchable;
     connector->ConnectToInterface("service:accessibility_autoclick",
@@ -638,7 +638,7 @@
   autoclick_delay_ms_ = autoclick_delay_ms;
 
   if (chrome::IsRunningInMash()) {
-    shell::Connector* connector =
+    service_manager::Connector* connector =
         content::ServiceManagerConnection::GetForProcess()->GetConnector();
     ash::autoclick::mojom::AutoclickControllerPtr autoclick_controller;
     connector->ConnectToInterface("service:accessibility_autoclick",
diff --git a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
index 6ca119aa..d2d290b2 100644
--- a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
@@ -178,7 +178,7 @@
     return;
   }
 
-  // Swap Chrome app with any app in row |kMaxAppResults-1| iff his index is
+  // Swap Chrome app with any app in row |kMaxAppResults-1| iff its index is
   // bigger, thus ensuring the user can always see Chrome without scrolling.
   size_t chrome_app_index = 0;
   for (size_t i = 0; i < handlers.size(); ++i) {
diff --git a/chrome/browser/chromeos/arc/gpu_arc_video_service_host.cc b/chrome/browser/chromeos/arc/gpu_arc_video_service_host.cc
index ec24339..1d9f587 100644
--- a/chrome/browser/chromeos/arc/gpu_arc_video_service_host.cc
+++ b/chrome/browser/chromeos/arc/gpu_arc_video_service_host.cc
@@ -18,7 +18,7 @@
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace arc {
 
diff --git a/chrome/browser/chromeos/chrome_interface_factory.cc b/chrome/browser/chromeos/chrome_interface_factory.cc
index 03d4879..2a8fdb2 100644
--- a/chrome/browser/chromeos/chrome_interface_factory.cc
+++ b/chrome/browser/chromeos/chrome_interface_factory.cc
@@ -24,8 +24,8 @@
 #include "content/public/common/service_manager_connection.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/app_list/presenter/app_list_presenter.mojom.h"
 #include "ui/keyboard/keyboard.mojom.h"
 
@@ -84,7 +84,7 @@
 
   template <typename Interface>
   static void AddFactory(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
     registry->AddInterface<Interface>(
         base::Bind(&FactoryImpl::CallMainThreadFactory<Interface>),
@@ -158,9 +158,10 @@
 
 ChromeInterfaceFactory::~ChromeInterfaceFactory() {}
 
-bool ChromeInterfaceFactory::OnConnect(const shell::Identity& remote_identity,
-                                       shell::InterfaceRegistry* registry,
-                                       shell::Connector* connector) {
+bool ChromeInterfaceFactory::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry,
+    service_manager::Connector* connector) {
   FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry,
                                                      main_thread_task_runner_);
   FactoryImpl::AddFactory<mash::mojom::Launchable>(registry,
diff --git a/chrome/browser/chromeos/chrome_interface_factory.h b/chrome/browser/chromeos/chrome_interface_factory.h
index 809eabfa..5724127 100644
--- a/chrome/browser/chromeos/chrome_interface_factory.h
+++ b/chrome/browser/chromeos/chrome_interface_factory.h
@@ -21,9 +21,9 @@
 
  private:
   // content::ConnectionFilter:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry,
-                 shell::Connector* connector) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry,
+                 service_manager::Connector* connector) override;
 
   scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
 
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
index 5523f1b..0432bcec 100644
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
@@ -61,7 +61,7 @@
 #include "content/public/browser/notification_service.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/service_manager_connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "ui/gfx/codec/jpeg_codec.h"
 #include "ui/gfx/image/image_skia_operations.h"
@@ -210,7 +210,7 @@
 void SetWallpaper(const gfx::ImageSkia& image,
                   wallpaper::WallpaperLayout layout) {
   if (chrome::IsRunningInMash()) {
-    shell::Connector* connector =
+    service_manager::Connector* connector =
         content::ServiceManagerConnection::GetForProcess()->GetConnector();
     ash::mojom::WallpaperControllerPtr wallpaper_controller;
     connector->ConnectToInterface("service:ash", &wallpaper_controller);
diff --git a/chrome/browser/chromeos/policy/proto/chrome_device_policy.proto b/chrome/browser/chromeos/policy/proto/chrome_device_policy.proto
index 58134cbc..3789e5f1 100644
--- a/chrome/browser/chromeos/policy/proto/chrome_device_policy.proto
+++ b/chrome/browser/chromeos/policy/proto/chrome_device_policy.proto
@@ -662,7 +662,7 @@
   // no autocomplete option during user sign-in flow will be shown.
   // If this policy is set to a string representing a domain name, an
   // autocomplete option during user sign-in will be shown allowing the user
-  // to type in only his user name without the domain name extension. The user
+  // to type in only their user name without the domain name extension. The user
   // will be able to overwrite this domain name extension.
   optional string login_screen_domain_auto_complete = 1;
 }
diff --git a/chrome/browser/chromeos/system/input_device_settings_impl_ozone.cc b/chrome/browser/chromeos/system/input_device_settings_impl_ozone.cc
index 10808ff3..7505514 100644
--- a/chrome/browser/chromeos/system/input_device_settings_impl_ozone.cc
+++ b/chrome/browser/chromeos/system/input_device_settings_impl_ozone.cc
@@ -8,7 +8,7 @@
 #include "base/sys_info.h"
 #include "chrome/browser/chromeos/system/fake_input_device_settings.h"
 #include "content/public/browser/browser_thread.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 #include "ui/ozone/public/input_controller.h"
 #include "ui/ozone/public/ozone_platform.h"
 
@@ -20,7 +20,9 @@
 InputDeviceSettings* g_instance = nullptr;
 
 std::unique_ptr<ui::InputController> CreateStubInputControllerIfNecessary() {
-  return shell::ShellIsRemote() ? ui::CreateStubInputController() : nullptr;
+  return service_manager::ServiceManagerIsRemote()
+             ? ui::CreateStubInputController()
+             : nullptr;
 }
 
 // InputDeviceSettings for Linux without X11 (a.k.a. Ozone).
diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc
index 9634546..2f96e82 100644
--- a/chrome/browser/crash_recovery_browsertest.cc
+++ b/chrome/browser/crash_recovery_browsertest.cc
@@ -16,6 +16,8 @@
 #include "chrome/common/url_constants.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/web_contents.h"
@@ -140,10 +142,10 @@
   const base::FilePath::CharType kTitle2File[] =
       FILE_PATH_LITERAL("title2.html");
 
-  ui_test_utils::NavigateToURL(
-      browser(), ui_test_utils::GetTestUrl(
-                     base::FilePath(base::FilePath::kCurrentDirectory),
-                     base::FilePath(kTitle2File)));
+  GURL url(ui_test_utils::GetTestUrl(
+      base::FilePath(base::FilePath::kCurrentDirectory),
+      base::FilePath(kTitle2File)));
+  ui_test_utils::NavigateToURL(browser(), url);
 
   base::string16 title_before_crash;
   base::string16 title_after_crash;
@@ -151,6 +153,9 @@
   ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
                                                 &title_before_crash));
   SimulateRendererCrash(browser());
+  ASSERT_EQ(GURL(content::kChromeUICrashURL),
+            GetActiveWebContents()->GetController().GetVisibleEntry()->
+                GetVirtualURL());
   chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB);
   content::WaitForLoadStop(GetActiveWebContents());
   ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(),
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc
index c3ff05e..c1b230b 100644
--- a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc
+++ b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.cc
@@ -12,10 +12,6 @@
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/gfx/vector_icons_public.h"
 
-#if defined(OS_MACOSX)
-#include "chrome/grit/theme_resources.h"
-#endif
-
 namespace {
 
 base::string16 GetProtocolName(
@@ -42,21 +38,9 @@
 RegisterProtocolHandlerPermissionRequest::
 ~RegisterProtocolHandlerPermissionRequest() {}
 
-gfx::VectorIconId RegisterProtocolHandlerPermissionRequest::GetVectorIconId()
+PermissionRequest::IconId RegisterProtocolHandlerPermissionRequest::GetIconId()
     const {
-#if defined(OS_MACOSX)
-  return gfx::VectorIconId::VECTOR_ICON_NONE;
-#else
   return gfx::VectorIconId::PROTOCOL_HANDLER;
-#endif
-}
-
-int RegisterProtocolHandlerPermissionRequest::GetIconId() const {
-#if defined(OS_MACOSX)
-  return IDR_REGISTER_PROTOCOL_HANDLER;
-#else
-  return 0;
-#endif
 }
 
 base::string16
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h
index 7540d229..2cb9d62 100644
--- a/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h
+++ b/chrome/browser/custom_handlers/register_protocol_handler_permission_request.h
@@ -24,8 +24,7 @@
 
  private:
   // PermissionRequest:
-  gfx::VectorIconId GetVectorIconId() const override;
-  int GetIconId() const override;
+  IconId GetIconId() const override;
   base::string16 GetMessageTextFragment() const override;
   GURL GetOrigin() const override;
   void PermissionGranted() override;
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc
index 7875ce0..2c5a4e70 100644
--- a/chrome/browser/devtools/devtools_window.cc
+++ b/chrome/browser/devtools/devtools_window.cc
@@ -13,6 +13,7 @@
 #include "base/time/time.h"
 #include "base/values.h"
 #include "chrome/browser/certificate_viewer.h"
+#include "chrome/browser/data_use_measurement/data_use_web_contents_observer.h"
 #include "chrome/browser/file_select_helper.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/profiles/profile.h"
@@ -791,6 +792,8 @@
   main_web_contents_->SetDelegate(this);
   // Bindings take ownership over devtools as its delegate.
   bindings_->SetDelegate(this);
+  data_use_measurement::DataUseWebContentsObserver::CreateForWebContents(
+      main_web_contents_);
   // DevTools uses PageZoom::Zoom(), so main_web_contents_ requires a
   // ZoomController.
   zoom::ZoomController::CreateForWebContents(main_web_contents_);
@@ -1017,6 +1020,8 @@
     // UserData so that it shows up in the task manager.
     task_manager::WebContentsTags::CreateForDevToolsContents(
         toolbox_web_contents_);
+    data_use_measurement::DataUseWebContentsObserver::CreateForWebContents(
+        toolbox_web_contents_);
   }
 }
 
diff --git a/chrome/browser/download/download_permission_request.cc b/chrome/browser/download/download_permission_request.cc
index 25d99a0..90522f0 100644
--- a/chrome/browser/download/download_permission_request.cc
+++ b/chrome/browser/download/download_permission_request.cc
@@ -19,7 +19,7 @@
 
 DownloadPermissionRequest::~DownloadPermissionRequest() {}
 
-gfx::VectorIconId DownloadPermissionRequest::GetVectorIconId() const {
+PermissionRequest::IconId DownloadPermissionRequest::GetIconId() const {
   return gfx::VectorIconId::FILE_DOWNLOAD;
 }
 
diff --git a/chrome/browser/download/download_permission_request.h b/chrome/browser/download/download_permission_request.h
index b23fab8..66c1cf9 100644
--- a/chrome/browser/download/download_permission_request.h
+++ b/chrome/browser/download/download_permission_request.h
@@ -21,8 +21,8 @@
   ~DownloadPermissionRequest() override;
 
  private:
-  // PermisisonBubbleDelegate:
-  gfx::VectorIconId GetVectorIconId() const override;
+  // PermissionBubbleDelegate:
+  IconId GetIconId() const override;
   base::string16 GetMessageTextFragment() const override;
   GURL GetOrigin() const override;
   void PermissionGranted() override;
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc b/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
index 1b5f72ea..299ce59 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
+++ b/chrome/browser/extensions/api/settings_private/settings_private_delegate.cc
@@ -60,14 +60,14 @@
 
 std::unique_ptr<base::Value> SettingsPrivateDelegate::GetDefaultZoomPercent() {
   double zoom = content::ZoomLevelToZoomFactor(
-      profile_->GetZoomLevelPrefs()->GetDefaultZoomLevelPref()) * 100;
+      profile_->GetZoomLevelPrefs()->GetDefaultZoomLevelPref());
   std::unique_ptr<base::Value> value(new base::FundamentalValue(zoom));
   return value;
 }
 
 PrefsUtil::SetPrefResult SettingsPrivateDelegate::SetDefaultZoomPercent(
-    int percent) {
-  double zoom_factor = content::ZoomFactorToZoomLevel(percent * 0.01);
+    double percent) {
+  double zoom_factor = content::ZoomFactorToZoomLevel(percent);
   profile_->GetZoomLevelPrefs()->SetDefaultZoomLevelPref(zoom_factor);
   return PrefsUtil::SetPrefResult::SUCCESS;
 }
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_delegate.h b/chrome/browser/extensions/api/settings_private/settings_private_delegate.h
index 66c7153..93bbb9d 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_delegate.h
+++ b/chrome/browser/extensions/api/settings_private/settings_private_delegate.h
@@ -48,7 +48,7 @@
   virtual std::unique_ptr<base::Value> GetDefaultZoomPercent();
 
   // Sets the pref.
-  virtual PrefsUtil::SetPrefResult SetDefaultZoomPercent(int percent);
+  virtual PrefsUtil::SetPrefResult SetDefaultZoomPercent(double percent);
 
  protected:
   Profile* profile_;  // weak; not owned by us
diff --git a/chrome/browser/extensions/chrome_mojo_service_registration.cc b/chrome/browser/extensions/chrome_mojo_service_registration.cc
index 5ebedbda..c280f2c14 100644
--- a/chrome/browser/extensions/chrome_mojo_service_registration.cc
+++ b/chrome/browser/extensions/chrome_mojo_service_registration.cc
@@ -11,7 +11,7 @@
 #include "extensions/common/extension.h"
 #include "extensions/common/permissions/api_permission.h"
 #include "extensions/common/permissions/permissions_data.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 #if defined(ENABLE_MEDIA_ROUTER)
 #include "chrome/browser/media/router/media_router_feature.h"
diff --git a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
index 8e659145..662dc94 100644
--- a/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
+++ b/chrome/browser/extensions/component_extensions_whitelist/whitelist.cc
@@ -14,7 +14,7 @@
 #include "chrome/grit/browser_resources.h"
 #include "extensions/common/constants.h"
 
-#if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
+#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
 #include "chrome/browser/ui/app_list/google_now_extension.h"
 #endif
 
@@ -48,7 +48,7 @@
       return true;
   }
 
-#if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
+#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
   std::string google_now_extension_id;
   if (GetGoogleNowExtensionId(&google_now_extension_id) &&
       google_now_extension_id == extension_id) {
@@ -72,7 +72,7 @@
   switch (manifest_resource_id) {
     // Please keep the list in alphabetical order.
     case IDR_BOOKMARKS_MANIFEST:
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
     case IDR_CHROME_APP_MANIFEST:
 #endif
 #if defined(ENABLE_PRINTING)
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc
index fdabd8f..7f66fb6 100644
--- a/chrome/browser/extensions/component_loader.cc
+++ b/chrome/browser/extensions/component_loader.cc
@@ -408,7 +408,7 @@
 }
 
 void ComponentLoader::AddChromeApp() {
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   AddWithNameAndDescription(
       IDR_CHROME_APP_MANIFEST, base::FilePath(FILE_PATH_LITERAL("chrome_app")),
       l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME),
diff --git a/chrome/browser/extensions/external_component_loader.cc b/chrome/browser/extensions/external_component_loader.cc
index 76e7c5f3..8a1e6af 100644
--- a/chrome/browser/extensions/external_component_loader.cc
+++ b/chrome/browser/extensions/external_component_loader.cc
@@ -12,6 +12,7 @@
 #include "chrome/browser/search/hotword_service_factory.h"
 #include "chrome/browser/signin/signin_manager_factory.h"
 #include "chrome/common/extensions/extension_constants.h"
+#include "chrome/common/features.h"
 #include "components/signin/core/browser/signin_manager.h"
 #include "extensions/common/extension_urls.h"
 #include "extensions/common/manifest.h"
@@ -21,7 +22,7 @@
 #include "chromeos/chromeos_switches.h"
 #endif
 
-#if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
+#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
 #include "chrome/browser/ui/app_list/google_now_extension.h"
 #endif
 
@@ -58,7 +59,7 @@
     AddExternalExtension(extension_misc::kMediaRouterStableExtensionId);
 #endif  // defined(ENABLE_MEDIA_ROUTER) && defined(GOOGLE_CHROME_BUILD)
 
-#if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
+#if BUILDFLAG(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
   std::string google_now_extension_id;
   if (GetGoogleNowExtensionId(&google_now_extension_id))
     AddExternalExtension(google_now_extension_id);
diff --git a/chrome/browser/image_decoder.cc b/chrome/browser/image_decoder.cc
index a45e5be1..b86f68af9 100644
--- a/chrome/browser/image_decoder.cc
+++ b/chrome/browser/image_decoder.cc
@@ -14,7 +14,7 @@
 #include "chrome/grit/generated_resources.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/utility_process_host.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "ui/base/l10n/l10n_util.h"
 
diff --git a/chrome/browser/media/webrtc/media_stream_capture_indicator.cc b/chrome/browser/media/webrtc/media_stream_capture_indicator.cc
index 9e80983..d97d9c69 100644
--- a/chrome/browser/media/webrtc/media_stream_capture_indicator.cc
+++ b/chrome/browser/media/webrtc/media_stream_capture_indicator.cc
@@ -356,6 +356,7 @@
 void MediaStreamCaptureIndicator::EnsureStatusTrayIconResources() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
+  // TODO(estade): these should use vector icons.
   if (!mic_image_) {
     mic_image_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
         IDR_INFOBAR_MEDIA_STREAM_MIC);
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller.cc b/chrome/browser/media/webrtc/media_stream_devices_controller.cc
index 366ff37..2bf8267 100644
--- a/chrome/browser/media/webrtc/media_stream_devices_controller.cc
+++ b/chrome/browser/media/webrtc/media_stream_devices_controller.cc
@@ -26,7 +26,6 @@
 #include "chrome/common/features.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/grit/generated_resources.h"
-#include "chrome/grit/theme_resources.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/content_settings/core/common/content_settings_pattern.h"
 #include "components/pref_registry/pref_registry_syncable.h"
@@ -40,12 +39,14 @@
 #include "content/public/common/origin_util.h"
 #include "extensions/common/constants.h"
 #include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/vector_icons_public.h"
 
 #if BUILDFLAG(ANDROID_JAVA_UI)
 #include <vector>
 
 #include "chrome/browser/android/preferences/pref_service_bridge.h"
 #include "chrome/browser/permissions/permission_update_infobar_delegate_android.h"
+#include "chrome/grit/theme_resources.h"
 #include "content/public/browser/android/content_view_core.h"
 #include "ui/android/window_android.h"
 #endif  // BUILDFLAG(ANDROID_JAVA_UI)
@@ -275,11 +276,14 @@
   set_persist(true);
 }
 
-int MediaStreamDevicesController::GetIconId() const {
-  if (IsAskingForVideo())
-    return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
-
-  return IDR_INFOBAR_MEDIA_STREAM_MIC;
+PermissionRequest::IconId MediaStreamDevicesController::GetIconId() const {
+#if defined(OS_ANDROID)
+  return IsAskingForVideo() ? IDR_INFOBAR_MEDIA_STREAM_CAMERA
+                            : IDR_INFOBAR_MEDIA_STREAM_MIC;
+#else
+  return IsAskingForVideo() ? gfx::VectorIconId::VIDEOCAM
+                            : gfx::VectorIconId::MICROPHONE;
+#endif
 }
 
 base::string16 MediaStreamDevicesController::GetMessageTextFragment() const {
diff --git a/chrome/browser/media/webrtc/media_stream_devices_controller.h b/chrome/browser/media/webrtc/media_stream_devices_controller.h
index 928c9379b..45170221 100644
--- a/chrome/browser/media/webrtc/media_stream_devices_controller.h
+++ b/chrome/browser/media/webrtc/media_stream_devices_controller.h
@@ -59,7 +59,7 @@
   bool ShouldShowPersistenceToggle() const override;
 
   // PermissionRequest:
-  int GetIconId() const override;
+  IconId GetIconId() const override;
   base::string16 GetMessageTextFragment() const override;
   GURL GetOrigin() const override;
   void PermissionGranted() override;
diff --git a/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc b/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc
index bdbc0be..2d9e4ae 100644
--- a/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc
+++ b/chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.cc
@@ -5,12 +5,12 @@
 #include "chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h"
 
 #include "base/callback_helpers.h"
+#include "chrome/browser/android/android_theme_resources.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/media/webrtc/desktop_streams_registry.h"
 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h"
 #include "chrome/grit/generated_resources.h"
-#include "chrome/grit/theme_resources.h"
 #include "components/infobars/core/infobar.h"
 #include "components/url_formatter/elide_url.h"
 #include "content/public/browser/web_contents.h"
@@ -59,7 +59,7 @@
 }
 
 int ScreenCaptureInfoBarDelegateAndroid::GetIconId() const {
-  return IDR_INFOBAR_MEDIA_STREAM_SCREEN;
+  return IDR_ANDROID_INFOBAR_MEDIA_STREAM_SCREEN;
 }
 
 base::string16 ScreenCaptureInfoBarDelegateAndroid::GetButtonLabel(
diff --git a/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc b/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc
index 9714ab8..339f5c2 100644
--- a/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc
+++ b/chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc
@@ -15,7 +15,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/utility_process_host.h"
 #include "content/public/browser/utility_process_host_client.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "ui/base/l10n/l10n_util.h"
 
 namespace {
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac.mm b/chrome/browser/notifications/notification_platform_bridge_mac.mm
index 3cc13058b..5890dc3 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm
@@ -48,7 +48,6 @@
 // Site settings button is implemented as NSUserNotification's action button
 // Not easy to implement:
 // -notification.requireInteraction
-// -The event associated to the close button
 
 // TODO(miguelg) implement the following features
 // - Sound names can be implemented by setting soundName in NSUserNotification
@@ -88,6 +87,7 @@
                                    const std::string& notification_id,
                                    int32_t button_index) {
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
   ProfileManager* profileManager = g_browser_process->profile_manager();
   DCHECK(profileManager);
 
@@ -114,8 +114,16 @@
 // Interface to communicate with the Alert XPC service.
 @interface NotificationRemoteDispatcher : NSObject
 
+// Deliver a notification to the XPC service to be displayed as an alert.
 - (void)dispatchNotification:(NSDictionary*)data;
 
+// Close a notification for a given |notificationId| and |profileId|.
+- (void)closeNotificationWithId:(NSString*)notificationId
+                  withProfileId:(NSString*)profileId;
+
+// Close all notifications.
+- (void)closeAllNotifications;
+
 @end
 
 // /////////////////////////////////////////////////////////////////////////////
@@ -137,9 +145,11 @@
 NotificationPlatformBridgeMac::~NotificationPlatformBridgeMac() {
   [notification_center_ setDelegate:nil];
 
-  // TODO(miguelg) remove only alerts shown by the XPC service.
   // TODO(miguelg) do not remove banners if possible.
   [notification_center_ removeAllDeliveredNotifications];
+#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
+  [notification_remote_dispatcher_ closeAllNotifications];
+#endif  // BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
 }
 
 void NotificationPlatformBridgeMac::Display(
@@ -231,8 +241,9 @@
 void NotificationPlatformBridgeMac::Close(const std::string& profile_id,
                                           const std::string& notification_id) {
   NSString* candidate_id = base::SysUTF8ToNSString(notification_id);
-
   NSString* current_profile_id = base::SysUTF8ToNSString(profile_id);
+
+  bool notification_removed = false;
   for (NSUserNotification* toast in
        [notification_center_ deliveredNotifications]) {
     NSString* toast_id =
@@ -244,8 +255,19 @@
     if ([toast_id isEqualToString:candidate_id] &&
         [persistent_profile_id isEqualToString:current_profile_id]) {
       [notification_center_ removeDeliveredNotification:toast];
+      notification_removed = true;
+      break;
     }
   }
+#if BUILDFLAG(ENABLE_XPC_NOTIFICATIONS)
+  // If no banner existed with that ID try to see if there is an alert
+  // in the xpc server.
+  if (!notification_removed) {
+    [notification_remote_dispatcher_
+        closeNotificationWithId:candidate_id
+                  withProfileId:current_profile_id];
+  }
+#endif  // ENABLE_XPC_NOTIFICATIONS
 }
 
 bool NotificationPlatformBridgeMac::GetDisplayed(
@@ -378,6 +400,20 @@
       notificationResponse);
 }
 
+// Overriden from _NSUserNotificationCenterDelegatePrivate.
+// Emitted when a user clicks the "Close" button in the notification.
+// It not is emitted if the notification is closed from the notification
+// center or if the app is not running at the time the Close button is
+// pressed so it's essentially just a best effort way to detect
+// notifications closed by the user.
+- (void)userNotificationCenter:(NSUserNotificationCenter*)center
+               didDismissAlert:(NSUserNotification*)notification {
+  NSDictionary* notificationResponse =
+      [NotificationResponseBuilder buildDictionary:notification];
+  NotificationPlatformBridgeMac::ProcessNotificationResponse(
+      notificationResponse);
+}
+
 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center
      shouldPresentNotification:(NSUserNotification*)nsNotification {
   // Always display notifications, regardless of whether the app is foreground.
@@ -427,6 +463,16 @@
   [[xpcConnection_ remoteObjectProxy] deliverNotification:data];
 }
 
+- (void)closeNotificationWithId:(NSString*)notificationId
+                  withProfileId:(NSString*)profileId {
+  [[xpcConnection_ remoteObjectProxy] closeNotificationWithId:notificationId
+                                                withProfileId:profileId];
+}
+
+- (void)closeAllNotifications {
+  [[xpcConnection_ remoteObjectProxy] closeAllNotifications];
+}
+
 // NotificationReply implementation
 - (void)notificationClick:(NSDictionary*)notificationResponseData {
   NotificationPlatformBridgeMac::ProcessNotificationResponse(
diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
index 32bcb93e..b7db856 100644
--- a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
+++ b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm
@@ -3,96 +3,133 @@
 // found in the LICENSE file.
 
 #import <AppKit/AppKit.h>
+#import <objc/runtime.h>
 
 #include "base/mac/scoped_nsobject.h"
-#include "chrome/browser/notifications/notification_common.h"
+#import "base/mac/scoped_objc_class_swizzler.h"
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/notifications/notification.h"
 #include "chrome/browser/notifications/notification_platform_bridge_mac.h"
+#include "chrome/browser/notifications/notification_test_util.h"
+#include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
 #include "chrome/browser/ui/cocoa/notifications/notification_builder_mac.h"
 #include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h"
 #include "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+#include "url/gurl.h"
 
-namespace {
+class NotificationPlatformBridgeMacTest : public CocoaTest {
+ protected:
+  std::unique_ptr<Notification> CreateNotification(const char* title,
+                                                   const char* subtitle,
+                                                   const char* origin,
+                                                   const char* button1,
+                                                   const char* button2) {
+    message_center::RichNotificationData optional_fields;
+    optional_fields.context_message = base::UTF8ToUTF16(origin);
+    if (button1) {
+      optional_fields.buttons.push_back(
+          message_center::ButtonInfo(base::UTF8ToUTF16(button1)));
+      if (button2) {
+        optional_fields.buttons.push_back(
+            message_center::ButtonInfo(base::UTF8ToUTF16(button2)));
+      }
+    }
 
-NSMutableDictionary* BuildDefaultNotificationResponse() {
-  base::scoped_nsobject<NotificationBuilder> builder(
-      [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
-                                         optionsLabel:@"Options"
-                                        settingsLabel:@"Settings"]);
-  [builder setTitle:@"Title"];
-  [builder setSubTitle:@"https://www.miguel.com"];
-  [builder setOrigin:@"https://www.miguel.com/"];
-  [builder setContextMessage:@""];
-  [builder setButtons:@"Button1" secondaryButton:@"Button2"];
-  [builder setTag:@"tag1"];
-  [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]];
-  [builder setNotificationId:@"notificationId"];
-  [builder setProfileId:@"profileId"];
-  [builder setIncognito:false];
-  [builder
-      setNotificationType:[NSNumber
-                              numberWithInt:NotificationCommon::PERSISTENT]];
+    GURL url = GURL(origin);
 
-  NSUserNotification* notification = [builder buildUserNotification];
-  return [NSMutableDictionary
-      dictionaryWithDictionary:[NotificationResponseBuilder
-                                   buildDictionary:notification]];
-}
+    std::unique_ptr<Notification> notification(new Notification(
+        message_center::NOTIFICATION_TYPE_SIMPLE, base::UTF8ToUTF16(title),
+        base::UTF8ToUTF16(subtitle), gfx::Image(),
+        message_center::NotifierId(url), base::UTF8ToUTF16("Notifier's Name"),
+        url, "id1", optional_fields, new MockNotificationDelegate("id1")));
 
-}  // namespace
+    return notification;
+  }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationValidResponse) {
+  NSMutableDictionary* BuildDefaultNotificationResponse() {
+    base::scoped_nsobject<NotificationBuilder> builder(
+        [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
+                                           optionsLabel:@"Options"
+                                          settingsLabel:@"Settings"]);
+    [builder setTitle:@"Title"];
+    [builder setSubTitle:@"https://www.miguel.com"];
+    [builder setOrigin:@"https://www.miguel.com/"];
+    [builder setContextMessage:@""];
+    [builder setButtons:@"Button1" secondaryButton:@"Button2"];
+    [builder setTag:@"tag1"];
+    [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]];
+    [builder setNotificationId:@"notificationId"];
+    [builder setProfileId:@"profileId"];
+    [builder setIncognito:false];
+    [builder
+        setNotificationType:[NSNumber
+                                numberWithInt:NotificationCommon::PERSISTENT]];
+
+    NSUserNotification* notification = [builder buildUserNotification];
+    return [NSMutableDictionary
+        dictionaryWithDictionary:[NotificationResponseBuilder
+                                     buildDictionary:notification]];
+  }
+};
+
+TEST_F(NotificationPlatformBridgeMacTest, TestNotificationVerifyValidResponse) {
   NSDictionary* response = BuildDefaultNotificationResponse();
   EXPECT_TRUE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationUnknownType) {
+TEST_F(NotificationPlatformBridgeMacTest, TestNotificationUnknownType) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response setValue:[NSNumber numberWithInt:210581]
               forKey:notification_constants::kNotificationType];
   EXPECT_FALSE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationUnknownOperation) {
+TEST_F(NotificationPlatformBridgeMacTest,
+       TestNotificationVerifyUnknownOperation) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response setValue:[NSNumber numberWithInt:40782]
               forKey:notification_constants::kNotificationOperation];
   EXPECT_FALSE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationMissingOperation) {
+TEST_F(NotificationPlatformBridgeMacTest,
+       TestNotificationVerifyMissingOperation) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response removeObjectForKey:notification_constants::kNotificationOperation];
   EXPECT_FALSE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationNoProfileId) {
+TEST_F(NotificationPlatformBridgeMacTest, TestNotificationVerifyNoProfileId) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response removeObjectForKey:notification_constants::kNotificationProfileId];
   EXPECT_FALSE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationNoNotificationId) {
+TEST_F(NotificationPlatformBridgeMacTest,
+       TestNotificationVerifyNoNotificationId) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response setValue:@"" forKey:notification_constants::kNotificationId];
   EXPECT_FALSE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationInvalidButton) {
+TEST_F(NotificationPlatformBridgeMacTest, TestNotificationVerifyInvalidButton) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response setValue:[NSNumber numberWithInt:-5]
               forKey:notification_constants::kNotificationButtonIndex];
   EXPECT_FALSE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationMissingButtonIndex) {
+TEST_F(NotificationPlatformBridgeMacTest,
+       TestNotificationVerifyMissingButtonIndex) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response
       removeObjectForKey:notification_constants::kNotificationButtonIndex];
   EXPECT_FALSE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
 
-TEST(NotificationPlatformBridgeMacTest, TestNotificationOrigin) {
+TEST_F(NotificationPlatformBridgeMacTest, TestNotificationVerifyOrigin) {
   NSMutableDictionary* response = BuildDefaultNotificationResponse();
   [response setValue:@"invalidorigin"
               forKey:notification_constants::kNotificationOrigin];
@@ -102,3 +139,71 @@
   [response removeObjectForKey:notification_constants::kNotificationOrigin];
   EXPECT_TRUE(NotificationPlatformBridgeMac::VerifyNotificationData(response));
 }
+
+// The usual [NSUSerNotificationCenter defaultNotificationCenter] constructor
+// is not available in tests. The private constructor fortunatelly is.
+@interface NSUserNotificationCenter (PrivateAPI)
++ (NSUserNotificationCenter*)_centerForIdentifier:(NSString*)ident
+                                             type:(NSUInteger)type;
+@end
+
+// Category to extend the notification center with different implementations
+// of the deliverNotification selector which can be swizzled as part of the
+// test.
+// TODO(miguelg) replace this with OCMock once a version with support
+// for dynamic properties is rolled out (crbug.com/622753).
+@interface NSUserNotificationCenter (TestAdditions)
+- (void)expectationsNoButtons:(NSUserNotification*)notification;
+- (void)expectationsOneButton:(NSUserNotification*)notification;
+@end
+
+@implementation NSUserNotificationCenter (TestAdditions)
+
+// Expectations for notifications with no buttons.
+- (void)expectationsNoButtons:(NSUserNotification*)notification {
+  EXPECT_NSEQ(@"Title", [notification title]);
+  EXPECT_NSEQ(@"Context", [notification informativeText]);
+  EXPECT_NSEQ(@"https://gmail.com", [notification subtitle]);
+  EXPECT_NSEQ(@"Close", [notification otherButtonTitle]);
+  EXPECT_NSEQ(@"Settings", [notification actionButtonTitle]);
+}
+
+// Expectations for notifications with one button.
+- (void)expectationsOneButton:(NSUserNotification*)notification {
+  EXPECT_NSEQ(@"Title", [notification title]);
+  EXPECT_NSEQ(@"Context", [notification informativeText]);
+  EXPECT_NSEQ(@"https://gmail.com", [notification subtitle]);
+  EXPECT_NSEQ(@"Close", [notification otherButtonTitle]);
+  EXPECT_NSEQ(@"Options", [notification actionButtonTitle]);
+}
+
+@end
+
+TEST_F(NotificationPlatformBridgeMacTest, TestDisplayNoButtons) {
+  base::scoped_nsobject<NSUserNotificationCenter> notification_center(
+      [NSUserNotificationCenter _centerForIdentifier:@"" type:0x0]);
+  base::mac::ScopedObjCClassSwizzler swizzler(
+      [notification_center class], @selector(deliverNotification:),
+      @selector(expectationsNoButtons:));
+
+  std::unique_ptr<Notification> notification = CreateNotification(
+      "Title", "Context", "https://gmail.com", nullptr, nullptr);
+  std::unique_ptr<NotificationPlatformBridgeMac> bridge(
+      new NotificationPlatformBridgeMac(notification_center));
+  bridge->Display(NotificationCommon::PERSISTENT, "notification_id",
+                  "profile_id", false, *notification);
+}
+
+TEST_F(NotificationPlatformBridgeMacTest, TestDisplayOneButton) {
+  std::unique_ptr<Notification> notification = CreateNotification(
+      "Title", "Context", "https://gmail.com", "Button 1", nullptr);
+  base::scoped_nsobject<NSUserNotificationCenter> notification_center(
+      [NSUserNotificationCenter _centerForIdentifier:@"" type:0x0]);
+  base::mac::ScopedObjCClassSwizzler swizzler(
+      [notification_center class], @selector(deliverNotification:),
+      @selector(expectationsOneButton:));
+  std::unique_ptr<NotificationPlatformBridgeMac> bridge(
+      new NotificationPlatformBridgeMac(notification_center));
+  bridge->Display(NotificationCommon::PERSISTENT, "notification_id",
+                  "profile_id", false, *notification);
+}
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
index cfb0da4..a1c27e2 100644
--- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc
@@ -167,17 +167,9 @@
 const char kHistogramLoadTypeParseStartNewNavigation[] =
     "PageLoad.ParseTiming.NavigationToParseStart.LoadType.NewNavigation";
 
-const char kHistogramFirstBackground[] =
-    "PageLoad.Timing2.NavigationToFirstBackground";
 const char kHistogramFirstForeground[] =
     "PageLoad.Timing2.NavigationToFirstForeground";
 
-const char kHistogramBackgroundBeforePaint[] =
-    "PageLoad.Timing2.NavigationToFirstBackground.AfterCommit.BeforePaint";
-const char kHistogramBackgroundBeforeCommit[] =
-    "PageLoad.Timing2.NavigationToFirstBackground.BeforeCommit";
-const char kHistogramBackgroundDuringParse[] =
-    "PageLoad.Timing2.NavigationToFirstBackground.DuringParse";
 const char kHistogramFailedProvisionalLoad[] =
     "PageLoad.Timing2.NavigationToFailedProvisionalLoad";
 
@@ -515,11 +507,6 @@
 void CorePageLoadMetricsObserver::OnFailedProvisionalLoad(
     const page_load_metrics::FailedProvisionalLoadInfo& failed_load_info,
     const page_load_metrics::PageLoadExtraInfo& extra_info) {
-  if (extra_info.started_in_foreground && extra_info.first_background_time) {
-    PAGE_LOAD_HISTOGRAM(internal::kHistogramBackgroundBeforeCommit,
-                        extra_info.first_background_time.value());
-  }
-
   // Only handle actual failures; provisional loads that failed due to another
   // committed load or due to user action are recorded in
   // AbortsPageLoadMetricsObserver.
@@ -581,24 +568,7 @@
 
   // Log time to first foreground / time to first background. Log counts that we
   // started a relevant page load in the foreground / background.
-  if (info.started_in_foreground) {
-    if (info.first_background_time) {
-      const base::TimeDelta first_background_time =
-          info.first_background_time.value();
-
-      PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstBackground,
-                          first_background_time);
-      if (!timing.first_paint || timing.first_paint > first_background_time) {
-        PAGE_LOAD_HISTOGRAM(internal::kHistogramBackgroundBeforePaint,
-                            first_background_time);
-      }
-      if (timing.parse_start && first_background_time >= timing.parse_start &&
-          (!timing.parse_stop || timing.parse_stop > first_background_time)) {
-        PAGE_LOAD_HISTOGRAM(internal::kHistogramBackgroundDuringParse,
-                            first_background_time);
-      }
-    }
-  } else {
+  if (!info.started_in_foreground) {
     if (info.first_foreground_time)
       PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstForeground,
                           info.first_foreground_time.value());
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h
index 458a4ea..d40f5f7 100644
--- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h
+++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h
@@ -41,7 +41,6 @@
 extern const char kHistogramLoadTypeParseStartForwardBack[];
 extern const char kHistogramLoadTypeParseStartNewNavigation[];
 
-extern const char kHistogramBackgroundBeforePaint[];
 extern const char kHistogramFailedProvisionalLoad[];
 
 extern const char kRapporMetricsNameCoarseTiming[];
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc
index b64afce..b36d82e 100644
--- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc
@@ -383,23 +383,6 @@
                                       0);
 }
 
-TEST_F(CorePageLoadMetricsObserverTest, BackgroundBeforePaint) {
-  page_load_metrics::PageLoadTiming timing;
-  timing.navigation_start = base::Time::FromDoubleT(1);
-  timing.first_paint = base::TimeDelta::FromSeconds(10);
-  PopulateRequiredTimingFields(&timing);
-  NavigateAndCommit(GURL(kDefaultTestUrl));
-  // Background the tab and go for a coffee or something.
-  web_contents()->WasHidden();
-  SimulateTimingUpdate(timing);
-  // Come back and start browsing again.
-  web_contents()->WasShown();
-  // Simulate the user performaning another navigation.
-  NavigateAndCommit(GURL("https://www.example.com"));
-  histogram_tester().ExpectTotalCount(internal::kHistogramBackgroundBeforePaint,
-                                      1);
-}
-
 TEST_F(CorePageLoadMetricsObserverTest, NoRappor) {
   rappor::TestSample::Shadow* sample_obj =
       rappor_tester_.GetRecordedSampleForMetric(
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.h b/chrome/browser/password_manager/chrome_password_manager_client.h
index a2ca4df..777cebb 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.h
+++ b/chrome/browser/password_manager/chrome_password_manager_client.h
@@ -10,7 +10,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/password_manager/content/browser/content_password_manager_driver_factory.h"
 #include "components/password_manager/content/browser/credential_manager_impl.h"
 #include "components/password_manager/core/browser/password_manager.h"
diff --git a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
index 694fc12f..71af844 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -20,7 +20,7 @@
 #include "chrome/common/channel_info.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
-#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
+#include "components/autofill/content/common/autofill_agent.mojom.h"
 #include "components/password_manager/content/browser/password_manager_internals_service_factory.h"
 #include "components/password_manager/core/browser/credentials_filter.h"
 #include "components/password_manager/core/browser/log_manager.h"
@@ -41,7 +41,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/web_contents_tester.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -198,9 +198,9 @@
 void ChromePasswordManagerClientTest::SetUp() {
   ChromeRenderViewHostTestHarness::SetUp();
 
-  shell::InterfaceProvider* remote_interfaces =
+  service_manager::InterfaceProvider* remote_interfaces =
       web_contents()->GetMainFrame()->GetRemoteInterfaces();
-  shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+  service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
   test_api.SetBinderForName(autofill::mojom::PasswordAutofillAgent::Name_,
                             base::Bind(&FakePasswordAutofillAgent::BindRequest,
                                        base::Unretained(&fake_agent_)));
diff --git a/chrome/browser/permissions/grouped_permission_infobar_delegate_android.cc b/chrome/browser/permissions/grouped_permission_infobar_delegate_android.cc
index 2cbb3b0..93aec6f 100644
--- a/chrome/browser/permissions/grouped_permission_infobar_delegate_android.cc
+++ b/chrome/browser/permissions/grouped_permission_infobar_delegate_android.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android.h"
 
 #include "base/memory/ptr_util.h"
+#include "chrome/browser/android/android_theme_resources.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/permissions/permission_util.h"
 #include "chrome/browser/ui/android/infobars/grouped_permission_infobar.h"
@@ -46,7 +47,7 @@
   if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)
     return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
 
-  return IDR_INFOBAR_WARNING;
+  return IDR_ANDROID_INFOBAR_WARNING;
 }
 
 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment(
diff --git a/chrome/browser/permissions/mock_permission_request.cc b/chrome/browser/permissions/mock_permission_request.cc
index 8fdf865..a224f48 100644
--- a/chrome/browser/permissions/mock_permission_request.cc
+++ b/chrome/browser/permissions/mock_permission_request.cc
@@ -7,6 +7,7 @@
 #include "base/strings/string16.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/grit/theme_resources.h"
+#include "ui/gfx/vector_icons_public.h"
 
 MockPermissionRequest::MockPermissionRequest()
     : MockPermissionRequest("test",
@@ -59,9 +60,9 @@
 
 MockPermissionRequest::~MockPermissionRequest() {}
 
-int MockPermissionRequest::GetIconId() const {
+PermissionRequest::IconId MockPermissionRequest::GetIconId() const {
   // Use a valid icon ID to support UI tests.
-  return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
+  return gfx::VectorIconId::WARNING;
 }
 
 base::string16 MockPermissionRequest::GetMessageTextFragment() const {
diff --git a/chrome/browser/permissions/mock_permission_request.h b/chrome/browser/permissions/mock_permission_request.h
index 9563925..8bcfe1b 100644
--- a/chrome/browser/permissions/mock_permission_request.h
+++ b/chrome/browser/permissions/mock_permission_request.h
@@ -23,7 +23,7 @@
 
   ~MockPermissionRequest() override;
 
-  int GetIconId() const override;
+  IconId GetIconId() const override;
   base::string16 GetMessageTextFragment() const override;
   GURL GetOrigin() const override;
 
diff --git a/chrome/browser/permissions/permission_request.cc b/chrome/browser/permissions/permission_request.cc
index 73b71e99..c7dfe59 100644
--- a/chrome/browser/permissions/permission_request.cc
+++ b/chrome/browser/permissions/permission_request.cc
@@ -8,14 +8,6 @@
 
 PermissionRequest::PermissionRequest() : persist_(true) {}
 
-gfx::VectorIconId PermissionRequest::GetVectorIconId() const {
-  return gfx::VectorIconId::VECTOR_ICON_NONE;
-}
-
-int PermissionRequest::GetIconId() const {
-  return 0;
-}
-
 bool PermissionRequest::ShouldShowPersistenceToggle() const {
   return false;
 }
diff --git a/chrome/browser/permissions/permission_request.h b/chrome/browser/permissions/permission_request.h
index c5eed7e..f3099b1 100644
--- a/chrome/browser/permissions/permission_request.h
+++ b/chrome/browser/permissions/permission_request.h
@@ -60,16 +60,19 @@
 // requests, or depending on the situation, not shown at all.
 class PermissionRequest {
  public:
+#if defined(OS_ANDROID)
+  // On Android, icons are represented with an IDR_ identifier.
+  typedef int IconId;
+#else
+  // On desktop, we use a vector icon id.
+  typedef gfx::VectorIconId IconId;
+#endif
+
   PermissionRequest();
   virtual ~PermissionRequest() {}
 
-  // Returns a vector icon id if the icon should be drawn as a vector
-  // resource. Otherwise, returns VECTOR_ICON_NONE.
-  virtual gfx::VectorIconId GetVectorIconId() const;
-
   // The icon to use next to the message text fragment in the permission bubble.
-  // TODO(estade): remove this in favor of GetVectorIconId().
-  virtual int GetIconId() const;
+  virtual IconId GetIconId() const = 0;
 
   // Returns the shortened prompt text for this permission.  Must be phrased
   // as a heading, e.g. "Location", or "Camera". The permission bubble may
diff --git a/chrome/browser/permissions/permission_request_impl.cc b/chrome/browser/permissions/permission_request_impl.cc
index 94e8b54..761d1db 100644
--- a/chrome/browser/permissions/permission_request_impl.cc
+++ b/chrome/browser/permissions/permission_request_impl.cc
@@ -8,16 +8,11 @@
 #include "chrome/browser/permissions/permission_uma_util.h"
 #include "chrome/browser/permissions/permission_util.h"
 #include "chrome/grit/generated_resources.h"
-#include "chrome/grit/theme_resources.h"
 #include "components/url_formatter/elide_url.h"
 #include "net/base/escape.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/gfx/vector_icons_public.h"
 
-#if defined(OS_ANDROID)
-#include "chrome/browser/android/android_theme_resources.h"
-#endif
-
 PermissionRequestImpl::PermissionRequestImpl(
     const GURL& request_origin,
     content::PermissionType permission_type,
@@ -42,10 +37,7 @@
   }
 }
 
-gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const {
-#if defined(OS_ANDROID)
-  return gfx::VectorIconId::VECTOR_ICON_NONE;
-#else
+PermissionRequest::IconId PermissionRequestImpl::GetIconId() const {
   switch (permission_type_) {
     case content::PermissionType::GEOLOCATION:
       return gfx::VectorIconId::LOCATION_ON;
@@ -67,25 +59,8 @@
       NOTREACHED();
       return gfx::VectorIconId::VECTOR_ICON_NONE;
   }
-#endif
 }
 
-#if defined(OS_ANDROID)
-int PermissionRequestImpl::GetIconId() const {
-  switch (permission_type_) {
-    case content::PermissionType::GEOLOCATION:
-      return IDR_ANDROID_INFOBAR_GEOLOCATION;
-    case content::PermissionType::MIDI_SYSEX:
-      return IDR_ALLOWED_MIDI_SYSEX;
-    case content::PermissionType::FLASH:
-      return IDR_ALLOWED_PLUGINS;
-    default:
-      NOTREACHED();
-      return 0;
-  }
-}
-#endif
-
 base::string16 PermissionRequestImpl::GetMessageTextFragment() const {
   int message_id;
   switch (permission_type_) {
diff --git a/chrome/browser/permissions/permission_request_impl.h b/chrome/browser/permissions/permission_request_impl.h
index 45c216a5..7ab94db7 100644
--- a/chrome/browser/permissions/permission_request_impl.h
+++ b/chrome/browser/permissions/permission_request_impl.h
@@ -37,10 +37,7 @@
 
  private:
   // PermissionRequest:
-  gfx::VectorIconId GetVectorIconId() const override;
-#if defined(OS_ANDROID)
-  int GetIconId() const override;
-#endif
+  IconId GetIconId() const override;
   base::string16 GetMessageTextFragment() const override;
   GURL GetOrigin() const override;
   // Remember to call RegisterActionTaken for these methods if you are
diff --git a/chrome/browser/permissions/permission_request_manager.cc b/chrome/browser/permissions/permission_request_manager.cc
index 19d67cf..40fdb50 100644
--- a/chrome/browser/permissions/permission_request_manager.cc
+++ b/chrome/browser/permissions/permission_request_manager.cc
@@ -27,7 +27,7 @@
         origin_(cancelled->GetOrigin()) {}
   ~CancelledRequest() override {}
 
-  int GetIconId() const override { return icon_; }
+  IconId GetIconId() const override { return icon_; }
   base::string16 GetMessageTextFragment() const override {
     return message_fragment_;
   }
@@ -41,7 +41,7 @@
   void RequestFinished() override { delete this; }
 
  private:
-  int icon_;
+  IconId icon_;
   base::string16 message_fragment_;
   GURL origin_;
 };
diff --git a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
index 6d796e9..47fb590 100644
--- a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
+++ b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
@@ -9,10 +9,10 @@
 #include "base/android/jni_array.h"
 #include "base/callback_helpers.h"
 #include "chrome/browser/android/preferences/pref_service_bridge.h"
+#include "chrome/browser/android/android_theme_resources.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/grit/chromium_strings.h"
 #include "chrome/grit/generated_resources.h"
-#include "chrome/grit/theme_resources.h"
 #include "components/infobars/core/infobar.h"
 #include "content/public/browser/android/content_view_core.h"
 #include "content/public/browser/web_contents.h"
@@ -154,7 +154,7 @@
 }
 
 int PermissionUpdateInfoBarDelegate::GetIconId() const {
-  return IDR_INFOBAR_WARNING;
+  return IDR_ANDROID_INFOBAR_WARNING;
 }
 
 base::string16 PermissionUpdateInfoBarDelegate::GetMessageText() const {
diff --git a/chrome/browser/plugins/flash_download_interception.cc b/chrome/browser/plugins/flash_download_interception.cc
index f623d72..12cef54 100644
--- a/chrome/browser/plugins/flash_download_interception.cc
+++ b/chrome/browser/plugins/flash_download_interception.cc
@@ -34,7 +34,7 @@
 // URLs that will be intercepted with any www. prefix pruned.
 const char* kFlashDownloadURLs[] = {
     "get.adobe.com/flash", "macromedia.com/go/getflashplayer",
-};
+    "adobe.com/go/getflashplayer", "adobe.com/go/gntray_dl_getflashplayer"};
 
 void DoNothing(blink::mojom::PermissionStatus result) {}
 
diff --git a/chrome/browser/plugins/flash_download_interception_unittest.cc b/chrome/browser/plugins/flash_download_interception_unittest.cc
index b3db3c5..08ad6c2 100644
--- a/chrome/browser/plugins/flash_download_interception_unittest.cc
+++ b/chrome/browser/plugins/flash_download_interception_unittest.cc
@@ -54,6 +54,14 @@
       host_content_settings_map(), GURL("http://source-page.com"),
       GURL("http://macromedia.com/go/getflashplayer"), true));
 
+  EXPECT_TRUE(FlashDownloadInterception::ShouldStopFlashDownloadAction(
+      host_content_settings_map(), GURL("http://source-page.com"),
+      GURL("http://adobe.com/go/getflashplayer"), true));
+
+  EXPECT_TRUE(FlashDownloadInterception::ShouldStopFlashDownloadAction(
+      host_content_settings_map(), GURL("http://source-page.com"),
+      GURL("http://adobe.com/go/gntray_dl_getflashplayer_jp"), true));
+
   EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction(
       host_content_settings_map(), GURL("http://source-page.com"),
       GURL("https://www.example.com"), true));
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index 7ba4dad..b42d024 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -16,6 +16,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/stringprintf.h"
 #include "base/time/time.h"
+#include "base/trace_event/trace_event.h"
 #include "chrome/browser/history/history_service_factory.h"
 #include "chrome/browser/predictors/predictor_database.h"
 #include "chrome/browser/predictors/predictor_database_factory.h"
@@ -586,6 +587,8 @@
 }
 
 void ResourcePrefetchPredictor::StartPrefetching(const GURL& url) {
+  TRACE_EVENT1("browser", "ResourcePrefetchPredictor::StartPrefetching", "url",
+               url.spec());
   if (!prefetch_manager_.get())  // Prefetching not enabled.
     return;
 
@@ -602,6 +605,8 @@
 }
 
 void ResourcePrefetchPredictor::StopPrefetching(const GURL& url) {
+  TRACE_EVENT1("browser", "ResourcePrefetchPredictor::StopPrefetching", "url",
+               url.spec());
   if (!prefetch_manager_.get())  // Not enabled.
     return;
 
@@ -847,6 +852,8 @@
     PrefetchDataMap* data_map,
     const std::string& key_before_redirects,
     RedirectDataMap* redirect_map) {
+  TRACE_EVENT1("browser", "ResourcePrefetchPredictor::LearnNavigation", "key",
+               key);
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
   // If the primary key is too long reject it.
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_tables.cc b/chrome/browser/predictors/resource_prefetch_predictor_tables.cc
index eca2c77..c04dc372 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_tables.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_tables.cc
@@ -13,6 +13,7 @@
 #include "base/logging.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/stringprintf.h"
+#include "base/trace_event/trace_event.h"
 #include "content/public/browser/browser_thread.h"
 #include "sql/meta_table.h"
 #include "sql/statement.h"
@@ -120,6 +121,7 @@
     PrefetchDataMap* host_data_map,
     RedirectDataMap* url_redirect_data_map,
     RedirectDataMap* host_redirect_data_map) {
+  TRACE_EVENT0("browser", "ResourcePrefetchPredictor::GetAllData");
   DCHECK_CURRENTLY_ON(BrowserThread::DB);
   if (CantAccessDatabase())
     return;
@@ -144,6 +146,7 @@
     const PrefetchData& host_data,
     const RedirectData& url_redirect_data,
     const RedirectData& host_redirect_data) {
+  TRACE_EVENT0("browser", "ResourcePrefetchPredictor::UpdateData");
   DCHECK_CURRENTLY_ON(BrowserThread::DB);
   if (CantAccessDatabase())
     return;
diff --git a/chrome/browser/predictors/resource_prefetcher.cc b/chrome/browser/predictors/resource_prefetcher.cc
index e62d245..b8aba07 100644
--- a/chrome/browser/predictors/resource_prefetcher.cc
+++ b/chrome/browser/predictors/resource_prefetcher.cc
@@ -7,6 +7,7 @@
 #include <iterator>
 #include <utility>
 
+#include "base/trace_event/trace_event.h"
 #include "content/public/browser/browser_thread.h"
 #include "net/base/io_buffer.h"
 #include "net/base/load_flags.h"
@@ -40,6 +41,7 @@
 ResourcePrefetcher::~ResourcePrefetcher() {}
 
 void ResourcePrefetcher::Start() {
+  TRACE_EVENT_ASYNC_BEGIN0("browser", "ResourcePrefetcher::Prefetch", this);
   DCHECK(thread_checker_.CalledOnValidThread());
 
   CHECK_EQ(state_, INITIALIZED);
@@ -49,6 +51,7 @@
 }
 
 void ResourcePrefetcher::Stop() {
+  TRACE_EVENT_ASYNC_END0("browser", "ResourcePrefetcher::Prefetch", this);
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (state_ == FINISHED)
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 78a3359..92b92d7 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -107,7 +107,7 @@
 #include "content/public/browser/render_process_host.h"
 #include "net/http/http_server_properties_manager.h"
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 #include "chrome/browser/apps/drive/drive_app_mapping.h"
 #endif
 
@@ -216,7 +216,7 @@
 #include "chrome/browser/extensions/default_apps.h"
 #endif
 
-#if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
+#if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST)
 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
 #endif
 
@@ -503,7 +503,7 @@
   ZeroSuggestProvider::RegisterProfilePrefs(registry);
   browsing_data::prefs::RegisterBrowserUserPrefs(registry);
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   app_list::AppListPrefs::RegisterProfilePrefs(registry);
 #endif
 
@@ -565,7 +565,7 @@
   AppShortcutManager::RegisterProfilePrefs(registry);
   DeviceIDFetcher::RegisterProfilePrefs(registry);
   DevToolsWindow::RegisterProfilePrefs(registry);
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   DriveAppMapping::RegisterProfilePrefs(registry);
 #endif
   extensions::CommandService::RegisterProfilePrefs(registry);
@@ -608,7 +608,7 @@
   flags_ui::PrefServiceFlagsStorage::RegisterProfilePrefs(registry);
 #endif
 
-#if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
+#if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST)
   ArcAppListPrefs::RegisterProfilePrefs(registry);
 #endif
 
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index 5d3bf45..e4dfb19 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -21,7 +21,6 @@
 #include "base/metrics/field_trial.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/single_thread_task_runner.h"
-#include "base/strings/string_util.h"
 #include "base/sys_info.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/time/time.h"
@@ -61,7 +60,6 @@
 #include "content/public/browser/web_contents_delegate.h"
 #include "content/public/common/url_constants.h"
 #include "extensions/common/constants.h"
-#include "net/http/http_request_headers.h"
 #include "ui/gfx/geometry/rect.h"
 
 using content::BrowserThread;
@@ -80,22 +78,6 @@
 // Length of prerender history, for display in chrome://net-internals
 const int kHistoryLength = 100;
 
-// Check if |extra_headers| requested via chrome::NavigateParams::extra_headers
-// are the same as what the HTTP server saw when serving prerendered contents.
-// PrerenderContents::StartPrerendering doesn't specify any extra headers when
-// calling content::NavigationController::LoadURLWithParams, but in reality
-// Blink will always add an Upgrade-Insecure-Requests http request header, so
-// that HTTP request for prerendered contents always includes this header.
-// Because of this, it is okay to show prerendered contents even if
-// |extra_headers| contains "Upgrade-Insecure-Requests" header.
-bool AreExtraHeadersCompatibleWithPrerenderContents(
-    const std::string& extra_headers) {
-  net::HttpRequestHeaders parsed_headers;
-  parsed_headers.AddHeadersFromString(extra_headers);
-  parsed_headers.RemoveHeader("upgrade-insecure-requests");
-  return parsed_headers.IsEmpty();
-}
-
 }  // namespace
 
 class PrerenderManager::OnCloseWebContentsDeleter
@@ -316,14 +298,9 @@
   WebContents* web_contents = params->target_contents;
   DCHECK(!IsWebContentsPrerendering(web_contents, nullptr));
 
-  // Don't prerender if the navigation involves some special parameters that
-  // are different from what was used by PrerenderContents::StartPrerendering
-  // (which always uses GET method and doesn't specify any extra headers when
-  // calling content::NavigationController::LoadURLWithParams).
-  if (params->uses_post ||
-      !AreExtraHeadersCompatibleWithPrerenderContents(params->extra_headers)) {
+  // Don't prerender if the navigation involves some special parameters.
+  if (params->uses_post || !params->extra_headers.empty())
     return false;
-  }
 
   DeleteOldEntries();
   to_delete_prerenders_.clear();
diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h
index 6ed8885..1ff78d1 100644
--- a/chrome/browser/printing/print_job_worker.h
+++ b/chrome/browser/printing/print_job_worker.h
@@ -43,7 +43,7 @@
   void SetNewOwner(PrintJobWorkerOwner* new_owner);
 
   // Initializes the print settings. If |ask_user_for_settings| is true, a
-  // Print... dialog box will be shown to ask the user his preference.
+  // Print... dialog box will be shown to ask the user their preference.
   // |is_scripted| should be true for calls coming straight from window.print().
   // |is_modifiable| implies HTML and not other formats like PDF.
   void GetSettings(bool ask_user_for_settings,
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
index 585ce4c..289fbc8 100644
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -181,7 +181,7 @@
   AppShortcutManagerFactory::GetInstance();
 #endif
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   app_list::AppListSyncableServiceFactory::GetInstance();
 #endif
 
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index e064818..5145a8c4 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -1067,7 +1067,7 @@
       GetPrefs()->ClearPref(prefs::kApplicationLocaleAccepted);
       // We maintain kApplicationLocale property in both a global storage
       // and user's profile.  Global property determines locale of login screen,
-      // while user's profile determines his personal locale preference.
+      // while user's profile determines their personal locale preference.
       break;
     }
     case APP_LOCALE_CHANGED_VIA_LOGIN:
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn
index 41d3628..49a50a3 100644
--- a/chrome/browser/resources/BUILD.gn
+++ b/chrome/browser/resources/BUILD.gn
@@ -40,6 +40,7 @@
 
 grit("policy_resources") {
   source = "md_policy/policy_resources.grd"
+  defines = chrome_grit_defines
 
   # TODO(thestig): use_qualified_include = true
   outputs = [
diff --git a/chrome/browser/resources/chromeos/chromevox/BUILD.gn b/chrome/browser/resources/chromeos/chromevox/BUILD.gn
index fc37ab8..5f21be1 100644
--- a/chrome/browser/resources/chromeos/chromevox/BUILD.gn
+++ b/chrome/browser/resources/chromeos/chromevox/BUILD.gn
@@ -3,6 +3,7 @@
 # found in the LICENSE file.
 
 import("//build/config/features.gni")
+import("//chrome/common/features.gni")
 import("//testing/test.gni")
 import("//chrome/test/base/js2gtest.gni")
 import("run_jsbundler.gni")
@@ -542,8 +543,8 @@
     "//chrome/test:test_support",
     "//chrome/test:test_support_ui",
     "//content/test:test_support",
-    "//services/shell/background:lib",
-    "//services/shell/background/tests:test_support",
+    "//services/service_manager/background:lib",
+    "//services/service_manager/background/tests:test_support",
     "//testing/gmock",
     "//testing/gtest",
     "//ui/keyboard:resources",
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
index ca949ce..f049a6d 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -986,15 +986,18 @@
     if (prevRange && !prevRange.isValid())
       prevRange = null;
 
-    // Scan ancestors to get the value of |outputContextFirst|.
+    // Scan unique ancestors to get the value of |outputContextFirst|.
     var parent = range.start.node;
-    while (parent && parent.root && parent.root.role != RoleType.desktop) {
+    var prevParent = prevRange ? prevRange.start.node : parent;
+    if (!parent || !prevParent)
+      return;
+    var uniqueAncestors = AutomationUtil.getUniqueAncestors(prevParent, parent);
+    for (var i = 0; parent = uniqueAncestors[i]; i++) {
       if (Output.ROLE_INFO_[parent.role] &&
           Output.ROLE_INFO_[parent.role].outputContextFirst) {
         this.outputContextFirst_ = true;
         break;
       }
-      parent = parent.parent;
     }
 
     if (range.isSubNode())
@@ -1394,9 +1397,29 @@
    * @private
    */
   ancestry_: function(node, prevNode, type, buff) {
-    var prevUniqueAncestors =
-        AutomationUtil.getUniqueAncestors(node, prevNode);
-    var uniqueAncestors = AutomationUtil.getUniqueAncestors(prevNode, node);
+    // Expects |ancestors| to be ordered from root down to leaf. Outputs in
+    // reverse; place context first nodes at the end.
+    function byContextFirst(ancestors) {
+      var contextFirst = [];
+      var rest = [];
+      for (i = 0; i < ancestors.length - 1; i++) {
+        var node = ancestors[i];
+        // Discard ancestors of deepest window.
+        if (node.role == RoleType.window) {
+          contextFirst = [];
+          rest = [];
+        }
+        if ((Output.ROLE_INFO_[node.role] || {}).outputContextFirst)
+          contextFirst.push(node);
+        else
+          rest.push(node);
+      }
+      return rest.concat(contextFirst.reverse());
+    }
+    var prevUniqueAncestors = byContextFirst(AutomationUtil.getUniqueAncestors(
+        node, prevNode));
+    var uniqueAncestors = byContextFirst(AutomationUtil.getUniqueAncestors(
+        prevNode, node));
 
     // First, look up the event type's format block.
     // Navigate is the default event.
@@ -1416,7 +1439,7 @@
 
     // Hash the roles we've entered.
     var enteredRoleSet = {};
-    for (var j = uniqueAncestors.length - 2, hashNode;
+    for (var j = uniqueAncestors.length - 1, hashNode;
          (hashNode = uniqueAncestors[j]);
          j--)
       enteredRoleSet[hashNode.role] = true;
@@ -1437,7 +1460,7 @@
 
     var enterOutputs = [];
     var enterRole = {};
-    for (var j = uniqueAncestors.length - 2, formatNode;
+    for (var j = uniqueAncestors.length - 1, formatNode;
          (formatNode = uniqueAncestors[j]);
          j--) {
       var roleBlock = getMergedRoleBlock(formatNode.role);
@@ -1447,8 +1470,6 @@
         enterRole[formatNode.role] = true;
         this.format_(formatNode, roleBlock.enter, buff, prevNode);
       }
-      if (formatNode.role == 'window')
-        break;
     }
   },
 
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
index 7e73afb..6c51f5d 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
@@ -271,13 +271,13 @@
   var categoryToMenu = {
     'navigation': jumpMenu,
     'jump_commands': jumpMenu,
+    'overview': jumpMenu,
+    'tables': jumpMenu,
     'controlling_speech': speechMenu,
+    'information': speechMenu,
     'modifier_keys': chromevoxMenu,
     'help_commands': chromevoxMenu,
 
-    'information': null,  // Get link URL, get page title, etc.
-    'overview': null,     // Headings list, etc.
-    'tables': null,       // Table navigation.
     'braille': null,
     'developer': null};
 
@@ -310,7 +310,12 @@
   });
 
   // Insert items from the bindings into the menus.
+  var sawBindingSet = {};
   sortedBindings.forEach(goog.bind(function(binding) {
+    var command = binding.command;
+    if (sawBindingSet[command])
+      return;
+    sawBindingSet[command] = true;
     var category = cvox.CommandStore.categoryForCommand(binding.command);
     var menu = category ? categoryToMenu[category] : null;
     if (binding.title && menu) {
diff --git a/chrome/browser/resources/chromeos/chromevox/strings/BUILD.gn b/chrome/browser/resources/chromeos/chromevox/strings/BUILD.gn
index 1fe755c..5ff0a39 100644
--- a/chrome/browser/resources/chromeos/chromevox/strings/BUILD.gn
+++ b/chrome/browser/resources/chromeos/chromevox/strings/BUILD.gn
@@ -2,12 +2,14 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//chrome/common/features.gni")
 import("//tools/grit/grit_rule.gni")
 
 chromevox_out_dir = "$root_out_dir/resources/chromeos/chromevox"
 
 grit("chromevox_strings") {
   source = "chromevox_strings.grd"
+  defines = chrome_grit_defines
   use_qualified_include = true
   outputs = [
     "_locales/am/messages.json",
diff --git a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
index 646f7d4..ba858a57 100644
--- a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
+++ b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
@@ -193,7 +193,7 @@
         Open ChromeVox tutorial
       </message>
       <message desc="The description of the toggleSearchWidget key. Displayed in the Options page." name="IDS_CHROMEVOX_TOGGLE_SEARCH_WIDGET">
-        Toggle search widget
+        ChromeVox find in page
       </message>
       <message desc="The description of the showOptionsPage key. Displayed in the Options page." name="IDS_CHROMEVOX_SHOW_OPTIONS_PAGE">
         Open options page
diff --git a/chrome/browser/resources/options_resources.grd b/chrome/browser/resources/options_resources.grd
index ae349331..a8015191 100644
--- a/chrome/browser/resources/options_resources.grd
+++ b/chrome/browser/resources/options_resources.grd
@@ -18,6 +18,11 @@
                  allowexternalscript="true"
                  type="chrome_html" />
       <if expr="chromeos">
+        <structure name="IDR_OPTIONS_ICONS_HTML"
+                   file="settings/icons.html"
+                   type="chrome_html"
+                   flattenhtml="true"
+                   allowexternalscript="true" />
         <structure name="IDR_OPTIONS_PIN_KEYBOARD_HTML"
                    file="chromeos/quick_unlock/pin_keyboard.html"
                    type="chrome_html"
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.html b/chrome/browser/resources/settings/appearance_page/appearance_page.html
index 82d49c3..6237a76 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.html
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.html
@@ -9,6 +9,7 @@
 <link rel="import" href="/controls/settings_dropdown_menu.html">
 <link rel="import" href="/controls/settings_input.html">
 <link rel="import" href="/controls/settings_radio_group.html">
+<link rel="import" href="/md_select_css.html">
 <link rel="import" href="/route.html">
 <link rel="import" href="/settings_page/settings_animated_pages.html">
 <link rel="import" href="/settings_page/settings_subpage.html">
@@ -17,7 +18,7 @@
 
 <dom-module id="settings-appearance-page">
   <template>
-    <style include="settings-shared">
+    <style include="settings-shared md-select">
       :host {
         --paper-input-container-label: {
           font-size: inherit;
@@ -146,9 +147,15 @@
         <div class="settings-box"
             hidden="[[!pageVisibility.pageZoom]]">
           <div class="start">$i18n{pageZoom}</div>
-          <settings-dropdown-menu id="pageZoom" pref="{{defaultZoomLevel_}}"
-              menu-options="[[pageZoomOptions_]]">
-          </settings-dropdown-menu>
+          <div class="md-select-wrapper">
+            <select id="zoomLevel" class="md-select"
+                on-change="onZoomLevelChange_">
+              <template is="dom-repeat" items="[[pageZoomLevels_]]">
+                <option value="[[item]]">[[formatZoom_(item)]]%</option>
+              </template>
+            </select>
+            <span class="md-select-underline"></span>
+          </div>
         </div>
       </neon-animatable>
       <template is="dom-if" route-path="/fonts">
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chrome/browser/resources/settings/appearance_page/appearance_page.js
index 7e0661d..bde7e1c 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.js
@@ -34,17 +34,6 @@
       value: false,  // Can only be true on Linux, but value exists everywhere.
     },
 
-    /** @private */
-    defaultZoomLevel_: {
-      notify: true,
-      type: Object,
-      value: function() {
-        return {
-          type: chrome.settingsPrivate.PrefType.NUMBER,
-        };
-      },
-    },
-
     /**
      * List of options for the font size drop-down menu.
      * @type {!DropdownMenuOptionList}
@@ -67,27 +56,28 @@
      * List of options for the page zoom drop-down menu.
      * @type {!DropdownMenuOptionList}
      */
-    pageZoomOptions_: {
+    pageZoomLevels_: {
       readOnly: true,
       type: Array,
       value: [
-        {value: 25, name: '25%'},
-        {value: 33, name: '33%'},
-        {value: 50, name: '50%'},
-        {value: 67, name: '67%'},
-        {value: 75, name: '75%'},
-        {value: 80, name: '80%'},
-        {value: 90, name: '90%'},
-        {value: 100, name: '100%'},
-        {value: 110, name: '110%'},
-        {value: 125, name: '125%'},
-        {value: 150, name: '150%'},
-        {value: 175, name: '175%'},
-        {value: 200, name: '200%'},
-        {value: 250, name: '250%'},
-        {value: 300, name: '300%'},
-        {value: 400, name: '400%'},
-        {value: 500, name: '500%'},
+        // TODO(dbeam): get these dynamically from C++ instead.
+        1 / 4,
+        1 / 3,
+        1 / 2,
+        2 / 3,
+        3 / 4,
+        4 / 5,
+        9 / 10,
+        1,
+        11 / 10,
+        5 / 4,
+        3 / 2,
+        7 / 4,
+        2,
+        5 / 2,
+        3,
+        4,
+        5,
       ],
     },
 
@@ -111,8 +101,6 @@
     // NOTE: this pref only exists on Linux.
     'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)',
 </if>
-
-    'zoomLevelChanged_(defaultZoomLevel_.value)',
   ],
 
   created: function() {
@@ -121,11 +109,21 @@
 
   ready: function() {
     this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
-    this.$.pageZoom.menuOptions = this.pageZoomOptions_;
     // TODO(dschuyler): Look into adding a listener for the
     // default zoom percent.
-    chrome.settingsPrivate.getDefaultZoomPercent(
-        this.zoomPrefChanged_.bind(this));
+    chrome.settingsPrivate.getDefaultZoomPercent(function(value) {
+      // TODO(dpapad): Non-integer values will cause no <option> to be selected
+      // until crbug.com/655742 is addressed.
+      this.$.zoomLevel.value = value;
+    }.bind(this));
+  },
+
+  /**
+   * @param {number} zoom
+   * @return {number} A zoom easier read by users.
+   */
+  formatZoom_: function(zoom) {
+    return Math.round(zoom * 100);
   },
 
   /**
@@ -228,23 +226,10 @@
     this.themeUrl_ = '';
   },
 
-  /**
-   * @param {number} percent The integer percentage of the page zoom.
-   * @private
-   */
-  zoomPrefChanged_: function(percent) {
-    this.set('defaultZoomLevel_.value', percent);
-  },
-
-  /**
-   * @param {number} percent The integer percentage of the page zoom.
-   * @private
-   */
-  zoomLevelChanged_: function(percent) {
-    // The |percent| may be undefined on startup.
-    if (percent === undefined)
-      return;
-    chrome.settingsPrivate.setDefaultZoomPercent(percent);
+  /** @private */
+  onZoomLevelChange_: function() {
+    chrome.settingsPrivate.setDefaultZoomPercent(
+        parseFloat(this.$.zoomLevel.value));
   },
 
   /**
diff --git a/chrome/browser/resources/settings/compiled_resources2.gyp b/chrome/browser/resources/settings/compiled_resources2.gyp
index 09caa83..ecfaee31 100644
--- a/chrome/browser/resources/settings/compiled_resources2.gyp
+++ b/chrome/browser/resources/settings/compiled_resources2.gyp
@@ -72,5 +72,12 @@
       ],
       'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'],
     },
+    {
+      'target_name': 'settings_action_menu',
+      'dependencies': [
+        'direction_delegate',
+      ],
+      'includes': ['../../../../third_party/closure_compiler/compile_js2.gypi'],
+    },
   ],
 }
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
index 4c4ed51c..6d5cd93 100644
--- a/chrome/browser/resources/settings/icons.html
+++ b/chrome/browser/resources/settings/icons.html
@@ -103,6 +103,9 @@
       <g id="videocam"><path d="M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"></path></g>
       <g id="visibility"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></g>
       <g id="volume-up"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"></path></g>
+<if expr="chromeos">
+      <g id="warning"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></g>
+</if>
 <if expr="not chromeos">
       <g id="web"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 14H4v-4h11v4zm0-5H4V9h11v4zm5 5h-4V9h4v9z"></path></g>
 </if>
diff --git a/chrome/browser/resources/settings/languages_page/compiled_resources2.gyp b/chrome/browser/resources/settings/languages_page/compiled_resources2.gyp
index 0ec9d7f..a0484dd 100644
--- a/chrome/browser/resources/settings/languages_page/compiled_resources2.gyp
+++ b/chrome/browser/resources/settings/languages_page/compiled_resources2.gyp
@@ -25,10 +25,10 @@
       'dependencies': [
         '../compiled_resources2.gyp:lifetime_browser_proxy',
         '../compiled_resources2.gyp:route',
+        '../compiled_resources2.gyp:settings_action_menu',
         '../settings_page/compiled_resources2.gyp:settings_animated_pages',
         '<(DEPTH)/third_party/polymer/v1_0/components-chromium/paper-checkbox/compiled_resources2.gyp:paper-checkbox-extracted',
         '<(DEPTH)/ui/webui/resources/cr_elements/cr_lazy_render/compiled_resources2.gyp:cr_lazy_render',
-        '<(DEPTH)/ui/webui/resources/cr_elements/cr_shared_menu/compiled_resources2.gyp:cr_shared_menu',
         '<(DEPTH)/ui/webui/resources/js/chromeos/compiled_resources2.gyp:ui_account_tweaks',
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert',
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.html b/chrome/browser/resources/settings/languages_page/languages_page.html
index 08b41d731..14f7e4d 100644
--- a/chrome/browser/resources/settings/languages_page/languages_page.html
+++ b/chrome/browser/resources/settings/languages_page/languages_page.html
@@ -7,12 +7,12 @@
 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
 <link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
 <link rel="import" href="chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_shared_menu/cr_shared_menu.html">
 <link rel="import" href="chrome://resources/cr_elements/icons.html">
 <link rel="import" href="/languages_page/add_languages_dialog.html">
 <link rel="import" href="/languages_page/languages.html">
 <link rel="import" href="/lifetime_browser_proxy.html">
 <link rel="import" href="/route.html">
+<link rel="import" href="/settings_action_menu.html">
 <link rel="import" href="/settings_page/settings_animated_pages.html">
 <link rel="import" href="/settings_page/settings_subpage.html">
 <link rel="import" href="/settings_shared_css.html">
@@ -39,19 +39,15 @@
         margin-top: 4px;
       }
 
-      cr-shared-menu {
-        --cr-shared-menu-width: 320px;
-      }
-
-      cr-shared-menu.complex .dropdown-item {
+      dialog[is='settings-action-menu'].complex .dropdown-item {
         min-height: 36px;
       }
 
-      cr-shared-menu:not(.complex) hr {
+      dialog[is='settings-action-menu']:not(.complex) hr {
         display: none;
       }
 
-      cr-shared-menu.complex hr {
+      dialog[is='settings-action-menu'].complex hr {
         /* Override user-agent border and margin. */
         border: none;
         /* TODO(michaelpg): Update to whatever variable is used for the darker,
@@ -115,7 +111,7 @@
                 </template>
 </if>
                 <paper-icon-button id="more-[[item.language.code]]"
-                    icon="cr:more-vert" on-tap="toggleMenu_">
+                    icon="cr:more-vert" on-tap="onDotsTap_">
                 </paper-icon-button>
               </div>
             </template>
@@ -197,7 +193,7 @@
         </iron-collapse>
 </if>
         <template is="cr-lazy-render" id="menu">
-          <cr-shared-menu
+          <dialog is="settings-action-menu"
               class$="[[getMenuClass_(prefs.translate.enabled.value)]]">
 <if expr="chromeos or is_win">
             <paper-checkbox id="uiLanguageItem" class="dropdown-item"
@@ -242,7 +238,7 @@
                 hidden="[[!detailLanguage_.removable]]">
               $i18n{removeLanguage}
             </button>
-          </cr-shared-menu>
+          </dialog>
         </template>
       </neon-animatable>
 <if expr="chromeos">
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.js b/chrome/browser/resources/settings/languages_page/languages_page.js
index 19a0538..9cfd9a2 100644
--- a/chrome/browser/resources/settings/languages_page/languages_page.js
+++ b/chrome/browser/resources/settings/languages_page/languages_page.js
@@ -185,7 +185,7 @@
       // Reset the chosen UI language to the actual UI language.
       this.languageHelper.resetUILanguage();
     }
-    /** @type {!CrSharedMenuElement} */(this.$.menu.get()).closeMenu();
+    /** @type {!SettingsActionMenuElement} */(this.$.menu.get()).close();
   },
 
    /**
@@ -215,7 +215,7 @@
       this.languageHelper.disableTranslateLanguage(
           this.detailLanguage_.language.code);
     }
-    /** @type {!CrSharedMenuElement} */(this.$.menu.get()).closeMenu();
+    /** @type {!SettingsActionMenuElement} */(this.$.menu.get()).close();
   },
 
   /**
@@ -235,7 +235,7 @@
    * @private
    */
   onMoveToTopTap_: function() {
-    /** @type {!CrSharedMenuElement} */(this.$.menu.get()).closeMenu();
+    /** @type {!SettingsActionMenuElement} */(this.$.menu.get()).close();
     this.languageHelper.moveLanguageToFront(this.detailLanguage_.language.code);
   },
 
@@ -244,7 +244,7 @@
    * @private
    */
   onMoveUpTap_: function() {
-    /** @type {!CrSharedMenuElement} */(this.$.menu.get()).closeMenu();
+    /** @type {!SettingsActionMenuElement} */(this.$.menu.get()).close();
     this.languageHelper.moveLanguage(this.detailLanguage_.language.code, -1);
   },
 
@@ -253,7 +253,7 @@
    * @private
    */
   onMoveDownTap_: function() {
-    /** @type {!CrSharedMenuElement} */(this.$.menu.get()).closeMenu();
+    /** @type {!SettingsActionMenuElement} */(this.$.menu.get()).close();
     this.languageHelper.moveLanguage(this.detailLanguage_.language.code, 1);
   },
 
@@ -262,7 +262,7 @@
    * @private
    */
   onRemoveLanguageTap_: function() {
-    /** @type {!CrSharedMenuElement} */(this.$.menu.get()).closeMenu();
+    /** @type {!SettingsActionMenuElement} */(this.$.menu.get()).close();
     this.languageHelper.disableLanguage(this.detailLanguage_.language.code);
   },
 
@@ -449,29 +449,27 @@
   },
 
   /**
-   * Opens or closes the shared menu at the location of the tapped item.
    * @param {!Event} e
    * @private
    */
-  toggleMenu_: function(e) {
-    e.stopPropagation();  // Prevent the tap event from closing the menu.
-
+  onDotsTap_: function(e) {
     this.detailLanguage_ =
         /** @type {!{model: !{item: !LanguageState}}} */(e).model.item;
 
     // Ensure the template has been stamped.
-    var menu = /** @type {?CrSharedMenuElement} */(this.$.menu.getIfExists());
+    var menu = /** @type {?SettingsActionMenuElement} */(
+        this.$.menu.getIfExists());
     if (!menu) {
-      menu = /** @type {!CrSharedMenuElement} */(this.$.menu.get());
+      menu = /** @type {!SettingsActionMenuElement} */(this.$.menu.get());
       this.initializeMenu_(menu);
     }
 
-    menu.toggleMenu(/** @type {!Element} */(e.target));
+    menu.showAt(/** @type {!Element} */ (e.target));
   },
 
   /**
    * Applies Chrome OS session tweaks to the menu.
-   * @param {!CrSharedMenuElement} menu
+   * @param {!SettingsActionMenuElement} menu
    * @private
    */
   initializeMenu_: function(menu) {
diff --git a/chrome/browser/resources/settings/people_page/lock_screen.html b/chrome/browser/resources/settings/people_page/lock_screen.html
index 6318855..a14921b 100644
--- a/chrome/browser/resources/settings/people_page/lock_screen.html
+++ b/chrome/browser/resources/settings/people_page/lock_screen.html
@@ -1,6 +1,7 @@
 <link rel="import" href="chrome://resources/html/i18n_behavior.html">
 <link rel="import" href="chrome://resources/html/polymer.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="chrome://resources/polymer/v1_0/paper-radio-group/paper-radio-group.html">
 <link rel="import" href="/people_page/lock_state_behavior.html">
 <link rel="import" href="/people_page/password_prompt_dialog.html">
 <link rel="import" href="/people_page/setup_pin_dialog.html">
diff --git a/chrome/browser/resources/settings/people_page/lock_state_behavior.js b/chrome/browser/resources/settings/people_page/lock_state_behavior.js
index e96c2af3..3e5a90c 100644
--- a/chrome/browser/resources/settings/people_page/lock_state_behavior.js
+++ b/chrome/browser/resources/settings/people_page/lock_state_behavior.js
@@ -37,13 +37,22 @@
     hasPin: {
       type: Boolean,
       notify: true
-    }
+    },
+
+    /**
+     * Interface for chrome.quickUnlockPrivate calls. May be overriden by tests.
+     * @private
+     */
+    quickUnlockPrivate_: {
+      type: Object,
+      value: chrome.quickUnlockPrivate
+    },
   },
 
   /** @override */
   attached: function() {
     this.boundOnActiveModesChanged_ = this.updateUnlockType_.bind(this);
-    chrome.quickUnlockPrivate.onActiveModesChanged.addListener(
+    this.quickUnlockPrivate_.onActiveModesChanged.addListener(
         this.boundOnActiveModesChanged_);
 
     this.updateUnlockType_();
@@ -51,7 +60,7 @@
 
   /** @override */
   detached: function() {
-    chrome.quickUnlockPrivate.onActiveModesChanged.removeListener(
+    this.quickUnlockPrivate_.onActiveModesChanged.removeListener(
         this.boundOnActiveModesChanged_);
   },
 
@@ -63,7 +72,7 @@
    * @private
    */
   updateUnlockType_: function() {
-    chrome.quickUnlockPrivate.getActiveModes(function(modes) {
+    this.quickUnlockPrivate_.getActiveModes(function(modes) {
       if (modes.includes(chrome.quickUnlockPrivate.QuickUnlockMode.PIN)) {
         this.hasPin = true;
         this.selectedUnlockType = LockScreenUnlockType.PIN_PASSWORD;
diff --git a/chrome/browser/resources/settings/people_page/password_prompt_dialog.js b/chrome/browser/resources/settings/people_page/password_prompt_dialog.js
index 415b338..7dae951 100644
--- a/chrome/browser/resources/settings/people_page/password_prompt_dialog.js
+++ b/chrome/browser/resources/settings/people_page/password_prompt_dialog.js
@@ -29,21 +29,6 @@
 
 /** @const */ var PASSWORD_ACTIVE_DURATION_MS = 10 * 60 * 1000; // Ten minutes.
 
-/**
- * Helper method that checks if |password| is valid.
- * @param {string} password
- * @param {function(boolean):void} onCheck
- */
-function checkAccountPassword_(password, onCheck) {
-  // We check the account password by trying to update the active set of quick
-  // unlock modes without changing any credentials.
-  chrome.quickUnlockPrivate.getActiveModes(function(modes) {
-    var credentials =
-        /** @type {!Array<string>} */ (Array(modes.length).fill(''));
-    chrome.quickUnlockPrivate.setModes(password, modes, credentials, onCheck);
-  });
-}
-
 Polymer({
   is: 'settings-password-prompt-dialog',
 
@@ -52,7 +37,7 @@
      * A wrapper around chrome.quickUnlockPrivate.setModes with the account
      * password already supplied. If this is null, the authentication screen
      * needs to be redisplayed. This property will be cleared after
-     * PASSWORD_ACTIVE_DURATION_MS milliseconds.
+     * |this.passwordActiveDurationMs_| milliseconds.
      */
     setModes: {
       type: Object,
@@ -75,7 +60,25 @@
      * Helper property which marks password as valid/invalid.
      * @private
      */
-    passwordInvalid_: Boolean
+    passwordInvalid_: Boolean,
+
+    /**
+     * Interface for chrome.quickUnlockPrivate calls. May be overriden by tests.
+     * @private
+     */
+    quickUnlockPrivate_: {
+      type: Object,
+      value: chrome.quickUnlockPrivate
+    },
+
+    /**
+     * PASSWORD_ACTIVE_DURATION_MS value. May be overridden by tests.
+     * @private
+     */
+    passwordActiveDurationMs_: {
+      type: Number,
+      value: PASSWORD_ACTIVE_DURATION_MS
+    },
   },
 
   /**
@@ -137,14 +140,14 @@
 
       if (valid) {
         // Create the |this.setModes| closure and automatically clear it after
-        // |PASSWORD_ACTIVE_DURATION_MS|.
+        // |this.passwordActiveDurationMs_|.
         var password = this.password_;
         this.password_ = '';
 
         this.setModes = function(modes, credentials, onComplete) {
-          chrome.quickUnlockPrivate.setModes(
+          this.quickUnlockPrivate_.setModes(
               password, modes, credentials, onComplete);
-        };
+        }.bind(this);
 
         function clearSetModes() {
           // Reset the password so that any cached references to this.setModes
@@ -154,13 +157,16 @@
         }
 
         this.clearAccountPasswordTimeout_ = setTimeout(
-          clearSetModes.bind(this), PASSWORD_ACTIVE_DURATION_MS);
-        // Closing the dialog will clear this.password_.
-        this.$.dialog.close();
+          clearSetModes.bind(this), this.passwordActiveDurationMs_);
+
+        // Clear stored password state and close the dialog.
+        this.password_ = '';
+        if (this.$.dialog.open)
+          this.$.dialog.close();
       }
     }
 
-    checkAccountPassword_(this.password_, onPasswordChecked.bind(this));
+    this.checkAccountPassword_(onPasswordChecked.bind(this));
   },
 
   /** @private */
@@ -171,6 +177,21 @@
   /** @private */
   enableConfirm_: function() {
     return !!this.password_ && !this.passwordInvalid_;
+  },
+
+  /**
+  * Helper method that checks if the current password is valid.
+  * @param {function(boolean):void} onCheck
+  */
+  checkAccountPassword_: function(onCheck) {
+    // We check the account password by trying to update the active set of quick
+    // unlock modes without changing any credentials.
+    this.quickUnlockPrivate_.getActiveModes(function(modes) {
+      var credentials =
+          /** @type {!Array<string>} */ (Array(modes.length).fill(''));
+      this.quickUnlockPrivate_.setModes(
+          this.password_, modes, credentials, onCheck);
+    }.bind(this));
   }
 });
 
diff --git a/chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js b/chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js
deleted file mode 100644
index f9680ad..0000000
--- a/chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview
- * 'settings-quick-unlock-choose-method' allows the user to change how they
- * unlock their device. Note that setting up the unlock method is delegated
- * to other elements.
- *
- * Example:
- *
- * <settings-quick-unlock-choose-method
- *   set-modes="[[quickUnlockSetModes]]"
- *   prefs="{{prefs}}">
- * </settings-quick-unlock-choose-method>
- */
-
-(function() {
-'use strict';
-
-/** @const */ var ENABLE_LOCK_SCREEN_PREF = 'settings.enable_screen_lock';
-
-/** @enum {string} */
-var QuickUnlockUnlockType = {
-  VALUE_PENDING: 'value_pending',
-  NONE: 'none',
-  PASSWORD: 'password',
-  PIN_PASSWORD: 'pin+password'
-};
-
-Polymer({
-  is: 'settings-quick-unlock-choose-method',
-
-  behaviors: [PrefsBehavior, QuickUnlockPasswordDetectBehavior],
-
-  properties: {
-    /** Preferences state. */
-    prefs: {
-      type: Object,
-      notify: true,
-    },
-
-    /**
-     * The currently selected unlock type.
-     * @type {!QuickUnlockUnlockType}
-     * @private
-     */
-    selectedUnlockType_: {
-      type: String,
-      notify: true,
-      value: QuickUnlockUnlockType.VALUE_PENDING,
-      observer: 'selectedUnlockTypeChanged_'
-    }
-  },
-
-  observers: ['onSetModesChanged_(setModes)'],
-
-  /** @override */
-  attached: function() {
-    CrSettingsPrefs.initialized.then(this.updateUnlockType_.bind(this));
-
-    this.boundOnPrefsChanged_ = function(prefs) {
-      for (var i = 0; i < prefs.length; ++i) {
-        if (prefs[i].key == ENABLE_LOCK_SCREEN_PREF)
-          this.updateUnlockType_();
-      }
-    }.bind(this);
-    this.boundOnActiveModesChanged_ = this.updateUnlockType_.bind(this);
-
-    chrome.settingsPrivate.onPrefsChanged.addListener(
-        this.boundOnPrefsChanged_);
-    chrome.quickUnlockPrivate.onActiveModesChanged.addListener(
-        this.boundOnActiveModesChanged_);
-
-    if (settings.getCurrentRoute() == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD)
-      this.askForPasswordIfUnset();
-  },
-
-  /** @override */
-  detached: function() {
-    chrome.settingsPrivate.onPrefsChanged.removeListener(
-        this.boundOnPrefsChanged_);
-    chrome.quickUnlockPrivate.onActiveModesChanged.removeListener(
-        this.boundOnActiveModesChanged_);
-  },
-
-  /** @protected */
-  currentRouteChanged: function() {
-    if (settings.getCurrentRoute() == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD)
-      this.askForPasswordIfUnset();
-  },
-
-  /** @private */
-  onSetModesChanged_: function() {
-    if (settings.getCurrentRoute() == settings.Route.QUICK_UNLOCK_CHOOSE_METHOD)
-      this.askForPasswordIfUnset();
-  },
-
-  /**
-   * Updates the selected unlock type radio group. This function will get called
-   * after preferences are initialized, after the quick unlock mode has been
-   * changed, and after the lockscreen preference has changed.
-   *
-   * @private
-   */
-  updateUnlockType_: function() {
-    // The quickUnlockPrivate.onActiveModesChanged event could trigger this
-    // function before CrSettingsPrefs is initialized if another settings page
-    // changes the quick unlock state.
-    if (!CrSettingsPrefs.isInitialized)
-      return;
-
-    if (!this.getPref(ENABLE_LOCK_SCREEN_PREF).value) {
-      this.selectedUnlockType_ = QuickUnlockUnlockType.NONE;
-      return;
-    }
-
-    chrome.quickUnlockPrivate.getActiveModes(function(modes) {
-      if (modes.includes(chrome.quickUnlockPrivate.QuickUnlockMode.PIN)) {
-        this.selectedUnlockType_ = QuickUnlockUnlockType.PIN_PASSWORD;
-      } else if (this.selectedUnlockType_ !=
-                 QuickUnlockUnlockType.PIN_PASSWORD) {
-        // We don't want to clobber an existing PIN+PASSWORD state because the
-        // user needs to configure that option before actually using it.
-        //
-        // Specifically, this check is needed because this function gets called
-        // by the pref system after changing the unlock type from NONE to
-        // PIN+PASSWORD. Without the conditional assignment, this function would
-        // change the PIN+PASSWORD lock type to PASSWORD because the PIN hasn't
-        // been configured yet.
-        this.selectedUnlockType_ = QuickUnlockUnlockType.PASSWORD;
-      }
-    }.bind(this));
-  },
-
-  /**
-   * Called when the unlock type has changed.
-   * @param {!string} selected The current unlock type.
-   * @param {?string} previous The old unlock type. undefined if not present.
-   * @private
-   */
-  selectedUnlockTypeChanged_: function(selected, previous) {
-    // This method gets invoked when setting the initial value from the existing
-    // state. In that case, we don't need to bother updating the prefs.
-    if (!previous)
-      return;
-
-    this.setPrefValue(ENABLE_LOCK_SCREEN_PREF,
-                      selected != QuickUnlockUnlockType.NONE);
-    if (selected != QuickUnlockUnlockType.PIN_PASSWORD && this.setModes) {
-      this.setModes.call(null, [], [], function(didSet) {
-        assert(didSet, 'Failed to clear quick unlock modes');
-      });
-    }
-  },
-
-  /**
-   * Retruns true if the setup pin section should be shown.
-   * @param {!string} selectedUnlockType The current unlock type. Used to let
-   * polymer know about the dependency.
-   * @private
-   */
-  showSetupPin_: function(selectedUnlockType) {
-    return selectedUnlockType === QuickUnlockUnlockType.PIN_PASSWORD;
-  },
-
-  /** @private */
-  onConfigurePin_: function() {
-    settings.navigateTo(settings.Route.QUICK_UNLOCK_SETUP_PIN);
-  },
-});
-
-})();
diff --git a/chrome/browser/resources/settings/people_page/setup_pin_dialog.html b/chrome/browser/resources/settings/people_page/setup_pin_dialog.html
index 5f2f98f6..3f222420 100644
--- a/chrome/browser/resources/settings/people_page/setup_pin_dialog.html
+++ b/chrome/browser/resources/settings/people_page/setup_pin_dialog.html
@@ -1,6 +1,7 @@
 <link rel="import" href="chrome://resources/html/polymer.html">
 <link rel="import" href="chrome://resources/html/i18n_behavior.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+<link rel="import" href="/icons.html">
 <link rel="import" href="/people_page/pin_keyboard.html">
 <link rel="import" href="/settings_shared_css.html">
 
@@ -32,10 +33,11 @@
     <dialog is="cr-dialog" id="dialog" on-close="close">
       <div class="title">[[getTitleMessage_(isConfirmStep_)]]</div>
       <div class="body">
-        <!-- Warning/error; only shown if title is hidden. -->
-        <div class$="[[problemClass_]] settings-box first"
+        <!-- Warning/error; only shown if title is hidden. Id is needed for
+             tests. -->
+        <div id="problemDiv" class$="[[problemClass_]] settings-box first"
              hidden$="[[!hasProblem_(problemMessage_)]]">
-          <iron-icon icon="icons:warning"></iron-icon>
+          <iron-icon icon="settings:warning"></iron-icon>
           <span class="middle">[[problemMessage_]]</span>
         </div>
 
diff --git a/chrome/browser/resources/settings/people_page/setup_pin_dialog.js b/chrome/browser/resources/settings/people_page/setup_pin_dialog.js
index f299a0e..72b68c8 100644
--- a/chrome/browser/resources/settings/people_page/setup_pin_dialog.js
+++ b/chrome/browser/resources/settings/people_page/setup_pin_dialog.js
@@ -102,7 +102,7 @@
   /** @private */
   onCancelTap_: function() {
     this.resetState_();
-    this.$.dialog.cancel();
+    this.$.dialog.close();
   },
 
   /**
diff --git a/chrome/browser/resources/settings/search_engines_page/compiled_resources2.gyp b/chrome/browser/resources/settings/search_engines_page/compiled_resources2.gyp
index cf9a8e5..b4d8ea70 100644
--- a/chrome/browser/resources/settings/search_engines_page/compiled_resources2.gyp
+++ b/chrome/browser/resources/settings/search_engines_page/compiled_resources2.gyp
@@ -15,6 +15,8 @@
     {
       'target_name': 'search_engine_entry',
       'dependencies': [
+        '../compiled_resources2.gyp:settings_action_menu',
+        '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:assert',
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:icon',
         'search_engines_browser_proxy',
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html
index e467d92..55b3bb9 100644
--- a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html
+++ b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.html
@@ -5,6 +5,7 @@
 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html">
 <link rel="import" href="/search_engines_page/search_engine_dialog.html">
 <link rel="import" href="/search_engines_page/search_engines_browser_proxy.html">
+<link rel="import" href="/settings_action_menu.html">
 <link rel="import" href="/settings_shared_css.html">
 
 <dom-module id="settings-search-engine-entry">
@@ -41,24 +42,21 @@
       </div>
       <div class="keyword-column">[[engine.keyword]]</div>
       <div class="url-column">[[engine.url]]</div>
-      <paper-icon-button icon="cr:more-vert" toggles tabindex$="[[tabindex]]"
-          active="{{editMenuOpened}}">
+      <paper-icon-button icon="cr:more-vert" tabindex$="[[tabindex]]"
+          on-tap="onDotsTap_">
       </paper-icon-button>
-      <iron-dropdown opened="{{editMenuOpened}}" horizontal-align="right"
-          vertical-align="auto">
-        <div class="dropdown-content">
-          <button class="dropdown-item" role="option" on-tap="onMakeDefaultTap_"
-              hidden$="[[!engine.canBeDefault]]" id="makeDefault">
-            $i18n{searchEnginesMakeDefault}
-          </button>
-          <button class="dropdown-item" role="option" on-tap="onEditTap_"
-              hidden$="[[!engine.canBeEdited]]"
-              id="edit">$i18n{searchEnginesEdit}</button>
-          <button class="dropdown-item" role="option" on-tap="onDeleteTap_"
-              hidden$="[[!engine.canBeRemoved]]"
-              id="delete">$i18n{searchEnginesRemoveFromList}</button>
-        <div>
-      </iron-dropdown>
+      <dialog is="settings-action-menu">
+        <button class="dropdown-item" role="option" on-tap="onMakeDefaultTap_"
+            hidden$="[[!engine.canBeDefault]]" id="makeDefault">
+          $i18n{searchEnginesMakeDefault}
+        </button>
+        <button class="dropdown-item" role="option" on-tap="onEditTap_"
+            hidden$="[[!engine.canBeEdited]]"
+            id="edit">$i18n{searchEnginesEdit}</button>
+        <button class="dropdown-item" role="option" on-tap="onDeleteTap_"
+            hidden$="[[!engine.canBeRemoved]]"
+            id="delete">$i18n{searchEnginesRemoveFromList}</button>
+      </dialog>
     </div>
   </template>
   <script src="search_engine_entry.js"></script>
diff --git a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js
index 5a33a875..1cd5068 100644
--- a/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js
+++ b/chrome/browser/resources/settings/search_engines_page/search_engine_entry.js
@@ -69,7 +69,7 @@
 
   /** @private */
   closePopupMenu_: function() {
-    this.$$('iron-dropdown').close();
+    this.$$('dialog[is=settings-action-menu]').close();
   },
 
   /**
@@ -81,4 +81,11 @@
     // Force default icon, if no |engine.iconURL| is available.
     return cr.icon.getFavicon(url || '');
   },
+
+  /** @private */
+  onDotsTap_: function() {
+    /** @type {!SettingsActionMenuElement} */ (
+        this.$$('dialog[is=settings-action-menu]')).showAt(
+            assert(this.$$('paper-icon-button')));
+  },
 });
diff --git a/chrome/browser/resources/settings/settings_action_menu.html b/chrome/browser/resources/settings/settings_action_menu.html
new file mode 100644
index 0000000..06a3bdd
--- /dev/null
+++ b/chrome/browser/resources/settings/settings_action_menu.html
@@ -0,0 +1,23 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+<link rel="import" href="/direction_delegate.html">
+
+<dom-module id="settings-action-menu">
+  <template>
+    <style>
+      :host {
+        background-color: white;
+        border: none;
+        box-shadow: 0 2px 6px var(--paper-grey-500);
+        margin: 0;
+        outline: none;
+        padding: 0;
+      }
+
+      :host::backdrop {
+        background-color: transparent;
+      }
+    </style>
+    <content select=".dropdown-item,hr"></content>
+  </template>
+  <script src="settings_action_menu.js"></script>
+</dom-module>
diff --git a/chrome/browser/resources/settings/settings_action_menu.js b/chrome/browser/resources/settings/settings_action_menu.js
new file mode 100644
index 0000000..e584a55
--- /dev/null
+++ b/chrome/browser/resources/settings/settings_action_menu.js
@@ -0,0 +1,165 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+  is: 'settings-action-menu',
+  extends: 'dialog',
+
+  /**
+   * List of all options in this action menu.
+   * @private {?NodeList<!Element>}
+   */
+  options_: null,
+
+  /**
+   * Index of the currently focused item.
+   * @private {number}
+   */
+  focusedIndex_: -1,
+
+  /**
+   * Reference to the bound window's resize listener, such that it can be
+   * removed on detach.
+   * @private {?Function}
+   */
+  onWindowResize_: null,
+
+  hostAttributes: {
+    tabindex: 0,
+  },
+
+  listeners: {
+    'keydown': 'onKeyDown_',
+    'tap': 'onTap_',
+  },
+
+  /** override */
+  attached: function() {
+    this.options_ = this.querySelectorAll('.dropdown-item');
+  },
+
+  /** override */
+  detached: function() {
+    this.removeResizeListener_();
+  },
+
+  /** @private */
+  removeResizeListener_: function() {
+    window.removeEventListener('resize', this.onWindowResize_);
+  },
+
+  /**
+   * @param {!Event} e
+   * @private
+   */
+  onTap_: function(e) {
+    if (e.target == this) {
+      this.close();
+      e.stopPropagation();
+    }
+  },
+
+  /**
+   * @param {!KeyboardEvent} e
+   * @private
+   */
+  onKeyDown_: function(e) {
+    if (e.key == 'Tab') {
+      this.close();
+      return;
+    }
+
+    if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp')
+      return;
+
+    var nextOption = this.getNextOption_(e.key == 'ArrowDown' ? 1 : - 1);
+    if (nextOption)
+      nextOption.focus();
+
+    e.preventDefault();
+  },
+
+  /**
+   * @param {number} step -1 for getting previous option (up), 1 for getting
+   *     next option (down).
+   * @return {?Element} The next focusable option, taking into account
+   *     disabled/hidden attributes, or null if no focusable option exists.
+   * @private
+   */
+  getNextOption_: function(step) {
+    // Using a counter to ensure no infinite loop occurs if all elements are
+    // hidden/disabled.
+    var counter = 0;
+    var nextOption = null;
+    var numOptions = this.options_.length;
+
+    do {
+      this.focusedIndex_ =
+          (numOptions + this.focusedIndex_ + step) % numOptions;
+      nextOption = this.options_[this.focusedIndex_];
+      if (nextOption.disabled || nextOption.hidden)
+        nextOption = null;
+      counter++;
+    } while (!nextOption && counter < numOptions);
+
+    return nextOption;
+  },
+
+  /** @override */
+  close: function() {
+    // Removing 'resize' listener when dialog is closed.
+    this.removeResizeListener_();
+    HTMLDialogElement.prototype.close.call(this);
+    window.dispatchEvent(new CustomEvent('resize'));
+  },
+
+  /**
+   * Shows the menu anchored to the given element.
+   * @param {!Element} anchorElement
+   */
+  showAt: function(anchorElement) {
+    var rect = anchorElement.getBoundingClientRect();
+
+    // Ensure that the correct item is focused when the dialog is shown, by
+    // setting the 'autofocus' attribute.
+    this.focusedIndex_ = -1;
+    var nextOption = this.getNextOption_(1);
+
+    /** @suppress {checkTypes} */
+    (function(options) {
+      options.forEach(function(option) {
+        option.removeAttribute('autofocus');
+      });
+    })(this.options_);
+
+    if (nextOption)
+      nextOption.setAttribute('autofocus', true);
+
+    this.onWindowResize_ = this.onWindowResize_ || function() {
+      if (this.open)
+        this.close();
+    }.bind(this);
+    window.addEventListener('resize', this.onWindowResize_);
+
+    this.showModal();
+
+    if (new settings.DirectionDelegateImpl().isRtl()) {
+      var right = window.innerWidth - rect.left - this.offsetWidth;
+      this.style.right = right + 'px';
+    } else {
+      var left = rect.right - this.offsetWidth;
+      this.style.left = left + 'px';
+    }
+
+    // Attempt to show the menu starting from the top of the rectangle and
+    // extending downwards. If that does not fit within the window, fallback to
+    // starting from the bottom and extending upwards.
+    var top = rect.top + this.offsetHeight <= window.innerHeight ?
+        rect.top :
+        rect.bottom - this.offsetHeight - Math.max(
+            rect.bottom - window.innerHeight, 0);
+
+    this.style.top = top + 'px';
+  },
+});
diff --git a/chrome/browser/resources/settings/settings_resources.grd b/chrome/browser/resources/settings/settings_resources.grd
index 1c629e0..55f7dcb 100644
--- a/chrome/browser/resources/settings/settings_resources.grd
+++ b/chrome/browser/resources/settings/settings_resources.grd
@@ -244,6 +244,12 @@
                  file="settings_ui/settings_ui.js"
                  type="chrome_html"
                  flattenhtml="true" />
+      <structure name="IDR_SETTINGS_SETTINGS_ACTION_MENU_HTML"
+                 file="settings_action_menu.html"
+                 type="chrome_html" />
+      <structure name="IDR_SETTINGS_SETTINGS_ACTION_MENU_JS"
+                 file="settings_action_menu.js"
+                 type="chrome_html" />
       <if expr="use_nss_certs">
         <structure name="IDR_SETTINGS_CERTIFICATE_MANAGER_PAGE_HTML"
                    file="certificate_manager_page/certificate_manager_page.html"
diff --git a/chrome/browser/resources/settings/settings_shared_css.html b/chrome/browser/resources/settings/settings_shared_css.html
index 371b8a3..ac07ddc5 100644
--- a/chrome/browser/resources/settings/settings_shared_css.html
+++ b/chrome/browser/resources/settings/settings_shared_css.html
@@ -307,16 +307,18 @@
         min-height: var(--settings-row-two-line-min-height);
       }
 
-      /*
-       * A single start-aligned column, generally but not necessarily used in
-       * combination with two-line.
-       */
+      /* A start-aligned column. */
       .single-column {
         align-items: flex-start;
         flex-direction: column;
         justify-content: center;
       }
 
+      /* A settings-box with no height other than the separator line. */
+      .settings-box.line-only {
+        min-height: 0;
+      }
+
       /* The lower line of text in a two-line row. */
       .secondary {
         @apply(--settings-secondary);
diff --git a/chrome/browser/resources/settings/site_settings/site_list.html b/chrome/browser/resources/settings/site_settings/site_list.html
index cd2141d4..f520b78 100644
--- a/chrome/browser/resources/settings/site_settings/site_list.html
+++ b/chrome/browser/resources/settings/site_settings/site_list.html
@@ -39,7 +39,7 @@
         <template is="dom-repeat" items="[[sites]]">
           <div class="list-item">
             <div class="start layout horizontal center" on-tap="onOriginTap_"
-                actionable>
+                actionable$="[[enableSiteSettings_]]">
               <div class="favicon-image"
                   style$="[[computeSiteIcon(item.originForDisplay)]]">
               </div>
diff --git a/chrome/browser/resources/settings/site_settings/site_list.js b/chrome/browser/resources/settings/site_settings/site_list.js
index f2fcb7c..41f844e 100644
--- a/chrome/browser/resources/settings/site_settings/site_list.js
+++ b/chrome/browser/resources/settings/site_settings/site_list.js
@@ -26,6 +26,14 @@
   behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
 
   properties: {
+    /** @private */
+    enableSiteSettings_: {
+      type: Boolean,
+      value: function() {
+        return loadTimeData.getBoolean('enableSiteSettings');
+      },
+    },
+
     /**
      * The site that was selected by the user in the dropdown list.
      * @type {SiteException}
@@ -418,6 +426,8 @@
    * @private
    */
   onOriginTap_: function(event) {
+    if (!this.enableSiteSettings_)
+      return;
     this.selectedSite = event.model.item;
     settings.navigateTo(settings.Route.SITE_SETTINGS_SITE_DETAILS,
         new URLSearchParams('site=' + this.selectedSite.origin));
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.html b/chrome/browser/resources/settings/site_settings_page/site_settings_page.html
index 930e5e5..f271495d6 100644
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.html
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.html
@@ -10,13 +10,17 @@
 <dom-module id="settings-site-settings-page">
   <template>
     <style include="settings-shared"></style>
-    <div class="settings-box first" category$="[[ALL_SITES]]"
-        on-tap="onTapCategory" actionable>
-      <iron-icon icon="settings:list"></iron-icon>
-      <div class="middle">$i18n{siteSettingsCategoryAllSites}</div>
-      <button class="icon-arrow-right" is="paper-icon-button-light"></button>
-    </div>
-    <div class="settings-box two-line"
+    <template is="dom-if" if="[[enableSiteSettings_]]">
+      <div class="settings-box first" category$="[[ALL_SITES]]"
+          on-tap="onTapCategory" actionable>
+        <iron-icon icon="settings:list"></iron-icon>
+        <div class="middle">$i18n{siteSettingsCategoryAllSites}</div>
+        <button class="icon-arrow-right" is="paper-icon-button-light"></button>
+      </div>
+      <div class="settings-box line-only">
+      </div>
+    </template>
+    <div class="settings-box two-line first"
         category$="[[ContentSettingsTypes.COOKIES]]" on-tap="onTapCategory"
         actionable>
       <iron-icon icon="[[computeIconForContentCategory(
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
index 923d5bc..e66fcd7 100644
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
@@ -13,6 +13,14 @@
   behaviors: [SiteSettingsBehavior],
 
   properties: {
+    /** @private */
+    enableSiteSettings_: {
+      type: Boolean,
+      value: function() {
+        return loadTimeData.getBoolean('enableSiteSettings');
+      },
+    },
+
     /**
      * The category selected by the user.
      */
diff --git a/chrome/browser/resources/welcome/welcome.css b/chrome/browser/resources/welcome/welcome.css
index be1f261..6e893e6 100644
--- a/chrome/browser/resources/welcome/welcome.css
+++ b/chrome/browser/resources/welcome/welcome.css
@@ -41,7 +41,7 @@
 
 @keyframes spin {
   from {
-    transform: rotate(-1440deg) scale(0.8);
+    transform: rotate(1440deg) scale(0.8);
   }
 }
 
@@ -175,11 +175,12 @@
 
 .action {
   background: var(--google-blue-500);
+  border-radius: 2px;
   color: white;
-  font-size: .875em;
+  font-size: .8125em;
   font-weight: 500;
-  line-height: 2.5em;
-  padding: 0.1em 1.5em;
+  line-height: 2.25rem;
+  padding: 0 1.5em;
 }
 
 .action:active {
@@ -193,16 +194,12 @@
 .link {
   color: var(--google-blue-700);
   display: inline-block;
-  font-size: .875em;
+  font-size: .8125em;
   margin: 1.5em;
   text-align: center;
   text-decoration: none;
 }
 
-.link:hover {
-  text-decoration: underline;
-}
-
 .watermark {
   -webkit-mask-image: url(chrome://welcome/watermark.svg);
   -webkit-mask-repeat: no-repeat;
@@ -213,4 +210,10 @@
   height: 24px;
   position: absolute;
   width: 74px;
-}
\ No newline at end of file
+}
+
+@media(max-height: 608px) {
+  .watermark {
+    display: none;
+  }
+}
diff --git a/chrome/browser/resources/welcome/welcome.html b/chrome/browser/resources/welcome/welcome.html
index 08c0720..ae5b0683 100644
--- a/chrome/browser/resources/welcome/welcome.html
+++ b/chrome/browser/resources/welcome/welcome.html
@@ -11,9 +11,6 @@
 
   <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
   <link rel="stylesheet" href="chrome://welcome/welcome.css">
-
-  <script src="chrome://welcome/welcome.js"></script>
-
 </head>
 <body>
   <div class="content">
@@ -34,5 +31,6 @@
     </div>
   </div>
   <div class="watermark"></div>
+  <script src="chrome://welcome/welcome.js"></script>
 </body>
 </html>
diff --git a/chrome/browser/resources/welcome/welcome.js b/chrome/browser/resources/welcome/welcome.js
index a68333a..34d74ba5 100644
--- a/chrome/browser/resources/welcome/welcome.js
+++ b/chrome/browser/resources/welcome/welcome.js
@@ -11,11 +11,24 @@
 
   function onDecline(e) {
     chrome.send('handleUserDecline');
+    e.preventDefault();
   }
 
   function initialize() {
     $('accept-button').addEventListener('click', onAccept);
     $('decline-button').addEventListener('click', onDecline);
+
+    var logo = document.querySelector('.logo-icon');
+    logo.onclick = function(e) {
+      logo.animate({
+        transform: ['none', 'rotate(-10turn)'],
+      }, /** @type {!KeyframeEffectOptions} */({
+        duration: 500,
+        easing: 'cubic-bezier(1, 0, 0, 1)',
+      }));
+    };
+
+    document.fonts.load('bold .8125em Roboto');
   }
 
   return {
diff --git a/chrome/browser/safe_browsing/srt_global_error_win.cc b/chrome/browser/safe_browsing/srt_global_error_win.cc
index 3b134fd..a5f6b2df 100644
--- a/chrome/browser/safe_browsing/srt_global_error_win.cc
+++ b/chrome/browser/safe_browsing/srt_global_error_win.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/safe_browsing/srt_global_error_win.h"
 
+#include "base/base_paths.h"
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/callback.h"
@@ -52,6 +53,7 @@
 
 // Switches to add to the command line when executing the SRT.
 const char kChromePromptSwitch[] = "chrome-prompt";
+const char kChromeExePathSwitch[] = "chrome-exe-path";
 const char kChromeSystemInstallSwitch[] = "chrome-system-install";
 const char kUmaUserSwitch[] = "uma-user";
 
@@ -88,6 +90,7 @@
 
       base::FilePath chrome_exe_path;
       PathService::Get(base::FILE_EXE, &chrome_exe_path);
+      srt_command_line.AppendSwitchPath(kChromeExePathSwitch, chrome_exe_path);
       if (!InstallUtil::IsPerUserInstall(chrome_exe_path))
         srt_command_line.AppendSwitch(kChromeSystemInstallSwitch);
 
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 30c6630b..57072b8 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -47,6 +47,7 @@
 #include "chrome/common/channel_info.h"
 #include "chrome/common/chrome_constants.h"
 #include "chrome/common/chrome_switches.h"
+#include "chrome/common/features.h"
 #include "chrome/grit/chrome_unscaled_resources.h"
 #include "components/version_info/version_info.h"
 #include "content/public/browser/browser_thread.h"
@@ -267,7 +268,7 @@
 
 namespace {
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 // The Categories for the App Launcher desktop shortcut. Should be the same as
 // the Chrome desktop shortcut, so they are in the same sub-menu.
 const char kAppListCategories[] = "Network;WebBrowser;";
@@ -499,7 +500,7 @@
 
 const char kDirectoryFilename[] = "chrome-apps.directory";
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 #if defined(GOOGLE_CHROME_BUILD)
 const char kAppListDesktopName[] = "chrome-app-list";
 #else  // CHROMIUM_BUILD
@@ -1028,7 +1029,7 @@
   return success;
 }
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 bool CreateAppListDesktopShortcut(
     const std::string& wm_class,
     const std::string& title) {
diff --git a/chrome/browser/shell_integration_linux.h b/chrome/browser/shell_integration_linux.h
index cd2ca8e..0f44c01 100644
--- a/chrome/browser/shell_integration_linux.h
+++ b/chrome/browser/shell_integration_linux.h
@@ -9,6 +9,7 @@
 
 #include "base/files/file_path.h"
 #include "chrome/browser/web_applications/web_app.h"
+#include "chrome/common/features.h"
 #include "url/gurl.h"
 
 namespace base {
@@ -120,7 +121,7 @@
     const web_app::ShortcutInfo& shortcut_info,
     const web_app::ShortcutLocations& creation_locations);
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 // Create shortcuts in the application menu for the app launcher. Duplicate
 // shortcuts are avoided, so if a requested shortcut already exists it is
 // deleted first. Also creates the icon required by the shortcut.
diff --git a/chrome/browser/signin/easy_unlock_service.h b/chrome/browser/signin/easy_unlock_service.h
index e32c6e4..2e16967 100644
--- a/chrome/browser/signin/easy_unlock_service.h
+++ b/chrome/browser/signin/easy_unlock_service.h
@@ -78,7 +78,7 @@
   static EasyUnlockService* Get(Profile* profile);
 
   // Gets EasyUnlockService instance associated with a user if the user is
-  // logged in and his profile is initialized.
+  // logged in and their profile is initialized.
   static EasyUnlockService* GetForUser(const user_manager::User& user);
 
   // Registers Easy Unlock profile preferences.
diff --git a/chrome/browser/ssl/chrome_security_state_model_client.cc b/chrome/browser/ssl/chrome_security_state_model_client.cc
index 51cd505..8f5d3232 100644
--- a/chrome/browser/ssl/chrome_security_state_model_client.cc
+++ b/chrome/browser/ssl/chrome_security_state_model_client.cc
@@ -82,12 +82,12 @@
   const char* cipher;
   const char* mac;
   bool is_aead;
+  bool is_tls13;
   uint16_t cipher_suite =
       net::SSLConnectionStatusToCipherSuite(security_info.connection_status);
   net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead,
-                               cipher_suite);
+                               &is_tls13, cipher_suite);
   base::string16 protocol_name = base::ASCIIToUTF16(protocol);
-  base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange);
   const base::string16 cipher_name =
       (mac == NULL) ? base::ASCIIToUTF16(cipher)
                     : l10n_util::GetStringFUTF16(IDS_CIPHER_WITH_MAC,
@@ -95,15 +95,17 @@
                                                  base::ASCIIToUTF16(mac));
 
   // Include the key exchange group (previously known as curve) if specified.
-  //
-  // TODO(davidben): When TLS 1.3's new negotiation is implemented, omit the
-  // "key exchange" if empty and only display the group, which is the true key
-  // exchange. See https://crbug.com/639495.
-  if (security_info.key_exchange_group != 0) {
+  base::string16 key_exchange_name;
+  if (is_tls13) {
+    key_exchange_name = base::ASCIIToUTF16(
+        SSL_get_curve_name(security_info.key_exchange_group));
+  } else if (security_info.key_exchange_group != 0) {
     key_exchange_name = l10n_util::GetStringFUTF16(
-        IDS_SSL_KEY_EXCHANGE_WITH_GROUP, key_exchange_name,
+        IDS_SSL_KEY_EXCHANGE_WITH_GROUP, base::ASCIIToUTF16(key_exchange),
         base::ASCIIToUTF16(
             SSL_get_curve_name(security_info.key_exchange_group)));
+  } else {
+    key_exchange_name = base::ASCIIToUTF16(key_exchange);
   }
 
   if (security_info.obsolete_ssl_status == net::OBSOLETE_SSL_NONE) {
diff --git a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc
index 2b2cff2..daeaafb 100644
--- a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc
+++ b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc
@@ -177,13 +177,14 @@
   int ssl_version =
       net::SSLConnectionStatusToVersion(security_info.connection_status);
   net::SSLVersionToString(&protocol, ssl_version);
-  bool is_aead;
+  bool is_aead, is_tls13;
   uint16_t cipher_suite =
       net::SSLConnectionStatusToCipherSuite(security_info.connection_status);
   net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead,
-                               cipher_suite);
+                               &is_tls13, cipher_suite);
   EXPECT_TRUE(is_aead);
-  EXPECT_EQ(NULL, mac);  // The default secure cipher does not have a MAC.
+  EXPECT_EQ(nullptr, mac);  // The default secure cipher does not have a MAC.
+  EXPECT_FALSE(is_tls13);   // The default secure cipher is not TLS 1.3.
 
   base::string16 key_exchange_name = base::ASCIIToUTF16(key_exchange);
   if (security_info.key_exchange_group != 0) {
diff --git a/chrome/browser/ssl/chrome_security_state_model_client_unittest.cc b/chrome/browser/ssl/chrome_security_state_model_client_unittest.cc
index 3f6ed9d..3e9333644 100644
--- a/chrome/browser/ssl/chrome_security_state_model_client_unittest.cc
+++ b/chrome/browser/ssl/chrome_security_state_model_client_unittest.cc
@@ -191,6 +191,26 @@
         "strong cipher (CHACHA20_POLY1305).",
         explanation.description);
   }
+
+  // TLS 1.3 ciphers use the key exchange group exclusively.
+  net::SSLConnectionStatusSetCipherSuite(0x1301 /* TLS_AES_128_GCM_SHA256 */,
+                                         &security_info.connection_status);
+  net::SSLConnectionStatusSetVersion(net::SSL_CONNECTION_VERSION_TLS1_3,
+                                     &security_info.connection_status);
+  security_info.key_exchange_group = 29;  // X25519
+  {
+    content::SecurityStyleExplanations explanations;
+    ChromeSecurityStateModelClient::GetSecurityStyle(security_info,
+                                                     &explanations);
+    content::SecurityStyleExplanation explanation;
+    ASSERT_TRUE(FindSecurityStyleExplanation(
+        explanations.secure_explanations, "Secure Connection", &explanation));
+    EXPECT_EQ(
+        "The connection to this site is encrypted and authenticated using a "
+        "strong protocol (TLS 1.3), a strong key exchange (X25519), and a "
+        "strong cipher (AES_128_GCM).",
+        explanation.description);
+  }
 }
 
 }  // namespace
diff --git a/chrome/browser/sync/DEPS b/chrome/browser/sync/DEPS
index 5dd6f12..ee408aa 100644
--- a/chrome/browser/sync/DEPS
+++ b/chrome/browser/sync/DEPS
@@ -1,6 +1,5 @@
 include_rules = [
   "+components/invalidation",
-  "+components/sync/core",
   "+components/sync/driver",
   "+components/sync_sessions",
   "+components/wifi_sync",
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc
index a549fbb4..9bf14597 100644
--- a/chrome/browser/sync/chrome_sync_client.cc
+++ b/chrome/browser/sync/chrome_sync_client.cc
@@ -66,7 +66,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "ui/base/device_form_factor.h"
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
 #include "ui/app_list/app_list_switches.h"
@@ -338,7 +338,7 @@
       return extensions::settings_sync_util::GetSyncableService(profile_, type)
           ->AsWeakPtr();
 #endif
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
     case syncer::APP_LIST:
       return app_list::AppListSyncableServiceFactory::GetForProfile(profile_)->
           AsWeakPtr();
@@ -569,7 +569,7 @@
   }
 #endif
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   if (app_list::switches::IsAppListSyncEnabled()) {
     sync_service->RegisterDataTypeController(
         base::MakeUnique<UIDataTypeController>(syncer::APP_LIST, error_callback,
diff --git a/chrome/browser/sync/profile_sync_service_factory_unittest.cc b/chrome/browser/sync/profile_sync_service_factory_unittest.cc
index 0038477d..cf641806 100644
--- a/chrome/browser/sync/profile_sync_service_factory_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_factory_unittest.cc
@@ -11,6 +11,7 @@
 
 #include "base/command_line.h"
 #include "build/build_config.h"
+#include "chrome/common/features.h"
 #include "chrome/test/base/testing_profile.h"
 #include "components/browser_sync/browser_sync_switches.h"
 #include "components/browser_sync/profile_sync_service.h"
@@ -34,7 +35,7 @@
     // Desktop types.
 #if !defined(OS_ANDROID)
     datatypes.push_back(syncer::APPS);
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
     if (app_list::switches::IsAppListSyncEnabled())
       datatypes.push_back(syncer::APP_LIST);
 #endif
diff --git a/chrome/browser/task_manager/providers/child_process_task.cc b/chrome/browser/task_manager/providers/child_process_task.cc
index 041de0d..bfea633 100644
--- a/chrome/browser/task_manager/providers/child_process_task.cc
+++ b/chrome/browser/task_manager/providers/child_process_task.cc
@@ -23,7 +23,7 @@
 #include "content/public/common/process_type.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/common/extension_set.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/resource/resource_bundle.h"
 
@@ -124,7 +124,8 @@
   if (!host)
     return;
 
-  shell::InterfaceProvider* interfaces = host->GetHost()->GetRemoteInterfaces();
+  service_manager::InterfaceProvider* interfaces =
+      host->GetHost()->GetRemoteInterfaces();
   if (interfaces)
     interfaces->GetInterface(std::move(resource_reporter));
 }
diff --git a/chrome/browser/task_manager/providers/web_contents/renderer_task.cc b/chrome/browser/task_manager/providers/web_contents/renderer_task.cc
index 25a68b0f..d3381b5 100644
--- a/chrome/browser/task_manager/providers/web_contents/renderer_task.cc
+++ b/chrome/browser/task_manager/providers/web_contents/renderer_task.cc
@@ -19,7 +19,7 @@
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_delegate.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "ui/base/l10n/l10n_util.h"
 
 namespace task_manager {
diff --git a/chrome/browser/tracing/crash_service_uploader.cc b/chrome/browser/tracing/crash_service_uploader.cc
index ab677e5..248eb6b 100644
--- a/chrome/browser/tracing/crash_service_uploader.cc
+++ b/chrome/browser/tracing/crash_service_uploader.cc
@@ -17,6 +17,7 @@
 #include "base/strings/stringprintf.h"
 #include "base/time/time.h"
 #include "build/build_config.h"
+#include "components/data_use_measurement/core/data_use_user_data.h"
 #include "components/tracing/common/tracing_switches.h"
 #include "components/version_info/version_info.h"
 #include "content/public/browser/browser_thread.h"
@@ -310,6 +311,9 @@
 
   url_fetcher_ =
       net::URLFetcher::Create(GURL(upload_url), net::URLFetcher::POST, this);
+  data_use_measurement::DataUseUserData::AttachToFetcher(
+      url_fetcher_.get(),
+      data_use_measurement::DataUseUserData::TRACING_UPLOADER);
   url_fetcher_->SetRequestContext(request_context_);
   url_fetcher_->SetUploadData(content_type, post_data);
   url_fetcher_->Start();
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 586b412..0bc642f 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -462,6 +462,7 @@
     "//chrome/app/resources:platform_locale_settings",
     "//chrome/app/theme:chrome_unscaled_resources",
     "//chrome/app/theme:theme_resources",
+    "//chrome/browser:resource_prefetch_predictor_proto",
     "//chrome/browser/devtools",
     "//chrome/browser/ui/webui/engagement:mojo_bindings",
     "//chrome/browser/ui/webui/omnibox:mojo_bindings",
@@ -564,7 +565,7 @@
     "//device/usb",
     "//media",
     "//net:net_with_v8",
-    "//services/shell/runner/common",
+    "//services/service_manager/runner/common",
     "//skia",
     "//storage/browser",
     "//storage/common",
diff --git a/chrome/browser/ui/android/page_info/connection_info_popup_android.cc b/chrome/browser/ui/android/page_info/connection_info_popup_android.cc
index c70b71c..2d706375 100644
--- a/chrome/browser/ui/android/page_info/connection_info_popup_android.cc
+++ b/chrome/browser/ui/android/page_info/connection_info_popup_android.cc
@@ -7,7 +7,6 @@
 #include "base/android/jni_android.h"
 #include "base/android/jni_array.h"
 #include "base/android/jni_string.h"
-#include "base/stl_util.h"
 #include "chrome/browser/android/resource_mapper.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/profiles/profile.h"
@@ -185,10 +184,7 @@
 
 void ConnectionInfoPopupAndroid::SetPermissionInfo(
     const PermissionInfoList& permission_info_list,
-    const ChosenObjectInfoList& chosen_object_info_list) {
-  base::STLDeleteContainerPointers(chosen_object_info_list.begin(),
-                                   chosen_object_info_list.end());
-
+    ChosenObjectInfoList chosen_object_info_list) {
   NOTIMPLEMENTED();
 }
 
diff --git a/chrome/browser/ui/android/page_info/connection_info_popup_android.h b/chrome/browser/ui/android/page_info/connection_info_popup_android.h
index bf78ba0d..97bf78e 100644
--- a/chrome/browser/ui/android/page_info/connection_info_popup_android.h
+++ b/chrome/browser/ui/android/page_info/connection_info_popup_android.h
@@ -36,16 +36,15 @@
 
   // WebsiteSettingsUI implementations.
   void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
-  void SetPermissionInfo(
-      const PermissionInfoList& permission_info_list,
-      const ChosenObjectInfoList& chosen_object_info_list) override;
+  void SetPermissionInfo(const PermissionInfoList& permission_info_list,
+                         ChosenObjectInfoList chosen_object_info_list) override;
   void SetIdentityInfo(const IdentityInfo& identity_info) override;
   void SetSelectedTab(WebsiteSettingsUI::TabId tab_id) override;
 
   static bool RegisterConnectionInfoPopupAndroid(JNIEnv* env);
 
  private:
-  // The presenter that controlls the Website Settings UI.
+  // The presenter that controls the Website Settings UI.
   std::unique_ptr<WebsiteSettings> presenter_;
 
   // The java prompt implementation.
diff --git a/chrome/browser/ui/android/page_info/website_settings_popup_android.cc b/chrome/browser/ui/android/page_info/website_settings_popup_android.cc
index 46141e4..a96194518 100644
--- a/chrome/browser/ui/android/page_info/website_settings_popup_android.cc
+++ b/chrome/browser/ui/android/page_info/website_settings_popup_android.cc
@@ -91,7 +91,7 @@
 
 void WebsiteSettingsPopupAndroid::SetPermissionInfo(
     const PermissionInfoList& permission_info_list,
-    const ChosenObjectInfoList& chosen_object_info_list) {
+    ChosenObjectInfoList chosen_object_info_list) {
   JNIEnv* env = base::android::AttachCurrentThread();
 
   // On Android, we only want to display a subset of the available options in a
@@ -129,7 +129,7 @@
     }
   }
 
-  for (auto* chosen_object : chosen_object_info_list) {
+  for (const auto& chosen_object : chosen_object_info_list) {
     base::string16 object_title =
         WebsiteSettingsUI::ChosenObjectToUIString(*chosen_object);
 
@@ -137,7 +137,6 @@
         env, popup_jobject_, ConvertUTF16ToJavaString(env, object_title),
         static_cast<jint>(chosen_object->ui_info.content_settings_type),
         static_cast<jint>(CONTENT_SETTING_ALLOW));
-    delete chosen_object;
   }
 
   Java_WebsiteSettingsPopup_updatePermissionDisplay(env, popup_jobject_);
diff --git a/chrome/browser/ui/android/page_info/website_settings_popup_android.h b/chrome/browser/ui/android/page_info/website_settings_popup_android.h
index b6cc23d3..46a27b78b 100644
--- a/chrome/browser/ui/android/page_info/website_settings_popup_android.h
+++ b/chrome/browser/ui/android/page_info/website_settings_popup_android.h
@@ -43,9 +43,8 @@
 
   // WebsiteSettingsUI implementations.
   void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
-  void SetPermissionInfo(
-      const PermissionInfoList& permission_info_list,
-      const ChosenObjectInfoList& chosen_object_info_list) override;
+  void SetPermissionInfo(const PermissionInfoList& permission_info_list,
+                         ChosenObjectInfoList chosen_object_info_list) override;
   void SetIdentityInfo(const IdentityInfo& identity_info) override;
   void SetSelectedTab(WebsiteSettingsUI::TabId tab_id) override;
 
diff --git a/chrome/browser/ui/app_list/app_list_util.cc b/chrome/browser/ui/app_list/app_list_util.cc
index 172debc2..37f8e5b3 100644
--- a/chrome/browser/ui/app_list/app_list_util.cc
+++ b/chrome/browser/ui/app_list/app_list_util.cc
@@ -10,7 +10,7 @@
 #include "components/prefs/pref_service.h"
 
 bool IsAppLauncherEnabled() {
-#if !defined(ENABLE_APP_LIST)
+#if !BUILDFLAG(ENABLE_APP_LIST)
   return false;
 #elif defined(OS_CHROMEOS) || defined(USE_ASH)
   return true;
diff --git a/chrome/browser/ui/apps/app_info_dialog.h b/chrome/browser/ui/apps/app_info_dialog.h
index 77b53924..4805d6a7 100644
--- a/chrome/browser/ui/apps/app_info_dialog.h
+++ b/chrome/browser/ui/apps/app_info_dialog.h
@@ -6,6 +6,7 @@
 #define CHROME_BROWSER_UI_APPS_APP_INFO_DIALOG_H_
 
 #include "base/callback_forward.h"
+#include "chrome/common/features.h"
 #include "ui/gfx/native_widget_types.h"
 
 class Profile;
@@ -38,7 +39,7 @@
 // Returns the size of the native window container for the app info dialog.
 gfx::Size GetAppInfoNativeDialogSize();
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 // Shows the chrome app information as a frameless window for the given |app|
 // and |profile| at the given |app_list_bounds|. Appears 'inside' the app list.
 void ShowAppInfoInAppList(gfx::NativeWindow parent,
diff --git a/chrome/browser/ui/ash/ash_util.cc b/chrome/browser/ui/ash/ash_util.cc
index 30605b6..33c69c1 100644
--- a/chrome/browser/ui/ash/ash_util.cc
+++ b/chrome/browser/ui/ash/ash_util.cc
@@ -8,7 +8,7 @@
 #include "ash/common/wm_shell.h"
 #include "build/build_config.h"
 #include "chrome/browser/ui/ash/ash_init.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 #include "ui/aura/window_event_dispatcher.h"
 
 namespace chrome {
@@ -18,7 +18,7 @@
 }
 
 bool IsRunningInMash() {
-  return shell::ShellIsRemote();
+  return service_manager::ServiceManagerIsRemote();
 }
 
 bool IsAcceleratorDeprecated(const ui::Accelerator& accelerator) {
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.cc b/chrome/browser/ui/ash/chrome_launcher_prefs.cc
index f4b87d8..54f33cdb 100644
--- a/chrome/browser/ui/ash/chrome_launcher_prefs.cc
+++ b/chrome/browser/ui/ash/chrome_launcher_prefs.cc
@@ -9,6 +9,7 @@
 #include <set>
 
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/values.h"
 #include "chrome/browser/app_mode/app_mode_utils.h"
@@ -309,10 +310,11 @@
   registry->RegisterBooleanPref(prefs::kShowLogoutButtonInTray, false);
 }
 
-base::DictionaryValue* CreateAppDict(const std::string& app_id) {
-  std::unique_ptr<base::DictionaryValue> app_value(new base::DictionaryValue);
+std::unique_ptr<base::DictionaryValue> CreateAppDict(
+    const std::string& app_id) {
+  auto app_value = base::MakeUnique<base::DictionaryValue>();
   app_value->SetString(kPinnedAppsPrefAppIDPath, app_id);
-  return app_value.release();
+  return app_value;
 }
 
 ShelfAutoHideBehavior GetShelfAutoHideBehaviorPref(PrefService* prefs,
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.h b/chrome/browser/ui/ash/chrome_launcher_prefs.h
index a8607d8..25751e4 100644
--- a/chrome/browser/ui/ash/chrome_launcher_prefs.h
+++ b/chrome/browser/ui/ash/chrome_launcher_prefs.h
@@ -54,7 +54,7 @@
 void RegisterChromeLauncherUserPrefs(
     user_prefs::PrefRegistrySyncable* registry);
 
-base::DictionaryValue* CreateAppDict(const std::string& app_id);
+std::unique_ptr<base::DictionaryValue> CreateAppDict(const std::string& app_id);
 
 // Get or set the shelf auto hide behavior preference for a particular display.
 ShelfAutoHideBehavior GetShelfAutoHideBehaviorPref(PrefService* prefs,
diff --git a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
index 77c9739..37a9bd4 100644
--- a/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
+++ b/chrome/browser/ui/ash/chrome_screenshot_grabber.cc
@@ -398,7 +398,7 @@
     const base::FilePath& screenshot_path) {
   // Do not show a notification that a screenshot was taken while no user is
   // logged in, since it is confusing for the user to get a message about it
-  // after he logs in (crbug.com/235217).
+  // after they log in (crbug.com/235217).
   if (!chromeos::LoginState::Get()->IsUserLoggedIn())
     return;
 
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc
index 8f4e9b7..1b9a2c6 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.cc
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -332,7 +332,7 @@
 ChromeShellDelegate::~ChromeShellDelegate() {
 }
 
-shell::Connector* ChromeShellDelegate::GetShellConnector() const {
+service_manager::Connector* ChromeShellDelegate::GetShellConnector() const {
   return content::ServiceManagerConnection::GetForProcess()->GetConnector();
 }
 
@@ -358,7 +358,7 @@
     // in. For special cases like Kiosk mode and / or guest mode this isn't a
     // problem since either the browser gets restarted and / or the flag is not
     // allowed, but for an "ephermal" user (see crbug.com/312324) it is not
-    // decided yet if he could add other users to his session or not.
+    // decided yet if they could add other users to their session or not.
     // TODO(skuhne): As soon as the issue above needs to be resolved, this logic
     // should change.
     logged_in_users = 1;
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h
index 954b3577..c6e982b 100644
--- a/chrome/browser/ui/ash/chrome_shell_delegate.h
+++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -31,7 +31,7 @@
   ~ChromeShellDelegate() override;
 
   // ash::ShellDelegate overrides;
-  shell::Connector* GetShellConnector() const override;
+  service_manager::Connector* GetShellConnector() const override;
   bool IsFirstRunAfterBoot() const override;
   bool IsMultiProfilesEnabled() const override;
   bool IsIncognitoAllowed() const override;
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index c238134..1b54d34 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -12,7 +12,7 @@
 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
 #include "content/public/common/service_manager_connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/display/display.h"
 #include "ui/display/screen.h"
 
diff --git a/chrome/browser/ui/ash/system_tray_client.cc b/chrome/browser/ui/ash/system_tray_client.cc
index 54a03396..516cb0c 100644
--- a/chrome/browser/ui/ash/system_tray_client.cc
+++ b/chrome/browser/ui/ash/system_tray_client.cc
@@ -13,6 +13,7 @@
 #include "chrome/browser/browser_process_platform_part.h"
 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
+#include "chrome/browser/chromeos/options/network_config_view.h"
 #include "chrome/browser/chromeos/system/system_clock.h"
 #include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/browser/ui/ash/ash_util.h"
@@ -25,7 +26,7 @@
 #include "content/public/browser/user_metrics.h"
 #include "content/public/common/service_manager_connection.h"
 #include "net/base/escape.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/base/l10n/l10n_util.h"
 
 using chromeos::LoginState;
@@ -140,6 +141,15 @@
   chrome::ShowPolicy(displayer.browser());
 }
 
+void SystemTrayClient::ShowNetworkConfigure(const std::string& service_path) {
+  // TODO(jamescook): Consolidate this with the classic ash version from
+  // NetworkConnectDelegateChromeOS. This will require moving the window
+  // container calculation to this class, then plumbing a container ID through
+  // the dialog code.
+  CHECK(chrome::IsRunningInMash());
+  chromeos::NetworkConfigView::Show(service_path, nullptr /* parent */);
+}
+
 void SystemTrayClient::ShowNetworkSettings(const std::string& network_id) {
   if (!chrome::IsRunningInMash()) {
     // TODO(mash): Need replacement for SessionStateDelegate. crbug.com/648964
@@ -178,7 +188,7 @@
   if (system_tray_.is_bound())
     return;
 
-  shell::Connector* connector =
+  service_manager::Connector* connector =
       content::ServiceManagerConnection::GetForProcess()->GetConnector();
   // Under mash the SystemTray interface is in the ash process. In classic ash
   // we provide it to ourself.
diff --git a/chrome/browser/ui/ash/system_tray_client.h b/chrome/browser/ui/ash/system_tray_client.h
index 5f364e9..2628b493 100644
--- a/chrome/browser/ui/ash/system_tray_client.h
+++ b/chrome/browser/ui/ash/system_tray_client.h
@@ -34,6 +34,7 @@
   void ShowPaletteHelp() override;
   void ShowPaletteSettings() override;
   void ShowPublicAccountInfo() override;
+  void ShowNetworkConfigure(const std::string& network_id) override;
   void ShowNetworkSettings(const std::string& network_id) override;
   void ShowProxySettings() override;
 
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 7cbbbdda..3872c17 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -57,7 +57,7 @@
 #include "content/public/common/url_constants.h"
 #include "extensions/browser/extension_system.h"
 #include "mash/public/interfaces/launchable.mojom.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/events/keycodes/keyboard_codes.h"
 
 #if defined(OS_MACOSX)
@@ -630,7 +630,7 @@
 #if defined(OS_CHROMEOS)
     case IDC_TOUCH_HUD_PROJECTION_TOGGLE:
       if (chrome::IsRunningInMash()) {
-        shell::Connector* connector =
+        service_manager::Connector* connector =
             content::ServiceManagerConnection::GetForProcess()->GetConnector();
         mash::mojom::LaunchablePtr launchable;
         connector->ConnectToInterface("service:touch_hud", &launchable);
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
index 10ffe50..29dda15 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm
@@ -369,17 +369,23 @@
     [id(delegate_) mouseDragged:theEvent];
 }
 
-- (void)rightMouseDown:(NSEvent*)event {
-  // Ensure that right-clicking on a button while a context menu is open
+- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event {
+  // Ensure that right-clicking on a button while a context menu is already open
   // highlights the new button.
+  [delegate_ mouseEnteredButton:self event:event];
+
   GradientButtonCell* cell =
       base::mac::ObjCCastStrict<GradientButtonCell>([self cell]);
-  [delegate_ mouseEnteredButton:self event:event];
-  [cell setMouseInside:YES animate:YES];
+  // Opt for animate:NO, otherwise the upcoming contextual menu's modal loop
+  // will block the animation and the button's state will visually never change
+  // ( https://crbug.com/649256 ).
+  [cell setMouseInside:YES animate:NO];
+}
 
-  // Keep a ref to |self|, in case -rightMouseDown: deletes this bookmark.
-  base::scoped_nsobject<BookmarkButton> keepAlive([self retain]);
-  [super rightMouseDown:event];
+- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event {
+  // Update the highlight after the contextual menu closes.
+  GradientButtonCell* cell =
+      base::mac::ObjCCastStrict<GradientButtonCell>([self cell]);
 
   if (![cell isMouseReallyInside]) {
     [cell setMouseInside:NO animate:YES];
diff --git a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
index 992baaeb..78af75a 100644
--- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration.mm
@@ -42,15 +42,19 @@
 
   base::string16 zoom_percent =
       base::FormatPercent(zoom_controller->GetZoomPercent());
-  NSString* zoom_string =
-      l10n_util::GetNSStringF(IDS_TOOLTIP_ZOOM, zoom_percent);
+  // In Material Design there is no icon at the default zoom factor (100%), so
+  // don't display a tooltip either.
+  NSString* tooltip_string =
+      zoom_controller->IsAtDefaultZoom()
+          ? @""
+          : l10n_util::GetNSStringF(IDS_TOOLTIP_ZOOM, zoom_percent);
 
-  if (IsVisible() && [tooltip_ isEqualToString:zoom_string] &&
+  if (IsVisible() && [tooltip_ isEqualToString:tooltip_string] &&
       !default_zoom_changed) {
     return false;
   }
 
-  ShowAndUpdateUI(zoom_controller, zoom_string, location_bar_is_dark);
+  ShowAndUpdateUI(zoom_controller, tooltip_string, location_bar_is_dark);
   return true;
 }
 
@@ -96,6 +100,7 @@
   vector_icon_id_ = gfx::VectorIconId::VECTOR_ICON_NONE;
   zoom::ZoomController::RelativeZoom relative_zoom =
       zoom_controller->GetZoomRelativeToDefault();
+  // In Material Design there is no icon at the default zoom factor.
   if (relative_zoom == zoom::ZoomController::ZOOM_BELOW_DEFAULT_ZOOM) {
     vector_icon_id_ = gfx::VectorIconId::ZOOM_MINUS;
   } else if (relative_zoom == zoom::ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM) {
diff --git a/chrome/browser/ui/cocoa/location_bar/zoom_decoration_unittest.mm b/chrome/browser/ui/cocoa/location_bar/zoom_decoration_unittest.mm
index 3641e7a6..bbaed85 100644
--- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration_unittest.mm
+++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration_unittest.mm
@@ -36,6 +36,7 @@
   explicit MockZoomController(content::WebContents* web_contents)
       : zoom::ZoomController(web_contents) {}
   int GetZoomPercent() const override { return zoom_percent_; }
+  bool IsAtDefaultZoom() const override { return zoom_percent_ == 100; }
 
   int zoom_percent_;
 
diff --git a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
index 522d42a..45e22f8 100644
--- a/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
+++ b/chrome/browser/ui/cocoa/notifications/alert_notification_service.mm
@@ -6,6 +6,7 @@
 
 #import "base/mac/scoped_nsobject.h"
 #import "chrome/browser/ui/cocoa/notifications/notification_builder_mac.h"
+#include "chrome/browser/ui/cocoa/notifications/notification_constants_mac.h"
 
 @class NSUserNotificationCenter;
 
@@ -21,4 +22,29 @@
       deliverNotification:toast];
 }
 
+- (void)closeNotificationWithId:(NSString*)notificationId
+                  withProfileId:(NSString*)profileId {
+  NSUserNotificationCenter* notificationCenter =
+      [NSUserNotificationCenter defaultUserNotificationCenter];
+  for (NSUserNotification* candidate in
+       [notificationCenter deliveredNotifications]) {
+    NSString* candidateId = [candidate.userInfo
+        objectForKey:notification_constants::kNotificationId];
+
+    NSString* candidateProfileId = [candidate.userInfo
+        objectForKey:notification_constants::kNotificationProfileId];
+
+    if ([candidateId isEqualToString:notificationId] &&
+        [profileId isEqualToString:candidateProfileId]) {
+      [notificationCenter removeDeliveredNotification:candidate];
+      break;
+    }
+  }
+}
+
+- (void)closeAllNotifications {
+  [[NSUserNotificationCenter defaultUserNotificationCenter]
+      removeAllDeliveredNotifications];
+}
+
 @end
diff --git a/chrome/browser/ui/cocoa/notifications/notification_delivery.h b/chrome/browser/ui/cocoa/notifications/notification_delivery.h
index e19593f4..8670956 100644
--- a/chrome/browser/ui/cocoa/notifications/notification_delivery.h
+++ b/chrome/browser/ui/cocoa/notifications/notification_delivery.h
@@ -16,6 +16,12 @@
 // |notificationData| is generated using a NofiticationBuilder object.
 - (void)deliverNotification:(NSDictionary*)notificationData;
 
+// Closes an alert with the given |notificationId| and |profileId|.
+- (void)closeNotificationWithId:(NSString*)notificationId
+                  withProfileId:(NSString*)profileId;
+
+// Closes all the alerts being displayed.
+- (void)closeAllNotifications;
 @end
 
 // Response protocol for the XPC notification service to notify Chrome of
diff --git a/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.mm b/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.mm
index c773dc54..fd582a9 100644
--- a/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.mm
+++ b/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.mm
@@ -46,9 +46,11 @@
   NSNumber* notificationType = [[notification userInfo]
       objectForKey:notification_constants::kNotificationType];
 
-  // Initialize operation and button index for the case where the
-  // notification itself was clicked.
-  NotificationOperation operation = NOTIFICATION_CLICK;
+  // Closed notifications are not activated.
+  NotificationOperation operation =
+      notification.activationType == NSUserNotificationActivationTypeNone
+          ? NOTIFICATION_CLOSE
+          : NOTIFICATION_CLICK;
   int buttonIndex = -1;
 
   // Determine whether the user clicked on a button, and if they did, whether it
diff --git a/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac_unittest.mm b/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac_unittest.mm
index 93896d3c..14be1ae 100644
--- a/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac_unittest.mm
+++ b/chrome/browser/ui/cocoa/notifications/notification_response_builder_mac_unittest.mm
@@ -11,24 +11,34 @@
 #include "chrome/browser/ui/cocoa/notifications/notification_response_builder_mac.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-TEST(NotificationResponseBuilderMacTest, TestNotificationClick) {
-  base::scoped_nsobject<NotificationBuilder> builder(
-      [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
-                                         optionsLabel:@"Options"
-                                        settingsLabel:@"Settings"]);
-  [builder setTitle:@"Title"];
-  [builder setSubTitle:@"https://www.miguel.com"];
-  [builder setContextMessage:@""];
-  [builder setTag:@"tag1"];
-  [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]];
-  [builder setNotificationId:@"notificationId"];
-  [builder setProfileId:@"profileId"];
-  [builder setIncognito:false];
-  [builder
-      setNotificationType:[NSNumber
-                              numberWithInt:NotificationCommon::PERSISTENT]];
+class NotificationResponseBuilderMacTest : public testing::Test {
+ protected:
+  base::scoped_nsobject<NotificationBuilder> NewTestBuilder() {
+    base::scoped_nsobject<NotificationBuilder> builder(
+        [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
+                                           optionsLabel:@"Options"
+                                          settingsLabel:@"Settings"]);
+    [builder setTitle:@"Title"];
+    [builder setSubTitle:@"https://www.miguel.com"];
+    [builder setContextMessage:@""];
+    [builder setTag:@"tag1"];
+    [builder setIcon:[NSImage imageNamed:NSImageNameApplicationIcon]];
+    [builder setNotificationId:@"notificationId"];
+    [builder setProfileId:@"profileId"];
+    [builder setIncognito:false];
+    [builder setNotificationType:@(NotificationCommon::PERSISTENT)];
+    return builder;
+  }
+};
 
+TEST_F(NotificationResponseBuilderMacTest, TestNotificationClick) {
+  base::scoped_nsobject<NotificationBuilder> builder = NewTestBuilder();
   NSUserNotification* notification = [builder buildUserNotification];
+  // This will be set by the notification center to indicate the notification
+  // was clicked.
+  [notification setValue:@(NSUserNotificationActivationTypeContentsClicked)
+                  forKey:@"_activationType"];
+
   NSDictionary* response =
       [NotificationResponseBuilder buildDictionary:notification];
 
@@ -40,32 +50,14 @@
   EXPECT_EQ(-1, buttonIndex.intValue);
 }
 
-TEST(NotificationResponseBuilderMacTest, TestNotificationSettingsClick) {
-  base::scoped_nsobject<NotificationBuilder> builder(
-      [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
-                                         optionsLabel:@"Options"
-                                        settingsLabel:@"Settings"]);
-  [builder setTitle:@"Title"];
-  [builder setSubTitle:@"https://www.miguel.com"];
-  [builder setContextMessage:@""];
-  [builder setTag:@"tag1"];
-  [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]];
-  [builder setNotificationId:@"notificationId"];
-  [builder setProfileId:@"profileId"];
-  [builder setIncognito:false];
-  [builder
-      setNotificationType:[NSNumber
-                              numberWithInt:NotificationCommon::PERSISTENT]];
-
+TEST_F(NotificationResponseBuilderMacTest, TestNotificationSettingsClick) {
+  base::scoped_nsobject<NotificationBuilder> builder = NewTestBuilder();
   NSUserNotification* notification = [builder buildUserNotification];
 
   // This will be set by the notification center to indicate the only available
   // button was clicked.
-  [notification
-      setValue:
-          [NSNumber
-              numberWithInt:NSUserNotificationActivationTypeActionButtonClicked]
-        forKey:@"_activationType"];
+  [notification setValue:@(NSUserNotificationActivationTypeActionButtonClicked)
+                  forKey:@"_activationType"];
   NSDictionary* response =
       [NotificationResponseBuilder buildDictionary:notification];
 
@@ -77,33 +69,16 @@
   EXPECT_EQ(-1, buttonIndex.intValue);
 }
 
-TEST(NotificationResponseBuilderMacTest, TestNotificationOneActionClick) {
-  base::scoped_nsobject<NotificationBuilder> builder(
-      [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
-                                         optionsLabel:@"Options"
-                                        settingsLabel:@"Settings"]);
-  [builder setTitle:@"Title"];
-  [builder setSubTitle:@"https://www.miguel.com"];
-  [builder setContextMessage:@""];
+TEST_F(NotificationResponseBuilderMacTest, TestNotificationOneActionClick) {
+  base::scoped_nsobject<NotificationBuilder> builder = NewTestBuilder();
   [builder setButtons:@"Button1" secondaryButton:@""];
-  [builder setTag:@"tag1"];
-  [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]];
-  [builder setNotificationId:@"notificationId"];
-  [builder setProfileId:@"profileId"];
-  [builder setIncognito:false];
-  [builder
-      setNotificationType:[NSNumber
-                              numberWithInt:NotificationCommon::PERSISTENT]];
 
   NSUserNotification* notification = [builder buildUserNotification];
 
   // These values will be set by the notification center to indicate that button
   // 1 was clicked.
-  [notification
-      setValue:
-          [NSNumber
-              numberWithInt:NSUserNotificationActivationTypeActionButtonClicked]
-        forKey:@"_activationType"];
+  [notification setValue:@(NSUserNotificationActivationTypeActionButtonClicked)
+                  forKey:@"_activationType"];
   [notification setValue:[NSNumber numberWithInt:0]
                   forKey:@"_alternateActionIndex"];
   NSDictionary* response =
@@ -117,33 +92,16 @@
   EXPECT_EQ(0, buttonIndex.intValue);
 }
 
-TEST(NotificationResponseBuilderMacTest, TestNotificationTwoActionClick) {
-  base::scoped_nsobject<NotificationBuilder> builder(
-      [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
-                                         optionsLabel:@"Options"
-                                        settingsLabel:@"Settings"]);
-  [builder setTitle:@"Title"];
-  [builder setSubTitle:@"https://www.miguel.com"];
-  [builder setContextMessage:@""];
+TEST_F(NotificationResponseBuilderMacTest, TestNotificationTwoActionClick) {
+  base::scoped_nsobject<NotificationBuilder> builder = NewTestBuilder();
   [builder setButtons:@"Button1" secondaryButton:@"Button2"];
-  [builder setTag:@"tag1"];
-  [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]];
-  [builder setNotificationId:@"notificationId"];
-  [builder setProfileId:@"profileId"];
-  [builder setIncognito:false];
-  [builder
-      setNotificationType:[NSNumber
-                              numberWithInt:NotificationCommon::PERSISTENT]];
 
   NSUserNotification* notification = [builder buildUserNotification];
 
   // These values will be set by the notification center to indicate that button
   // 2 was clicked.
-  [notification
-      setValue:
-          [NSNumber
-              numberWithInt:NSUserNotificationActivationTypeActionButtonClicked]
-        forKey:@"_activationType"];
+  [notification setValue:@(NSUserNotificationActivationTypeActionButtonClicked)
+                  forKey:@"_activationType"];
   [notification setValue:[NSNumber numberWithInt:1]
                   forKey:@"_alternateActionIndex"];
 
@@ -158,25 +116,10 @@
   EXPECT_EQ(1, buttonIndex.intValue);
 }
 
-TEST(NotificationResponseBuilderMacTest,
-     TestNotificationTwoActionSettingsClick) {
-  base::scoped_nsobject<NotificationBuilder> builder(
-      [[NotificationBuilder alloc] initWithCloseLabel:@"Close"
-                                         optionsLabel:@"Options"
-                                        settingsLabel:@"Settings"]);
-  [builder setTitle:@"Title"];
-  [builder setSubTitle:@"https://www.miguel.com"];
-  [builder setContextMessage:@""];
+TEST_F(NotificationResponseBuilderMacTest,
+       TestNotificationTwoActionSettingsClick) {
+  base::scoped_nsobject<NotificationBuilder> builder = NewTestBuilder();
   [builder setButtons:@"Button1" secondaryButton:@"Button2"];
-  [builder setTag:@"tag1"];
-  [builder setIcon:[NSImage imageNamed:@"NSApplicationIcon"]];
-  [builder setNotificationId:@"notificationId"];
-  [builder setProfileId:@"profileId"];
-  [builder setIncognito:false];
-  [builder
-      setNotificationType:[NSNumber
-                              numberWithInt:NotificationCommon::PERSISTENT]];
-
   NSUserNotification* notification = [builder buildUserNotification];
 
   // These values will be set by the notification center to indicate that button
@@ -199,3 +142,23 @@
   EXPECT_EQ(2 /* NOTIFICATION_SETTINGS */, operation.intValue);
   EXPECT_EQ(-1, buttonIndex.intValue);
 }
+
+TEST_F(NotificationResponseBuilderMacTest, TestNotificationClose) {
+  base::scoped_nsobject<NotificationBuilder> builder = NewTestBuilder();
+  NSUserNotification* notification = [builder buildUserNotification];
+
+  // None is what the NSUserNotification center emits when closing since it
+  // interprets it as not activated.
+  [notification setValue:@(NSUserNotificationActivationTypeNone)
+                  forKey:@"_activationType"];
+
+  NSDictionary* response =
+      [NotificationResponseBuilder buildDictionary:notification];
+
+  NSNumber* operation =
+      [response objectForKey:notification_constants::kNotificationOperation];
+  NSNumber* buttonIndex =
+      [response objectForKey:notification_constants::kNotificationButtonIndex];
+  EXPECT_EQ(1 /* NOTIFICATION_CLOSE */, operation.intValue);
+  EXPECT_EQ(-1, buttonIndex.intValue);
+}
diff --git a/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm b/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm
index 78118dd4..919ad46 100644
--- a/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm
+++ b/chrome/browser/ui/cocoa/notifications/notification_service_delegate.mm
@@ -60,4 +60,12 @@
   [[connection_ remoteObjectProxy] notificationClick:response];
 }
 
+// _NSUserNotificationCenterDelegatePrivate
+- (void)userNotificationCenter:(NSUserNotificationCenter*)center
+               didDismissAlert:(NSUserNotification*)notification {
+  NSDictionary* response =
+      [NotificationResponseBuilder buildDictionary:notification];
+  [[connection_ remoteObjectProxy] notificationClick:response];
+}
+
 @end
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
index 17b61ae..fd134bd 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
@@ -43,7 +43,7 @@
 // Returns true if |browser| has a visible location bar.
 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser;
 
-// Makes the bubble visible. The bubble will be popuplated with text retrieved
+// Makes the bubble visible. The bubble will be populated with text retrieved
 // from |requests|. |delegate| will receive callbacks for user actions.
 - (void)showWithDelegate:(PermissionPrompt::Delegate*)delegate
              forRequests:(const std::vector<PermissionRequest*>&)requests
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
index ddae36c..6cb51087 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm
@@ -512,9 +512,9 @@
       [[NSView alloc] initWithFrame:NSZeroRect]);
   base::scoped_nsobject<NSImageView> permissionIcon(
       [[NSImageView alloc] initWithFrame:NSZeroRect]);
-  [permissionIcon setImage:NSImageFromImageSkia(
-      gfx::CreateVectorIcon(request->GetVectorIconId(), 18,
-                            gfx::kChromeIconGrey))];
+  [permissionIcon
+      setImage:NSImageFromImageSkia(gfx::CreateVectorIcon(
+                   request->GetIconId(), 18, gfx::kChromeIconGrey))];
   [permissionIcon setFrameSize:kPermissionIconSize];
   [permissionView addSubview:permissionIcon];
 
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm
index 7ac95ca..9a9ecc2 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller_unittest.mm
@@ -9,7 +9,7 @@
 #include "base/mac/foundation_util.h"
 #import "base/mac/scoped_objc_class_swizzler.h"
 #include "base/mac/sdk_forward_declarations.h"
-#include "base/stl_util.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/permissions/mock_permission_request.h"
@@ -89,16 +89,17 @@
   void TearDown() override {
     [controller_ close];
     chrome::testing::NSRunLoopRunAllPending();
-    base::STLDeleteElements(&requests_);
+    owned_requests_.clear();
     CocoaProfileTest::TearDown();
   }
 
   void AddRequest(const std::string& title) {
-    MockPermissionRequest* request = new MockPermissionRequest(
-        title,
-        l10n_util::GetStringUTF8(IDS_PERMISSION_ALLOW),
-        l10n_util::GetStringUTF8(IDS_PERMISSION_DENY));
-    requests_.push_back(request);
+    std::unique_ptr<MockPermissionRequest> request =
+        base::MakeUnique<MockPermissionRequest>(
+            title, l10n_util::GetStringUTF8(IDS_PERMISSION_ALLOW),
+            l10n_util::GetStringUTF8(IDS_PERMISSION_DENY));
+    requests_.push_back(request.get());
+    owned_requests_.push_back(std::move(request));
   }
 
   NSButton* FindButtonWithTitle(const std::string& title) {
@@ -160,6 +161,7 @@
   PermissionBubbleController* controller_;  // Weak;  it deletes itself.
   std::unique_ptr<PermissionBubbleCocoa> bridge_;
   std::vector<PermissionRequest*> requests_;
+  std::vector<std::unique_ptr<PermissionRequest>> owned_requests_;
   std::vector<bool> accept_states_;
 };
 
diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h
index e354afe7..04ecb58 100644
--- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h
@@ -142,9 +142,8 @@
 
   // WebsiteSettingsUI implementations.
   void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
-  void SetPermissionInfo(
-      const PermissionInfoList& permission_info_list,
-      const ChosenObjectInfoList& chosen_object_info_list) override;
+  void SetPermissionInfo(const PermissionInfoList& permission_info_list,
+                         ChosenObjectInfoList chosen_object_info_list) override;
   void SetIdentityInfo(const IdentityInfo& identity_info) override;
   void SetSelectedTab(TabId tab_id) override;
 
diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
index 3636bc6..8c2e8a6 100644
--- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
@@ -1076,7 +1076,7 @@
 }
 
 - (void)setPermissionInfo:(const PermissionInfoList&)permissionInfoList
-         andChosenObjects:(const ChosenObjectInfoList&)chosenObjectInfoList {
+         andChosenObjects:(ChosenObjectInfoList)chosenObjectInfoList {
   [permissionsView_ setSubviews:[NSArray array]];
   NSPoint controlOrigin = NSMakePoint(kSectionHorizontalPadding, 0);
 
@@ -1094,9 +1094,9 @@
       controlOrigin.y = rowBottomRight.y;
     }
 
-    for (auto* object : chosenObjectInfoList) {
+    for (auto& object : chosenObjectInfoList) {
       controlOrigin.y += kPermissionsVerticalSpacing;
-      NSPoint rowBottomRight = [self addChosenObject:base::WrapUnique(object)
+      NSPoint rowBottomRight = [self addChosenObject:std::move(object)
                                               toView:permissionsView_
                                              atPoint:controlOrigin];
       controlOrigin.y = rowBottomRight.y;
@@ -1198,9 +1198,9 @@
 
 void WebsiteSettingsUIBridge::SetPermissionInfo(
     const PermissionInfoList& permission_info_list,
-    const ChosenObjectInfoList& chosen_object_info_list) {
+    ChosenObjectInfoList chosen_object_info_list) {
   [bubble_controller_ setPermissionInfo:permission_info_list
-                       andChosenObjects:chosen_object_info_list];
+                       andChosenObjects:std::move(chosen_object_info_list)];
 }
 
 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) {
diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller_unittest.mm
index 641109bd..0d18821 100644
--- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller_unittest.mm
@@ -203,7 +203,8 @@
       permission_info_list.push_back(info);
     }
     ChosenObjectInfoList chosen_object_info_list;
-    bridge_->SetPermissionInfo(permission_info_list, chosen_object_info_list);
+    bridge_->SetPermissionInfo(permission_info_list,
+                               std::move(chosen_object_info_list));
   }
 
   content::TestBrowserThreadBundle thread_bundle_;
diff --git a/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc b/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc
index 2ea2da4..5f7acef 100644
--- a/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc
+++ b/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc
@@ -339,6 +339,13 @@
   g_signal_connect(dialog_, "delete-event",
                    G_CALLBACK(gtk_widget_hide_on_delete), NULL);
 
+  // Handle the case when the existing |gtk_settings_| has "selection" selected
+  // as the page range, but |has_selection| is false.
+  if (!has_selection) {
+    GtkPrintPages range = gtk_print_settings_get_print_pages(gtk_settings_);
+    if (range == GTK_PRINT_PAGES_SELECTION)
+      gtk_print_settings_set_print_pages(gtk_settings_, GTK_PRINT_PAGES_ALL);
+  }
 
   // Set modal so user cannot focus the same tab and press print again.
   gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 22768756..d46bb4f 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -61,6 +61,7 @@
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/chrome_result_codes.h"
 #include "chrome/common/chrome_switches.h"
+#include "chrome/common/features.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/installer/util/browser_distribution.h"
@@ -109,7 +110,7 @@
 #include "chrome/browser/printing/print_dialog_cloud.h"
 #endif
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 #include "chrome/browser/ui/app_list/app_list_service.h"
 #endif
 
@@ -871,7 +872,7 @@
         command_line.GetSwitchValuePath(switches::kProfileDirectory));
   }
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   // If we are showing the app list then chrome isn't shown so load the app
   // list's profile rather than chrome's.
   if (command_line.HasSwitch(switches::kShowAppList))
diff --git a/chrome/browser/ui/user_manager.h b/chrome/browser/ui/user_manager.h
index e7290df..1173d04 100644
--- a/chrome/browser/ui/user_manager.h
+++ b/chrome/browser/ui/user_manager.h
@@ -73,8 +73,8 @@
   // Hides the reauth dialog if it is showing.
   static void HideReauthDialog();
 
-  // Shows a dialog where the user login his or her profile by the first time
-  // via user manager.
+  // Shows a dialog where the user logs into their profile for the first time
+  // via the user manager.
   static void ShowSigninDialog(content::BrowserContext* browser_context,
                                const base::FilePath& profile_path);
 
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.cc
index 4f6f9f8..e2e1192 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.cc
@@ -8,6 +8,7 @@
 
 #include "base/macros.h"
 #include "build/build_config.h"
+#include "chrome/common/features.h"
 #include "ui/base/accelerators/accelerator.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_types.h"
@@ -27,7 +28,7 @@
 #include "ui/views/window/native_frame_view.h"
 #include "ui/views/window/non_client_view.h"
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 #include "third_party/skia/include/core/SkPaint.h"
 #include "ui/app_list/app_list_constants.h"  // nogncheck
 #include "ui/views/background.h"
@@ -44,7 +45,7 @@
     views::BubbleBorder::SMALL_SHADOW;
 #endif
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 // The background for App List dialogs, which appears as a rounded rectangle
 // with the same border radius and color as the app list contents.
 class AppListOverlayBackground : public views::Background {
@@ -123,7 +124,7 @@
   DISALLOW_COPY_AND_ASSIGN(BaseDialogContainer);
 };
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 
 // The contents view for an App List Dialog, which covers the entire app list
 // and adds a close button.
@@ -241,7 +242,7 @@
 
 }  // namespace
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 views::DialogDelegateView* CreateAppListContainerForView(
     views::View* view,
     const base::Closure& close_callback) {
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.h b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.h
index 15feb8f..2ab1a91 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.h
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.h
@@ -6,6 +6,7 @@
 #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_DIALOG_CONTAINER_H_
 
 #include "base/callback_forward.h"
+#include "chrome/common/features.h"
 #include "ui/gfx/geometry/size.h"
 
 namespace views {
@@ -13,7 +14,7 @@
 class View;
 }
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 
 // Creates a new dialog containing |view| that can be displayed inside the app
 // list, covering the entire app list and adding a close button. Takes ownership
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc
index 0a86b3e..c31f0fa 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc
@@ -18,6 +18,7 @@
 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/extensions/extension_constants.h"
+#include "chrome/common/features.h"
 #include "components/constrained_window/constrained_window_views.h"
 #include "content/public/browser/web_contents.h"
 #include "extensions/browser/extension_registry.h"
@@ -70,7 +71,7 @@
   return gfx::Size(380, 490);
 }
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 void ShowAppInfoInAppList(gfx::NativeWindow parent,
                           const gfx::Rect& app_list_bounds,
                           Profile* profile,
diff --git a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
index 02f37da..9254a33 100644
--- a/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
+++ b/chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
@@ -12,8 +12,8 @@
 #include "base/run_loop.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/common/service_manager_connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/runner/common/client_util.h"
 #include "services/ui/public/cpp/gpu_service.h"
 #include "services/ui/public/cpp/input_devices/input_device_client.h"
 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom.h"
@@ -55,7 +55,7 @@
     content::ServiceManagerConnection* connection) {
   DCHECK(connection);
 #if defined(USE_AURA)
-  if (shell::ShellIsRemote()) {
+  if (service_manager::ServiceManagerIsRemote()) {
     // TODO(rockot): Remove the blocking wait for init.
     // http://crbug.com/594852.
     base::RunLoop wait_loop;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc
index e83af33..0a2535e4 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc
@@ -7,7 +7,7 @@
 
 #if defined(USE_AURA)
 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 #endif
 
 #if !defined(OS_CHROMEOS)
@@ -28,7 +28,7 @@
     BrowserFrame* frame,
     BrowserView* browser_view) {
 #if defined(USE_AURA)
-  if (shell::ShellIsRemote()) {
+  if (service_manager::ServiceManagerIsRemote()) {
     BrowserNonClientFrameViewMus* frame_view =
         new BrowserNonClientFrameViewMus(frame, browser_view);
     frame_view->Init();
diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc
index 7515c03..44dd8b52 100644
--- a/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc
+++ b/chrome/browser/ui/views/frame/native_browser_frame_factory_auralinux.cc
@@ -6,12 +6,12 @@
 
 #include "chrome/browser/ui/views/frame/browser_frame_mus.h"
 #include "chrome/browser/ui/views/frame/desktop_browser_frame_auralinux.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 
 NativeBrowserFrame* NativeBrowserFrameFactory::Create(
     BrowserFrame* browser_frame,
     BrowserView* browser_view) {
-  if (shell::ShellIsRemote())
+  if (service_manager::ServiceManagerIsRemote())
     return new BrowserFrameMus(browser_frame, browser_view);
   return new DesktopBrowserFrameAuraLinux(browser_frame, browser_view);
 }
diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc
index c29e013..424fca7 100644
--- a/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc
+++ b/chrome/browser/ui/views/frame/native_browser_frame_factory_aurawin.cc
@@ -6,12 +6,12 @@
 
 #include "chrome/browser/ui/views/frame/browser_frame_mus.h"
 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 
 NativeBrowserFrame* NativeBrowserFrameFactory::Create(
     BrowserFrame* browser_frame,
     BrowserView* browser_view) {
-  if (shell::ShellIsRemote())
+  if (service_manager::ServiceManagerIsRemote())
     return new BrowserFrameMus(browser_frame, browser_view);
   return new DesktopBrowserFrameAura(browser_frame, browser_view);
 }
diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_chromeos.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_chromeos.cc
index f9b95c7..c3f8a72 100644
--- a/chrome/browser/ui/views/frame/native_browser_frame_factory_chromeos.cc
+++ b/chrome/browser/ui/views/frame/native_browser_frame_factory_chromeos.cc
@@ -6,12 +6,12 @@
 
 #include "chrome/browser/ui/views/frame/browser_frame_ash.h"
 #include "chrome/browser/ui/views/frame/browser_frame_mus.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 
 NativeBrowserFrame* NativeBrowserFrameFactory::Create(
     BrowserFrame* browser_frame,
     BrowserView* browser_view) {
-  if (shell::ShellIsRemote())
+  if (service_manager::ServiceManagerIsRemote())
     return new BrowserFrameMus(browser_frame, browser_view);
   return new BrowserFrameAsh(browser_frame, browser_view);
 }
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index db542697..1e6e2d4 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -51,7 +51,7 @@
 #if defined(USE_AURA)
 #include "chrome/browser/ui/views/tabs/window_finder_mus.h"  // nogncheck
 #include "content/public/common/service_manager_connection.h"  // nogncheck
-#include "services/shell/runner/common/client_util.h"  // nogncheck
+#include "services/service_manager/runner/common/client_util.h"  // nogncheck
 #include "ui/aura/env.h"  // nogncheck
 #include "ui/aura/window.h"  // nogncheck
 #include "ui/wm/core/window_modality_controller.h"  // nogncheck
@@ -231,7 +231,7 @@
 #if defined(USE_AURA)
   content::ServiceManagerConnection* service_manager_connection =
       content::ServiceManagerConnection::GetForProcess();
-  if (service_manager_connection && shell::ShellIsRemote())
+  if (service_manager_connection && service_manager::ServiceManagerIsRemote())
     window_finder_.reset(new WindowFinderMus);
   else
 #endif
diff --git a/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc b/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc
index 79d19ab..94ea1b8 100644
--- a/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc
+++ b/chrome/browser/ui/views/website_settings/permission_prompt_impl.cc
@@ -205,7 +205,6 @@
       requests[0]->GetOrigin(),
       url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC);
 
-  ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
   bool show_persistence_toggle = true;
   for (size_t index = 0; index < requests.size(); index++) {
     DCHECK(index < accept_state.size());
@@ -227,13 +226,10 @@
         views::BoxLayout::kHorizontal, views::kCheckboxIndent, 0,
         views::kItemLabelSpacing));
     views::ImageView* icon = new views::ImageView();
-    gfx::VectorIconId vector_id = requests[index]->GetVectorIconId();
+    gfx::VectorIconId vector_id = requests[index]->GetIconId();
     if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) {
       icon->SetImage(
           gfx::CreateVectorIcon(vector_id, kIconSize, gfx::kChromeIconGrey));
-    } else {
-      icon->SetImage(bundle.GetImageSkiaNamed(requests.at(index)->GetIconId()));
-      icon->SetImageSize(gfx::Size(kIconSize, kIconSize));
     }
     icon->SetTooltipText(base::string16());  // Redundant with the text fragment
     label_container->AddChildView(icon);
diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
index 06872d4..f182aab 100644
--- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
+++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc
@@ -108,10 +108,12 @@
 // Spacing between rows in the site settings section
 const int kPermissionsVerticalSpacing = 12;
 
-// Button IDs ------------------------------------------------------------------
-
-const int BUTTON_RESET_CERTIFICATE_DECISIONS = 1337;
-const int BUTTON_SITE_SETTINGS = 1338;
+// Button/styled label/link IDs ------------------------------------------------
+const int BUTTON_CLOSE = 1337;
+const int STYLED_LABEL_SECURITY_DETAILS = 1338;
+const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339;
+const int LINK_COOKIE_DIALOG = 1340;
+const int LINK_SITE_SETTINGS = 1341;
 
 }  // namespace
 
@@ -226,6 +228,7 @@
   layout->AddView(summary_label_, 1, 1, views::GridLayout::LEADING,
                   views::GridLayout::TRAILING);
   views::ImageButton* close_button = new views::ImageButton(button_listener);
+  close_button->set_id(BUTTON_CLOSE);
   close_button->SetImage(views::CustomButton::STATE_NORMAL,
                          rb.GetImageNamed(IDR_CLOSE_2).ToImageSkia());
   close_button->SetImage(views::CustomButton::STATE_HOVERED,
@@ -250,6 +253,7 @@
   layout->StartRow(0, label_column_status);
   details_label_ =
       new views::StyledLabel(base::string16(), styled_label_listener);
+  details_label_->set_id(STYLED_LABEL_SECURITY_DETAILS);
   layout->AddView(details_label_, 1, 1, views::GridLayout::FILL,
                   views::GridLayout::LEADING);
 
@@ -310,6 +314,7 @@
   base::string16 text = base::ReplaceStringPlaceholders(
       base::ASCIIToUTF16("$1 $2"), subst, &offsets);
   reset_decisions_label_ = new views::StyledLabel(text, styled_label_listener_);
+  reset_decisions_label_->set_id(STYLED_LABEL_RESET_CERTIFICATE_DECISIONS);
   gfx::Range link_range(offsets[1], text.length());
 
   views::StyledLabel::RangeStyleInfo link_style =
@@ -319,11 +324,15 @@
   link_style.disable_line_wrapping = false;
 
   reset_decisions_label_->AddStyleRange(link_range, link_style);
+  // Fit the styled label to occupy available width.
+  reset_decisions_label_->SizeToFit(0);
   reset_decisions_label_container_->AddChildView(reset_decisions_label_);
 
   // Now that it contains a label, the container needs padding at the top.
   reset_decisions_label_container_->SetBorder(
       views::Border::CreateEmptyBorder(8, 0, 0, 0));
+
+  InvalidateLayout();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -532,26 +541,8 @@
 
 void WebsiteSettingsPopupView::ButtonPressed(views::Button* button,
                                              const ui::Event& event) {
-  switch (button->id()) {
-    case BUTTON_RESET_CERTIFICATE_DECISIONS:
-      presenter_->OnRevokeSSLErrorBypassButtonPressed();
-      GetWidget()->Close();
-      break;
-    case BUTTON_SITE_SETTINGS:
-      // TODO(palmer): This opens the general Content Settings pane, which is OK
-      // for now. But on Android, it opens a page specific to a given origin
-      // that shows all of the settings for that origin. If/when that's
-      // available on desktop we should link to that here, too.
-      web_contents()->OpenURL(content::OpenURLParams(
-          GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(),
-          WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
-          false));
-      presenter_->RecordWebsiteSettingsAction(
-          WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED);
-      break;
-    default:
-      NOTREACHED();
-  }
+  DCHECK_EQ(BUTTON_CLOSE, button->id());
+  GetWidget()->Close();
 }
 
 void WebsiteSettingsPopupView::LinkClicked(views::Link* source,
@@ -598,6 +589,7 @@
 
   if (!cookie_dialog_link_) {
     cookie_dialog_link_ = new views::Link(label_text);
+    cookie_dialog_link_->set_id(LINK_COOKIE_DIALOG);
     cookie_dialog_link_->set_listener(this);
   } else {
     cookie_dialog_link_->SetText(label_text);
@@ -656,17 +648,14 @@
 
 void WebsiteSettingsPopupView::SetPermissionInfo(
     const PermissionInfoList& permission_info_list,
-    const ChosenObjectInfoList& chosen_object_info_list) {
+    ChosenObjectInfoList chosen_object_info_list) {
   // When a permission is changed, WebsiteSettings::OnSitePermissionChanged()
   // calls this method with updated permissions. However, PermissionSelectorRow
   // will have already updated its state, so it's already reflected in the UI.
   // In addition, if a permission is set to the default setting, WebsiteSettings
   // removes it from |permission_info_list|, but the button should remain.
-  if (permissions_view_) {
-    base::STLDeleteContainerPointers(chosen_object_info_list.begin(),
-                                     chosen_object_info_list.end());
+  if (permissions_view_)
     return;
-  }
 
   permissions_view_ = new views::View();
   views::GridLayout* layout = new views::GridLayout(permissions_view_);
@@ -694,10 +683,10 @@
     layout->AddPaddingRow(1, kPermissionsVerticalSpacing);
   }
 
-  for (auto* object : chosen_object_info_list) {
+  for (auto& object : chosen_object_info_list) {
     layout->StartRow(1, content_column);
     // The view takes ownership of the object info.
-    auto* object_view = new ChosenObjectRow(base::WrapUnique(object));
+    auto* object_view = new ChosenObjectRow(std::move(object));
     object_view->AddObserver(this);
     layout->AddView(object_view, 1, 1, views::GridLayout::LEADING,
                     views::GridLayout::CENTER);
@@ -709,6 +698,7 @@
   // Add site settings link.
   views::Link* site_settings_link = new views::Link(
       l10n_util::GetStringUTF16(IDS_PAGE_INFO_SITE_SETTINGS_LINK));
+  site_settings_link->set_id(LINK_SITE_SETTINGS);
   site_settings_link->set_listener(this);
   views::View* link_section = new views::View();
   const int kLinkMarginTop = 4;
@@ -764,30 +754,58 @@
 }
 
 void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) {
+  // Both switch cases require accessing web_contents(), so we check it here.
   if (web_contents() == nullptr || web_contents()->IsBeingDestroyed())
     return;
-  DCHECK_EQ(source, cookie_dialog_link_);
-  // Count how often the Collected Cookies dialog is opened.
-  presenter_->RecordWebsiteSettingsAction(
-      WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED);
-  new CollectedCookiesViews(web_contents());
+  switch (source->id()) {
+    case LINK_SITE_SETTINGS:
+      // TODO(crbug.com/655876): This opens the general Content Settings pane,
+      // which is OK for now. But on Android, it opens a page specific to a
+      // given origin that shows all of the settings for that origin. If/when
+      // that's available on desktop we should link to that here, too.
+      web_contents()->OpenURL(content::OpenURLParams(
+          GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(),
+          WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
+          false));
+      presenter_->RecordWebsiteSettingsAction(
+          WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED);
+      break;
+    case LINK_COOKIE_DIALOG:
+      // Count how often the Collected Cookies dialog is opened.
+      presenter_->RecordWebsiteSettingsAction(
+          WebsiteSettings::WEBSITE_SETTINGS_COOKIES_DIALOG_OPENED);
+      new CollectedCookiesViews(web_contents());
+      break;
+    default:
+      NOTREACHED();
+  }
 }
 
 void WebsiteSettingsPopupView::StyledLabelLinkClicked(views::StyledLabel* label,
                                                       const gfx::Range& range,
                                                       int event_flags) {
-  presenter_->RecordWebsiteSettingsAction(
-      WebsiteSettings::WEBSITE_SETTINGS_SECURITY_DETAILS_OPENED);
+  switch (label->id()) {
+    case STYLED_LABEL_SECURITY_DETAILS:
+      presenter_->RecordWebsiteSettingsAction(
+          WebsiteSettings::WEBSITE_SETTINGS_SECURITY_DETAILS_OPENED);
 
-  if (is_devtools_disabled_) {
-    DCHECK(certificate_);
-    gfx::NativeWindow parent =
-        anchor_widget() ? anchor_widget()->GetNativeWindow() : nullptr;
-    presenter_->RecordWebsiteSettingsAction(
-        WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED);
-    ShowCertificateViewer(web_contents(), parent, certificate_.get());
-  } else {
-    DevToolsWindow::OpenDevToolsWindow(
-        web_contents(), DevToolsToggleAction::ShowSecurityPanel());
+      if (is_devtools_disabled_) {
+        DCHECK(certificate_);
+        gfx::NativeWindow parent =
+            anchor_widget() ? anchor_widget()->GetNativeWindow() : nullptr;
+        presenter_->RecordWebsiteSettingsAction(
+            WebsiteSettings::WEBSITE_SETTINGS_CERTIFICATE_DIALOG_OPENED);
+        ShowCertificateViewer(web_contents(), parent, certificate_.get());
+      } else {
+        DevToolsWindow::OpenDevToolsWindow(
+            web_contents(), DevToolsToggleAction::ShowSecurityPanel());
+      }
+      break;
+    case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
+      presenter_->OnRevokeSSLErrorBypassButtonPressed();
+      GetWidget()->Close();
+      break;
+    default:
+      NOTREACHED();
   }
 }
diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.h b/chrome/browser/ui/views/website_settings/website_settings_popup_view.h
index c4006be..06d940d 100644
--- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.h
+++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.h
@@ -128,9 +128,8 @@
 
   // WebsiteSettingsUI implementations.
   void SetCookieInfo(const CookieInfoList& cookie_info_list) override;
-  void SetPermissionInfo(
-      const PermissionInfoList& permission_info_list,
-      const ChosenObjectInfoList& chosen_object_info_list) override;
+  void SetPermissionInfo(const PermissionInfoList& permission_info_list,
+                         ChosenObjectInfoList chosen_object_info_list) override;
   void SetIdentityInfo(const IdentityInfo& identity_info) override;
   // TODO(lgarron): Remove SetSelectedTab() with https://crbug.com/571533
   void SetSelectedTab(TabId tab_id) override;
diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc
index ac64aec..92e884d2 100644
--- a/chrome/browser/ui/website_settings/website_settings.cc
+++ b/chrome/browser/ui/website_settings/website_settings.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/ui/website_settings/website_settings.h"
 
+#include <openssl/ssl.h>
 #include <stddef.h>
 #include <stdint.h>
 
@@ -13,6 +14,7 @@
 #include "base/command_line.h"
 #include "base/i18n/time_formatting.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_number_conversions.h"
@@ -647,12 +649,21 @@
         (security_info.connection_status &
          net::SSL_CONNECTION_NO_RENEGOTIATION_EXTENSION) != 0;
     const char *key_exchange, *cipher, *mac;
-    bool is_aead;
-    net::SSLCipherSuiteToStrings(
-        &key_exchange, &cipher, &mac, &is_aead, cipher_suite);
+    bool is_aead, is_tls13;
+    net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead,
+                                 &is_tls13, cipher_suite);
 
     site_connection_details_ += ASCIIToUTF16("\n\n");
     if (is_aead) {
+      if (is_tls13) {
+        // For TLS 1.3 ciphers, report the group (historically, curve) as the
+        // key exchange.
+        key_exchange = SSL_get_curve_name(security_info.key_exchange_group);
+        if (!key_exchange) {
+          NOTREACHED();
+          key_exchange = "";
+        }
+      }
       site_connection_details_ += l10n_util::GetStringFUTF16(
           IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTION_DETAILS_AEAD,
           ASCIIToUTF16(cipher), ASCIIToUTF16(key_exchange));
@@ -763,11 +774,13 @@
     auto chosen_objects = context->GetGrantedObjects(origin, origin);
     for (std::unique_ptr<base::DictionaryValue>& object : chosen_objects) {
       chosen_object_info_list.push_back(
-          new WebsiteSettingsUI::ChosenObjectInfo(ui_info, std::move(object)));
+          base::MakeUnique<WebsiteSettingsUI::ChosenObjectInfo>(
+              ui_info, std::move(object)));
     }
   }
 
-  ui_->SetPermissionInfo(permission_info_list, chosen_object_info_list);
+  ui_->SetPermissionInfo(permission_info_list,
+                         std::move(chosen_object_info_list));
 }
 
 void WebsiteSettings::PresentSiteData() {
diff --git a/chrome/browser/ui/website_settings/website_settings_ui.h b/chrome/browser/ui/website_settings/website_settings_ui.h
index ef1ecbca..79ae180 100644
--- a/chrome/browser/ui/website_settings/website_settings_ui.h
+++ b/chrome/browser/ui/website_settings/website_settings_ui.h
@@ -138,7 +138,7 @@
 
   using CookieInfoList = std::vector<CookieInfo>;
   using PermissionInfoList = std::vector<PermissionInfo>;
-  using ChosenObjectInfoList = std::vector<ChosenObjectInfo*>;
+  using ChosenObjectInfoList = std::vector<std::unique_ptr<ChosenObjectInfo>>;
 
   virtual ~WebsiteSettingsUI();
 
@@ -194,11 +194,10 @@
   // Sets cookie information.
   virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) = 0;
 
-  // Sets permission information. The callee is expected to take ownership of
-  // the objects in |chosen_object_info_list|.
+  // Sets permission information.
   virtual void SetPermissionInfo(
       const PermissionInfoList& permission_info_list,
-      const ChosenObjectInfoList& chosen_object_info_list) = 0;
+      ChosenObjectInfoList chosen_object_info_list) = 0;
 
   // Sets site identity information.
   virtual void SetIdentityInfo(const IdentityInfo& identity_info) = 0;
diff --git a/chrome/browser/ui/website_settings/website_settings_unittest.cc b/chrome/browser/ui/website_settings/website_settings_unittest.cc
index 89db415..d66dfff0 100644
--- a/chrome/browser/ui/website_settings/website_settings_unittest.cc
+++ b/chrome/browser/ui/website_settings/website_settings_unittest.cc
@@ -8,6 +8,7 @@
 #include <vector>
 
 #include "base/at_exit.h"
+#include "base/bind.h"
 #include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/string16.h"
@@ -70,11 +71,23 @@
  public:
   virtual ~MockWebsiteSettingsUI() {}
   MOCK_METHOD1(SetCookieInfo, void(const CookieInfoList& cookie_info_list));
-  MOCK_METHOD2(SetPermissionInfo,
-               void(const PermissionInfoList& permission_info_list,
-                    const ChosenObjectInfoList& chosen_object_info_list));
+  MOCK_METHOD0(SetPermissionInfoStub, void());
   MOCK_METHOD1(SetIdentityInfo, void(const IdentityInfo& identity_info));
   MOCK_METHOD1(SetSelectedTab, void(TabId tab_id));
+
+  void SetPermissionInfo(
+      const PermissionInfoList& permission_info_list,
+      ChosenObjectInfoList chosen_object_info_list) override {
+    SetPermissionInfoStub();
+    if (set_permission_info_callback_) {
+      set_permission_info_callback_.Run(permission_info_list,
+                                        std::move(chosen_object_info_list));
+    }
+  }
+
+  base::Callback<void(const PermissionInfoList& permission_info_list,
+                      ChosenObjectInfoList chosen_object_info_list)>
+      set_permission_info_callback_;
 };
 
 class WebsiteSettingsTest : public ChromeRenderViewHostTestHarness {
@@ -99,8 +112,10 @@
 
     // Setup mock ui.
     mock_ui_.reset(new MockWebsiteSettingsUI());
-    ON_CALL(*mock_ui_, SetPermissionInfo(_, _))
-        .WillByDefault(Invoke(this, &WebsiteSettingsTest::SetPermissionInfo));
+    // Use this rather than gmock's ON_CALL.WillByDefault(Invoke(... because
+    // gmock doesn't handle move-only types well.
+    mock_ui_->set_permission_info_callback_ = base::Bind(
+        &WebsiteSettingsTest::SetPermissionInfo, base::Unretained(this));
   }
 
   void TearDown() override {
@@ -112,7 +127,7 @@
 
   void SetDefaultUIExpectations(MockWebsiteSettingsUI* mock_ui) {
     // During creation |WebsiteSettings| makes the following calls to the ui.
-    EXPECT_CALL(*mock_ui, SetPermissionInfo(_, _));
+    EXPECT_CALL(*mock_ui, SetPermissionInfoStub());
     EXPECT_CALL(*mock_ui, SetIdentityInfo(_));
     EXPECT_CALL(*mock_ui, SetCookieInfo(_));
   }
@@ -120,11 +135,10 @@
   void SetURL(const std::string& url) { url_ = GURL(url); }
 
   void SetPermissionInfo(const PermissionInfoList& permission_info_list,
-                         const ChosenObjectInfoList& chosen_object_info_list) {
+                         ChosenObjectInfoList chosen_object_info_list) {
     last_chosen_object_info_.clear();
-    for (WebsiteSettingsUI::ChosenObjectInfo* chosen_object_info :
-         chosen_object_info_list)
-      last_chosen_object_info_.push_back(base::WrapUnique(chosen_object_info));
+    for (auto& chosen_object_info : chosen_object_info_list)
+      last_chosen_object_info_.push_back(std::move(chosen_object_info));
   }
 
   void ResetMockUI() { mock_ui_.reset(new MockWebsiteSettingsUI()); }
@@ -207,9 +221,9 @@
   // OnSitePermissionChanged() is called.
 #if !defined(ENABLE_PLUGINS)
   // SetPermissionInfo for plugins didn't get called.
-  EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(6);
+  EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(6);
 #else
-  EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(7);
+  EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(7);
 #endif
   EXPECT_CALL(*mock_ui(), SetSelectedTab(
       WebsiteSettingsUI::TAB_ID_PERMISSIONS));
@@ -268,7 +282,7 @@
 
   // SetPermissionInfo() is called once initially, and then again every time
   // OnSitePermissionChanged() is called.
-  EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(3);
+  EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(3);
 
   // Execute code under tests.
   website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_FULLSCREEN,
@@ -296,7 +310,7 @@
 }
 
 TEST_F(WebsiteSettingsTest, OnSiteDataAccessed) {
-  EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _));
+  EXPECT_CALL(*mock_ui(), SetPermissionInfoStub());
   EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
   EXPECT_CALL(*mock_ui(), SetCookieInfo(_)).Times(2);
   EXPECT_CALL(*mock_ui(), SetSelectedTab(
@@ -320,7 +334,7 @@
   // Access WebsiteSettings so that SetPermissionInfo is called once to populate
   // |last_chosen_object_info_|. It will be called again by
   // OnSiteChosenObjectDeleted.
-  EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(2);
+  EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(2);
   website_settings();
 
   ASSERT_EQ(1u, last_chosen_object_info().size());
@@ -842,7 +856,7 @@
   EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
   EXPECT_CALL(*mock_ui(), SetCookieInfo(_));
 
-  EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(2);
+  EXPECT_CALL(*mock_ui(), SetPermissionInfoStub()).Times(2);
 
   EXPECT_CALL(*mock_ui(), SetSelectedTab(
       WebsiteSettingsUI::TAB_ID_PERMISSIONS));
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 6b8cfb5..ac57a412 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -181,7 +181,7 @@
 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h"
 #endif
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 #include "chrome/browser/ui/webui/app_list/start_page_ui.h"
 #endif
 
@@ -591,7 +591,7 @@
     return &NewWebUI<PolicyMaterialDesignUI>;
   }
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   if (url.host() == chrome::kChromeUIAppListStartPageHost)
     return &NewWebUI<app_list::StartPageUI>;
 #endif
diff --git a/chrome/browser/ui/webui/mojo_web_ui_controller.h b/chrome/browser/ui/webui/mojo_web_ui_controller.h
index d28cf54..e9a88f3 100644
--- a/chrome/browser/ui/webui/mojo_web_ui_controller.h
+++ b/chrome/browser/ui/webui/mojo_web_ui_controller.h
@@ -15,7 +15,7 @@
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/web_ui_controller.h"
 #include "mojo/public/cpp/system/core.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 class MojoWebUIHandler;
 
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index 40ef8de..a8c2df6 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -44,6 +44,7 @@
 #include "chrome/common/extensions/extension_constants.h"
 #include "chrome/common/extensions/extension_metrics.h"
 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
+#include "chrome/common/features.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/common/web_application_info.h"
@@ -232,7 +233,7 @@
       content::Source<WebContents>(web_ui()->GetWebContents()));
 
   // Some tests don't have a local state.
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   if (g_browser_process->local_state()) {
     local_state_pref_change_registrar_.Init(g_browser_process->local_state());
     local_state_pref_change_registrar_.Add(
@@ -737,7 +738,7 @@
 
 void AppLauncherHandler::HandleStopShowingAppLauncherPromo(
     const base::ListValue* args) {
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   g_browser_process->local_state()->SetBoolean(
       prefs::kShowAppLauncherPromo, false);
   RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_DISMISSED);
@@ -797,7 +798,7 @@
 }
 
 void AppLauncherHandler::OnLocalStatePreferenceChanged() {
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   web_ui()->CallJavascriptFunctionUnsafe(
       "ntp.appLauncherPromoPrefChangeCallback",
       base::FundamentalValue(g_browser_process->local_state()->GetBoolean(
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index 8fc2d444..21df0d4 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -33,6 +33,7 @@
 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
 #include "chrome/common/chrome_switches.h"
+#include "chrome/common/features.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/grit/browser_resources.h"
@@ -183,7 +184,7 @@
   profile_pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback);
 
   // Some tests don't have a local state.
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
   if (g_browser_process->local_state()) {
     local_state_pref_change_registrar_.Init(g_browser_process->local_state());
     local_state_pref_change_registrar_.Add(prefs::kShowAppLauncherPromo,
diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc
index 135a5f5..c4879aa 100644
--- a/chrome/browser/ui/webui/options/options_ui.cc
+++ b/chrome/browser/ui/webui/options/options_ui.cc
@@ -118,6 +118,7 @@
 const char kOptionsBundleJsFile[]  = "options_bundle.js";
 
 #if defined(OS_CHROMEOS)
+constexpr char kIconsHTMLPath[] = "icons.html";
 constexpr char kPinKeyboardHTMLPath[] = "people_page/pin_keyboard.html";
 constexpr char kPinKeyboardJSPath[] = "people_page/pin_keyboard.js";
 constexpr char kPasswordPromptDialogHTMLPath[] =
@@ -249,6 +250,7 @@
 
 void OptionsUIHTMLSource::CreateDataSourceMap() {
 #if defined(OS_CHROMEOS)
+  path_to_idr_map_[kIconsHTMLPath] = IDR_OPTIONS_ICONS_HTML;
   path_to_idr_map_[kPinKeyboardHTMLPath] = IDR_OPTIONS_PIN_KEYBOARD_HTML;
   path_to_idr_map_[kPinKeyboardJSPath] = IDR_OPTIONS_PIN_KEYBOARD_JS;
   path_to_idr_map_[kPasswordPromptDialogHTMLPath] =
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
index 26a2f22..f90b41c 100644
--- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -17,6 +17,7 @@
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/ui/webui/policy_indicator_localized_strings_provider.h"
 #include "chrome/common/chrome_features.h"
+#include "chrome/common/chrome_switches.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/grit/chromium_strings.h"
 #include "chrome/grit/generated_resources.h"
@@ -29,11 +30,11 @@
 #include "content/public/browser/web_ui_data_source.h"
 #include "ui/base/l10n/l10n_util.h"
 
+
 #if defined(OS_CHROMEOS)
 #include "ash/common/system/chromeos/devicetype_utils.h"
 #include "chrome/browser/chromeos/profiles/profile_helper.h"
 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h"
-#include "chrome/common/chrome_switches.h"
 #include "chromeos/chromeos_switches.h"
 #include "components/user_manager/user.h"
 #include "components/user_manager/user_manager.h"
@@ -1506,6 +1507,10 @@
   AddLocalizedStringsBulk(html_source, localized_strings,
                           arraysize(localized_strings));
 
+  html_source->AddBoolean("enableSiteSettings",
+                          base::CommandLine::ForCurrentProcess()->HasSwitch(
+                              switches::kEnableSiteSettings));
+
   if (PluginUtils::ShouldPreferHtmlOverPlugins(
           HostContentSettingsMapFactory::GetForProfile(profile))) {
     LocalizedString flash_strings[] = {
diff --git a/chrome/browser/ui/webui/voice_search_ui.cc b/chrome/browser/ui/webui/voice_search_ui.cc
index 2c05270..88f9f1a 100644
--- a/chrome/browser/ui/webui/voice_search_ui.cc
+++ b/chrome/browser/ui/webui/voice_search_ui.cc
@@ -28,6 +28,7 @@
 #include "chrome/common/chrome_content_client.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/extensions/extension_constants.h"
+#include "chrome/common/features.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/grit/browser_resources.h"
@@ -380,7 +381,7 @@
 
   // Adds information specific to voice search in the app launcher to the list.
   void AddAppListInfo(base::ListValue* list) {
-#if defined (ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
     std::string state = "No Start Page Service";
     app_list::StartPageService* start_page_service =
         app_list::StartPageService::Get(profile_);
diff --git a/chrome/chrome_paks.gni b/chrome/chrome_paks.gni
index 3e93269..8b1ec9ba 100644
--- a/chrome/chrome_paks.gni
+++ b/chrome/chrome_paks.gni
@@ -3,6 +3,7 @@
 # found in the LICENSE file.
 
 import("//build/config/locales.gni")
+import("//chrome/common/features.gni")
 import("//ui/base/ui_features.gni")
 import("chrome_repack_locales.gni")
 
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn
index 7ce9af10..7d45ac0 100644
--- a/chrome/common/BUILD.gn
+++ b/chrome/common/BUILD.gn
@@ -12,6 +12,7 @@
 grit("resources") {
   source = "common_resources.grd"
   use_qualified_include = true
+  defines = chrome_grit_defines
   output_dir = "$root_gen_dir/chrome"
   output_name = "common_resources"
   outputs = [
@@ -24,6 +25,7 @@
   header = "features.h"
   flags = [
     "ANDROID_JAVA_UI=$android_java_ui",
+    "ENABLE_APP_LIST=$enable_app_list",
     "ENABLE_BACKGROUND=$enable_background",
     "ENABLE_BASIC_PRINT_DIALOG=$enable_basic_print_dialog",
     "ENABLE_CAPTIVE_PORTAL_DETECTION=$enable_captive_portal_detection",
@@ -172,7 +174,7 @@
     "//chrome/common/safe_browsing:proto",
     "//chrome/common/variations:fieldtrial_testing_config",
     "//chrome/installer/util:with_no_strings",
-    "//components/autofill/content/common",
+    "//components/autofill/content/common:ipc_traits",
     "//components/autofill/core/common",
     "//components/cast_certificate",
     "//components/cdm/common",
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 22dfac9..229a319 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -474,6 +474,10 @@
 // allocates certain resources accordingly.
 const char kEnableSiteEngagementService[]   = "enable-site-engagement-service";
 
+// Enables the site settings all sites list and site details pages in the Chrome
+// settings UI.
+const char kEnableSiteSettings[] = "enable-site-settings";
+
 // Enables the supervised user managed bookmarks folder.
 const char kEnableSupervisedUserManagedBookmarksFolder[] =
     "enable-supervised-user-managed-bookmarks-folder";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 8deb4e9..12e9d72 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -144,6 +144,7 @@
 extern const char kEnableSiteEngagementAppBanner[];
 extern const char kEnableSiteEngagementEvictionPolicy[];
 extern const char kEnableSiteEngagementService[];
+extern const char kEnableSiteSettings[];
 extern const char kEnableSupervisedUserManagedBookmarksFolder[];
 extern const char kEnableTabAudioMuting[];
 extern const char kEnableThumbnailRetargeting[];
diff --git a/chrome/common/extensions/api/platform_keys.idl b/chrome/common/extensions/api/platform_keys.idl
index dc875fc..b184c7b4 100644
--- a/chrome/common/extensions/api/platform_keys.idl
+++ b/chrome/common/extensions/api/platform_keys.idl
@@ -107,7 +107,7 @@
     // are known to the platform, match <code>request</code> and for which the
     // extension has permission to access the certificate and its private key.
     // If <code>interactive</code> is true, the user is presented a dialog where
-    // he can select from matching certificates and grant the extension access
+    // they can select from matching certificates and grant the extension access
     // to the certificate.
     // The selected/filtered client certificates will be passed to
     // <code>callback</code>.
diff --git a/chrome/common/extensions/api/settings_private.idl b/chrome/common/extensions/api/settings_private.idl
index 815cf61..287f1d1f 100644
--- a/chrome/common/extensions/api/settings_private.idl
+++ b/chrome/common/extensions/api/settings_private.idl
@@ -57,7 +57,7 @@
   callback OnPrefSetCallback = void (boolean success);
   callback GetAllPrefsCallback = void (PrefObject[] prefs);
   callback GetPrefCallback = void (PrefObject pref);
-  callback GetDefaultZoomPercentCallback = void (long percent);
+  callback GetDefaultZoomPercentCallback = void (double percent);
   callback SetDefaultZoomPercentCallback = void (boolean success);
 
   interface Functions {
@@ -79,7 +79,7 @@
     static void getDefaultZoomPercent(GetDefaultZoomPercentCallback callback);
 
     // Sets the page zoom factor from a zoom percentage.
-    static void setDefaultZoomPercent(long percent,
+    static void setDefaultZoomPercent(double percent,
         optional SetDefaultZoomPercentCallback callback);
   };
 
diff --git a/chrome/common/extensions/docs/server2/update_cache.py b/chrome/common/extensions/docs/server2/update_cache.py
index 40aace3f..9e106178 100644
--- a/chrome/common/extensions/docs/server2/update_cache.py
+++ b/chrome/common/extensions/docs/server2/update_cache.py
@@ -110,7 +110,7 @@
   '''
   server_instance = _CreateServerInstance(commit)
 
-  # This is the guy that would be responsible for refreshing the cache of
+  # This is the thing that would be responsible for refreshing the cache of
   # examples. Here for posterity, hopefully it will be added to the targets
   # below someday.
   # render_refresher = RenderRefresher(server_instance, self._request)
diff --git a/chrome/common/features.gni b/chrome/common/features.gni
index cfd9437..a2f0e50 100644
--- a/chrome/common/features.gni
+++ b/chrome/common/features.gni
@@ -15,6 +15,8 @@
   # through the environment.
   android_java_ui = is_android
 
+  enable_app_list = is_chromeos
+
   # Enables support for background apps.
   enable_background = !is_ios && !is_android && !is_chromecast
 
@@ -66,6 +68,7 @@
 }
 
 chrome_grit_defines = [
+  "enable_app_list=$enable_app_list",
   "enable_background=$enable_background",
   "enable_google_now=$enable_google_now",
   "enable_hotwording=$enable_hotwording",
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index ecb95d0..81283886 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -14,7 +14,7 @@
 // *************** PROFILE PREFS ***************
 // These are attached to the user profile
 
-#if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
+#if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST)
 // A preference to keep list of Android apps and their state.
 const char kArcApps[] = "arc.apps";
 // A preference to store backup and restore state for Android apps.
@@ -2081,7 +2081,7 @@
 const char kRLZDisabled[] = "rlz.disabled";
 #endif
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 // The directory in user data dir that contains the profile to be used with the
 // app launcher.
 const char kAppListProfile[] = "app_list.profile";
@@ -2125,7 +2125,7 @@
 // A list of Drive app ids that tracks the uninstallable Drive apps.
 const char kAppLauncherUninstalledDriveApps[] =
     "apps.app_launcher.uninstalled_drive_apps";
-#endif  // defined(ENABLE_APP_LIST)
+#endif  // BUILDFLAG(ENABLE_APP_LIST)
 
 #if defined(OS_WIN)
 // If set, the user requested to launch the app with this extension id while
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index e7f91db..01369f5 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -15,7 +15,7 @@
 namespace prefs {
 
 // Profile prefs. Please add Local State prefs below instead.
-#if defined(OS_CHROMEOS) && defined(ENABLE_APP_LIST)
+#if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_APP_LIST)
 extern const char kArcApps[];
 extern const char kArcBackupRestoreEnabled[];
 extern const char kArcEnabled[];
@@ -758,7 +758,7 @@
 extern const char kRLZDisabled[];
 #endif
 
-#if defined(ENABLE_APP_LIST)
+#if BUILDFLAG(ENABLE_APP_LIST)
 extern const char kAppListProfile[];
 extern const char kLastAppListLaunchPing[];
 extern const char kAppListLaunchCount[];
@@ -773,7 +773,7 @@
 extern const char kShowAppLauncherPromo[];
 extern const char kAppLauncherDriveAppMapping[];
 extern const char kAppLauncherUninstalledDriveApps[];
-#endif  // defined(ENABLE_APP_LIST)
+#endif  // BUILDFLAG(ENABLE_APP_LIST)
 
 #if defined(OS_WIN)
 extern const char kAppLaunchForMetroRestart[];
diff --git a/chrome/gpu/DEPS b/chrome/gpu/DEPS
index 124ee67..3c43578 100644
--- a/chrome/gpu/DEPS
+++ b/chrome/gpu/DEPS
@@ -7,5 +7,5 @@
   "+media/base/video_frame.h",
   "+media/gpu",
   "+mojo/edk/embedder",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 ]
diff --git a/chrome/gpu/chrome_content_gpu_client.cc b/chrome/gpu/chrome_content_gpu_client.cc
index 3403ef5..15726af 100644
--- a/chrome/gpu/chrome_content_gpu_client.cc
+++ b/chrome/gpu/chrome_content_gpu_client.cc
@@ -14,8 +14,8 @@
 #include "chrome/common/stack_sampling_configuration.h"
 #include "components/metrics/child_call_stack_profile_collector.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 #if defined(OS_CHROMEOS)
 #include "chrome/gpu/gpu_arc_video_service.h"
@@ -73,7 +73,7 @@
 }
 
 void ChromeContentGpuClient::ExposeInterfacesToBrowser(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     const gpu::GpuPreferences& gpu_preferences) {
 #if defined(OS_CHROMEOS)
   registry->AddInterface(
@@ -84,7 +84,7 @@
 }
 
 void ChromeContentGpuClient::ConsumeInterfacesFromBrowser(
-    shell::InterfaceProvider* provider) {
+    service_manager::InterfaceProvider* provider) {
   metrics::mojom::CallStackProfileCollectorPtr browser_interface;
   provider->GetInterface(&browser_interface);
   g_call_stack_profile_collector.Get().SetParentProfileCollector(
diff --git a/chrome/gpu/chrome_content_gpu_client.h b/chrome/gpu/chrome_content_gpu_client.h
index f63f682..39f7ce2 100644
--- a/chrome/gpu/chrome_content_gpu_client.h
+++ b/chrome/gpu/chrome_content_gpu_client.h
@@ -20,10 +20,10 @@
   // content::ContentGpuClient:
   void Initialize(base::FieldTrialList::Observer* observer) override;
   void ExposeInterfacesToBrowser(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       const gpu::GpuPreferences& gpu_preferences) override;
   void ConsumeInterfacesFromBrowser(
-      shell::InterfaceProvider* provider) override;
+      service_manager::InterfaceProvider* provider) override;
 
  private:
   std::unique_ptr<chrome_variations::ChildProcessFieldTrialSyncer>
diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn
index 5550218..845006a 100644
--- a/chrome/renderer/BUILD.gn
+++ b/chrome/renderer/BUILD.gn
@@ -3,10 +3,12 @@
 # found in the LICENSE file.
 
 import("//build/config/features.gni")
+import("//chrome/common/features.gni")
 import("//tools/grit/grit_rule.gni")
 
 grit("resources") {
   source = "resources/renderer_resources.grd"
+  defines = chrome_grit_defines
   use_qualified_include = true
   output_dir = "$root_gen_dir/chrome"
   output_name = "renderer_resources"
diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS
index f5d1411..3b6ae25 100644
--- a/chrome/renderer/DEPS
+++ b/chrome/renderer/DEPS
@@ -1,6 +1,6 @@
 include_rules = [
   "+chrome/grit",
-  "+components/autofill/content/public/interfaces",
+  "+components/autofill/content/common",
   "+components/autofill/content/renderer",
   "+components/autofill/core/common",
   "+components/cdm/renderer",
@@ -48,7 +48,7 @@
   "+media/base",
   "+ppapi/c",
   "+ppapi/shared_impl",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+skia",
   "+storage/common",
 ]
diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
index 5ed72c9c..3947588 100644
--- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc
+++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
@@ -12,7 +12,7 @@
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/test/base/chrome_render_view_test.h"
 #include "chrome/test/base/ui_test_utils.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/content/renderer/autofill_agent.h"
 #include "components/autofill/core/common/form_data.h"
 #include "components/autofill/core/common/form_field_data.h"
@@ -20,7 +20,7 @@
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/WebURLRequest.h"
@@ -131,9 +131,9 @@
 
     // We only use the fake driver for main frame
     // because our test cases only involve the main frame.
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         view_->GetMainRenderFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         mojom::AutofillDriver::Name_,
         base::Bind(&AutofillRendererTest::BindAutofillDriver,
diff --git a/chrome/renderer/autofill/fake_content_password_manager_driver.h b/chrome/renderer/autofill/fake_content_password_manager_driver.h
index 2ae2f56..f7314ba 100644
--- a/chrome/renderer/autofill/fake_content_password_manager_driver.h
+++ b/chrome/renderer/autofill/fake_content_password_manager_driver.h
@@ -10,7 +10,7 @@
 
 #include "base/optional.h"
 #include "base/strings/string16.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/core/common/password_form.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 
diff --git a/chrome/renderer/autofill/fake_password_manager_client.h b/chrome/renderer/autofill/fake_password_manager_client.h
index 76da3e2..9bdd8ae 100644
--- a/chrome/renderer/autofill/fake_password_manager_client.h
+++ b/chrome/renderer/autofill/fake_password_manager_client.h
@@ -10,7 +10,7 @@
 
 #include "base/optional.h"
 #include "base/strings/string16.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/core/common/password_form.h"
 #include "mojo/public/cpp/bindings/associated_binding.h"
 
diff --git a/chrome/renderer/autofill/form_autocomplete_browsertest.cc b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
index e7dac38c..ea68d93 100644
--- a/chrome/renderer/autofill/form_autocomplete_browsertest.cc
+++ b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
@@ -13,7 +13,7 @@
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
@@ -187,9 +187,9 @@
 
     // We only use the fake driver for main frame
     // because our test cases only involve the main frame.
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         view_->GetMainRenderFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         mojom::AutofillDriver::Name_,
         base::Bind(&FormAutocompleteTest::BindAutofillDriver,
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
index 6499ffd..2796bbbe 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <components/autofill/core/common/password_form.h>
 #include "base/feature_list.h"
 #include "base/macros.h"
 #include "base/run_loop.h"
@@ -19,13 +20,12 @@
 #include "components/autofill/core/common/autofill_constants.h"
 #include "components/autofill/core/common/form_data.h"
 #include "components/autofill/core/common/form_field_data.h"
-#include <components/autofill/core/common/password_form.h>
 #include "components/autofill/core/common/password_form_field_prediction_map.h"
 #include "components/password_manager/core/common/password_manager_features.h"
 #include "content/public/common/associated_interface_provider.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/WebVector.h"
@@ -327,9 +327,9 @@
   void RegisterMainFrameRemoteInterfaces() override {
     // We only use the fake driver for main frame
     // because our test cases only involve the main frame.
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         view_->GetMainRenderFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         mojom::PasswordManagerDriver::Name_,
         base::Bind(&PasswordAutofillAgentTest::BindPasswordManagerDriver,
diff --git a/chrome/renderer/autofill/password_generation_agent_browsertest.cc b/chrome/renderer/autofill/password_generation_agent_browsertest.cc
index 75a8550f..697c99e 100644
--- a/chrome/renderer/autofill/password_generation_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_generation_agent_browsertest.cc
@@ -22,7 +22,7 @@
 #include "content/public/common/associated_interface_provider.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
@@ -45,9 +45,9 @@
   void RegisterMainFrameRemoteInterfaces() override {
     // We only use the fake driver for main frame
     // because our test cases only involve the main frame.
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         view_->GetMainRenderFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         mojom::PasswordManagerDriver::Name_,
         base::Bind(&PasswordGenerationAgentTest::BindPasswordManagerDriver,
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 67923a0..4f0bc44c 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -98,7 +98,7 @@
 #include "net/base/net_errors.h"
 #include "ppapi/c/private/ppb_pdf.h"
 #include "ppapi/shared_impl/ppapi_switches.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/URLConversion.h"
 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
diff --git a/chrome/renderer/chrome_render_frame_observer_browsertest.cc b/chrome/renderer/chrome_render_frame_observer_browsertest.cc
index 0d0fa21..accc868 100644
--- a/chrome/renderer/chrome_render_frame_observer_browsertest.cc
+++ b/chrome/renderer/chrome_render_frame_observer_browsertest.cc
@@ -14,7 +14,7 @@
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/web/WebView.h"
 
 namespace {
@@ -57,9 +57,9 @@
   void SetUp() override {
     ChromeRenderViewTest::SetUp();
 
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         view_->GetMainRenderFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         translate::mojom::ContentTranslateDriver::Name_,
         base::Bind(&FakeContentTranslateDriver::BindHandle,
diff --git a/chrome/renderer/chrome_render_thread_observer.cc b/chrome/renderer/chrome_render_thread_observer.cc
index 817a4f6..fca7896 100644
--- a/chrome/renderer/chrome_render_thread_observer.cc
+++ b/chrome/renderer/chrome_render_thread_observer.cc
@@ -46,7 +46,7 @@
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "net/base/net_errors.h"
 #include "net/base/net_module.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/web/WebCache.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
diff --git a/chrome/renderer/leak_detector/BUILD.gn b/chrome/renderer/leak_detector/BUILD.gn
index 4549bb8..5d4464de6 100644
--- a/chrome/renderer/leak_detector/BUILD.gn
+++ b/chrome/renderer/leak_detector/BUILD.gn
@@ -12,7 +12,7 @@
       "//components/metrics/leak_detector:interfaces",
       "//components/metrics/leak_detector:leak_detector",
       "//components/metrics/proto:proto",
-      "//services/shell/public/cpp",
+      "//services/service_manager/public/cpp",
     ]
   }
 }
diff --git a/chrome/renderer/leak_detector/leak_detector_remote_client.cc b/chrome/renderer/leak_detector/leak_detector_remote_client.cc
index 80e65ff..fd849a1 100644
--- a/chrome/renderer/leak_detector/leak_detector_remote_client.cc
+++ b/chrome/renderer/leak_detector/leak_detector_remote_client.cc
@@ -10,7 +10,7 @@
 #include "components/metrics/proto/memory_leak_report.pb.h"
 #include "content/public/renderer/render_thread.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 LeakDetectorRemoteClient::LeakDetectorRemoteClient() {
   // Connect to Mojo service.
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
index e15a738..75e82dd 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -410,7 +410,7 @@
   static void CheckIsUserSignedInToChromeAs(
       const v8::FunctionCallbackInfo<v8::Value>& args);
 
-  // Checks whether the user sync his history.
+  // Checks whether the user syncs their history.
   static void CheckIsUserSyncingHistory(
       const v8::FunctionCallbackInfo<v8::Value>& args);
 
diff --git a/chrome/renderer/translate/translate_helper_browsertest.cc b/chrome/renderer/translate/translate_helper_browsertest.cc
index dca087f4..c0cda89 100644
--- a/chrome/renderer/translate/translate_helper_browsertest.cc
+++ b/chrome/renderer/translate/translate_helper_browsertest.cc
@@ -16,7 +16,7 @@
 #include "content/public/renderer/render_view.h"
 #include "extensions/common/constants.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
@@ -151,9 +151,9 @@
     ChromeRenderViewTest::SetUp();
     translate_helper_ = new TestTranslateHelper(view_->GetMainRenderFrame());
 
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         view_->GetMainRenderFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         translate::mojom::ContentTranslateDriver::Name_,
         base::Bind(&FakeContentTranslateDriver::BindHandle,
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 8affd62..d69a1e3 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -13,7 +13,7 @@
 import("//components/os_crypt/features.gni")
 import("//ppapi/features/features.gni")
 import("//remoting/remoting_enable.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 import("//v8/gni/v8.gni")
 
@@ -1182,8 +1182,8 @@
 
     deps += [
       "//mash/package",
-      "//services/shell/background:lib",
-      "//services/shell/background/tests:test_support",
+      "//services/service_manager/background:lib",
+      "//services/service_manager/background/tests:test_support",
     ]
 
     data_deps = [
@@ -1897,7 +1897,7 @@
       "//net",
       "//net:test_support",
       "//sdch",
-      "//services/shell/public/cpp",
+      "//services/service_manager/public/cpp",
       "//skia",
       "//testing/gmock",
       "//testing/gtest",
diff --git a/chrome/test/base/mash_browser_tests_main.cc b/chrome/test/base/mash_browser_tests_main.cc
index 5d623d4..b2b1902 100644
--- a/chrome/test/base/mash_browser_tests_main.cc
+++ b/chrome/test/base/mash_browser_tests_main.cc
@@ -20,18 +20,18 @@
 #include "content/public/common/service_manager_connection.h"
 #include "content/public/test/test_launcher.h"
 #include "mash/package/mash_packaged_service.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/host/child_process.h"
-#include "services/shell/runner/host/child_process_base.h"
-#include "services/shell/runner/init.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/host/child_process.h"
+#include "services/service_manager/runner/host/child_process_base.h"
+#include "services/service_manager/runner/init.h"
 
 namespace {
 
-void ConnectToDefaultApps(shell::Connector* connector) {
+void ConnectToDefaultApps(service_manager::Connector* connector) {
   connector->Connect("service:mash_session");
 }
 
@@ -88,7 +88,7 @@
     if (!mojo_test_connector_) {
       mojo_test_connector_ = base::MakeUnique<MojoTestConnector>();
       service_ = base::MakeUnique<mash::MashPackagedService>();
-      service_->set_context(base::MakeUnique<shell::ServiceContext>(
+      service_->set_context(base::MakeUnique<service_manager::ServiceContext>(
           service_.get(), mojo_test_connector_->Init()));
     }
     std::unique_ptr<content::TestState> test_state =
@@ -124,13 +124,13 @@
   return connection;
 }
 
-void StartChildApp(shell::mojom::ServiceRequest service_request) {
+void StartChildApp(service_manager::mojom::ServiceRequest service_request) {
   base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT);
   base::RunLoop run_loop;
   mash::MashPackagedService service;
-  std::unique_ptr<shell::ServiceContext> context =
-      base::MakeUnique<shell::ServiceContext>(&service,
-                                              std::move(service_request));
+  std::unique_ptr<service_manager::ServiceContext> context =
+      base::MakeUnique<service_manager::ServiceContext>(
+          &service, std::move(service_request));
   context->SetConnectionLostClosure(run_loop.QuitClosure());
   service.set_context(std::move(context));
   run_loop.Run();
@@ -150,7 +150,7 @@
     base::AtExitManager exit_manager;
 #endif
     base::i18n::InitializeICU();
-    shell::ChildProcessMainWithCallback(base::Bind(&StartChildApp));
+    service_manager::ChildProcessMainWithCallback(base::Bind(&StartChildApp));
     *exit_code = 0;
     return true;
   }
@@ -158,12 +158,12 @@
   if (command_line.HasSwitch(switches::kChildProcess) &&
       !command_line.HasSwitch(MojoTestConnector::kTestSwitch)) {
     base::AtExitManager at_exit;
-    shell::InitializeLogging();
-    shell::WaitForDebuggerIfNecessary();
+    service_manager::InitializeLogging();
+    service_manager::WaitForDebuggerIfNecessary();
 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN)
     base::RouteStdioToConsole(false);
 #endif
-    *exit_code = shell::ChildProcessMain();
+    *exit_code = service_manager::ChildProcessMain();
     return true;
   }
 
@@ -173,13 +173,13 @@
   // from the command line. In this case we have to start up
   // ServiceManagerConnection
   // as though we were embedded.
-  content::ServiceManagerConnection::Factory shell_connection_factory;
+  content::ServiceManagerConnection::Factory service_manager_connection_factory;
   if (command_line.HasSwitch(content::kSingleProcessTestsFlag) &&
       !command_line.HasSwitch(switches::kPrimordialPipeToken)) {
-    shell_connection_factory =
+    service_manager_connection_factory =
         base::Bind(&CreateServiceManagerConnection, &delegate);
     content::ServiceManagerConnection::SetFactoryForTest(
-        &shell_connection_factory);
+        &service_manager_connection_factory);
   }
   *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv);
   return true;
diff --git a/chrome/test/base/mash_browser_tests_manifest.json b/chrome/test/base/mash_browser_tests_manifest.json
index a20b011c0..31a7c14f 100644
--- a/chrome/test/base/mash_browser_tests_manifest.json
+++ b/chrome/test/base/mash_browser_tests_manifest.json
@@ -4,10 +4,10 @@
   "display_name": "Mash Browser Tests",
   "capabilities": {
     "provided": {
-      "shell:service_factory":  [ "shell::mojom::ServiceFactory" ]
+      "shell:service_factory":  [ "service_manager::mojom::ServiceFactory" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/chrome/test/base/mojo_test_connector.cc b/chrome/test/base/mojo_test_connector.cc
index a5aca22d..ef490c79d 100644
--- a/chrome/test/base/mojo_test_connector.cc
+++ b/chrome/test/base/mojo_test_connector.cc
@@ -19,18 +19,18 @@
 #include "mojo/edk/embedder/process_delegate.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "services/catalog/store.h"
-#include "services/shell/background/tests/test_catalog_store.h"
-#include "services/shell/native_runner_delegate.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/runner/common/client_util.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/service_manager.h"
-#include "services/shell/switches.h"
+#include "services/service_manager/background/tests/test_catalog_store.h"
+#include "services/service_manager/native_runner_delegate.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/runner/common/client_util.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/service_manager.h"
+#include "services/service_manager/switches.h"
 
-using shell::mojom::Service;
-using shell::mojom::ServicePtr;
+using service_manager::mojom::Service;
+using service_manager::mojom::ServicePtr;
 
 namespace {
 
@@ -47,7 +47,7 @@
   // Prepares the command line and other setup for connecting the test to mojo.
   // Must be paired with a call to ChildProcessLaunched().
   void Connect(base::CommandLine* command_line,
-               shell::ServiceManager* service_manager,
+               service_manager::ServiceManager* service_manager,
                base::TestLauncher::LaunchOptions* test_launch_options) {
     command_line->AppendSwitch(MojoTestConnector::kTestSwitch);
     command_line->AppendSwitch(switches::kChildProcess);
@@ -65,18 +65,22 @@
 #else
 #error "Unsupported"
 #endif
-    shell::mojom::ServicePtr service =
-        shell::PassServiceRequestOnCommandLine(command_line, child_token_);
+    service_manager::mojom::ServicePtr service =
+        service_manager::PassServiceRequestOnCommandLine(command_line,
+                                                         child_token_);
 
-    std::unique_ptr<shell::ConnectParams> params(new shell::ConnectParams);
-    params->set_source(shell::CreateServiceManagerIdentity());
+    std::unique_ptr<service_manager::ConnectParams> params(
+        new service_manager::ConnectParams);
+    params->set_source(service_manager::CreateServiceManagerIdentity());
     // Use the default instance name (which should be "browser"). Otherwise a
     // service (e.g. ash) that connects to the default "service:content_browser"
     // will spawn a new instance.
-    params->set_target(shell::Identity(kTestName, shell::mojom::kRootUserID));
+    params->set_target(service_manager::Identity(
+        kTestName, service_manager::mojom::kRootUserID));
 
-    shell::mojom::ClientProcessConnectionPtr client_process_connection =
-        shell::mojom::ClientProcessConnection::New();
+    service_manager::mojom::ClientProcessConnectionPtr
+        client_process_connection =
+            service_manager::mojom::ClientProcessConnection::New();
     client_process_connection->service =
         service.PassInterface().PassHandle();
     client_process_connection->pid_receiver_request =
@@ -103,7 +107,7 @@
 
   mojo::edk::HandlePassingInformation handle_passing_info_;
 
-  shell::mojom::PIDReceiverPtr pid_receiver_;
+  service_manager::mojom::PIDReceiverPtr pid_receiver_;
 
   DISALLOW_COPY_AND_ASSIGN(BackgroundTestState);
 };
@@ -111,20 +115,22 @@
 // Called used destroy BackgroundTestState on the background thread.
 void DestroyBackgroundStateOnBackgroundThread(
     std::unique_ptr<BackgroundTestState> state,
-    shell::ServiceManager* service_manager) {}
+    service_manager::ServiceManager* service_manager) {}
 
 // State created per test. Manages creation of the corresponding
 // BackgroundTestState and making sure processing runs on the right threads.
 class MojoTestState : public content::TestState {
  public:
-  explicit MojoTestState(shell::BackgroundShell* background_shell)
+  explicit MojoTestState(service_manager::BackgroundShell* background_shell)
       : background_shell_(background_shell) {}
 
   ~MojoTestState() override {
     DCHECK(background_state_);
     // BackgroundState needs to be destroyed on the background thread. We're
-    // guaranteed |background_shell_| has been created by the time we reach
-    // here as Init() blocks until |background_shell_| has been created.
+    // guaranteed |background_shell_| has been created by the time we
+    // reach
+    // here as Init() blocks until |background_shell_| has been
+    // created.
     background_shell_->ExecuteOnServiceManagerThread(
         base::Bind(&DestroyBackgroundStateOnBackgroundThread,
                    base::Passed(&background_state_)));
@@ -160,7 +166,7 @@
       base::ProcessHandle handle,
       base::ProcessId pid,
       base::WaitableEvent* signal,
-      shell::ServiceManager* service_manager) {
+      service_manager::ServiceManager* service_manager) {
     background_state_->ChildProcessLaunched(handle, pid);
     signal->Signal();
   }
@@ -169,14 +175,14 @@
       base::WaitableEvent* signal,
       base::CommandLine* command_line,
       base::TestLauncher::LaunchOptions* test_launch_options,
-      shell::ServiceManager* service_manager) {
+      service_manager::ServiceManager* service_manager) {
     background_state_.reset(new BackgroundTestState);
     background_state_->Connect(command_line, service_manager,
                                test_launch_options);
     signal->Signal();
   }
 
-  shell::BackgroundShell* background_shell_;
+  service_manager::BackgroundShell* background_shell_;
   std::unique_ptr<BackgroundTestState> background_state_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoTestState);
@@ -199,15 +205,15 @@
 // NativeRunnerDelegate that makes exe:mash_browser_tests to exe:browser_tests,
 // and removes '--run-in-mash'.
 class MojoTestConnector::NativeRunnerDelegateImpl
-    : public shell::NativeRunnerDelegate {
+    : public service_manager::NativeRunnerDelegate {
  public:
   NativeRunnerDelegateImpl() {}
   ~NativeRunnerDelegateImpl() override {}
 
  private:
-  // shell::NativeRunnerDelegate:
+  // service_manager::NativeRunnerDelegate:
   void AdjustCommandLineArgumentsForTarget(
-      const shell::Identity& target,
+      const service_manager::Identity& target,
       base::CommandLine* command_line) override {
     if (target.name() != kTestName) {
       if (target.name() == kTestRunnerName)
@@ -234,11 +240,11 @@
 
 MojoTestConnector::MojoTestConnector() {}
 
-shell::mojom::ServiceRequest MojoTestConnector::Init() {
+service_manager::mojom::ServiceRequest MojoTestConnector::Init() {
   native_runner_delegate_ = base::MakeUnique<NativeRunnerDelegateImpl>();
 
-  std::unique_ptr<shell::BackgroundShell::InitParams> init_params(
-      new shell::BackgroundShell::InitParams);
+  std::unique_ptr<service_manager::BackgroundShell::InitParams> init_params(
+      new service_manager::BackgroundShell::InitParams);
   // When running in single_process mode chrome initializes the edk.
   init_params->init_edk = !base::CommandLine::ForCurrentProcess()->HasSwitch(
       content::kSingleProcessTestsFlag);
diff --git a/chrome/test/base/mojo_test_connector.h b/chrome/test/base/mojo_test_connector.h
index bf295f1..bc3ccae4 100644
--- a/chrome/test/base/mojo_test_connector.h
+++ b/chrome/test/base/mojo_test_connector.h
@@ -10,8 +10,8 @@
 #include "base/macros.h"
 #include "base/process/process_handle.h"
 #include "base/test/launcher/test_launcher.h"
-#include "services/shell/background/background_shell.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/background/background_shell.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace base {
 class CommandLine;
@@ -38,7 +38,7 @@
   ~MojoTestConnector();
 
   // Initializes the background thread the Shell runs on.
-  shell::mojom::ServiceRequest Init();
+  service_manager::mojom::ServiceRequest Init();
 
   std::unique_ptr<content::TestState> PrepareForTest(
       base::CommandLine* command_line,
@@ -49,7 +49,7 @@
 
   std::unique_ptr<NativeRunnerDelegateImpl> native_runner_delegate_;
 
-  shell::BackgroundShell background_shell_;
+  service_manager::BackgroundShell background_shell_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoTestConnector);
 };
diff --git a/chrome/test/data/BUILD.gn b/chrome/test/data/BUILD.gn
index b5713b8..4039469 100644
--- a/chrome/test/data/BUILD.gn
+++ b/chrome/test/data/BUILD.gn
@@ -2,10 +2,12 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//chrome/common/features.gni")
 import("//tools/grit/grit_rule.gni")
 
 grit("webui_test_resources") {
   source = "webui_test_resources.grd"
+  defines = chrome_grit_defines
   use_qualified_include = true
   outputs = [
     "test/data/grit/webui_test_resources.h",
diff --git a/chrome/test/data/webui/settings/cr_settings_browsertest.js b/chrome/test/data/webui/settings/cr_settings_browsertest.js
index 8664769..763a5fc 100644
--- a/chrome/test/data/webui/settings/cr_settings_browsertest.js
+++ b/chrome/test/data/webui/settings/cr_settings_browsertest.js
@@ -158,6 +158,95 @@
 GEN('#endif');
 
 GEN('#if defined(OS_CHROMEOS)');
+
+/**
+ * Test fixture for
+ * chrome/browser/resources/settings/people_page/password_prompt_dialog.html.
+ * This is ChromeOS only.
+ * @constructor
+ * @extends {CrSettingsBrowserTest}
+*/
+function CrSettingsPeoplePageQuickUnlockAuthenticateTest() {}
+
+CrSettingsPeoplePageQuickUnlockAuthenticateTest.prototype = {
+  __proto__: CrSettingsBrowserTest.prototype,
+
+  /** @override */
+  browsePreload: 'chrome://md-settings/people_page/password_prompt_dialog.html',
+
+  /** @override */
+  extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([
+    '../fake_chrome_event.js',
+    'fake_quick_unlock_private.js',
+    'quick_unlock_authenticate_browsertest_chromeos.js'
+  ]),
+};
+
+TEST_F('CrSettingsPeoplePageQuickUnlockAuthenticateTest', 'Test', function() {
+  settings_people_page_quick_unlock.registerAuthenticateTests();
+  mocha.run();
+});
+
+/**
+ * Test fixture for
+ * chrome/browser/resources/settings/people_page/lock_screen.html
+ * This is ChromeOS only.
+ * @constructor
+ * @extends {CrSettingsBrowserTest}
+*/
+function CrSettingsPeoplePageLockScreenTest() {}
+
+CrSettingsPeoplePageLockScreenTest.prototype = {
+  __proto__: CrSettingsBrowserTest.prototype,
+
+  /** @override */
+  //browsePreload: 'chrome://md-settings/settings_main/settings_main.html',
+  browsePreload: 'chrome://md-settings/people_page/lock_screen.html',
+
+  /** @override */
+  extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([
+    '../fake_chrome_event.js',
+    'fake_quick_unlock_private.js',
+    'fake_settings_private.js',
+    'quick_unlock_authenticate_browsertest_chromeos.js'
+  ]),
+};
+
+TEST_F('CrSettingsPeoplePageLockScreenTest', 'Test', function() {
+  settings_people_page_quick_unlock.registerLockScreenTests();
+  mocha.run();
+});
+
+/**
+ * Test fixture for
+ * chrome/browser/resources/settings/people_page/setup_pin_dialog.html.
+ *
+ * This is ChromeOS only.
+ * @constructor
+ * @extends {CrSettingsBrowserTest}
+*/
+function CrSettingsPeoplePageSetupPinDialogTest() {}
+
+CrSettingsPeoplePageSetupPinDialogTest.prototype = {
+  __proto__: CrSettingsBrowserTest.prototype,
+
+  /** @override */
+  browsePreload: 'chrome://md-settings/people_page/setup_pin_dialog.html',
+
+  /** @override */
+  extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([
+    '../fake_chrome_event.js',
+    'fake_quick_unlock_private.js',
+    'fake_settings_private.js',
+    'quick_unlock_authenticate_browsertest_chromeos.js'
+  ]),
+};
+
+TEST_F('CrSettingsPeoplePageSetupPinDialogTest', 'Test', function() {
+  settings_people_page_quick_unlock.registerSetupPinDialogTests();
+  mocha.run();
+});
+
 /**
  * Test fixture for
  * chrome/browser/resources/settings/people_page/change_picture.html.
@@ -863,3 +952,20 @@
 });
 
 GEN('#endif');
+
+function CrSettingsActionMenuTest() {}
+
+CrSettingsActionMenuTest.prototype = {
+  __proto__: CrSettingsBrowserTest.prototype,
+
+  /** @override */
+  browsePreload: 'chrome://md-settings/settings_action_menu.html',
+
+  extraLibraries: CrSettingsBrowserTest.prototype.extraLibraries.concat([
+    'settings_action_menu_test.js',
+  ]),
+};
+
+TEST_F('CrSettingsActionMenuTest', 'All', function() {
+  mocha.run();
+});
diff --git a/chrome/test/data/webui/settings/fake_quick_unlock_private.js b/chrome/test/data/webui/settings/fake_quick_unlock_private.js
new file mode 100644
index 0000000..0852d67
--- /dev/null
+++ b/chrome/test/data/webui/settings/fake_quick_unlock_private.js
@@ -0,0 +1,64 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Fake implementation of chrome.quickUnlockPrivate for testing.
+ */
+cr.define('settings', function() {
+  /**
+   * Fake of the chrome.quickUnlockPrivate API.
+   * @constructor
+   * @implements {QuickUnlockPrivate}
+   */
+  function FakeQuickUnlockPrivate() {
+    /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
+        this.availableModes = [chrome.quickUnlockPrivate.QuickUnlockMode.PIN];
+    /** @type {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} */
+        this.activeModes = [];
+    /** @type {!Array<string>} */ this.credentials = [];
+    /** @type {string} */ this.accountPassword = '';
+  }
+
+  FakeQuickUnlockPrivate.prototype = {
+    // Public testing methods.
+    /**
+     * @override
+     * @param {function(
+     *     !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
+     */
+    getAvailableModes: function(onComplete) {
+      onComplete(this.availableModes);
+    },
+
+    /**
+     * @override
+     * @param {function(
+     *     !Array<!chrome.quickUnlockPrivate.QuickUnlockMode>):void} onComplete
+     */
+    getActiveModes: function(onComplete) {
+      onComplete(this.activeModes);
+    },
+
+    /**
+     * @override
+     * @param {string} accountPassword
+     * @param {!Array<!chrome.quickUnlockPrivate.QuickUnlockMode>} modes
+     * @param {!Array<string>} credentials
+     * @param {function(boolean):void} onComplete
+     */
+    setModes: function(accountPassword, modes, credentials, onComplete) {
+      // Even if the account password is wrong we still update activeModes and
+      // credentials so that the mock owner has a chance to see what was given
+      // to the API.
+      this.activeModes = modes;
+      this.credentials = credentials;
+      onComplete(this.accountPassword == accountPassword);
+    }
+  };
+
+  /** @type {!ChromeEvent} */
+  FakeQuickUnlockPrivate.prototype.onActiveModesChanged = new FakeChromeEvent();
+
+  return {FakeQuickUnlockPrivate: FakeQuickUnlockPrivate};
+});
diff --git a/chrome/test/data/webui/settings/languages_page_browsertest.js b/chrome/test/data/webui/settings/languages_page_browsertest.js
index ad427df1..6d8a539 100644
--- a/chrome/test/data/webui/settings/languages_page_browsertest.js
+++ b/chrome/test/data/webui/settings/languages_page_browsertest.js
@@ -53,6 +53,7 @@
     var languagesPage;
     var languagesCollapse;
     var languageHelper;
+    var actionMenu;
 
     /**
      * @param {numExpected} Expected number of languages to eventually be
@@ -88,12 +89,16 @@
           languagesSection.querySelector('settings-languages-page'));
       languagesCollapse = languagesPage.$.languagesCollapse;
       languagesCollapse.opened = true;
+      actionMenu = languagesPage.$.menu.get();
 
       languageHelper = languagesPage.languageHelper;
       return languageHelper.whenReady();
     }.bind(this));
 
     teardown(function(done) {
+      if (actionMenu.open)
+        actionMenu.close();
+
       // Close the section if we're in a sub-page.
       if (settings.getCurrentRoute().isSubpage()) {
         settings.navigateTo(settings.Route.BASIC);
@@ -209,35 +214,25 @@
         cur = languageHelper.prefs.translate.enabled.value;
       });
 
-      test('structure', function(done) {
+      test('structure', function() {
         var languageOptionsDropdownTrigger = languagesCollapse.querySelector(
             'paper-icon-button');
         assertTrue(!!languageOptionsDropdownTrigger);
         MockInteractions.tap(languageOptionsDropdownTrigger);
-        var languageMenu = assert(languagesPage.$$('cr-shared-menu'));
+        assertTrue(actionMenu.open);
 
-        listenOnce(languageMenu, 'iron-overlay-opened', function() {
-          assertTrue(languageMenu.menuOpen);
+        // Enable Translate so the menu always shows the Translate checkbox.
+        languageHelper.setPrefValue('translate.enabled', true);
 
-          // Enable Translate so the menu always shows the Translate checkbox.
-          languageHelper.setPrefValue('translate.enabled', true);
+        var separator = actionMenu.querySelector('hr');
+        assertEquals(1, separator.offsetHeight);
 
-          var separator = languageMenu.querySelector('hr');
-          assertEquals(1, separator.offsetHeight);
-
-          // Disable Translate. On platforms that can't change the UI language,
-          // this hides all the checkboxes, so the separator isn't needed.
-          // Chrome OS and Windows still show a checkbox and thus the separator.
-          languageHelper.setPrefValue('translate.enabled', false);
-          if (cr.isChromeOS || cr.isWindows)
-            assertEquals(1, separator.offsetHeight);
-          else
-            assertEquals(0, separator.offsetHeight);
-
-          MockInteractions.tap(languageOptionsDropdownTrigger);
-          assertFalse(languageMenu.menuOpen);
-          done();
-        });
+        // Disable Translate. On platforms that can't change the UI language,
+        // this hides all the checkboxes, so the separator isn't needed.
+        // Chrome OS and Windows still show a checkbox and thus the separator.
+        languageHelper.setPrefValue('translate.enabled', false);
+        assertEquals(
+            cr.isChromeOS || cr.isWindows ? 1 : 0, separator.offsetHeight);
       });
 
       test('remove language', function() {
@@ -264,18 +259,17 @@
           // Open the menu and select Remove.
           MockInteractions.tap(item.querySelector('paper-icon-button'));
 
-          var languageMenu = assert(languagesPage.$$('cr-shared-menu'));
-          assertTrue(languageMenu.menuOpen);
-          var removeMenuItem = assert(languageMenu.querySelector(
+          assertTrue(actionMenu.open);
+          var removeMenuItem = assert(actionMenu.querySelector(
               '.dropdown-item:last-child'));
           assertFalse(removeMenuItem.disabled);
           MockInteractions.tap(removeMenuItem);
-          assertFalse(languageMenu.menuOpen);
+          assertFalse(actionMenu.open);
 
           // We should go back down to the original number of enabled languages.
-          return whenNumEnabledLanguagesBecomes(numEnabled).then(function() {
-            assertFalse(languageHelper.isLanguageEnabled(newLanguage.code));
-          });
+          return whenNumEnabledLanguagesBecomes(numEnabled);
+        }).then(function() {
+          assertFalse(languageHelper.isLanguageEnabled(newLanguage.code));
         });
       });
     });
diff --git a/chrome/test/data/webui/settings/quick_unlock_authenticate_browsertest_chromeos.js b/chrome/test/data/webui/settings/quick_unlock_authenticate_browsertest_chromeos.js
new file mode 100644
index 0000000..0a2f1f32
--- /dev/null
+++ b/chrome/test/data/webui/settings/quick_unlock_authenticate_browsertest_chromeos.js
@@ -0,0 +1,456 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('settings_people_page_quick_unlock', function() {
+  var element = null;
+  var quickUnlockPrivateApi = null;
+  var QuickUnlockMode = chrome.quickUnlockPrivate.QuickUnlockMode;
+
+  /**
+   * Returns if the element is visible.
+   * @param {!Element} element
+   */
+  function isVisible(element) {
+    while (element) {
+      if (element.offsetWidth <= 0 || element.offsetHeight <= 0 ||
+          element.hidden) {
+        return false;
+      }
+
+      element = element.parentElement;
+    }
+
+    return true;
+  }
+
+  /**
+   * Returns true if the given |element| has class |className|.
+   * @param {!Element} element
+   * @param {string} className
+   */
+  function assertHasClass(element, className) {
+    assertTrue(element.classList.contains(className));
+  }
+
+  /**
+   * Returns the result of running |selector| on element.
+   * @param {string} selector
+   * @return {Element}
+   */
+  function getFromElement(selector) {
+    var childElement = element.$$(selector);
+    assertTrue(!!childElement);
+    return childElement;
+  }
+
+  /**
+   * Sets the active quick unlock modes and raises a mode change event.
+   * @param {!Array<chrome.quickUnlockPrivate.QuickUnlockMode>} modes
+   */
+  function setActiveModes(modes) {
+    quickUnlockPrivateApi.activeModes = modes;
+    quickUnlockPrivateApi.onActiveModesChanged.callListeners(modes);
+  }
+
+  function registerAuthenticateTests() {
+    suite('authenticate', function() {
+      var passwordElement = null;
+
+      setup(function() {
+        PolymerTest.clearBody();
+
+        quickUnlockPrivateApi = new settings.FakeQuickUnlockPrivate();
+
+        element = document.createElement('settings-password-prompt-dialog');
+        element.quickUnlockPrivate_ = quickUnlockPrivateApi;
+        document.body.appendChild(element);
+
+        passwordElement = getFromElement('#passwordInput');
+      });
+
+      test('PasswordCheckDoesNotChangeActiveMode', function() {
+        // No active modes.
+        quickUnlockPrivateApi.activeModes = [];
+        passwordElement.value = 'foo';
+        element.submitPassword_();
+        assertDeepEquals([], quickUnlockPrivateApi.activeModes);
+        assertDeepEquals([], quickUnlockPrivateApi.credentials);
+
+        // PIN is active.
+        quickUnlockPrivateApi.activeModes = [QuickUnlockMode.PIN];
+        passwordElement.value = 'foo';
+        element.submitPassword_();
+        assertDeepEquals([QuickUnlockMode.PIN],
+                         quickUnlockPrivateApi.activeModes);
+        assertDeepEquals([''], quickUnlockPrivateApi.credentials);
+      });
+
+      // A bad password does not provide an authenticated setModes object.
+      test('InvalidPasswordDoesNotProvideAuthentication', function() {
+        quickUnlockPrivateApi.accountPassword = 'bar';
+
+        passwordElement.value = 'foo';
+        element.submitPassword_();
+
+        assertFalse(!!element.setModes);
+      });
+
+      // A valid password provides an authenticated setModes object.
+      test('ValidPasswordProvidesAuthentication', function() {
+        quickUnlockPrivateApi.accountPassword = 'foo';
+
+        passwordElement.value = 'foo';
+        element.submitPassword_();
+
+        assertTrue(!!element.setModes);
+      });
+
+      // The setModes objects times out after a delay.
+      test('AuthenticationTimesOut', function(done) {
+        quickUnlockPrivateApi.accountPassword = 'foo';
+
+        element.passwordActiveDurationMs_ = 0;
+        passwordElement.value = 'foo';
+        element.submitPassword_();
+
+        assertFalse(!!element.password_);
+        assertTrue(!!element.setModes);
+
+        // Two setTimeout calls with the same delay are guaranteed to execute in
+        // the same order that they were submitted in, so using
+        // element.autosubmitDelayMs_ is safe.
+        setTimeout(function() {
+          assertFalse(!!element.password_);
+          assertFalse(!!element.setModes);
+          done();
+        }, element.passwordActiveDurationMs_);
+      });
+    });
+  }
+
+  function registerLockScreenTests() {
+    suite('lock-screen', function() {
+      /** @const */ var ENABLE_LOCK_SCREEN_PREF = 'settings.enable_screen_lock';
+
+      var fakeSettings = null;
+      var passwordRadioButton = null;
+      var pinPasswordRadioButton = null;
+      var noneRadioButton = null;
+      var configureButton = null;
+
+      /**
+       * Asserts that only the given radio button is active and all of the
+       * others are inactive.
+       * @param {Element} radioButton
+       */
+      function assertRadioButtonActive(radioButton) {
+        function doAssert(element, name) {
+          if (radioButton == element)
+            assertTrue(element.active, 'Expected ' + name + ' to be active');
+          else
+            assertFalse(element.active, 'Expected ' + name + ' to be inactive');
+        }
+
+        doAssert(passwordRadioButton, 'passwordButton');
+        doAssert(pinPasswordRadioButton, 'pinPasswordButton');
+      }
+
+      /**
+       * Returns the lock screen pref value.
+       * @return {boolean}
+       */
+      function getLockScreenPref() {
+        var result;
+        fakeSettings.getPref(ENABLE_LOCK_SCREEN_PREF, function(value) {
+          result = value;
+        });
+        assertNotEquals(undefined, result);
+        return result.value;
+      }
+
+      /**
+       * Changes the lock screen pref value using the settings API; this is like
+       * the pref got changed from an unkown source such as another tab.
+       * @param {boolean} value
+       */
+      function setLockScreenPref(value) {
+        fakeSettings.setPref(ENABLE_LOCK_SCREEN_PREF, value, '', assertTrue);
+      }
+
+      suiteSetup(function() {
+        var urls = [
+          'chrome://md-settings/i18n_setup.html',
+          'chrome://md-settings/prefs/prefs.html',
+        ];
+        return Promise.all(urls.map(PolymerTest.importHtml));
+      });
+
+      setup(function(done) {
+        PolymerTest.clearBody();
+
+        CrSettingsPrefs.deferInitialization = true;
+
+        // Build pref fakes.
+        var fakePrefs = [{
+          key: ENABLE_LOCK_SCREEN_PREF,
+          type: chrome.settingsPrivate.PrefType.BOOLEAN,
+          value: true
+        }];
+        fakeSettings = new settings.FakeSettingsPrivate(fakePrefs);
+        setLockScreenPref(true);
+        var prefElement = document.createElement('settings-prefs');
+        prefElement.initialize(fakeSettings);
+        document.body.appendChild(prefElement);
+
+        // Wait for prefElement to finish initializing; it takes some time for
+        // the prefs element to get allocated.
+        prefElement.addEventListener('prefs-changed', function prefsReady() {
+          prefElement.removeEventListener('prefs-changed', prefsReady);
+
+          quickUnlockPrivateApi = new settings.FakeQuickUnlockPrivate();
+
+          // Create choose-method element.
+          element = document.createElement('settings-lock-screen');
+          element.settingsPrivate_ = fakeSettings;
+          element.quickUnlockPrivate_ = quickUnlockPrivateApi;
+          element.prefs = prefElement.prefs;
+
+          document.body.appendChild(element);
+          Polymer.dom.flush();
+
+          element.setModes_ =
+              quickUnlockPrivateApi.setModes.bind(quickUnlockPrivateApi, '');
+
+          passwordRadioButton =
+              getFromElement('paper-radio-button[name="password"]');
+          pinPasswordRadioButton =
+              getFromElement('paper-radio-button[name="pin+password"]');
+          configureButton = getFromElement('paper-button');
+
+          done();
+        });
+      });
+
+      // Showing the choose method screen does not make any destructive pref or
+      // quickUnlockPrivate calls.
+      test('ShowingScreenDoesNotModifyPrefs', function() {
+        assertTrue(getLockScreenPref());
+        assertRadioButtonActive(passwordRadioButton);
+        assertDeepEquals([], quickUnlockPrivateApi.activeModes);
+      });
+
+      // The various radio buttons update internal state and do not modify
+      // prefs.
+      test('TappingButtonsChangesUnderlyingState', function() {
+        function togglePin() {
+          assertRadioButtonActive(passwordRadioButton);
+
+          // Tap pin+password button.
+          MockInteractions.tap(pinPasswordRadioButton);
+          assertRadioButtonActive(pinPasswordRadioButton);
+          assertTrue(isVisible(configureButton));
+          assertDeepEquals([], quickUnlockPrivateApi.activeModes);
+
+          // Enable quick unlock so that we verify tapping password disables it.
+          setActiveModes([QuickUnlockMode.PIN]);
+
+          // Tap password button and verify quick unlock is disabled.
+          MockInteractions.tap(passwordRadioButton);
+          assertRadioButtonActive(passwordRadioButton);
+          assertFalse(isVisible(configureButton));
+          assertDeepEquals([], quickUnlockPrivateApi.activeModes);
+        }
+
+        // Verify toggling PIN on/off does not disable screen lock.
+        setLockScreenPref(true);
+        togglePin();
+        assertTrue(getLockScreenPref());
+
+        // Verify toggling PIN on/off does not enable screen lock.
+        setLockScreenPref(false);
+        togglePin();
+        assertFalse(getLockScreenPref());
+      });
+
+      // If quick unlock is changed by another settings page the radio button
+      // will update to show quick unlock is active.
+      test('EnablingQuickUnlockChangesButtonState', function() {
+        setActiveModes([QuickUnlockMode.PIN]);
+        assertRadioButtonActive(pinPasswordRadioButton);
+        assertTrue(isVisible(configureButton));
+
+        setActiveModes([]);
+        assertRadioButtonActive(passwordRadioButton);
+        assertDeepEquals([], quickUnlockPrivateApi.activeModes);
+      });
+
+      // Tapping the PIN configure button opens up the setup PIN dialog.
+      test('TappingConfigureOpensSetupPin', function() {
+        assertRadioButtonActive(passwordRadioButton);
+
+        MockInteractions.tap(pinPasswordRadioButton);
+        assertTrue(isVisible(configureButton));
+        assertRadioButtonActive(pinPasswordRadioButton)
+
+        MockInteractions.tap(configureButton);
+        var setupPinDialog = getFromElement('#setupPin');
+        assertTrue(setupPinDialog.$.dialog.open);
+      });
+    });
+  }
+
+  function registerSetupPinDialogTests() {
+    suite('setup-pin-dialog', function() {
+      var titleDiv = null;
+      var problemDiv = null;
+      var pinKeyboard = null;
+      var backButton = null;
+      var continueButton = null;
+
+      suiteSetup(function() {
+        var urls = ['chrome://md-settings/i18n_setup.html'];
+        return Promise.all(urls.map(PolymerTest.importHtml));
+      });
+
+      setup(function() {
+        PolymerTest.clearBody();
+
+        quickUnlockPrivateApi = new settings.FakeQuickUnlockPrivate();
+
+        // Create setup-pin element.
+        element = document.createElement('settings-setup-pin-dialog');
+        element.setModes =
+            quickUnlockPrivateApi.setModes.bind(quickUnlockPrivateApi, '');
+
+        document.body.appendChild(element);
+        Polymer.dom.flush();
+
+        element.open();
+
+        titleDiv = getFromElement('div[class="title"]');
+        problemDiv = getFromElement('#problemDiv');
+        pinKeyboard = getFromElement('pin-keyboard');
+        backButton = getFromElement('paper-button[class="cancel-button"]');
+        continueButton = getFromElement('paper-button[class="action-button"]');
+
+        assertTrue(isVisible(backButton));
+        assertTrue(isVisible(continueButton));
+      });
+
+      // The continue button and title change text between the setup and confirm
+      // steps.
+      test('TextChangesBetweenSetupAndConfirmStep', function() {
+        var initialContinue = continueButton.textContent;
+        var initialTitle = titleDiv.textContent;
+
+        pinKeyboard.value = '1111';
+        MockInteractions.tap(continueButton);
+
+        assertNotEquals(initialContinue, continueButton.textContent);
+        assertNotEquals(initialTitle, titleDiv.textContent);
+      });
+
+      // The continue button is disabled unless the user has entered a >= 4
+      // digit PIN.
+      test('CanOnlyContinueAfterEnteringAtLeastFourDigitPin', function() {
+        pinKeyboard.value = '111';
+        assertTrue(continueButton.disabled);
+
+        pinKeyboard.value = '1111';
+        assertFalse(continueButton.disabled);
+
+        pinKeyboard.value = '111';
+        assertTrue(continueButton.disabled);
+
+        pinKeyboard.value = '';
+        assertTrue(continueButton.disabled);
+
+        pinKeyboard.value = '1111111';
+        assertFalse(continueButton.disabled);
+      });
+
+      // Problem messages are hidden if the PIN is cleared.
+      test('NoProblemShownWithEmptyPin', function() {
+        pinKeyboard.value = '11';
+        assertTrue(isVisible(problemDiv));
+
+        pinKeyboard.value = '';
+        assertFalse(isVisible(problemDiv));
+      });
+
+      // If the PIN is too short an error problem is shown.
+      test('ErrorShownForShortPins', function() {
+        assertFalse(isVisible(problemDiv));
+
+        pinKeyboard.value = '11';
+
+        assertTrue(isVisible(problemDiv));
+        assertHasClass(problemDiv, 'error');
+        assertTrue(continueButton.disabled);
+      });
+
+      // If the PIN is weak a warning problem is shown.
+      test('WarningShownForWeakPins', function() {
+        assertFalse(isVisible(problemDiv));
+
+        pinKeyboard.value = '1111';
+
+        assertTrue(isVisible(problemDiv));
+        assertHasClass(problemDiv, 'warning');
+      });
+
+      // If the confirm PIN does not match the initial PIN an error is shown and
+      // the submit button is disabled.
+      test('ErrorShownForMismatchedPins', function() {
+        pinKeyboard.value = '1118';
+        MockInteractions.tap(continueButton);
+        pinKeyboard.value = '1119';
+
+        assertTrue(isVisible(problemDiv));
+        assertHasClass(problemDiv, 'error');
+        assertTrue(continueButton.disabled);
+      });
+
+      // Hitting cancel at the setup step dismisses the dialog.
+      test('HittingBackButtonResetsState', function() {
+        MockInteractions.tap(backButton);
+        assertFalse(element.$.dialog.open);
+      });
+
+      // Hitting cancel at the confirm step dismisses the dialog.
+      test('HittingBackButtonResetsState', function() {
+        pinKeyboard.value = '1111';
+        MockInteractions.tap(continueButton);
+        MockInteractions.tap(backButton);
+        assertFalse(element.$.dialog.open);
+      });
+
+      // User has to re-enter PIN for confirm step.
+      test('PinKeyboardIsResetForConfirmStep', function() {
+        pinKeyboard.value = '1111';
+        MockInteractions.tap(continueButton);
+        assertEquals('', pinKeyboard.value);
+      });
+
+      // Completing the flow results in a call to the quick unlock private API.
+      test('SubmittingPinCallsQuickUnlockApi', function() {
+        // Entering the same (even weak) pin twice calls the quick unlock API
+        // and sets up a PIN.
+        pinKeyboard.value = '1111';
+        MockInteractions.tap(continueButton);
+        pinKeyboard.value = '1111';
+        MockInteractions.tap(continueButton);
+
+        assertDeepEquals(['PIN'], quickUnlockPrivateApi.activeModes);
+        assertDeepEquals(['1111'], quickUnlockPrivateApi.credentials);
+      });
+    });
+  }
+
+  return {
+    registerAuthenticateTests: registerAuthenticateTests,
+    registerLockScreenTests: registerLockScreenTests,
+    registerSetupPinDialogTests: registerSetupPinDialogTests
+  };
+});
diff --git a/chrome/test/data/webui/settings/search_engines_page_test.js b/chrome/test/data/webui/settings/search_engines_page_test.js
index 0aaa26d..76dd00b 100644
--- a/chrome/test/data/webui/settings/search_engines_page_test.js
+++ b/chrome/test/data/webui/settings/search_engines_page_test.js
@@ -187,6 +187,9 @@
       });
 
       test('MakeDefault_Enabled', function() {
+        // Open action menu.
+        MockInteractions.tap(entry.$$('paper-icon-button'));
+
         var makeDefaultButton = entry.$.makeDefault;
         assertTrue(!!makeDefaultButton);
         MockInteractions.tap(makeDefaultButton);
@@ -198,6 +201,9 @@
 
       // Test that clicking the "edit" button brings up a dialog.
       test('Edit_Enabled', function() {
+        // Open action menu.
+        MockInteractions.tap(entry.$$('paper-icon-button'));
+
         var engine = entry.engine;
         var editButton = entry.$.edit;
         assertTrue(!!editButton);
diff --git a/chrome/test/data/webui/settings/settings_action_menu_test.js b/chrome/test/data/webui/settings/settings_action_menu_test.js
new file mode 100644
index 0000000..4115d8a3
--- /dev/null
+++ b/chrome/test/data/webui/settings/settings_action_menu_test.js
@@ -0,0 +1,111 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @fileoverview Tests for settings-action-menu element. */
+suite('SettingsActionMenu', function() {
+  /** @type {?SettingsActionMenuElement} */
+  var menu = null;
+
+  /** @type {?NodeList<HTMLElement>} */
+  var items = null;
+
+  setup(function() {
+    PolymerTest.clearBody();
+
+    document.body.innerHTML = `
+      <button id="dots">...</button>
+      <dialog is="settings-action-menu">
+        <button class="dropdown-item">Un</button>
+        <button class="dropdown-item">Dos</button>
+        <button class="dropdown-item">Tres</button>
+      </dialog>
+    `;
+
+    menu = document.querySelector('dialog[is=settings-action-menu]');
+    items = menu.querySelectorAll('.dropdown-item');
+    assertEquals(3, items.length);
+  });
+
+  teardown(function() {
+    if (menu.open)
+      menu.close();
+  });
+
+  test('focus after showing', function() {
+    /** @param {!HTMLElement} element */
+    function assertFocused(element) {
+      assertEquals(element, menu.root.activeElement);
+      items.forEach(function(item, i) {
+        assertEquals(element === item, item.hasAttribute('autofocus'));
+      });
+    }
+
+    menu.showAt(document.querySelector('#dots'));
+    assertFocused(items[0]);
+
+    menu.close();
+    items[0].hidden = true;
+    menu.showAt(document.querySelector('#dots'));
+    assertFocused(items[1]);
+
+    menu.close();
+    items[1].hidden = true;
+    menu.showAt(document.querySelector('#dots'));
+    assertFocused(items[2]);
+
+    menu.close();
+    items[2].disabled = true;
+    menu.showAt(document.querySelector('#dots'));
+    assertEquals(null, menu.root.activeElement);
+    assertEquals(0, menu.querySelectorAll('[autofocus]').length);
+  });
+
+  test('focus after down/up arrow', function() {
+    function down() {
+      MockInteractions.keyDownOn(menu, 'ArrowDown', [], 'ArrowDown');
+    }
+
+    function up() {
+      MockInteractions.keyDownOn(menu, 'ArrowUp', [], 'ArrowUp');
+    }
+
+    menu.showAt(document.querySelector('#dots'));
+    assertEquals(items[0], menu.root.activeElement);
+
+    down();
+    assertEquals(items[1], menu.root.activeElement);
+    down();
+    assertEquals(items[2], menu.root.activeElement);
+    down();
+    assertEquals(items[0], menu.root.activeElement);
+    up();
+    assertEquals(items[2], menu.root.activeElement);
+    up();
+    assertEquals(items[1], menu.root.activeElement);
+    up();
+    assertEquals(items[0], menu.root.activeElement);
+    up();
+    assertEquals(items[2], menu.root.activeElement);
+
+    items[1].disabled = true;
+    up();
+    assertEquals(items[0], menu.root.activeElement);
+  });
+
+  test('close on resize', function() {
+    menu.showAt(document.querySelector('#dots'));
+    assertTrue(menu.open);
+
+    window.dispatchEvent(new CustomEvent('resize'));
+    assertFalse(menu.open);
+  });
+
+  test('close on Tab', function() {
+    menu.showAt(document.querySelector('#dots'));
+    assertTrue(menu.open);
+
+    MockInteractions.keyDownOn(menu, 'Tab', [], 'Tab');
+    assertFalse(menu.open);
+  });
+});
diff --git a/chrome/test/data/webui/settings/site_list_tests.js b/chrome/test/data/webui/settings/site_list_tests.js
index 78596029..72cf641 100644
--- a/chrome/test/data/webui/settings/site_list_tests.js
+++ b/chrome/test/data/webui/settings/site_list_tests.js
@@ -583,6 +583,7 @@
             settings.PermissionValues.ALLOW, prefs);
         return browserProxy.whenCalled('getExceptionList').then(
             function(contentType) {
+              testElement.enableSiteSettings_ = true;
               assertEquals(
                   settings.ContentSettingsTypes.GEOLOCATION, contentType);
 
@@ -705,6 +706,7 @@
               var resolver = new PromiseResolver();
               testElement.async(resolver.resolve);
               return resolver.promise.then(function() {
+                testElement.enableSiteSettings_ = true;
                 // All Sites calls getExceptionList for all categories, starting
                 // with Cookies.
                 assertEquals(
@@ -749,6 +751,7 @@
               var resolver = new PromiseResolver();
               testElement.async(resolver.resolve);
               return resolver.promise.then(function() {
+                testElement.enableSiteSettings_ = true;
                 // All Sites calls getExceptionList for all categories, starting
                 // with Cookies.
                 assertEquals(
diff --git a/chrome/test/nacl/nacl_browsertest_util.h b/chrome/test/nacl/nacl_browsertest_util.h
index 5b7a5dd..a16881b 100644
--- a/chrome/test/nacl/nacl_browsertest_util.h
+++ b/chrome/test/nacl/nacl_browsertest_util.h
@@ -196,10 +196,11 @@
 
 // Similar to MAYBE_NONSFI, this is available only on x86-32, x86-64 or
 // ARM linux.
-// TODO(crbug.com/579804) -- tests disabled on Linux for flakiness.
-#if defined(OS_LINUX) && \
+#if defined(OS_LINUX) && !defined(ADDRESS_SANITIZER) && \
+    !defined(THREAD_SANITIZER) && !defined(MEMORY_SANITIZER) && \
+    !defined(LEAK_SANITIZER) && \
     (defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL))
-#  define MAYBE_PNACL_NONSFI(test_case) DISABLED_##test_case
+#  define MAYBE_PNACL_NONSFI(test_case) test_case
 #else
 #  define MAYBE_PNACL_NONSFI(test_case) DISABLED_##test_case
 #endif
diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn
index 46866beb..e44a96c 100644
--- a/chrome/utility/BUILD.gn
+++ b/chrome/utility/BUILD.gn
@@ -50,7 +50,7 @@
     "//courgette:courgette_lib",
     "//media",
     "//net:net_with_v8",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//sql",
     "//third_party/libxml",
diff --git a/chrome/utility/DEPS b/chrome/utility/DEPS
index bfa7073..a43b1da 100644
--- a/chrome/utility/DEPS
+++ b/chrome/utility/DEPS
@@ -8,7 +8,7 @@
   "+courgette",
   "+extensions/common",
   "+media",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+skia/ext",
   "+third_party/libxml",
   "+third_party/zlib/google",
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index 7fcf170..c4f4989 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -26,7 +26,7 @@
 #include "courgette/third_party/bsdiff/bsdiff.h"
 #include "ipc/ipc_channel.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/zlib/google/zip.h"
 #include "ui/gfx/geometry/size.h"
 
@@ -190,11 +190,11 @@
 }
 
 void ChromeContentUtilityClient::ExposeInterfacesToBrowser(
-    shell::InterfaceRegistry* registry) {
+    service_manager::InterfaceRegistry* registry) {
   // When the utility process is running with elevated privileges, we need to
   // filter messages so that only a whitelist of IPCs can run. In Mojo, there's
   // no way of filtering individual messages. Instead, we can avoid adding
-  // non-whitelisted Mojo services to the shell::InterfaceRegistry.
+  // non-whitelisted Mojo services to the service_manager::InterfaceRegistry.
   // TODO(amistry): Use a whitelist once the whistlisted IPCs have been
   // converted to Mojo.
   if (filter_messages_)
diff --git a/chrome/utility/chrome_content_utility_client.h b/chrome/utility/chrome_content_utility_client.h
index 0d9c9552..0f2f481f 100644
--- a/chrome/utility/chrome_content_utility_client.h
+++ b/chrome/utility/chrome_content_utility_client.h
@@ -33,7 +33,8 @@
 
   void UtilityThreadStarted() override;
   bool OnMessageReceived(const IPC::Message& message) override;
-  void ExposeInterfacesToBrowser(shell::InterfaceRegistry* registry) override;
+  void ExposeInterfacesToBrowser(
+      service_manager::InterfaceRegistry* registry) override;
 
   void AddHandler(std::unique_ptr<UtilityMessageHandler> handler);
 
diff --git a/chrome/utility/importer/safari_importer.mm b/chrome/utility/importer/safari_importer.mm
index a719a102..035c761 100644
--- a/chrome/utility/importer/safari_importer.mm
+++ b/chrome/utility/importer/safari_importer.mm
@@ -294,7 +294,7 @@
   // Safari stores it's passwords in the Keychain, same as us so we don't need
   // to import them.
   // Note: that we don't automatically pick them up, there is some logic around
-  // the user needing to explicitly input his username in a page and blurring
+  // the user needing to explicitly input their username in a page and blurring
   // the field before we pick it up, but the details of that are beyond the
   // scope of this comment.
 }
diff --git a/chromecast/browser/DEPS b/chromecast/browser/DEPS
index 8b763cd2..e030bf1 100644
--- a/chromecast/browser/DEPS
+++ b/chromecast/browser/DEPS
@@ -20,7 +20,7 @@
   "+media/mojo",
   "+mojo/public",
   "+net",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+ui/aura",
   "+ui/base",
   "+ui/compositor",
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc
index 2b50d7ee..e32cf18 100644
--- a/chromecast/browser/cast_content_browser_client.cc
+++ b/chromecast/browser/cast_content_browser_client.cc
@@ -55,7 +55,7 @@
 #include "content/public/common/web_preferences.h"
 #include "net/ssl/ssl_cert_request_info.h"
 #include "net/url_request/url_request_context_getter.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/display/display.h"
 #include "ui/display/screen.h"
@@ -77,7 +77,7 @@
 
 namespace {
 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
-static std::unique_ptr<::shell::Service> CreateMojoMediaApplication(
+static std::unique_ptr<service_manager::Service> CreateMojoMediaApplication(
     CastContentBrowserClient* browser_client,
     const base::Closure& quit_closure) {
   std::unique_ptr<media::CastMojoMediaClient> mojo_media_client(
@@ -88,7 +88,7 @@
                      base::Unretained(browser_client)),
           browser_client->GetVideoResolutionPolicy(),
           browser_client->media_resource_tracker()));
-  return std::unique_ptr<::shell::Service>(
+  return std::unique_ptr<service_manager::Service>(
       new ::media::MojoMediaApplication(std::move(mojo_media_client),
                                         quit_closure));
 }
@@ -416,7 +416,7 @@
 }
 
 void CastContentBrowserClient::ExposeInterfacesToRenderer(
-    ::shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     content::RenderProcessHost* render_process_host) {
   registry->AddInterface(
       base::Bind(&media::MediaCapsImpl::AddBinding,
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h
index 27a0c53..a2a98e9 100644
--- a/chromecast/browser/cast_content_browser_client.h
+++ b/chromecast/browser/cast_content_browser_client.h
@@ -29,7 +29,7 @@
 class MetricsService;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
@@ -149,7 +149,7 @@
       int opener_render_frame_id,
       bool* no_javascript_access) override;
   void ExposeInterfacesToRenderer(
-      ::shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       content::RenderProcessHost* render_process_host) override;
   void RegisterInProcessServices(StaticServiceMap* services) override;
   std::unique_ptr<base::Value> GetServiceManifestOverlay(
diff --git a/chromecast/browser/media/BUILD.gn b/chromecast/browser/media/BUILD.gn
index 433a818..5e6fcd2e 100644
--- a/chromecast/browser/media/BUILD.gn
+++ b/chromecast/browser/media/BUILD.gn
@@ -26,7 +26,7 @@
     public_deps = [
       "//media/mojo/interfaces",
       "//media/mojo/services",
-      "//services/shell/public/cpp",
+      "//services/service_manager/public/cpp",
     ]
   }
 
diff --git a/chromecast/browser/media/cast_mojo_media_client.cc b/chromecast/browser/media/cast_mojo_media_client.cc
index ebb707f8..9681240 100644
--- a/chromecast/browser/media/cast_mojo_media_client.cc
+++ b/chromecast/browser/media/cast_mojo_media_client.cc
@@ -19,7 +19,8 @@
 // CastAudioRendererSink is only used to hold audio-device-id.
 class CastAudioRendererSink : public ::media::AudioRendererSink {
  public:
-  CastAudioRendererSink(const std::string& device_id) : device_id_(device_id) {}
+  explicit CastAudioRendererSink(const std::string& device_id)
+      : device_id_(device_id) {}
 
   // ::media::AudioRendererSink implementation.
   void Initialize(const ::media::AudioParameters& params,
@@ -113,7 +114,7 @@
 }
 
 std::unique_ptr<::media::CdmFactory> CastMojoMediaClient::CreateCdmFactory(
-    ::shell::mojom::InterfaceProvider* interface_provider) {
+    service_manager::mojom::InterfaceProvider* interface_provider) {
   return create_cdm_factory_cb_.Run();
 }
 
diff --git a/chromecast/browser/media/cast_mojo_media_client.h b/chromecast/browser/media/cast_mojo_media_client.h
index b896a49..4696f053 100644
--- a/chromecast/browser/media/cast_mojo_media_client.h
+++ b/chromecast/browser/media/cast_mojo_media_client.h
@@ -31,7 +31,7 @@
   std::unique_ptr<::media::RendererFactory> CreateRendererFactory(
       const scoped_refptr<::media::MediaLog>& media_log) override;
   std::unique_ptr<::media::CdmFactory> CreateCdmFactory(
-      ::shell::mojom::InterfaceProvider* interface_provider) override;
+      service_manager::mojom::InterfaceProvider* interface_provider) override;
 
  private:
   const CreateMediaPipelineBackendCB create_backend_cb_;
diff --git a/chromecast/graphics/cast_vsync_settings.cc b/chromecast/graphics/cast_vsync_settings.cc
index 5c2a951..dd908a5 100644
--- a/chromecast/graphics/cast_vsync_settings.cc
+++ b/chromecast/graphics/cast_vsync_settings.cc
@@ -22,8 +22,8 @@
   if (interval_ == interval)
     return;
   interval_ = interval;
-  FOR_EACH_OBSERVER(Observer, observers_,
-                    OnVSyncIntervalChanged(interval));
+  for (auto& observer : observers_)
+    observer.OnVSyncIntervalChanged(interval);
 }
 
 void CastVSyncSettings::AddObserver(Observer* observer) {
diff --git a/chromecast/renderer/BUILD.gn b/chromecast/renderer/BUILD.gn
index 93a808d..5dd2a3f 100644
--- a/chromecast/renderer/BUILD.gn
+++ b/chromecast/renderer/BUILD.gn
@@ -43,7 +43,7 @@
     "//gin:gin",
     "//ipc",
     "//media",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/widevine/cdm:headers",
   ]
 }
diff --git a/chromecast/renderer/DEPS b/chromecast/renderer/DEPS
index 43f23cbc..3ab7279 100644
--- a/chromecast/renderer/DEPS
+++ b/chromecast/renderer/DEPS
@@ -11,7 +11,7 @@
   "+media/base",
   "+media/media_features.h",
   "+media/renderers",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+third_party/WebKit/public/platform",
   "+third_party/WebKit/public/web",
   "+ui/base/resource",
diff --git a/chromecast/renderer/cast_content_renderer_client.cc b/chromecast/renderer/cast_content_renderer_client.cc
index 8894b89c..81021b27 100644
--- a/chromecast/renderer/cast_content_renderer_client.cc
+++ b/chromecast/renderer/cast_content_renderer_client.cc
@@ -29,7 +29,7 @@
 #include "gin/per_context_data.h"
 #include "gin/public/context_holder.h"
 #include "media/base/media.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/WebColor.h"
 #include "third_party/WebKit/public/web/WebFrameWidget.h"
 #include "third_party/WebKit/public/web/WebKit.h"
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM
index b216d87..d148364d 100644
--- a/chromeos/CHROMEOS_LKGM
+++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@
-8894.0.0
\ No newline at end of file
+8898.0.0
\ No newline at end of file
diff --git a/chromeos/audio/audio_devices_pref_handler_impl.cc b/chromeos/audio/audio_devices_pref_handler_impl.cc
index 3a25f56..3024bfd 100644
--- a/chromeos/audio/audio_devices_pref_handler_impl.cc
+++ b/chromeos/audio/audio_devices_pref_handler_impl.cc
@@ -244,9 +244,8 @@
 }
 
 void AudioDevicesPrefHandlerImpl::NotifyAudioPolicyChange() {
-  FOR_EACH_OBSERVER(AudioPrefObserver,
-                    observers_,
-                    OnAudioPolicyPrefChanged());
+  for (auto& observer : observers_)
+    observer.OnAudioPolicyPrefChanged();
 }
 
 // static
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index c085b4a..d75f3e37 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -348,9 +348,8 @@
         SetGlobalOutputChannelRemix(output_channels_, kStereoToStereo);
   }
 
-  FOR_EACH_OBSERVER(
-      AudioObserver, observers_,
-      OnOuputChannelRemixingChanged(mono_on));
+  for (auto& observer : observers_)
+    observer.OnOuputChannelRemixingChanged(mono_on);
 }
 
 bool CrasAudioHandler::IsOutputMonoEnabled() const {
@@ -413,9 +412,8 @@
     }
   }
 
-  FOR_EACH_OBSERVER(
-      AudioObserver, observers_,
-      OnOutputMuteChanged(output_mute_on_, false /* system_adjust */));
+  for (auto& observer : observers_)
+    observer.OnOutputMuteChanged(output_mute_on_, false /* system_adjust */);
 }
 
 void CrasAudioHandler::AdjustOutputVolumeToAudibleLevel() {
@@ -428,8 +426,8 @@
 
 void CrasAudioHandler::SetInputMute(bool mute_on) {
   SetInputMuteInternal(mute_on);
-  FOR_EACH_OBSERVER(AudioObserver, observers_,
-                    OnInputMuteChanged(input_mute_on_));
+  for (auto& observer : observers_)
+    observer.OnInputMuteChanged(input_mute_on_);
 }
 
 void CrasAudioHandler::SetActiveDevice(const AudioDevice& active_device,
@@ -647,8 +645,8 @@
     initializing_audio_state_ = false;
 
   if (should_notify) {
-    FOR_EACH_OBSERVER(AudioObserver, observers_,
-                      OnOutputNodeVolumeChanged(node_id, volume));
+    for (auto& observer : observers_)
+      observer.OnOutputNodeVolumeChanged(node_id, volume);
   }
 }
 
@@ -886,8 +884,8 @@
 
   if (device->active) {
     SetInputNodeGain(node_id, gain_percent);
-    FOR_EACH_OBSERVER(AudioObserver, observers_,
-                      OnInputNodeGainChanged(node_id, gain_percent));
+    for (auto& observer : observers_)
+      observer.OnInputNodeGainChanged(node_id, gain_percent);
   }
 }
 
@@ -1017,9 +1015,11 @@
 
 void CrasAudioHandler::NotifyActiveNodeChanged(bool is_input) {
   if (is_input)
-    FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveInputNodeChanged());
+    for (auto& observer : observers_)
+      observer.OnActiveInputNodeChanged();
   else
-    FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveOutputNodeChanged());
+    for (auto& observer : observers_)
+      observer.OnActiveOutputNodeChanged();
 }
 
 bool CrasAudioHandler::GetActiveDeviceFromUserPref(bool is_input,
@@ -1300,7 +1300,8 @@
   }
 
   UpdateDevicesAndSwitchActive(node_list);
-  FOR_EACH_OBSERVER(AudioObserver, observers_, OnAudioNodesChanged());
+  for (auto& observer : observers_)
+    observer.OnAudioNodesChanged();
 }
 
 void CrasAudioHandler::HandleGetNodesError(const std::string& error_name,
@@ -1374,9 +1375,10 @@
     SetOutputMuteInternal(false);
 
     // Notify UI about the mute state change.
-    FOR_EACH_OBSERVER(
-        AudioObserver, observers_,
-        OnOutputMuteChanged(output_mute_on_, true /* system adjustment */));
+    for (auto& observer : observers_) {
+      observer.OnOutputMuteChanged(output_mute_on_,
+                                   true /* system adjustment */);
+    }
   }
 }
 
diff --git a/chromeos/cert_loader.cc b/chromeos/cert_loader.cc
index 22efff5b..5532300 100644
--- a/chromeos/cert_loader.cc
+++ b/chromeos/cert_loader.cc
@@ -170,8 +170,8 @@
 }
 
 void CertLoader::NotifyCertificatesLoaded(bool initial_load) {
-  FOR_EACH_OBSERVER(Observer, observers_,
-                    OnCertificatesLoaded(*cert_list_, initial_load));
+  for (auto& observer : observers_)
+    observer.OnCertificatesLoaded(*cert_list_, initial_load);
 }
 
 void CertLoader::OnCertDBChanged(const net::X509Certificate* cert) {
diff --git a/chromeos/dbus/cras_audio_client.cc b/chromeos/dbus/cras_audio_client.cc
index e9957ec..acf24ed 100644
--- a/chromeos/dbus/cras_audio_client.cc
+++ b/chromeos/dbus/cras_audio_client.cc
@@ -279,7 +279,8 @@
 
   void NameOwnerChangedReceived(const std::string& old_owner,
                                 const std::string& new_owner) {
-    FOR_EACH_OBSERVER(Observer, observers_, AudioClientRestarted());
+    for (auto& observer : observers_)
+      observer.AudioClientRestarted();
   }
 
   // Called when a OutputMuteChanged signal is received.
@@ -292,7 +293,8 @@
       LOG(ERROR) << "Error reading signal from cras:"
                  << signal->ToString();
     }
-    FOR_EACH_OBSERVER(Observer, observers_, OutputMuteChanged(user_mute));
+    for (auto& observer : observers_)
+      observer.OutputMuteChanged(user_mute);
   }
 
   // Called when a InputMuteChanged signal is received.
@@ -303,11 +305,13 @@
       LOG(ERROR) << "Error reading signal from cras:"
                  << signal->ToString();
     }
-    FOR_EACH_OBSERVER(Observer, observers_, InputMuteChanged(mute));
+    for (auto& observer : observers_)
+      observer.InputMuteChanged(mute);
   }
 
   void NodesChangedReceived(dbus::Signal* signal) {
-    FOR_EACH_OBSERVER(Observer, observers_, NodesChanged());
+    for (auto& observer : observers_)
+      observer.NodesChanged();
   }
 
   void ActiveOutputNodeChangedReceived(dbus::Signal* signal) {
@@ -317,7 +321,8 @@
       LOG(ERROR) << "Error reading signal from cras:"
                  << signal->ToString();
     }
-    FOR_EACH_OBSERVER(Observer, observers_, ActiveOutputNodeChanged(node_id));
+    for (auto& observer : observers_)
+      observer.ActiveOutputNodeChanged(node_id);
   }
 
   void ActiveInputNodeChangedReceived(dbus::Signal* signal) {
@@ -327,7 +332,8 @@
       LOG(ERROR) << "Error reading signal from cras:"
                  << signal->ToString();
     }
-    FOR_EACH_OBSERVER(Observer, observers_, ActiveInputNodeChanged(node_id));
+    for (auto& observer : observers_)
+      observer.ActiveInputNodeChanged(node_id);
   }
 
   void OutputNodeVolumeChangedReceived(dbus::Signal* signal) {
@@ -341,8 +347,8 @@
     if (!reader.PopInt32(&volume)) {
       LOG(ERROR) << "Error eading signal from cras:" << signal->ToString();
     }
-    FOR_EACH_OBSERVER(Observer, observers_,
-                      OutputNodeVolumeChanged(node_id, volume));
+    for (auto& observer : observers_)
+      observer.OutputNodeVolumeChanged(node_id, volume);
   }
 
   void OnGetVolumeState(const GetVolumeStateCallback& callback,
diff --git a/chromeos/dbus/fake_cras_audio_client.cc b/chromeos/dbus/fake_cras_audio_client.cc
index 3ee4c4d4..78db0ed 100644
--- a/chromeos/dbus/fake_cras_audio_client.cc
+++ b/chromeos/dbus/fake_cras_audio_client.cc
@@ -113,8 +113,8 @@
 
 void FakeCrasAudioClient::SetOutputUserMute(bool mute_on) {
   volume_state_.output_user_mute = mute_on;
-  FOR_EACH_OBSERVER(Observer, observers_,
-                    OutputMuteChanged(volume_state_.output_user_mute));
+  for (auto& observer : observers_)
+    observer.OutputMuteChanged(volume_state_.output_user_mute);
 }
 
 void FakeCrasAudioClient::SetInputNodeGain(uint64_t node_id,
@@ -122,8 +122,8 @@
 
 void FakeCrasAudioClient::SetInputMute(bool mute_on) {
   volume_state_.input_mute = mute_on;
-  FOR_EACH_OBSERVER(Observer, observers_,
-                    InputMuteChanged(volume_state_.input_mute));
+  for (auto& observer : observers_)
+    observer.InputMuteChanged(volume_state_.input_mute);
 }
 
 void FakeCrasAudioClient::SetActiveOutputNode(uint64_t node_id) {
@@ -137,7 +137,8 @@
       node_list_[i].active = true;
   }
   active_output_node_id_ = node_id;
-  FOR_EACH_OBSERVER(Observer, observers_, ActiveOutputNodeChanged(node_id));
+  for (auto& observer : observers_)
+    observer.ActiveOutputNodeChanged(node_id);
 }
 
 void FakeCrasAudioClient::SetActiveInputNode(uint64_t node_id) {
@@ -151,7 +152,8 @@
       node_list_[i].active = true;
   }
   active_input_node_id_ = node_id;
-  FOR_EACH_OBSERVER(Observer, observers_, ActiveInputNodeChanged(node_id));
+  for (auto& observer : observers_)
+    observer.ActiveInputNodeChanged(node_id);
 }
 
 void FakeCrasAudioClient::AddActiveInputNode(uint64_t node_id) {
@@ -198,14 +200,16 @@
     (*iter) = audio_node;
   else
     node_list_.push_back(audio_node);
-  FOR_EACH_OBSERVER(Observer, observers_, NodesChanged());
+  for (auto& observer : observers_)
+    observer.NodesChanged();
 }
 
 void FakeCrasAudioClient::RemoveAudioNodeFromList(const uint64_t& node_id) {
   auto iter = FindNode(node_id);
   if (iter != node_list_.end()) {
     node_list_.erase(iter);
-    FOR_EACH_OBSERVER(Observer, observers_, NodesChanged());
+    for (auto& observer : observers_)
+      observer.NodesChanged();
   }
 }
 
@@ -217,14 +221,15 @@
 void FakeCrasAudioClient::SetAudioNodesAndNotifyObserversForTesting(
     const AudioNodeList& new_nodes) {
   SetAudioNodesForTesting(new_nodes);
-  FOR_EACH_OBSERVER(Observer, observers_, NodesChanged());
+  for (auto& observer : observers_)
+    observer.NodesChanged();
 }
 
 void FakeCrasAudioClient::NotifyOutputNodeVolumeChangedForTesting(
     uint64_t node_id,
     int volume) {
-  FOR_EACH_OBSERVER(Observer, observers_,
-                    OutputNodeVolumeChanged(node_id, volume));
+  for (auto& observer : observers_)
+    observer.OutputNodeVolumeChanged(node_id, volume);
 }
 
 AudioNodeList::iterator FakeCrasAudioClient::FindNode(uint64_t node_id) {
diff --git a/chromeos/dbus/fake_power_manager_client.cc b/chromeos/dbus/fake_power_manager_client.cc
index 1bcbee1..6bee1ea7 100644
--- a/chromeos/dbus/fake_power_manager_client.cc
+++ b/chromeos/dbus/fake_power_manager_client.cc
@@ -164,7 +164,8 @@
 }
 
 void FakePowerManagerClient::SendSuspendImminent() {
-  FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent());
+  for (auto& observer : observers_)
+    observer.SuspendImminent();
   if (render_process_manager_delegate_)
     render_process_manager_delegate_->SuspendImminent();
 }
@@ -173,18 +174,20 @@
   if (render_process_manager_delegate_)
     render_process_manager_delegate_->SuspendDone();
 
-  FOR_EACH_OBSERVER(Observer, observers_, SuspendDone(base::TimeDelta()));
+  for (auto& observer : observers_)
+    observer.SuspendDone(base::TimeDelta());
 }
 
 void FakePowerManagerClient::SendDarkSuspendImminent() {
-  FOR_EACH_OBSERVER(Observer, observers_, DarkSuspendImminent());
+  for (auto& observer : observers_)
+    observer.DarkSuspendImminent();
 }
 
 void FakePowerManagerClient::SendPowerButtonEvent(
     bool down,
     const base::TimeTicks& timestamp) {
-  FOR_EACH_OBSERVER(Observer, observers_,
-                    PowerButtonEventReceived(down, timestamp));
+  for (auto& observer : observers_)
+    observer.PowerButtonEventReceived(down, timestamp);
 }
 
 void FakePowerManagerClient::UpdatePowerProperties(
@@ -194,7 +197,8 @@
 }
 
 void FakePowerManagerClient::NotifyObservers() {
-  FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(props_));
+  for (auto& observer : observers_)
+    observer.PowerChanged(props_);
 }
 
 void FakePowerManagerClient::HandleSuspendReadiness() {
diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc
index 32480a8..b24085c3 100644
--- a/chromeos/dbus/fake_session_manager_client.cc
+++ b/chromeos/dbus/fake_session_manager_client.cc
@@ -124,7 +124,8 @@
   device_policy_ = policy_blob;
   base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
                                                 base::Bind(callback, true));
-  FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(true));
+  for (auto& observer : observers_)
+    observer.PropertyChangeComplete(true);
 }
 
 void FakeSessionManagerClient::StorePolicyForUser(
@@ -237,7 +238,8 @@
 }
 
 void FakeSessionManagerClient::OnPropertyChangeComplete(bool success) {
-  FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success));
+  for (auto& observer : observers_)
+    observer.PropertyChangeComplete(success);
 }
 
 }  // namespace chromeos
diff --git a/chromeos/dbus/fake_shill_device_client.cc b/chromeos/dbus/fake_shill_device_client.cc
index 6a60e817..f1d0e18 100644
--- a/chromeos/dbus/fake_shill_device_client.cc
+++ b/chromeos/dbus/fake_shill_device_client.cc
@@ -604,9 +604,8 @@
         << path << " : " << property;
     return;
   }
-  FOR_EACH_OBSERVER(ShillPropertyChangedObserver,
-                    GetObserverList(device_path),
-                    OnPropertyChanged(property, *value));
+  for (auto& observer : GetObserverList(device_path))
+    observer.OnPropertyChanged(property, *value);
 }
 
 base::DictionaryValue* FakeShillDeviceClient::GetDeviceProperties(
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc
index a4df88b..5be945b 100644
--- a/chromeos/dbus/fake_shill_manager_client.cc
+++ b/chromeos/dbus/fake_shill_manager_client.cc
@@ -966,14 +966,12 @@
   }
   if (property == shill::kServiceCompleteListProperty) {
     std::unique_ptr<base::ListValue> services(GetEnabledServiceList(property));
-    FOR_EACH_OBSERVER(ShillPropertyChangedObserver,
-                      observer_list_,
-                      OnPropertyChanged(property, *(services.get())));
+    for (auto& observer : observer_list_)
+      observer.OnPropertyChanged(property, *(services.get()));
     return;
   }
-  FOR_EACH_OBSERVER(ShillPropertyChangedObserver,
-                    observer_list_,
-                    OnPropertyChanged(property, *value));
+  for (auto& observer : observer_list_)
+    observer.OnPropertyChanged(property, *value);
 }
 
 base::ListValue* FakeShillManagerClient::GetListProperty(
diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc
index cbbcc5ca..33a8169 100644
--- a/chromeos/dbus/fake_shill_service_client.cc
+++ b/chromeos/dbus/fake_shill_service_client.cc
@@ -521,9 +521,8 @@
                << path << " : " << property;
     return;
   }
-  FOR_EACH_OBSERVER(ShillPropertyChangedObserver,
-                    GetObserverList(service_path),
-                    OnPropertyChanged(property, *value));
+  for (auto& observer : GetObserverList(service_path))
+    observer.OnPropertyChanged(property, *value);
 }
 
 base::DictionaryValue* FakeShillServiceClient::GetModifiableServiceProperties(
diff --git a/chromeos/dbus/fake_update_engine_client.cc b/chromeos/dbus/fake_update_engine_client.cc
index a18cf1b1..078a74d2 100644
--- a/chromeos/dbus/fake_update_engine_client.cc
+++ b/chromeos/dbus/fake_update_engine_client.cc
@@ -66,7 +66,8 @@
 
 void FakeUpdateEngineClient::NotifyObserversThatStatusChanged(
     const UpdateEngineClient::Status& status) {
-  FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(status));
+  for (auto& observer : observers_)
+    observer.UpdateStatusChanged(status);
 }
 
 void FakeUpdateEngineClient::SetChannel(const std::string& target_channel,
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc
index 2d8291e1..90097f81 100644
--- a/chromeos/dbus/power_manager_client.cc
+++ b/chromeos/dbus/power_manager_client.cc
@@ -404,7 +404,8 @@
       POWER_LOG(EVENT) << "Sending initial state to power manager";
       RegisterSuspendDelays();
       SetIsProjecting(last_is_projecting_);
-      FOR_EACH_OBSERVER(Observer, observers_, PowerManagerRestarted());
+      for (auto& observer : observers_)
+        observer.PowerManagerRestarted();
     }
   }
 
@@ -420,8 +421,8 @@
     }
     POWER_LOG(DEBUG) << "Brightness changed to " << brightness_level
                      << ": user initiated " << user_initiated;
-    FOR_EACH_OBSERVER(Observer, observers_,
-                      BrightnessChanged(brightness_level, user_initiated));
+    for (auto& observer : observers_)
+      observer.BrightnessChanged(brightness_level, user_initiated);
   }
 
   void PeripheralBatteryStatusReceived(dbus::Signal* signal) {
@@ -441,8 +442,8 @@
     POWER_LOG(DEBUG) << "Device battery status received " << level << " for "
                      << name << " at " << path;
 
-    FOR_EACH_OBSERVER(Observer, observers_,
-                      PeripheralBatteryStatusReceived(path, name, level));
+    for (auto& observer : observers_)
+      observer.PeripheralBatteryStatusReceived(path, name, level);
   }
 
   void PowerSupplyPollReceived(dbus::Signal* signal) {
@@ -512,7 +513,8 @@
 
   void HandlePowerSupplyProperties(
       const power_manager::PowerSupplyProperties& proto) {
-    FOR_EACH_OBSERVER(Observer, observers_, PowerChanged(proto));
+    for (auto& observer : observers_)
+      observer.PowerChanged(proto);
     const bool on_battery = proto.external_power() ==
         power_manager::PowerSupplyProperties_ExternalPower_DISCONNECTED;
     base::PowerMonitorDeviceSource::SetPowerSource(on_battery);
@@ -587,9 +589,11 @@
     // instead of asynchronously.
     notifying_observers_about_suspend_imminent_ = true;
     if (suspending_from_dark_resume_)
-      FOR_EACH_OBSERVER(Observer, observers_, DarkSuspendImminent());
+      for (auto& observer : observers_)
+        observer.DarkSuspendImminent();
     else
-      FOR_EACH_OBSERVER(Observer, observers_, SuspendImminent());
+      for (auto& observer : observers_)
+        observer.SuspendImminent();
     notifying_observers_about_suspend_imminent_ = false;
 
     base::PowerMonitorDeviceSource::HandleSystemSuspending();
@@ -629,8 +633,8 @@
     suspending_from_dark_resume_ = false;
     num_pending_suspend_readiness_callbacks_ = 0;
 
-    FOR_EACH_OBSERVER(
-        PowerManagerClient::Observer, observers_, SuspendDone(duration));
+    for (auto& observer : observers_)
+      observer.SuspendDone(duration);
     base::PowerMonitorDeviceSource::HandleSystemResumed();
   }
 
@@ -642,13 +646,15 @@
                        << power_manager::kIdleActionImminentSignal << " signal";
       return;
     }
-    FOR_EACH_OBSERVER(Observer, observers_,
-        IdleActionImminent(base::TimeDelta::FromInternalValue(
-            proto.time_until_idle_action())));
+    for (auto& observer : observers_) {
+      observer.IdleActionImminent(
+          base::TimeDelta::FromInternalValue(proto.time_until_idle_action()));
+    }
   }
 
   void IdleActionDeferredReceived(dbus::Signal* signal) {
-    FOR_EACH_OBSERVER(Observer, observers_, IdleActionDeferred());
+    for (auto& observer : observers_)
+      observer.IdleActionDeferred();
   }
 
   void InputEventReceived(dbus::Signal* signal) {
@@ -670,8 +676,8 @@
       case power_manager::InputEvent_Type_POWER_BUTTON_UP: {
         const bool down =
             (proto.type() == power_manager::InputEvent_Type_POWER_BUTTON_DOWN);
-        FOR_EACH_OBSERVER(PowerManagerClient::Observer, observers_,
-                          PowerButtonEventReceived(down, timestamp));
+        for (auto& observer : observers_)
+          observer.PowerButtonEventReceived(down, timestamp);
 
         // Tell powerd that Chrome has handled power button presses.
         if (down) {
@@ -691,16 +697,16 @@
       case power_manager::InputEvent_Type_LID_CLOSED: {
         bool open =
             (proto.type() == power_manager::InputEvent_Type_LID_OPEN);
-        FOR_EACH_OBSERVER(PowerManagerClient::Observer, observers_,
-                          LidEventReceived(open, timestamp));
+        for (auto& observer : observers_)
+          observer.LidEventReceived(open, timestamp);
         break;
       }
       case power_manager::InputEvent_Type_TABLET_MODE_ON:
       case power_manager::InputEvent_Type_TABLET_MODE_OFF: {
         bool on =
             (proto.type() == power_manager::InputEvent_Type_TABLET_MODE_ON);
-        FOR_EACH_OBSERVER(PowerManagerClient::Observer, observers_,
-                          TabletModeEventReceived(on, timestamp));
+        for (auto& observer : observers_)
+          observer.TabletModeEventReceived(on, timestamp);
         break;
       }
     }
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc
index 234f1e9..341323d 100644
--- a/chromeos/dbus/session_manager_client.cc
+++ b/chromeos/dbus/session_manager_client.cc
@@ -105,7 +105,8 @@
   void EmitLoginPromptVisible() override {
     SimpleMethodCallToSessionManager(
         login_manager::kSessionManagerEmitLoginPromptVisible);
-    FOR_EACH_OBSERVER(Observer, observers_, EmitLoginPromptVisibleCalled());
+    for (auto& observer : observers_)
+      observer.EmitLoginPromptVisibleCalled();
   }
 
   void RestartJob(int socket_fd,
@@ -600,7 +601,8 @@
     }
     const bool success = base::StartsWith(result_string, "success",
                                           base::CompareCase::INSENSITIVE_ASCII);
-    FOR_EACH_OBSERVER(Observer, observers_, OwnerKeySet(success));
+    for (auto& observer : observers_)
+      observer.OwnerKeySet(success);
   }
 
   // Called when the property change complete signal is received.
@@ -613,17 +615,20 @@
     }
     const bool success = base::StartsWith(result_string, "success",
                                           base::CompareCase::INSENSITIVE_ASCII);
-    FOR_EACH_OBSERVER(Observer, observers_, PropertyChangeComplete(success));
+    for (auto& observer : observers_)
+      observer.PropertyChangeComplete(success);
   }
 
   void ScreenIsLockedReceived(dbus::Signal* signal) {
     screen_is_locked_ = true;
-    FOR_EACH_OBSERVER(Observer, observers_, ScreenIsLocked());
+    for (auto& observer : observers_)
+      observer.ScreenIsLocked();
   }
 
   void ScreenIsUnlockedReceived(dbus::Signal* signal) {
     screen_is_locked_ = false;
-    FOR_EACH_OBSERVER(Observer, observers_, ScreenIsUnlocked());
+    for (auto& observer : observers_)
+      observer.ScreenIsUnlocked();
   }
 
   void ArcInstanceStoppedReceived(dbus::Signal* signal) {
@@ -633,7 +638,8 @@
       LOG(ERROR) << "Invalid signal: " << signal->ToString();
       return;
     }
-    FOR_EACH_OBSERVER(Observer, observers_, ArcInstanceStopped(clean));
+    for (auto& observer : observers_)
+      observer.ArcInstanceStopped(clean);
   }
 
   // Called when the object is connected to the signal.
@@ -794,11 +800,13 @@
   }
   void NotifyLockScreenShown() override {
     screen_is_locked_ = true;
-    FOR_EACH_OBSERVER(Observer, observers_, ScreenIsLocked());
+    for (auto& observer : observers_)
+      observer.ScreenIsLocked();
   }
   void NotifyLockScreenDismissed() override {
     screen_is_locked_ = false;
-    FOR_EACH_OBSERVER(Observer, observers_, ScreenIsUnlocked());
+    for (auto& observer : observers_)
+      observer.ScreenIsUnlocked();
   }
   void RetrieveActiveSessions(const ActiveSessionsCallback& callback) override {
   }
diff --git a/chromeos/dbus/shill_client_helper.cc b/chromeos/dbus/shill_client_helper.cc
index 47970246..647c473 100644
--- a/chromeos/dbus/shill_client_helper.cc
+++ b/chromeos/dbus/shill_client_helper.cc
@@ -547,8 +547,8 @@
   if (!value.get())
     return;
 
-  FOR_EACH_OBSERVER(ShillPropertyChangedObserver, observer_list_,
-                    OnPropertyChanged(name, *value));
+  for (auto& observer : observer_list_)
+    observer.OnPropertyChanged(name, *value);
 }
 
 }  // namespace chromeos
diff --git a/chromeos/dbus/system_clock_client.cc b/chromeos/dbus/system_clock_client.cc
index 600536d..fe27f58e 100644
--- a/chromeos/dbus/system_clock_client.cc
+++ b/chromeos/dbus/system_clock_client.cc
@@ -84,7 +84,8 @@
   void TimeUpdatedReceived(dbus::Signal* signal) {
     VLOG(1) << "TimeUpdated signal received: " << signal->ToString();
     dbus::MessageReader reader(signal);
-    FOR_EACH_OBSERVER(Observer, observers_, SystemClockUpdated());
+    for (auto& observer : observers_)
+      observer.SystemClockUpdated();
 
     // Check if the system clock can be changed now.
     GetCanSet();
@@ -119,8 +120,8 @@
     can_set_time_initialized_ = true;
     can_set_time_ = can_set_time;
 
-    FOR_EACH_OBSERVER(
-        Observer, observers_, SystemClockCanSetTimeChanged(can_set_time));
+    for (auto& observer : observers_)
+      observer.SystemClockCanSetTimeChanged(can_set_time);
   }
 
   // Check whether the time can be set.
diff --git a/chromeos/dbus/update_engine_client.cc b/chromeos/dbus/update_engine_client.cc
index 0bd247ae..d772d00 100644
--- a/chromeos/dbus/update_engine_client.cc
+++ b/chromeos/dbus/update_engine_client.cc
@@ -328,7 +328,8 @@
     }
     status.status = UpdateStatusFromString(current_operation);
     last_status_ = status;
-    FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(status));
+    for (auto& observer : observers_)
+      observer.UpdateStatusChanged(status);
   }
 
   // Called when GetStatus call failed.
@@ -419,7 +420,8 @@
     status.new_size = new_size;
 
     last_status_ = status;
-    FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(status));
+    for (auto& observer : observers_)
+      observer.UpdateStatusChanged(status);
   }
 
   // Called when the status update signal is initially connected.
@@ -566,7 +568,8 @@
         break;
     }
     last_status_.status = next_status;
-    FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(last_status_));
+    for (auto& observer : observers_)
+      observer.UpdateStatusChanged(last_status_);
     if (last_status_.status != UPDATE_STATUS_IDLE) {
       base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
           FROM_HERE, base::Bind(&UpdateEngineClientFakeImpl::StateTransition,
diff --git a/chromeos/disks/disk_mount_manager.cc b/chromeos/disks/disk_mount_manager.cc
index 8f94af3..c5d3737 100644
--- a/chromeos/disks/disk_mount_manager.cc
+++ b/chromeos/disks/disk_mount_manager.cc
@@ -608,28 +608,30 @@
   // Notifies all observers about disk status update.
   void NotifyDiskStatusUpdate(DiskEvent event,
                               const Disk* disk) {
-    FOR_EACH_OBSERVER(Observer, observers_, OnDiskEvent(event, disk));
+    for (auto& observer : observers_)
+      observer.OnDiskEvent(event, disk);
   }
 
   // Notifies all observers about device status update.
   void NotifyDeviceStatusUpdate(DeviceEvent event,
                                 const std::string& device_path) {
-    FOR_EACH_OBSERVER(Observer, observers_, OnDeviceEvent(event, device_path));
+    for (auto& observer : observers_)
+      observer.OnDeviceEvent(event, device_path);
   }
 
   // Notifies all observers about mount completion.
   void NotifyMountStatusUpdate(MountEvent event,
                                MountError error_code,
                                const MountPointInfo& mount_info) {
-    FOR_EACH_OBSERVER(Observer, observers_,
-                      OnMountEvent(event, error_code, mount_info));
+    for (auto& observer : observers_)
+      observer.OnMountEvent(event, error_code, mount_info);
   }
 
   void NotifyFormatStatusUpdate(FormatEvent event,
                                 FormatError error_code,
                                 const std::string& device_path) {
-    FOR_EACH_OBSERVER(Observer, observers_,
-                      OnFormatEvent(event, error_code, device_path));
+    for (auto& observer : observers_)
+      observer.OnFormatEvent(event, error_code, device_path);
   }
 
   // Finds system path prefix from |system_path|.
diff --git a/chromeos/disks/mock_disk_mount_manager.cc b/chromeos/disks/mock_disk_mount_manager.cc
index 07596db..99ba785 100644
--- a/chromeos/disks/mock_disk_mount_manager.cc
+++ b/chromeos/disks/mock_disk_mount_manager.cc
@@ -218,12 +218,14 @@
 void MockDiskMountManager::NotifyDiskChanged(
     DiskEvent event,
     const DiskMountManager::Disk* disk) {
-  FOR_EACH_OBSERVER(Observer, observers_, OnDiskEvent(event, disk));
+  for (auto& observer : observers_)
+    observer.OnDiskEvent(event, disk);
 }
 
 void MockDiskMountManager::NotifyDeviceChanged(DeviceEvent event,
                                                const std::string& path) {
-  FOR_EACH_OBSERVER(Observer, observers_, OnDeviceEvent(event, path));
+  for (auto& observer : observers_)
+    observer.OnDeviceEvent(event, path);
 }
 
 }  // namespace disks
diff --git a/chromeos/login/login_state.cc b/chromeos/login/login_state.cc
index 07a7f6b..99c5dfe 100644
--- a/chromeos/login/login_state.cc
+++ b/chromeos/login/login_state.cc
@@ -133,8 +133,8 @@
 }
 
 void LoginState::NotifyObservers() {
-  FOR_EACH_OBSERVER(LoginState::Observer, observer_list_,
-                    LoggedInStateChanged());
+  for (auto& observer : observer_list_)
+    observer.LoggedInStateChanged();
 }
 
 }  // namespace chromeos
diff --git a/chromeos/network/client_cert_resolver.cc b/chromeos/network/client_cert_resolver.cc
index d457b5308..706a6d1 100644
--- a/chromeos/network/client_cert_resolver.cc
+++ b/chromeos/network/client_cert_resolver.cc
@@ -569,7 +569,8 @@
   resolve_task_running_ = false;
   const bool changed = network_properties_changed_;
   network_properties_changed_ = false;
-  FOR_EACH_OBSERVER(Observer, observers_, ResolveRequestCompleted(changed));
+  for (auto& observer : observers_)
+    observer.ResolveRequestCompleted(changed);
 }
 
 base::Time ClientCertResolver::Now() const {
diff --git a/chromeos/network/managed_network_configuration_handler_impl.cc b/chromeos/network/managed_network_configuration_handler_impl.cc
index 71eed8b..c91cfdaa 100644
--- a/chromeos/network/managed_network_configuration_handler_impl.cc
+++ b/chromeos/network/managed_network_configuration_handler_impl.cc
@@ -464,8 +464,8 @@
 
   old_per_network_config.clear();
   ApplyOrQueuePolicies(userhash, &modified_policies);
-  FOR_EACH_OBSERVER(NetworkPolicyObserver, observers_,
-                    PoliciesChanged(userhash));
+  for (auto& observer : observers_)
+    observer.PoliciesChanged(userhash);
 }
 
 bool ManagedNetworkConfigurationHandlerImpl::IsAnyPolicyApplicationRunning()
@@ -604,8 +604,8 @@
     queued_modified_policies_.erase(userhash);
     ApplyOrQueuePolicies(userhash, &modified_policies);
   } else {
-    FOR_EACH_OBSERVER(
-        NetworkPolicyObserver, observers_, PoliciesApplied(userhash));
+    for (auto& observer : observers_)
+      observer.PoliciesApplied(userhash);
   }
 }
 
@@ -730,8 +730,8 @@
     const std::string& guid) {
   if (service_path.empty())
     return;
-  FOR_EACH_OBSERVER(
-      NetworkPolicyObserver, observers_, PolicyAppliedToNetwork(service_path));
+  for (auto& observer : observers_)
+    observer.PolicyAppliedToNetwork(service_path);
 }
 
 // Get{Managed}Properties helpers
diff --git a/chromeos/network/network_configuration_handler.cc b/chromeos/network/network_configuration_handler.cc
index cc3210d..03bf1fb 100644
--- a/chromeos/network/network_configuration_handler.cc
+++ b/chromeos/network/network_configuration_handler.cc
@@ -401,9 +401,10 @@
     DCHECK(!guid.empty());
     callback.Run(service_path.value(), guid);
   }
-  FOR_EACH_OBSERVER(NetworkConfigurationObserver, observers_,
-                    OnConfigurationCreated(service_path.value(), profile_path,
-                                           *configure_properties, source));
+  for (auto& observer : observers_) {
+    observer.OnConfigurationCreated(service_path.value(), profile_path,
+                                    *configure_properties, source);
+  }
   // This may also get called when CreateConfiguration is used to update an
   // existing configuration, so request a service update just in case.
   // TODO(pneubeck): Separate 'Create' and 'Update' calls and only trigger
@@ -417,8 +418,8 @@
     NetworkConfigurationObserver::Source source,
     bool success) {
   if (success) {
-    FOR_EACH_OBSERVER(NetworkConfigurationObserver, observers_,
-                      OnConfigurationRemoved(service_path, guid, source));
+    for (auto& observer : observers_)
+      observer.OnConfigurationRemoved(service_path, guid, source);
   }
   auto iter = profile_entry_deleters_.find(service_path);
   DCHECK(iter != profile_entry_deleters_.end());
@@ -432,9 +433,8 @@
     const base::Closure& callback) {
   if (!callback.is_null())
     callback.Run();
-  FOR_EACH_OBSERVER(
-      NetworkConfigurationObserver, observers_,
-      OnConfigurationProfileChanged(service_path, profile_path, source));
+  for (auto& observer : observers_)
+    observer.OnConfigurationProfileChanged(service_path, profile_path, source);
 }
 
 void NetworkConfigurationHandler::GetPropertiesCallback(
@@ -488,9 +488,10 @@
   if (!network_state)
     return;  // Network no longer exists, do not notify or request update.
 
-  FOR_EACH_OBSERVER(NetworkConfigurationObserver, observers_,
-                    OnPropertiesSet(service_path, network_state->guid(),
-                                    *set_properties, source));
+  for (auto& observer : observers_) {
+    observer.OnPropertiesSet(service_path, network_state->guid(),
+                             *set_properties, source);
+  }
   network_state_handler_->RequestUpdateForNetwork(service_path);
 }
 
diff --git a/chromeos/network/network_connection_handler.cc b/chromeos/network/network_connection_handler.cc
index c4f5856..b79c360c 100644
--- a/chromeos/network/network_connection_handler.cc
+++ b/chromeos/network/network_connection_handler.cc
@@ -226,8 +226,8 @@
     const network_handler::ErrorCallback& error_callback,
     bool check_error_state) {
   NET_LOG_USER("ConnectToNetwork", service_path);
-  FOR_EACH_OBSERVER(NetworkConnectionObserver, observers_,
-                    ConnectToNetworkRequested(service_path));
+  for (auto& observer : observers_)
+    observer.ConnectToNetworkRequested(service_path);
 
   // Clear any existing queued connect request.
   queued_connect_.reset();
@@ -313,8 +313,8 @@
     const base::Closure& success_callback,
     const network_handler::ErrorCallback& error_callback) {
   NET_LOG_USER("DisconnectNetwork", service_path);
-  FOR_EACH_OBSERVER(NetworkConnectionObserver, observers_,
-                    DisconnectRequested(service_path));
+  for (auto& observer : observers_)
+    observer.DisconnectRequested(service_path);
 
   const NetworkState* network =
       network_state_handler_->GetNetworkState(service_path);
@@ -762,8 +762,8 @@
   NET_LOG_EVENT("Connect Request Succeeded", service_path);
   if (!success_callback.is_null())
     success_callback.Run();
-  FOR_EACH_OBSERVER(NetworkConnectionObserver, observers_,
-                    ConnectSucceeded(service_path));
+  for (auto& observer : observers_)
+    observer.ConnectSucceeded(service_path);
 }
 
 void NetworkConnectionHandler::ErrorCallbackForPendingRequest(
@@ -788,8 +788,8 @@
   NET_LOG_ERROR("Connect Failure: " + error_name, service_path);
   network_handler::RunErrorCallback(error_callback, service_path, error_name,
                                     "");
-  FOR_EACH_OBSERVER(NetworkConnectionObserver, observers_,
-                    ConnectFailed(service_path, error_name));
+  for (auto& observer : observers_)
+    observer.ConnectFailed(service_path, error_name);
 }
 
 // Disconnect
diff --git a/chromeos/network/network_profile_handler.cc b/chromeos/network/network_profile_handler.cc
index 0d13ee32..8b4dc17 100644
--- a/chromeos/network/network_profile_handler.cc
+++ b/chromeos/network/network_profile_handler.cc
@@ -156,8 +156,8 @@
 void NetworkProfileHandler::AddProfile(const NetworkProfile& profile) {
   VLOG(2) << "Adding profile " << profile.ToDebugString() << ".";
   profiles_.push_back(profile);
-  FOR_EACH_OBSERVER(NetworkProfileObserver, observers_,
-                    OnProfileAdded(profiles_.back()));
+  for (auto& observer : observers_)
+    observer.OnProfileAdded(profiles_.back());
 }
 
 void NetworkProfileHandler::RemoveProfile(const std::string& profile_path) {
@@ -168,8 +168,8 @@
     return;
   NetworkProfile profile = *found;
   profiles_.erase(found);
-  FOR_EACH_OBSERVER(NetworkProfileObserver, observers_,
-                    OnProfileRemoved(profile));
+  for (auto& observer : observers_)
+    observer.OnProfileRemoved(profile);
 }
 
 const NetworkProfile* NetworkProfileHandler::GetProfileForPath(
diff --git a/chromeos/network/network_sms_handler.cc b/chromeos/network/network_sms_handler.cc
index 943d570..a12a75f 100644
--- a/chromeos/network/network_sms_handler.cc
+++ b/chromeos/network/network_sms_handler.cc
@@ -392,7 +392,8 @@
 
 void NetworkSmsHandler::NotifyMessageReceived(
     const base::DictionaryValue& message) {
-  FOR_EACH_OBSERVER(Observer, observers_, MessageReceived(message));
+  for (auto& observer : observers_)
+    observer.MessageReceived(message);
 }
 
 void NetworkSmsHandler::MessageReceived(const base::DictionaryValue& message) {
diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc
index 7e10125..bf0681c 100644
--- a/chromeos/network/network_state_handler.cc
+++ b/chromeos/network/network_state_handler.cc
@@ -80,7 +80,8 @@
 void NetworkStateHandler::Shutdown() {
   DCHECK(!did_shutdown_);
   did_shutdown_ = true;
-  FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, OnShuttingDown());
+  for (auto& observer : observers_)
+    observer.OnShuttingDown();
 }
 
 void NetworkStateHandler::InitShillPropertyHandler() {
@@ -695,8 +696,8 @@
     // Notify observers that the list of networks has changed.
     NET_LOG_EVENT("NOTIFY:NetworkListChanged",
                   base::StringPrintf("Size:%" PRIuS, network_list_.size()));
-    FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
-                      NetworkListChanged());
+    for (auto& observer : observers_)
+      observer.NetworkListChanged();
   } else if (type == ManagedState::MANAGED_TYPE_DEVICE) {
     std::string devices;
     for (auto iter = device_list_.begin(); iter != device_list_.end(); ++iter) {
@@ -838,8 +839,8 @@
   SCOPED_NET_LOG_IF_SLOW();
   NET_LOG_DEBUG("NOTIFY:DeviceListChanged",
                 base::StringPrintf("Size:%" PRIuS, device_list_.size()));
-  FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
-                    DeviceListChanged());
+  for (auto& observer : observers_)
+    observer.DeviceListChanged();
 }
 
 DeviceState* NetworkStateHandler::GetModifiableDeviceState(
@@ -910,8 +911,8 @@
     desc = "Default" + desc;
   NET_LOG(EVENT) << "NOTIFY: " << desc << ": " << GetLogName(network) << ": "
                  << network->connection_state();
-  FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
-                    NetworkConnectionStateChanged(network));
+  for (auto& observer : observers_)
+    observer.NetworkConnectionStateChanged(network);
   if (notify_default)
     NotifyDefaultNetworkChanged(network);
 }
@@ -920,31 +921,31 @@
     const NetworkState* default_network) {
   SCOPED_NET_LOG_IF_SLOW();
   NET_LOG_EVENT("NOTIFY:DefaultNetworkChanged", GetLogName(default_network));
-  FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
-                    DefaultNetworkChanged(default_network));
+  for (auto& observer : observers_)
+    observer.DefaultNetworkChanged(default_network);
 }
 
 void NetworkStateHandler::NotifyNetworkPropertiesUpdated(
     const NetworkState* network) {
   SCOPED_NET_LOG_IF_SLOW();
   NET_LOG_DEBUG("NOTIFY:NetworkPropertiesUpdated", GetLogName(network));
-  FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
-                    NetworkPropertiesUpdated(network));
+  for (auto& observer : observers_)
+    observer.NetworkPropertiesUpdated(network);
 }
 
 void NetworkStateHandler::NotifyDevicePropertiesUpdated(
     const DeviceState* device) {
   SCOPED_NET_LOG_IF_SLOW();
   NET_LOG_DEBUG("NOTIFY:DevicePropertiesUpdated", GetLogName(device));
-  FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
-                    DevicePropertiesUpdated(device));
+  for (auto& observer : observers_)
+    observer.DevicePropertiesUpdated(device);
 }
 
 void NetworkStateHandler::NotifyScanCompleted(const DeviceState* device) {
   SCOPED_NET_LOG_IF_SLOW();
   NET_LOG_DEBUG("NOTIFY:ScanCompleted", GetLogName(device));
-  FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_,
-                    ScanCompleted(device));
+  for (auto& observer : observers_)
+    observer.ScanCompleted(device);
 }
 
 std::string NetworkStateHandler::GetTechnologyForType(
diff --git a/chromeos/settings/timezone_settings.cc b/chromeos/settings/timezone_settings.cc
index 0f42e86..38ea65d6 100644
--- a/chromeos/settings/timezone_settings.cc
+++ b/chromeos/settings/timezone_settings.cc
@@ -393,7 +393,8 @@
   base::WorkerPool::GetTaskRunner(true /* task is slow */)->
       PostTask(FROM_HERE, base::Bind(&SetTimezoneIDFromString, id));
   icu::TimeZone::setDefault(*known_timezone);
-  FOR_EACH_OBSERVER(Observer, observers_, TimezoneChanged(*known_timezone));
+  for (auto& observer : observers_)
+    observer.TimezoneChanged(*known_timezone);
 }
 
 // static
@@ -440,7 +441,8 @@
   VLOG(1) << "Setting timezone to " << id;
   timezone_.reset(known_timezone->clone());
   icu::TimeZone::setDefault(*known_timezone);
-  FOR_EACH_OBSERVER(Observer, observers_, TimezoneChanged(*known_timezone));
+  for (auto& observer : observers_)
+    observer.TimezoneChanged(*known_timezone);
 }
 
 // static
diff --git a/components/BUILD.gn b/components/BUILD.gn
index 15071c3..6c61cca 100644
--- a/components/BUILD.gn
+++ b/components/BUILD.gn
@@ -168,7 +168,7 @@
   } else {  # !iOS
     deps += [
       "//components/autofill/content/browser:unit_tests",
-      "//components/autofill/content/public/cpp:unit_tests",
+      "//components/autofill/content/common:unit_tests",
       "//components/autofill/content/renderer:unit_tests",
       "//components/cast_certificate:unit_tests",
       "//components/certificate_reporting:unit_tests",
@@ -423,7 +423,7 @@
       "//device/geolocation",
       "//ipc:test_support",
       "//net:test_support",
-      "//services/shell/public/cpp",
+      "//services/service_manager/public/cpp",
       "//testing/gmock",
       "//testing/gtest",
       "//ui/base",
diff --git a/components/autofill/content/DEPS b/components/autofill/content/DEPS
index bfb7fc1..97138c92 100644
--- a/components/autofill/content/DEPS
+++ b/components/autofill/content/DEPS
@@ -5,7 +5,7 @@
   "+third_party/WebKit/public/web",
   "+mojo/common",
   "+mojo/public",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 ]
 
 specific_include_rules = {
diff --git a/components/autofill/content/browser/BUILD.gn b/components/autofill/content/browser/BUILD.gn
index 3b9290e1..d881920 100644
--- a/components/autofill/content/browser/BUILD.gn
+++ b/components/autofill/content/browser/BUILD.gn
@@ -16,7 +16,7 @@
 
   public_deps = [
     ":risk_proto",
-    "//components/autofill/content/public/interfaces",
+    "//components/autofill/content/common:mojo_interfaces",
     "//components/autofill/core/browser",
     "//components/autofill/core/common",
     "//skia",
@@ -37,7 +37,7 @@
     "//gpu/config",
     "//mojo/common:common_base",
     "//net",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//sql",
     "//third_party/icu",
     "//third_party/libphonenumber",
@@ -66,7 +66,7 @@
   deps = [
     ":browser",
     "//base",
-    "//components/autofill/content/public/interfaces",
+    "//components/autofill/content/common:mojo_interfaces",
     "//components/autofill/core/browser",
     "//components/autofill/core/browser:test_support",
     "//components/autofill/core/common",
@@ -78,7 +78,7 @@
     "//mojo/common:common_base",
     "//net",
     "//net:test_support",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//testing/gmock",
     "//testing/gtest",
   ]
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc
index 2821197..8332c65 100644
--- a/components/autofill/content/browser/content_autofill_driver.cc
+++ b/components/autofill/content/browser/content_autofill_driver.cc
@@ -24,7 +24,7 @@
 #include "content/public/browser/site_instance.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/browser/web_contents.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "ui/gfx/geometry/size_f.h"
 
 namespace autofill {
diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h
index 0c91497..02b037ea 100644
--- a/components/autofill/content/browser/content_autofill_driver.h
+++ b/components/autofill/content/browser/content_autofill_driver.h
@@ -9,8 +9,8 @@
 #include <string>
 
 #include "base/supports_user_data.h"
-#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_agent.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/core/browser/autofill_driver.h"
 #include "components/autofill/core/browser/autofill_external_delegate.h"
 #include "components/autofill/core/browser/autofill_manager.h"
diff --git a/components/autofill/content/browser/content_autofill_driver_factory.h b/components/autofill/content/browser/content_autofill_driver_factory.h
index d121269..8bec3e5a0 100644
--- a/components/autofill/content/browser/content_autofill_driver_factory.h
+++ b/components/autofill/content/browser/content_autofill_driver_factory.h
@@ -10,7 +10,7 @@
 #include <string>
 
 #include "base/supports_user_data.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/core/browser/autofill_manager.h"
 #include "content/public/browser/web_contents_observer.h"
 
diff --git a/components/autofill/content/browser/content_autofill_driver_unittest.cc b/components/autofill/content/browser/content_autofill_driver_unittest.cc
index 2b85105..5feba336 100644
--- a/components/autofill/content/browser/content_autofill_driver_unittest.cc
+++ b/components/autofill/content/browser/content_autofill_driver_unittest.cc
@@ -27,7 +27,7 @@
 #include "content/public/common/frame_navigate_params.h"
 #include "content/public/test/test_renderer_host.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -261,9 +261,9 @@
     driver_.reset(new TestContentAutofillDriver(web_contents()->GetMainFrame(),
                                                 test_autofill_client_.get()));
 
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         web_contents()->GetMainFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(mojom::AutofillAgent::Name_,
                               base::Bind(&FakeAutofillAgent::BindRequest,
                                          base::Unretained(&fake_agent_)));
diff --git a/components/autofill/content/common/BUILD.gn b/components/autofill/content/common/BUILD.gn
index 734deef4..331de75 100644
--- a/components/autofill/content/common/BUILD.gn
+++ b/components/autofill/content/common/BUILD.gn
@@ -2,7 +2,9 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-static_library("common") {
+import("//mojo/public/tools/bindings/mojom.gni")
+
+static_library("ipc_traits") {
   sources = [
     "autofill_message_generator.cc",
     "autofill_param_traits_macros.h",
@@ -15,3 +17,57 @@
     "//url/ipc:url_ipc",
   ]
 }
+
+mojom("mojo_interfaces") {
+  sources = [
+    "autofill_agent.mojom",
+    "autofill_driver.mojom",
+  ]
+
+  public_deps = [
+    ":mojo_types",
+    "//mojo/common:common_custom_types",
+    "//ui/gfx/geometry/mojo",
+  ]
+}
+
+mojom("mojo_types") {
+  sources = [
+    "autofill_types.mojom",
+  ]
+
+  public_deps = [
+    "//mojo/common:common_custom_types",
+    "//url/mojo:url_mojom_gurl",
+    "//url/mojo:url_mojom_origin",
+  ]
+}
+
+mojom("mojo_test_types") {
+  sources = [
+    "test_autofill_types.mojom",
+  ]
+
+  public_deps = [
+    ":mojo_types",
+  ]
+}
+
+source_set("unit_tests") {
+  testonly = true
+  sources = [
+    "autofill_types_struct_traits_unittest.cc",
+  ]
+
+  public_deps = [
+    ":mojo_test_types",
+  ]
+
+  deps = [
+    "//base",
+    "//components/autofill/core/browser:test_support",
+    "//components/password_manager/core/common",
+    "//mojo/public/cpp/bindings",
+    "//testing/gtest",
+  ]
+}
diff --git a/components/autofill/content/common/OWNERS b/components/autofill/content/common/OWNERS
index 078544d0..4a41b7b 100644
--- a/components/autofill/content/common/OWNERS
+++ b/components/autofill/content/common/OWNERS
@@ -1,5 +1,9 @@
 # Changes to IPC messages require a security review to avoid introducing
 # new sandbox escapes.
+per-file *.mojom=set noparent
+per-file *.mojom=file://ipc/SECURITY_OWNERS
+per-file *_struct_traits*.*=set noparent
+per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS
 per-file *_message*.*=set noparent
 per-file *_message*.*=file://ipc/SECURITY_OWNERS
 per-file *_param_traits*.*=set noparent
diff --git a/components/autofill/content/public/interfaces/autofill_agent.mojom b/components/autofill/content/common/autofill_agent.mojom
similarity index 98%
rename from components/autofill/content/public/interfaces/autofill_agent.mojom
rename to components/autofill/content/common/autofill_agent.mojom
index f94ef04..a2f40a9d 100644
--- a/components/autofill/content/public/interfaces/autofill_agent.mojom
+++ b/components/autofill/content/common/autofill_agent.mojom
@@ -4,7 +4,7 @@
 
 module autofill.mojom;
 
-import "components/autofill/content/public/interfaces/autofill_types.mojom";
+import "components/autofill/content/common/autofill_types.mojom";
 import "mojo/common/common_custom_types.mojom";
 
 // There is one instance of this interface per render frame in the render
diff --git a/components/autofill/content/public/interfaces/autofill_driver.mojom b/components/autofill/content/common/autofill_driver.mojom
similarity index 98%
rename from components/autofill/content/public/interfaces/autofill_driver.mojom
rename to components/autofill/content/common/autofill_driver.mojom
index fdfa4c61..5127819 100644
--- a/components/autofill/content/public/interfaces/autofill_driver.mojom
+++ b/components/autofill/content/common/autofill_driver.mojom
@@ -4,7 +4,7 @@
 
 module autofill.mojom;
 
-import "components/autofill/content/public/interfaces/autofill_types.mojom";
+import "components/autofill/content/common/autofill_types.mojom";
 import "mojo/common/common_custom_types.mojom";
 import "ui/gfx/geometry/mojo/geometry.mojom";
 
diff --git a/components/autofill/content/public/interfaces/autofill_types.mojom b/components/autofill/content/common/autofill_types.mojom
similarity index 100%
rename from components/autofill/content/public/interfaces/autofill_types.mojom
rename to components/autofill/content/common/autofill_types.mojom
diff --git a/components/autofill/content/public/cpp/autofill_types.typemap b/components/autofill/content/common/autofill_types.typemap
similarity index 89%
rename from components/autofill/content/public/cpp/autofill_types.typemap
rename to components/autofill/content/common/autofill_types.typemap
index a257f4b..4511910 100644
--- a/components/autofill/content/public/cpp/autofill_types.typemap
+++ b/components/autofill/content/common/autofill_types.typemap
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-mojom = "//components/autofill/content/public/interfaces/autofill_types.mojom"
+mojom = "//components/autofill/content/common/autofill_types.mojom"
 public_headers = [
   "//components/autofill/core/common/form_data.h",
   "//components/autofill/core/common/form_data_predictions.h",
@@ -13,9 +13,10 @@
   "//components/autofill/core/common/password_form_fill_data.h",
   "//components/autofill/core/common/password_form_generation_data.h",
 ]
-traits_headers = [ "//components/autofill/content/public/cpp/autofill_types_struct_traits.h" ]
+traits_headers =
+    [ "//components/autofill/content/common/autofill_types_struct_traits.h" ]
 sources = [
-  "//components/autofill/content/public/cpp/autofill_types_struct_traits.cc",
+  "//components/autofill/content/common/autofill_types_struct_traits.cc",
 ]
 deps = [
   "//base",
diff --git a/components/autofill/content/public/cpp/autofill_types_struct_traits.cc b/components/autofill/content/common/autofill_types_struct_traits.cc
similarity index 96%
rename from components/autofill/content/public/cpp/autofill_types_struct_traits.cc
rename to components/autofill/content/common/autofill_types_struct_traits.cc
index 4b02077..81e2fb47 100644
--- a/components/autofill/content/public/cpp/autofill_types_struct_traits.cc
+++ b/components/autofill/content/common/autofill_types_struct_traits.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/autofill/content/public/cpp/autofill_types_struct_traits.h"
+#include "components/autofill/content/common/autofill_types_struct_traits.h"
 
 #include "base/i18n/rtl.h"
 #include "ipc/ipc_message_utils.h"
@@ -417,10 +417,8 @@
 }
 
 // static
-bool StructTraits<mojom::FormDataPredictionsDataView,
-                  FormDataPredictions>::Read(mojom::FormDataPredictionsDataView
-                                                 data,
-                                             FormDataPredictions* out) {
+bool StructTraits<mojom::FormDataPredictionsDataView, FormDataPredictions>::
+    Read(mojom::FormDataPredictionsDataView data, FormDataPredictions* out) {
   if (!data.ReadData(&out->data))
     return false;
   if (!data.ReadSignature(&out->signature))
@@ -644,10 +642,8 @@
 }
 
 // static
-bool StructTraits<mojom::FormsPredictionsMapDataView,
-                  FormsPredictionsMap>::Read(mojom::FormsPredictionsMapDataView
-                                                 data,
-                                             FormsPredictionsMap* out) {
+bool StructTraits<mojom::FormsPredictionsMapDataView, FormsPredictionsMap>::
+    Read(mojom::FormsPredictionsMapDataView data, FormsPredictionsMap* out) {
   // Combines keys vector and values vector to the map.
   std::vector<FormData> keys;
   if (!data.ReadKeys(&keys))
diff --git a/components/autofill/content/public/cpp/autofill_types_struct_traits.h b/components/autofill/content/common/autofill_types_struct_traits.h
similarity index 97%
rename from components/autofill/content/public/cpp/autofill_types_struct_traits.h
rename to components/autofill/content/common/autofill_types_struct_traits.h
index e22085f..8e2f740 100644
--- a/components/autofill/content/public/cpp/autofill_types_struct_traits.h
+++ b/components/autofill/content/common/autofill_types_struct_traits.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_AUTOFILL_CONTENT_PUBLIC_INTERFACES_AUTOFILL_TYPES_STRUCT_TRAITS_H_
-#define COMPONENTS_AUTOFILL_CONTENT_PUBLIC_INTERFACES_AUTOFILL_TYPES_STRUCT_TRAITS_H_
+#ifndef COMPONENTS_AUTOFILL_CONTENT_COMMON_AUTOFILL_TYPES_STRUCT_TRAITS_H_
+#define COMPONENTS_AUTOFILL_CONTENT_COMMON_AUTOFILL_TYPES_STRUCT_TRAITS_H_
 
 #include <utility>
 
 #include "base/strings/string16.h"
-#include "components/autofill/content/public/interfaces/autofill_types.mojom.h"
+#include "components/autofill/content/common/autofill_types.mojom.h"
 #include "components/autofill/core/common/form_data.h"
 #include "components/autofill/core/common/form_data_predictions.h"
 #include "components/autofill/core/common/form_field_data.h"
@@ -588,4 +588,4 @@
 
 }  // namespace mojo
 
-#endif  // COMPONENTS_AUTOFILL_CONTENT_PUBLIC_INTERFACES_AUTOFILL_TYPES_STRUCT_TRAITS_H_
+#endif  // COMPONENTS_AUTOFILL_CONTENT_COMMON_AUTOFILL_TYPES_STRUCT_TRAITS_H_
diff --git a/components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc b/components/autofill/content/common/autofill_types_struct_traits_unittest.cc
similarity index 98%
rename from components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc
rename to components/autofill/content/common/autofill_types_struct_traits_unittest.cc
index 7013668..2da13f2 100644
--- a/components/autofill/content/public/cpp/autofill_types_struct_traits_unittest.cc
+++ b/components/autofill/content/common/autofill_types_struct_traits_unittest.cc
@@ -5,7 +5,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/strings/utf_string_conversions.h"
-#include "components/autofill/content/public/interfaces/test_autofill_types.mojom.h"
+#include "components/autofill/content/common/test_autofill_types.mojom.h"
 #include "components/autofill/core/browser/autofill_test_utils.h"
 #include "components/autofill/core/common/form_data.h"
 #include "components/autofill/core/common/form_field_data.h"
@@ -351,8 +351,8 @@
 
   base::RunLoop loop;
   mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
-  proxy->PassFormData(
-      input, base::Bind(&ExpectFormData, input, loop.QuitClosure()));
+  proxy->PassFormData(input,
+                      base::Bind(&ExpectFormData, input, loop.QuitClosure()));
   loop.Run();
 }
 
@@ -384,8 +384,7 @@
   base::RunLoop loop;
   mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy();
   proxy->PassFormDataPredictions(
-      input,
-      base::Bind(&ExpectFormDataPredictions, input, loop.QuitClosure()));
+      input, base::Bind(&ExpectFormDataPredictions, input, loop.QuitClosure()));
   loop.Run();
 }
 
diff --git a/components/autofill/content/public/interfaces/test_autofill_types.mojom b/components/autofill/content/common/test_autofill_types.mojom
similarity index 91%
rename from components/autofill/content/public/interfaces/test_autofill_types.mojom
rename to components/autofill/content/common/test_autofill_types.mojom
index 70c18e7..b578eb4 100644
--- a/components/autofill/content/public/interfaces/test_autofill_types.mojom
+++ b/components/autofill/content/common/test_autofill_types.mojom
@@ -4,7 +4,7 @@
 
 module autofill.mojom;
 
-import "components/autofill/content/public/interfaces/autofill_types.mojom";
+import "components/autofill/content/common/autofill_types.mojom";
 
 interface TypeTraitsTest {
   PassFormData(FormData s) => (FormData passed);
diff --git a/components/autofill/content/public/cpp/BUILD.gn b/components/autofill/content/public/cpp/BUILD.gn
deleted file mode 100644
index e7c88ce..0000000
--- a/components/autofill/content/public/cpp/BUILD.gn
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-source_set("unit_tests") {
-  testonly = true
-  sources = [
-    "autofill_types_struct_traits_unittest.cc",
-  ]
-
-  public_deps = [
-    "../interfaces:test_types",
-  ]
-
-  deps = [
-    "//base",
-    "//components/autofill/core/browser:test_support",
-    "//components/password_manager/core/common",
-    "//mojo/public/cpp/bindings",
-    "//testing/gtest",
-  ]
-}
diff --git a/components/autofill/content/public/cpp/DEPS b/components/autofill/content/public/cpp/DEPS
deleted file mode 100644
index 1c40d98..0000000
--- a/components/autofill/content/public/cpp/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
-  "+ipc",
-]
diff --git a/components/autofill/content/public/cpp/OWNERS b/components/autofill/content/public/cpp/OWNERS
deleted file mode 100644
index bb65116..0000000
--- a/components/autofill/content/public/cpp/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-per-file *_struct_traits*.*=set noparent
-per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/components/autofill/content/public/interfaces/BUILD.gn b/components/autofill/content/public/interfaces/BUILD.gn
deleted file mode 100644
index ea583e7..0000000
--- a/components/autofill/content/public/interfaces/BUILD.gn
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//mojo/public/tools/bindings/mojom.gni")
-
-mojom("interfaces") {
-  sources = [
-    "autofill_agent.mojom",
-    "autofill_driver.mojom",
-  ]
-
-  public_deps = [
-    ":types",
-    "//mojo/common:common_custom_types",
-    "//ui/gfx/geometry/mojo",
-  ]
-}
-
-mojom("types") {
-  sources = [
-    "autofill_types.mojom",
-  ]
-
-  public_deps = [
-    "//mojo/common:common_custom_types",
-    "//url/mojo:url_mojom_gurl",
-    "//url/mojo:url_mojom_origin",
-  ]
-}
-
-mojom("test_types") {
-  sources = [
-    "test_autofill_types.mojom",
-  ]
-
-  public_deps = [
-    ":types",
-  ]
-}
diff --git a/components/autofill/content/public/interfaces/OWNERS b/components/autofill/content/public/interfaces/OWNERS
deleted file mode 100644
index 08850f4..0000000
--- a/components/autofill/content/public/interfaces/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-per-file *.mojom=set noparent
-per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/components/autofill/content/renderer/BUILD.gn b/components/autofill/content/renderer/BUILD.gn
index c3335d4..5dd8086 100644
--- a/components/autofill/content/renderer/BUILD.gn
+++ b/components/autofill/content/renderer/BUILD.gn
@@ -28,7 +28,7 @@
   deps = [
     "//base",
     "//base:i18n",
-    "//components/autofill/content/public/interfaces",
+    "//components/autofill/content/common:mojo_interfaces",
     "//components/autofill/core/common",
     "//components/strings",
     "//content/public/common",
@@ -37,7 +37,7 @@
     "//ipc",
     "//mojo/common:common_base",
     "//net",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//third_party/WebKit/public:blink",
     "//third_party/re2",
@@ -76,7 +76,7 @@
 
   deps = [
     ":test_support",
-    "//components/autofill/content/public/interfaces",
+    "//components/autofill/content/common:mojo_interfaces",
     "//testing/gtest",
   ]
 }
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index 2a20a17..6de7579d 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -41,8 +41,8 @@
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
 #include "net/cert/cert_status_flags.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/platform/WebURLRequest.h"
 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
 #include "third_party/WebKit/public/web/WebDataSource.h"
diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h
index c03040f..e464af9 100644
--- a/components/autofill/content/renderer/autofill_agent.h
+++ b/components/autofill/content/renderer/autofill_agent.h
@@ -13,8 +13,8 @@
 #include "base/memory/weak_ptr.h"
 #include "base/strings/string16.h"
 #include "base/time/time.h"
-#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_agent.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/content/renderer/form_cache.h"
 #include "components/autofill/content/renderer/page_click_listener.h"
 #include "content/public/renderer/render_frame_observer.h"
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 9fdf40e..952033b1 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -31,8 +31,8 @@
 #include "content/public/renderer/navigation_state.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
 #include "third_party/WebKit/public/platform/WebVector.h"
 #include "third_party/WebKit/public/web/WebAutofillClient.h"
diff --git a/components/autofill/content/renderer/password_autofill_agent.h b/components/autofill/content/renderer/password_autofill_agent.h
index 18874298..48f61a4 100644
--- a/components/autofill/content/renderer/password_autofill_agent.h
+++ b/components/autofill/content/renderer/password_autofill_agent.h
@@ -10,8 +10,8 @@
 #include <vector>
 
 #include "base/macros.h"
-#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_agent.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/content/renderer/autofill_agent.h"
 #include "components/autofill/content/renderer/password_form_conversion_utils.h"
 #include "components/autofill/core/common/form_data_predictions.h"
diff --git a/components/autofill/content/renderer/password_generation_agent.cc b/components/autofill/content/renderer/password_generation_agent.cc
index d5371f6..a0a5283 100644
--- a/components/autofill/content/renderer/password_generation_agent.cc
+++ b/components/autofill/content/renderer/password_generation_agent.cc
@@ -22,7 +22,7 @@
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
 #include "google_apis/gaia/gaia_urls.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
 #include "third_party/WebKit/public/platform/WebVector.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
diff --git a/components/autofill/content/renderer/password_generation_agent.h b/components/autofill/content/renderer/password_generation_agent.h
index 824d4cf7..2b73a4d 100644
--- a/components/autofill/content/renderer/password_generation_agent.h
+++ b/components/autofill/content/renderer/password_generation_agent.h
@@ -14,8 +14,8 @@
 
 #include "base/macros.h"
 #include "base/memory/linked_ptr.h"
-#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_agent.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "content/public/renderer/render_frame_observer.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "third_party/WebKit/public/web/WebInputElement.h"
diff --git a/components/autofill/content/renderer/renderer_save_password_progress_logger.h b/components/autofill/content/renderer/renderer_save_password_progress_logger.h
index 2ebe2b5..43416aa 100644
--- a/components/autofill/content/renderer/renderer_save_password_progress_logger.h
+++ b/components/autofill/content/renderer/renderer_save_password_progress_logger.h
@@ -8,7 +8,7 @@
 #include <string>
 
 #include "base/macros.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/core/common/save_password_progress_logger.h"
 
 namespace blink {
diff --git a/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc b/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc
index 874f534..7c0c27e 100644
--- a/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc
+++ b/components/autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc
@@ -4,7 +4,7 @@
 
 #include "base/optional.h"
 #include "base/run_loop.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/content/renderer/renderer_save_password_progress_logger.h"
 #include "mojo/public/cpp/bindings/binding.h"
 
diff --git a/components/browser_sync/abstract_profile_sync_service_test.cc b/components/browser_sync/abstract_profile_sync_service_test.cc
index b13bfc0a..9baf0a5 100644
--- a/components/browser_sync/abstract_profile_sync_service_test.cc
+++ b/components/browser_sync/abstract_profile_sync_service_test.cc
@@ -14,10 +14,10 @@
 #include "base/run_loop.h"
 #include "components/browser_sync/test_http_bridge_factory.h"
 #include "components/browser_sync/test_profile_sync_service.h"
-#include "components/sync/core/test/sync_manager_factory_for_profile_sync_test.h"
-#include "components/sync/core/test/test_internal_components_factory.h"
 #include "components/sync/driver/glue/sync_backend_host_core.h"
 #include "components/sync/driver/sync_api_component_factory_mock.h"
+#include "components/sync/engine/sync_manager_factory_for_profile_sync_test.h"
+#include "components/sync/engine/test_engine_components_factory.h"
 #include "components/sync/protocol/sync.pb.h"
 #include "components/sync/syncable/test_user_share.h"
 #include "google_apis/gaia/gaia_constants.h"
@@ -96,15 +96,15 @@
   options->credentials.scope_set.insert(GaiaConstants::kChromeSyncOAuth2Scope);
   options->restored_key_for_bootstrapping.clear();
 
-  // It'd be nice if we avoided creating the InternalComponentsFactory in the
+  // It'd be nice if we avoided creating the EngineComponentsFactory in the
   // first place, but SyncBackendHost will have created one by now so we must
   // free it. Grab the switches to pass on first.
-  syncer::InternalComponentsFactory::Switches factory_switches =
-      options->internal_components_factory->GetSwitches();
-  options->internal_components_factory.reset(
-      new syncer::TestInternalComponentsFactory(
-          factory_switches,
-          syncer::InternalComponentsFactory::STORAGE_IN_MEMORY, nullptr));
+  syncer::EngineComponentsFactory::Switches factory_switches =
+      options->engine_components_factory->GetSwitches();
+  options->engine_components_factory.reset(
+      new syncer::TestEngineComponentsFactory(
+          factory_switches, syncer::EngineComponentsFactory::STORAGE_IN_MEMORY,
+          nullptr));
 
   SyncBackendHostImpl::InitCore(std::move(options));
 }
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc
index f331193..315e0b3d 100644
--- a/components/browser_sync/profile_sync_service.cc
+++ b/components/browser_sync/profile_sync_service.cc
@@ -43,10 +43,7 @@
 #include "components/sync/base/pref_names.h"
 #include "components/sync/base/report_unrecoverable_error.h"
 #include "components/sync/base/stop_source.h"
-#include "components/sync/base/sync_db_util.h"
 #include "components/sync/base/system_encryptor.h"
-#include "components/sync/core/configure_reason.h"
-#include "components/sync/core/sync_encryption_handler.h"
 #include "components/sync/device_info/device_info.h"
 #include "components/sync/device_info/device_info_service.h"
 #include "components/sync/device_info/device_info_sync_service.h"
@@ -62,10 +59,12 @@
 #include "components/sync/driver/sync_type_preference_provider.h"
 #include "components/sync/driver/sync_util.h"
 #include "components/sync/driver/user_selectable_sync_type.h"
+#include "components/sync/engine/configure_reason.h"
 #include "components/sync/engine/cycle/model_neutral_state.h"
 #include "components/sync/engine/cycle/type_debug_info_observer.h"
 #include "components/sync/engine/net/http_bridge_network_resources.h"
 #include "components/sync/engine/net/network_resources.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/engine/sync_string_conversions.h"
 #include "components/sync/js/js_event_details.h"
 #include "components/sync/model/model_type_change_processor.h"
@@ -73,6 +72,7 @@
 #include "components/sync/model/sync_error.h"
 #include "components/sync/protocol/sync.pb.h"
 #include "components/sync/syncable/directory.h"
+#include "components/sync/syncable/sync_db_util.h"
 #include "components/sync/syncable/syncable_read_transaction.h"
 #include "components/sync_sessions/favicon_cache.h"
 #include "components/sync_sessions/session_data_type_controller.h"
diff --git a/components/browser_sync/profile_sync_service.h b/components/browser_sync/profile_sync_service.h
index 7a8f3e1..864a542 100644
--- a/components/browser_sync/profile_sync_service.h
+++ b/components/browser_sync/profile_sync_service.h
@@ -30,8 +30,6 @@
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/sync_prefs.h"
 #include "components/sync/base/unrecoverable_error_handler.h"
-#include "components/sync/core/shutdown_reason.h"
-#include "components/sync/core/sync_manager_factory.h"
 #include "components/sync/device_info/local_device_info_provider.h"
 #include "components/sync/driver/data_type_controller.h"
 #include "components/sync/driver/data_type_manager.h"
@@ -46,6 +44,8 @@
 #include "components/sync/driver/sync_stopped_reporter.h"
 #include "components/sync/engine/model_safe_worker.h"
 #include "components/sync/engine/net/network_time_update_callback.h"
+#include "components/sync/engine/shutdown_reason.h"
+#include "components/sync/engine/sync_manager_factory.h"
 #include "components/sync/js/sync_js_controller.h"
 #include "components/sync/syncable/user_share.h"
 #include "components/version_info/version_info.h"
diff --git a/components/browser_sync/profile_sync_service_autofill_unittest.cc b/components/browser_sync/profile_sync_service_autofill_unittest.cc
index 0d39c2a..559b895 100644
--- a/components/browser_sync/profile_sync_service_autofill_unittest.cc
+++ b/components/browser_sync/profile_sync_service_autofill_unittest.cc
@@ -42,10 +42,10 @@
 #include "components/browser_sync/profile_sync_service.h"
 #include "components/browser_sync/test_profile_sync_service.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/data_type_debug_info_listener.h"
 #include "components/sync/driver/data_type_controller.h"
 #include "components/sync/driver/data_type_manager_impl.h"
 #include "components/sync/driver/sync_api_component_factory_mock.h"
+#include "components/sync/engine/data_type_debug_info_listener.h"
 #include "components/sync/protocol/autofill_specifics.pb.h"
 #include "components/sync/syncable/mutable_entry.h"
 #include "components/sync/syncable/read_node.h"
diff --git a/components/browser_sync/profile_sync_service_bookmark_unittest.cc b/components/browser_sync/profile_sync_service_bookmark_unittest.cc
index 6f976d5..56ed068 100644
--- a/components/browser_sync/profile_sync_service_bookmark_unittest.cc
+++ b/components/browser_sync/profile_sync_service_bookmark_unittest.cc
@@ -37,8 +37,8 @@
 #include "components/bookmarks/test/bookmark_test_helpers.h"
 #include "components/bookmarks/test/test_bookmark_client.h"
 #include "components/browser_sync/profile_sync_test_util.h"
-#include "components/sync/core_impl/syncapi_internal.h"
 #include "components/sync/driver/fake_sync_client.h"
+#include "components/sync/engine/engine_util.h"
 #include "components/sync/model/data_type_error_handler.h"
 #include "components/sync/model/data_type_error_handler_mock.h"
 #include "components/sync/model/sync_error.h"
diff --git a/components/browsing_data/core/DEPS b/components/browsing_data/core/DEPS
index c559bcd..07a87da 100644
--- a/components/browsing_data/core/DEPS
+++ b/components/browsing_data/core/DEPS
@@ -8,7 +8,6 @@
   "+components/prefs",
   "+components/signin",
   "+components/sync/base",
-  "+components/sync/core",
   "+components/sync/driver",
   "+components/version_info",
   "+components/webdata/common",
diff --git a/components/contextual_search/BUILD.gn b/components/contextual_search/BUILD.gn
index dea8e60..4e39cec 100644
--- a/components/contextual_search/BUILD.gn
+++ b/components/contextual_search/BUILD.gn
@@ -57,7 +57,7 @@
     "//content/public/renderer",
     "//gin",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/WebKit/public:blink_headers",
     "//v8",
   ]
diff --git a/components/contextual_search/DEPS b/components/contextual_search/DEPS
index 546100b..57157178 100644
--- a/components/contextual_search/DEPS
+++ b/components/contextual_search/DEPS
@@ -1,4 +1,4 @@
 include_rules = [
   "+mojo/public",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 ]
diff --git a/components/contextual_search/renderer/contextual_search_wrapper.cc b/components/contextual_search/renderer/contextual_search_wrapper.cc
index 917e1d55..94986bb 100644
--- a/components/contextual_search/renderer/contextual_search_wrapper.cc
+++ b/components/contextual_search/renderer/contextual_search_wrapper.cc
@@ -9,7 +9,7 @@
 #include "content/public/renderer/render_frame.h"
 #include "gin/arguments.h"
 #include "gin/object_template_builder.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
diff --git a/components/contextual_search/renderer/overlay_js_render_frame_observer.cc b/components/contextual_search/renderer/overlay_js_render_frame_observer.cc
index 9214a77..573f5d3 100644
--- a/components/contextual_search/renderer/overlay_js_render_frame_observer.cc
+++ b/components/contextual_search/renderer/overlay_js_render_frame_observer.cc
@@ -11,7 +11,7 @@
 #include "components/contextual_search/renderer/overlay_page_notifier_service_impl.h"
 #include "content/public/renderer/render_frame.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "v8/include/v8.h"
 
 namespace contextual_search {
diff --git a/components/contextual_search/renderer/overlay_js_render_frame_observer.h b/components/contextual_search/renderer/overlay_js_render_frame_observer.h
index cbde3c2..595cea3 100644
--- a/components/contextual_search/renderer/overlay_js_render_frame_observer.h
+++ b/components/contextual_search/renderer/overlay_js_render_frame_observer.h
@@ -36,7 +36,8 @@
   // RenderFrameObserver implementation.
   void OnDestruct() override;
 
-  // Add the mojo interface to a RenderFrame's shell::InterfaceRegistry.
+  // Add the mojo interface to a RenderFrame's
+  // service_manager::InterfaceRegistry.
   void RegisterMojoInterface();
   // Creates the OverlayPageNotifierService connecting the browser to this
   // observer.
diff --git a/components/data_use_measurement/core/data_use_user_data.cc b/components/data_use_measurement/core/data_use_user_data.cc
index d1e2f09..a272226 100644
--- a/components/data_use_measurement/core/data_use_user_data.cc
+++ b/components/data_use_measurement/core/data_use_user_data.cc
@@ -86,6 +86,12 @@
       return "Precache";
     case NTP_TILES:
       return "NTPTiles";
+    case FEEDBACK_UPLOADER:
+      return "FeedbackUploader";
+    case TRACING_UPLOADER:
+      return "TracingUploader";
+    case DOM_DISTILLER:
+      return "DOMDistiller";
   }
   return "INVALID";
 }
diff --git a/components/data_use_measurement/core/data_use_user_data.h b/components/data_use_measurement/core/data_use_user_data.h
index f220084..98fee5fd 100644
--- a/components/data_use_measurement/core/data_use_user_data.h
+++ b/components/data_use_measurement/core/data_use_user_data.h
@@ -44,6 +44,9 @@
     DATA_REDUCTION_PROXY,
     PRECACHE,
     NTP_TILES,
+    FEEDBACK_UPLOADER,
+    TRACING_UPLOADER,
+    DOM_DISTILLER,
   };
 
   // The state of the application. Only available on Android and on other
diff --git a/components/dom_distiller/DEPS b/components/dom_distiller/DEPS
index 1de619d..b02404d 100644
--- a/components/dom_distiller/DEPS
+++ b/components/dom_distiller/DEPS
@@ -1,8 +1,8 @@
 include_rules = [
+  "+components/data_use_measurement/core",
   "+components/leveldb_proto",
   "+components/pref_registry",
   "+components/prefs",
-  "+components/sync/core/attachments", # Needed for tests.
   "+components/sync/model",
   "+components/sync/protocol",
   "+components/variations",
diff --git a/components/dom_distiller/content/browser/BUILD.gn b/components/dom_distiller/content/browser/BUILD.gn
index b1dbd39..e7ebb3b7 100644
--- a/components/dom_distiller/content/browser/BUILD.gn
+++ b/components/dom_distiller/content/browser/BUILD.gn
@@ -37,7 +37,7 @@
     "//content/public/common",
     "//mojo/public/cpp/bindings",
     "//net",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//third_party/WebKit/public:blink_headers",
     "//ui/base",
diff --git a/components/dom_distiller/content/browser/DEPS b/components/dom_distiller/content/browser/DEPS
index d83a340..8521159 100644
--- a/components/dom_distiller/content/browser/DEPS
+++ b/components/dom_distiller/content/browser/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
   "+mojo/public",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+ui/display",
 ]
diff --git a/components/dom_distiller/content/browser/distillability_driver.cc b/components/dom_distiller/content/browser/distillability_driver.cc
index d87d36d..aea16bc 100644
--- a/components/dom_distiller/content/browser/distillability_driver.cc
+++ b/components/dom_distiller/content/browser/distillability_driver.cc
@@ -9,7 +9,7 @@
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_user_data.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 DEFINE_WEB_CONTENTS_USER_DATA_KEY(
     dom_distiller::DistillabilityDriver);
diff --git a/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc b/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc
index e28e11d5..76f1651 100644
--- a/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc
+++ b/components/dom_distiller/content/browser/dom_distiller_viewer_source.cc
@@ -41,8 +41,8 @@
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "net/base/url_util.h"
 #include "net/url_request/url_request.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/base/l10n/l10n_util.h"
 
 namespace dom_distiller {
diff --git a/components/dom_distiller/content/renderer/BUILD.gn b/components/dom_distiller/content/renderer/BUILD.gn
index f774265..e32706e9 100644
--- a/components/dom_distiller/content/renderer/BUILD.gn
+++ b/components/dom_distiller/content/renderer/BUILD.gn
@@ -25,7 +25,7 @@
     "//content/public/renderer",
     "//gin",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//third_party/WebKit/public:blink_headers",
     "//v8",
diff --git a/components/dom_distiller/content/renderer/DEPS b/components/dom_distiller/content/renderer/DEPS
index 19c8308..f0806cb3 100644
--- a/components/dom_distiller/content/renderer/DEPS
+++ b/components/dom_distiller/content/renderer/DEPS
@@ -1,7 +1,7 @@
 include_rules = [
   "+gin",
   "+mojo/public",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/WebKit/public",
   "+v8/include",
 ]
diff --git a/components/dom_distiller/content/renderer/distillability_agent.cc b/components/dom_distiller/content/renderer/distillability_agent.cc
index 0534a99..543a47df 100644
--- a/components/dom_distiller/content/renderer/distillability_agent.cc
+++ b/components/dom_distiller/content/renderer/distillability_agent.cc
@@ -12,7 +12,7 @@
 #include "components/dom_distiller/core/page_features.h"
 #include "components/dom_distiller/core/url_utils.h"
 #include "content/public/renderer/render_frame.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/WebDistillability.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
diff --git a/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc
index 0ba5d27..9fb77a0 100644
--- a/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc
+++ b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.cc
@@ -11,7 +11,7 @@
 #include "components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h"
 #include "content/public/renderer/render_frame.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "v8/include/v8.h"
 
 namespace dom_distiller {
diff --git a/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h
index a44d358..fb75189 100644
--- a/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h
+++ b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h
@@ -33,7 +33,8 @@
                               int extension_group,
                               int world_id) override;
 
-  // Add the mojo interface to a RenderFrame's shell::InterfaceRegistry.
+  // Add the mojo interface to a RenderFrame's
+  // service_manager::InterfaceRegistry.
   void RegisterMojoInterface();
   // Flag the current page as a distiller page.
   void SetIsDistillerPage();
diff --git a/components/dom_distiller/content/renderer/distiller_native_javascript.cc b/components/dom_distiller/content/renderer/distiller_native_javascript.cc
index 7bd6002..7e5f9062 100644
--- a/components/dom_distiller/content/renderer/distiller_native_javascript.cc
+++ b/components/dom_distiller/content/renderer/distiller_native_javascript.cc
@@ -12,7 +12,7 @@
 #include "content/public/renderer/render_frame.h"
 #include "gin/arguments.h"
 #include "gin/function_template.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
 #include "v8/include/v8.h"
diff --git a/components/dom_distiller/core/BUILD.gn b/components/dom_distiller/core/BUILD.gn
index 1ba587aa..3ed00be 100644
--- a/components/dom_distiller/core/BUILD.gn
+++ b/components/dom_distiller/core/BUILD.gn
@@ -63,6 +63,7 @@
   ]
   deps = [
     "//base",
+    "//components/data_use_measurement/core",
     "//components/leveldb_proto",
     "//components/pref_registry",
     "//components/prefs",
diff --git a/components/dom_distiller/core/distiller_url_fetcher.cc b/components/dom_distiller/core/distiller_url_fetcher.cc
index 0061d67..752c7ad 100644
--- a/components/dom_distiller/core/distiller_url_fetcher.cc
+++ b/components/dom_distiller/core/distiller_url_fetcher.cc
@@ -4,6 +4,7 @@
 
 #include "components/dom_distiller/core/distiller_url_fetcher.h"
 
+#include "components/data_use_measurement/core/data_use_user_data.h"
 #include "net/http/http_status_code.h"
 #include "net/url_request/url_fetcher.h"
 #include "net/url_request/url_fetcher_delegate.h"
@@ -48,6 +49,8 @@
     const std::string& url) {
   std::unique_ptr<net::URLFetcher> fetcher =
       URLFetcher::Create(GURL(url), URLFetcher::GET, this);
+  data_use_measurement::DataUseUserData::AttachToFetcher(
+      fetcher.get(), data_use_measurement::DataUseUserData::DOM_DISTILLER);
   fetcher->SetRequestContext(context_getter);
   static const int kMaxRetries = 5;
   fetcher->SetMaxRetriesOn5xx(kMaxRetries);
diff --git a/components/feedback/BUILD.gn b/components/feedback/BUILD.gn
index 2382cc6..49ee204 100644
--- a/components/feedback/BUILD.gn
+++ b/components/feedback/BUILD.gn
@@ -30,6 +30,7 @@
 
   deps = [
     "//base",
+    "//components/data_use_measurement/core",
     "//components/feedback/proto",
     "//components/keyed_service/content",
     "//components/keyed_service/core",
diff --git a/components/feedback/DEPS b/components/feedback/DEPS
index 73e72b2..d1b80c1 100644
--- a/components/feedback/DEPS
+++ b/components/feedback/DEPS
@@ -1,5 +1,6 @@
 include_rules = [
   "-content",
+  "+components/data_use_measurement/core",
   "+components/keyed_service",
   "+components/pref_registry",
   "+components/prefs",
diff --git a/components/feedback/feedback_uploader_chrome.cc b/components/feedback/feedback_uploader_chrome.cc
index c59513d..0de322a 100644
--- a/components/feedback/feedback_uploader_chrome.cc
+++ b/components/feedback/feedback_uploader_chrome.cc
@@ -11,6 +11,7 @@
 #include "base/files/file_path.h"
 #include "base/task_runner_util.h"
 #include "base/threading/sequenced_worker_pool.h"
+#include "components/data_use_measurement/core/data_use_user_data.h"
 #include "components/feedback/feedback_report.h"
 #include "components/feedback/feedback_switches.h"
 #include "components/feedback/feedback_uploader_delegate.h"
@@ -55,7 +56,8 @@
                                AsWeakPtr()),
               base::Bind(&FeedbackUploaderChrome::RetryReport, AsWeakPtr())))
           .release();
-
+  data_use_measurement::DataUseUserData::AttachToFetcher(
+      fetcher, data_use_measurement::DataUseUserData::FEEDBACK_UPLOADER);
   // Tell feedback server about the variation state of this install.
   net::HttpRequestHeaders headers;
   variations::AppendVariationHeaders(
diff --git a/components/filesystem/BUILD.gn b/components/filesystem/BUILD.gn
index 66c16bb..ace7de6d 100644
--- a/components/filesystem/BUILD.gn
+++ b/components/filesystem/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 static_library("lib") {
@@ -28,8 +28,8 @@
     "//mojo/common",
     "//mojo/common:common_base",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//url",
   ]
 }
@@ -48,7 +48,7 @@
     "//mojo/common",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
   ]
 
@@ -76,9 +76,9 @@
     "//mojo/common",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
   ]
 
   data_deps = [
diff --git a/components/filesystem/DEPS b/components/filesystem/DEPS
index 64f79d8d..26e54241 100644
--- a/components/filesystem/DEPS
+++ b/components/filesystem/DEPS
@@ -3,6 +3,6 @@
   "+mojo/common",
   "+mojo/public",
   "+mojo/util",
-  "+services/shell",
+  "+services/service_manager",
   "+services/tracing/public/cpp",
 ]
diff --git a/components/filesystem/file_system_app.cc b/components/filesystem/file_system_app.cc
index 054545d..58a1a57 100644
--- a/components/filesystem/file_system_app.cc
+++ b/components/filesystem/file_system_app.cc
@@ -10,8 +10,8 @@
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 #if defined(OS_WIN)
 #include "base/base_paths_win.h"
@@ -40,18 +40,18 @@
 
 FileSystemApp::~FileSystemApp() {}
 
-void FileSystemApp::OnStart(const shell::Identity& identity) {
+void FileSystemApp::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 }
 
-bool FileSystemApp::OnConnect(const shell::Identity& remote_identity,
-                              shell::InterfaceRegistry* registry) {
+bool FileSystemApp::OnConnect(const service_manager::Identity& remote_identity,
+                              service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::FileSystem>(this);
   return true;
 }
 
 // |InterfaceFactory<Files>| implementation:
-void FileSystemApp::Create(const shell::Identity& remote_identity,
+void FileSystemApp::Create(const service_manager::Identity& remote_identity,
                            mojom::FileSystemRequest request) {
   mojo::MakeStrongBinding(base::MakeUnique<FileSystemImpl>(
                               remote_identity, GetUserDataDir(), lock_table_),
diff --git a/components/filesystem/file_system_app.h b/components/filesystem/file_system_app.h
index ee72a60..bca21d2 100644
--- a/components/filesystem/file_system_app.h
+++ b/components/filesystem/file_system_app.h
@@ -10,8 +10,8 @@
 #include "components/filesystem/file_system_impl.h"
 #include "components/filesystem/lock_table.h"
 #include "components/filesystem/public/interfaces/file_system.mojom.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace mojo {
@@ -20,8 +20,9 @@
 
 namespace filesystem {
 
-class FileSystemApp : public shell::Service,
-                      public shell::InterfaceFactory<mojom::FileSystem> {
+class FileSystemApp
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::FileSystem> {
  public:
   FileSystemApp();
   ~FileSystemApp() override;
@@ -30,13 +31,13 @@
   // Gets the system specific toplevel profile directory.
   static base::FilePath GetUserDataDir();
 
-  // |shell::Service| override:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // |service_manager::Service| override:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // |InterfaceFactory<Files>| implementation:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               mojo::InterfaceRequest<mojom::FileSystem> request) override;
 
   tracing::Provider tracing_;
diff --git a/components/filesystem/file_system_impl.cc b/components/filesystem/file_system_impl.cc
index 1dc8008..1fbed03 100644
--- a/components/filesystem/file_system_impl.cc
+++ b/components/filesystem/file_system_impl.cc
@@ -18,12 +18,12 @@
 #include "components/filesystem/directory_impl.h"
 #include "components/filesystem/lock_table.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/identity.h"
 #include "url/gurl.h"
 
 namespace filesystem {
 
-FileSystemImpl::FileSystemImpl(const shell::Identity& remote_identity,
+FileSystemImpl::FileSystemImpl(const service_manager::Identity& remote_identity,
                                base::FilePath persistent_dir,
                                scoped_refptr<LockTable> lock_table)
     : remote_application_name_(remote_identity.name()),
diff --git a/components/filesystem/file_system_impl.h b/components/filesystem/file_system_impl.h
index 8e8abd2..573fd31 100644
--- a/components/filesystem/file_system_impl.h
+++ b/components/filesystem/file_system_impl.h
@@ -15,7 +15,7 @@
 class FilePath;
 }
 
-namespace shell {
+namespace service_manager {
 class Identity;
 }
 
@@ -29,7 +29,7 @@
  public:
   // |persistent_dir| is the directory served to callers of
   // |OpenPersistentFileSystem().
-  FileSystemImpl(const shell::Identity& remote_identity,
+  FileSystemImpl(const service_manager::Identity& remote_identity,
                  base::FilePath persistent_dir,
                  scoped_refptr<LockTable> lock_table);
   ~FileSystemImpl() override;
diff --git a/components/filesystem/files_test_base.cc b/components/filesystem/files_test_base.cc
index 9472827..1868241 100644
--- a/components/filesystem/files_test_base.cc
+++ b/components/filesystem/files_test_base.cc
@@ -8,7 +8,7 @@
 
 #include "components/filesystem/public/interfaces/directory.mojom.h"
 #include "components/filesystem/public/interfaces/types.mojom.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace filesystem {
 
diff --git a/components/filesystem/files_test_base.h b/components/filesystem/files_test_base.h
index 8712a6c..d77acda 100644
--- a/components/filesystem/files_test_base.h
+++ b/components/filesystem/files_test_base.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "components/filesystem/public/interfaces/file_system.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 
 namespace filesystem {
 
@@ -37,12 +37,12 @@
   return base::Bind(&DoCaptures<T1, T2, T3>, t1, t2, t3);
 }
 
-class FilesTestBase : public shell::test::ServiceTest {
+class FilesTestBase : public service_manager::test::ServiceTest {
  public:
   FilesTestBase();
   ~FilesTestBase() override;
 
-  // Overridden from shell::test::ServiceTest:
+  // Overridden from service_manager::test::ServiceTest:
   void SetUp() override;
 
  protected:
diff --git a/components/filesystem/main.cc b/components/filesystem/main.cc
index 2d7d8a6..781dfb64 100644
--- a/components/filesystem/main.cc
+++ b/components/filesystem/main.cc
@@ -4,10 +4,10 @@
 
 #include "base/macros.h"
 #include "components/filesystem/file_system_app.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle request) {
-  shell::ServiceRunner runner(new filesystem::FileSystemApp());
+  service_manager::ServiceRunner runner(new filesystem::FileSystemApp());
   return runner.Run(request);
 }
diff --git a/components/filesystem/manifest.json b/components/filesystem/manifest.json
index c378f967..22127cbae 100644
--- a/components/filesystem/manifest.json
+++ b/components/filesystem/manifest.json
@@ -7,7 +7,7 @@
       "filesystem:filesystem": [ "filesystem::mojom::FileSystem" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/components/filesystem/public/cpp/prefs/BUILD.gn b/components/filesystem/public/cpp/prefs/BUILD.gn
index 40a776ff..ed36b59 100644
--- a/components/filesystem/public/cpp/prefs/BUILD.gn
+++ b/components/filesystem/public/cpp/prefs/BUILD.gn
@@ -15,7 +15,7 @@
     "//components/filesystem/public/interfaces",
     "//components/prefs",
     "//mojo/common",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 
   data_deps = [
diff --git a/components/filesystem/public/cpp/prefs/pref_service_factory.cc b/components/filesystem/public/cpp/prefs/pref_service_factory.cc
index 22a1f1d..3c56729 100644
--- a/components/filesystem/public/cpp/prefs/pref_service_factory.cc
+++ b/components/filesystem/public/cpp/prefs/pref_service_factory.cc
@@ -12,7 +12,7 @@
 #include "components/prefs/pref_value_store.h"
 #include "components/prefs/value_map_pref_store.h"
 #include "components/prefs/writeable_pref_store.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace filesystem {
 
@@ -23,8 +23,9 @@
 
 }  // namespace
 
-std::unique_ptr<PrefService> CreatePrefService(shell::Connector* connector,
-                                               PrefRegistry* pref_registry) {
+std::unique_ptr<PrefService> CreatePrefService(
+    service_manager::Connector* connector,
+    PrefRegistry* pref_registry) {
   filesystem::mojom::FileSystemPtr filesystem;
   connector->ConnectToInterface("service:filesystem", &filesystem);
 
diff --git a/components/filesystem/public/cpp/prefs/pref_service_factory.h b/components/filesystem/public/cpp/prefs/pref_service_factory.h
index cee2631..86a2704 100644
--- a/components/filesystem/public/cpp/prefs/pref_service_factory.h
+++ b/components/filesystem/public/cpp/prefs/pref_service_factory.h
@@ -20,8 +20,9 @@
 // This factory method creates a PrefService for the local process based on the
 // preference registry passed in. This PrefService will synchronize with a JSON
 // file in the mojo:filesystem.
-std::unique_ptr<PrefService> CreatePrefService(shell::Connector* connector,
-                                               PrefRegistry* registry);
+std::unique_ptr<PrefService> CreatePrefService(
+    service_manager::Connector* connector,
+    PrefRegistry* registry);
 
 }  // namespace filesystem
 
diff --git a/components/filesystem/test_manifest.json b/components/filesystem/test_manifest.json
index 4f3282d..edc646f 100644
--- a/components/filesystem/test_manifest.json
+++ b/components/filesystem/test_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Filesystem Service Unittests",
   "capabilities": {
     "required": {
-      "service:filesystem": { "classes": [ "filesystem:filesystem" ] }
+      "service:filesystem": [ "filesystem:filesystem" ]
     }
   }
 }
diff --git a/components/font_service/BUILD.gn b/components/font_service/BUILD.gn
index 73a5c84..0777cce3 100644
--- a/components/font_service/BUILD.gn
+++ b/components/font_service/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 
 source_set("lib") {
   sources = [
@@ -17,7 +17,7 @@
     "//mojo/common:common_base",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
   ]
 
@@ -35,7 +35,7 @@
     ":lib",
     "//base",
     "//mojo/public/c/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 
   data_deps = [
diff --git a/components/font_service/DEPS b/components/font_service/DEPS
index b33591e..a32f59c 100644
--- a/components/font_service/DEPS
+++ b/components/font_service/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
-  "+services/shell",
+  "+services/service_manager",
   "+mojo/common",
   "+mojo/public",
   "+services/tracing/public/cpp",
diff --git a/components/font_service/font_service_app.cc b/components/font_service/font_service_app.cc
index 888709f..946acb2e 100644
--- a/components/font_service/font_service_app.cc
+++ b/components/font_service/font_service_app.cc
@@ -9,7 +9,7 @@
 #include "base/files/file.h"
 #include "base/files/file_path.h"
 #include "mojo/public/cpp/system/platform_handle.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 
 static_assert(
     static_cast<uint32_t>(SkFontStyle::kUpright_Slant) ==
@@ -48,18 +48,18 @@
 
 FontServiceApp::~FontServiceApp() {}
 
-void FontServiceApp::OnStart(const shell::Identity& identity) {
+void FontServiceApp::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 }
 
-bool FontServiceApp::OnConnect(const shell::Identity& remote_identity,
-                               shell::InterfaceRegistry* registry) {
+bool FontServiceApp::OnConnect(const service_manager::Identity& remote_identity,
+                               service_manager::InterfaceRegistry* registry) {
   registry->AddInterface(this);
   return true;
 }
 
 void FontServiceApp::Create(
-    const shell::Identity& remote_identity,
+    const service_manager::Identity& remote_identity,
     mojo::InterfaceRequest<mojom::FontService> request) {
   bindings_.AddBinding(this, std::move(request));
 }
diff --git a/components/font_service/font_service_app.h b/components/font_service/font_service_app.h
index 18d1f3c..d2a80fd 100644
--- a/components/font_service/font_service_app.h
+++ b/components/font_service/font_service_app.h
@@ -11,28 +11,29 @@
 #include "base/macros.h"
 #include "components/font_service/public/interfaces/font_service.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "skia/ext/skia_utils_base.h"
 
 namespace font_service {
 
-class FontServiceApp : public shell::Service,
-                       public shell::InterfaceFactory<mojom::FontService>,
-                       public mojom::FontService {
+class FontServiceApp
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::FontService>,
+      public mojom::FontService {
  public:
   FontServiceApp();
   ~FontServiceApp() override;
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
-  // shell::InterfaceFactory<mojom::FontService>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::FontService>:
+  void Create(const service_manager::Identity& remote_identity,
               mojo::InterfaceRequest<mojom::FontService> request) override;
 
   // FontService:
diff --git a/components/font_service/main.cc b/components/font_service/main.cc
index ee9e55b..4fd55f0 100644
--- a/components/font_service/main.cc
+++ b/components/font_service/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "components/font_service/font_service_app.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new font_service::FontServiceApp);
+  service_manager::ServiceRunner runner(new font_service::FontServiceApp);
   return runner.Run(service_request_handle);
 }
diff --git a/components/font_service/manifest.json b/components/font_service/manifest.json
index d9588bb..14f479b6 100644
--- a/components/font_service/manifest.json
+++ b/components/font_service/manifest.json
@@ -4,12 +4,10 @@
   "display_name": "Font Service",
   "capabilities": {
     "provided": {
-      "app": [
-        "font_service::mojom::FontService"
-      ]
+      "app": [ "font_service::mojom::FontService" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/components/font_service/public/cpp/BUILD.gn b/components/font_service/public/cpp/BUILD.gn
index 3d52c47..b51c79c 100644
--- a/components/font_service/public/cpp/BUILD.gn
+++ b/components/font_service/public/cpp/BUILD.gn
@@ -18,8 +18,8 @@
     "//mojo/common",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//skia",
   ]
 }
diff --git a/components/font_service/public/cpp/font_loader.cc b/components/font_service/public/cpp/font_loader.cc
index e6e3298..dd684c8 100644
--- a/components/font_service/public/cpp/font_loader.cc
+++ b/components/font_service/public/cpp/font_loader.cc
@@ -9,11 +9,11 @@
 #include "base/bind.h"
 #include "base/trace_event/trace_event.h"
 #include "components/font_service/public/cpp/font_service_thread.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace font_service {
 
-FontLoader::FontLoader(shell::Connector* connector) {
+FontLoader::FontLoader(service_manager::Connector* connector) {
   mojom::FontServicePtr font_service;
   connector->ConnectToInterface("service:font_service", &font_service);
   thread_ = new internal::FontServiceThread(std::move(font_service));
diff --git a/components/font_service/public/cpp/font_loader.h b/components/font_service/public/cpp/font_loader.h
index add2f4f0..d2affa9 100644
--- a/components/font_service/public/cpp/font_loader.h
+++ b/components/font_service/public/cpp/font_loader.h
@@ -17,7 +17,7 @@
 #include "third_party/skia/include/core/SkTypeface.h"
 #include "third_party/skia/include/ports/SkFontConfigInterface.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -35,7 +35,7 @@
 class FontLoader : public SkFontConfigInterface,
                    public internal::MappedFontFile::Observer {
  public:
-  explicit FontLoader(shell::Connector* connector);
+  explicit FontLoader(service_manager::Connector* connector);
   ~FontLoader() override;
 
   // Shuts down the background thread.
diff --git a/components/leveldb/BUILD.gn b/components/leveldb/BUILD.gn
index 082ab78..c21ef79b 100644
--- a/components/leveldb/BUILD.gn
+++ b/components/leveldb/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 static_library("lib") {
@@ -27,7 +27,7 @@
   deps = [
     "//mojo/common",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/leveldatabase",
   ]
 }
@@ -45,7 +45,7 @@
     "//mojo/common",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
   ]
 
@@ -73,9 +73,9 @@
     "//mojo/common",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
     "//third_party/leveldatabase",
   ]
 
diff --git a/components/leveldb/DEPS b/components/leveldb/DEPS
index 902c24fd..af1a7ae 100644
--- a/components/leveldb/DEPS
+++ b/components/leveldb/DEPS
@@ -3,7 +3,7 @@
   "+mojo/common",
   "+mojo/public",
   "+mojo/util",
-  "+services/shell",
+  "+services/service_manager",
   "+services/tracing/public/cpp",
   "+third_party/leveldatabase",
 ]
diff --git a/components/leveldb/env_mojo.cc b/components/leveldb/env_mojo.cc
index 9f183d941..b226ce4 100644
--- a/components/leveldb/env_mojo.cc
+++ b/components/leveldb/env_mojo.cc
@@ -359,7 +359,8 @@
 
 Status MojoEnv::GetTestDirectory(std::string* path) {
   // TODO(erg): This method is actually only used from the test harness in
-  // leveldb. And when we go and port that test stuff to a shell::ServiceTest,
+  // leveldb. And when we go and port that test stuff to a
+  // service_manager::ServiceTest,
   // we probably won't use it since the mojo filesystem actually handles
   // temporary filesystems just fine.
   NOTREACHED();
diff --git a/components/leveldb/leveldb_app.cc b/components/leveldb/leveldb_app.cc
index 55eb590..d43029b9 100644
--- a/components/leveldb/leveldb_app.cc
+++ b/components/leveldb/leveldb_app.cc
@@ -6,7 +6,7 @@
 
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/leveldb/leveldb_service_impl.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace leveldb {
 
@@ -14,17 +14,17 @@
 
 LevelDBApp::~LevelDBApp() {}
 
-void LevelDBApp::OnStart(const shell::Identity& identity) {
+void LevelDBApp::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 }
 
-bool LevelDBApp::OnConnect(const shell::Identity& remote_identity,
-                           shell::InterfaceRegistry* registry) {
+bool LevelDBApp::OnConnect(const service_manager::Identity& remote_identity,
+                           service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::LevelDBService>(this);
   return true;
 }
 
-void LevelDBApp::Create(const shell::Identity& remote_identity,
+void LevelDBApp::Create(const service_manager::Identity& remote_identity,
                         leveldb::mojom::LevelDBServiceRequest request) {
   if (!service_)
     service_.reset(new LevelDBServiceImpl(base::ThreadTaskRunnerHandle::Get()));
diff --git a/components/leveldb/leveldb_app.h b/components/leveldb/leveldb_app.h
index 28706c1b..9ccca11b 100644
--- a/components/leveldb/leveldb_app.h
+++ b/components/leveldb/leveldb_app.h
@@ -9,26 +9,27 @@
 
 #include "components/leveldb/public/interfaces/leveldb.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace leveldb {
 
-class LevelDBApp : public shell::Service,
-                   public shell::InterfaceFactory<mojom::LevelDBService> {
+class LevelDBApp
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::LevelDBService> {
  public:
   LevelDBApp();
   ~LevelDBApp() override;
 
  private:
   // |Service| override:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // |InterfaceFactory<mojom::LevelDBService>| implementation:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               leveldb::mojom::LevelDBServiceRequest request) override;
 
   tracing::Provider tracing_;
diff --git a/components/leveldb/leveldb_service_unittest.cc b/components/leveldb/leveldb_service_unittest.cc
index bfa6d2c6..c7c3612 100644
--- a/components/leveldb/leveldb_service_unittest.cc
+++ b/components/leveldb/leveldb_service_unittest.cc
@@ -11,8 +11,8 @@
 #include "components/leveldb/public/cpp/util.h"
 #include "components/leveldb/public/interfaces/leveldb.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_test.h"
 
 using filesystem::mojom::FileError;
 
@@ -103,7 +103,7 @@
   run_loop.Run();
 }
 
-class LevelDBServiceTest : public shell::test::ServiceTest {
+class LevelDBServiceTest : public service_manager::test::ServiceTest {
  public:
   LevelDBServiceTest() : ServiceTest("exe:leveldb_service_unittests") {}
   ~LevelDBServiceTest() override {}
diff --git a/components/leveldb/main.cc b/components/leveldb/main.cc
index 937755a..82ad845 100644
--- a/components/leveldb/main.cc
+++ b/components/leveldb/main.cc
@@ -4,10 +4,10 @@
 
 #include "base/macros.h"
 #include "components/leveldb/leveldb_app.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle application_request) {
-  shell::ServiceRunner runner(new leveldb::LevelDBApp());
+  service_manager::ServiceRunner runner(new leveldb::LevelDBApp());
   return runner.Run(application_request);
 }
diff --git a/components/leveldb/manifest.json b/components/leveldb/manifest.json
index f92f11f..6491a3bf 100644
--- a/components/leveldb/manifest.json
+++ b/components/leveldb/manifest.json
@@ -7,7 +7,7 @@
       "leveldb:leveldb": [ "leveldb::mojom::LevelDBService" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/components/leveldb/public/cpp/BUILD.gn b/components/leveldb/public/cpp/BUILD.gn
index 1996c768..c729f4c 100644
--- a/components/leveldb/public/cpp/BUILD.gn
+++ b/components/leveldb/public/cpp/BUILD.gn
@@ -14,7 +14,7 @@
     "//base",
     "//components/leveldb/public/interfaces",
     "//mojo/common",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/leveldatabase",
   ]
 }
diff --git a/components/leveldb/remote_iterator_unittest.cc b/components/leveldb/remote_iterator_unittest.cc
index 70da2337..e0c1b0a 100644
--- a/components/leveldb/remote_iterator_unittest.cc
+++ b/components/leveldb/remote_iterator_unittest.cc
@@ -10,8 +10,8 @@
 #include "components/leveldb/public/cpp/remote_iterator.h"
 #include "components/leveldb/public/cpp/util.h"
 #include "components/leveldb/public/interfaces/leveldb.mojom.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_test.h"
 
 namespace leveldb {
 namespace {
@@ -39,7 +39,7 @@
                     quit_closure);
 }
 
-class RemoteIteratorTest : public shell::test::ServiceTest {
+class RemoteIteratorTest : public service_manager::test::ServiceTest {
  public:
   RemoteIteratorTest() : ServiceTest("exe:leveldb_service_unittests") {}
   ~RemoteIteratorTest() override {}
diff --git a/components/leveldb/test_manifest.json b/components/leveldb/test_manifest.json
index 8c05723a..3d3740b 100644
--- a/components/leveldb/test_manifest.json
+++ b/components/leveldb/test_manifest.json
@@ -4,8 +4,8 @@
   "display_name": "LevelDB Service Unittests",
   "capabilities": {
     "required": {
-      "service:filesystem": { "classes": [ "filesystem:filesystem" ] },
-      "service:leveldb": { "classes":  [ "leveldb:leveldb" ] }
+      "service:filesystem": [ "filesystem:filesystem" ],
+      "service:leveldb": [ "leveldb:leveldb" ]
     }
   }
 }
diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn
index 5c10219..ca83e67 100644
--- a/components/metrics/BUILD.gn
+++ b/components/metrics/BUILD.gn
@@ -259,7 +259,7 @@
   ]
   deps = [
     "//components/metrics/public/interfaces:call_stack_mojo_bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 }
 
@@ -335,7 +335,7 @@
     "//components/variations",
     "//mojo/public/cpp/bindings",
     "//net:test_support",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:sources",
     "//testing/gtest",
     "//third_party/zlib:compression_utils",
     "//ui/gfx/geometry",
diff --git a/components/metrics/DEPS b/components/metrics/DEPS
index a7bf8dc..29757f4 100644
--- a/components/metrics/DEPS
+++ b/components/metrics/DEPS
@@ -9,7 +9,7 @@
   "+components/version_info",
   "+content/public/test",
   "+mojo/public/cpp",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/zlib/google",
   "-net",
 ]
diff --git a/components/metrics/child_call_stack_profile_collector.cc b/components/metrics/child_call_stack_profile_collector.cc
index 9c62af8..0daf673 100644
--- a/components/metrics/child_call_stack_profile_collector.cc
+++ b/components/metrics/child_call_stack_profile_collector.cc
@@ -8,7 +8,7 @@
 #include "base/logging.h"
 #include "base/synchronization/lock.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace metrics {
 
diff --git a/components/metrics/child_call_stack_profile_collector.h b/components/metrics/child_call_stack_profile_collector.h
index adc356d..bc19a540 100644
--- a/components/metrics/child_call_stack_profile_collector.h
+++ b/components/metrics/child_call_stack_profile_collector.h
@@ -11,7 +11,7 @@
 #include "base/synchronization/lock.h"
 #include "components/metrics/public/interfaces/call_stack_profile_collector.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
diff --git a/components/metrics/child_call_stack_profile_collector_unittest.cc b/components/metrics/child_call_stack_profile_collector_unittest.cc
index 556124fe..3747ee11d 100644
--- a/components/metrics/child_call_stack_profile_collector_unittest.cc
+++ b/components/metrics/child_call_stack_profile_collector_unittest.cc
@@ -13,7 +13,7 @@
 #include "components/metrics/call_stack_profile_params.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace metrics {
diff --git a/components/network_time/network_time_tracker.cc b/components/network_time/network_time_tracker.cc
index 71223e0e7..d33de065 100644
--- a/components/network_time/network_time_tracker.cc
+++ b/components/network_time/network_time_tracker.cc
@@ -188,7 +188,8 @@
       getter_(std::move(getter)),
       clock_(std::move(clock)),
       tick_clock_(std::move(tick_clock)),
-      pref_service_(pref_service) {
+      pref_service_(pref_service),
+      time_query_completed_(false) {
   const base::DictionaryValue* time_mapping =
       pref_service_->GetDictionary(prefs::kNetworkTimeMapping);
   double time_js = 0;
@@ -310,7 +311,22 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK(network_time);
   if (network_time_at_last_measurement_.is_null()) {
-    return NETWORK_TIME_NO_SYNC;
+    if (time_query_completed_) {
+      // Time query attempts have been made in the past and failed.
+      if (time_fetcher_) {
+        // A fetch (not the first attempt) is in progress.
+        return NETWORK_TIME_SUBSEQUENT_SYNC_PENDING;
+      } else {
+        return NETWORK_TIME_NO_SUCCESSFUL_SYNC;
+      }
+    } else {
+      // No time queries have happened yet.
+      if (time_fetcher_) {
+        return NETWORK_TIME_FIRST_SYNC_PENDING;
+      } else {
+        return NETWORK_TIME_NO_SYNC_ATTEMPT;
+      }
+    }
   }
   DCHECK(!ticks_at_last_measurement_.is_null());
   DCHECK(!time_at_last_measurement_.is_null());
@@ -400,6 +416,7 @@
 bool NetworkTimeTracker::UpdateTimeFromResponse() {
   if (time_fetcher_->GetStatus().status() != net::URLRequestStatus::SUCCESS ||
       time_fetcher_->GetResponseCode() != 200) {
+    time_query_completed_ = true;
     DVLOG(1) << "fetch failed, status=" << time_fetcher_->GetStatus().status()
              << ",code=" << time_fetcher_->GetResponseCode();
     // The error code is negated because net errors are negative, but
@@ -450,6 +467,7 @@
       base::TimeDelta::FromMilliseconds(1) +
       base::TimeDelta::FromSeconds(kTimeServerMaxSkewSeconds);
   base::TimeDelta latency = tick_clock_->NowTicks() - fetch_started_;
+  UMA_HISTOGRAM_TIMES("NetworkTimeTracker.TimeQueryLatency", latency);
   UpdateNetworkTime(current_time, resolution, latency, tick_clock_->NowTicks());
   return true;
 }
@@ -459,6 +477,8 @@
   DCHECK(time_fetcher_);
   DCHECK_EQ(source, time_fetcher_.get());
 
+  time_query_completed_ = true;
+
   // After completion of a query, whether succeeded or failed, go to sleep for a
   // long time.
   if (!UpdateTimeFromResponse()) {  // On error, back off.
diff --git a/components/network_time/network_time_tracker.h b/components/network_time/network_time_tracker.h
index ae1f268..5e31411 100644
--- a/components/network_time/network_time_tracker.h
+++ b/components/network_time/network_time_tracker.h
@@ -62,8 +62,20 @@
     // of sync due to, for example, a suspend/resume.
     NETWORK_TIME_SYNC_LOST,
     // Network time is unavailable because the tracker has not yet
-    // retrieved a time from the network.
-    NETWORK_TIME_NO_SYNC,
+    // attempted to retrieve a time from the network.
+    NETWORK_TIME_NO_SYNC_ATTEMPT,
+    // Network time is unavailable because the tracker has not yet
+    // successfully retrieved a time from the network (at least one
+    // attempt has been made but all have failed).
+    NETWORK_TIME_NO_SUCCESSFUL_SYNC,
+    // Network time is unavailable because the tracker has not yet
+    // attempted to retrieve a time from the network, but the first
+    // attempt is currently pending.
+    NETWORK_TIME_FIRST_SYNC_PENDING,
+    // Network time is unavailable because the tracker has made failed
+    // attempts to retrieve a time from the network, but an attempt is
+    // currently pending.
+    NETWORK_TIME_SUBSEQUENT_SYNC_PENDING,
   };
 
   static void RegisterPrefs(PrefRegistrySimple* registry);
@@ -175,6 +187,10 @@
   // UpdateNetworkTime(...) implementation for details.
   base::TimeDelta network_time_uncertainty_;
 
+  // True if any time query has completed (but not necessarily succeeded) in
+  // this NetworkTimeTracker's lifetime.
+  bool time_query_completed_;
+
   base::ThreadChecker thread_checker_;
 
   DISALLOW_COPY_AND_ASSIGN(NetworkTimeTracker);
diff --git a/components/network_time/network_time_tracker_unittest.cc b/components/network_time/network_time_tracker_unittest.cc
index 401839a..312b4cd 100644
--- a/components/network_time/network_time_tracker_unittest.cc
+++ b/components/network_time/network_time_tracker_unittest.cc
@@ -241,7 +241,7 @@
 TEST_F(NetworkTimeTrackerTest, Uninitialized) {
   base::Time network_time;
   base::TimeDelta uncertainty;
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC_ATTEMPT,
             tracker_->GetNetworkTime(&network_time, &uncertainty));
 }
 
@@ -472,7 +472,7 @@
   prefs.SetDouble("network", network);
   pref_service_.Set(prefs::kNetworkTimeMapping, prefs);
   Reset();
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC_ATTEMPT,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
 }
 
@@ -487,7 +487,7 @@
             tracker_->GetNetworkTime(&out_network_time, nullptr));
   AdvanceBoth(base::TimeDelta::FromDays(8));
   Reset();
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC_ATTEMPT,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
 }
 
@@ -528,7 +528,7 @@
   histograms.ExpectTotalCount(kFetchValidHistogram, 0);
 
   base::Time out_network_time;
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC_ATTEMPT,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
   // First query should happen soon.
   EXPECT_EQ(base::TimeDelta::FromMinutes(0),
@@ -605,7 +605,7 @@
   tracker_->WaitForFetchForTesting(123123123);
 
   base::Time out_network_time;
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SUCCESSFUL_SYNC,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
   EXPECT_EQ(base::TimeDelta::FromMinutes(120),
             tracker_->GetTimerDelayForTesting());
@@ -640,7 +640,7 @@
   EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
   tracker_->WaitForFetchForTesting(123123123);
   base::Time out_network_time;
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SUCCESSFUL_SYNC,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
   EXPECT_EQ(base::TimeDelta::FromMinutes(120),
             tracker_->GetTimerDelayForTesting());
@@ -663,7 +663,7 @@
   tracker_->WaitForFetchForTesting(123123123);
 
   base::Time out_network_time;
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SUCCESSFUL_SYNC,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
   // Should see backoff in the error case.
   EXPECT_EQ(base::TimeDelta::FromMinutes(120),
@@ -690,7 +690,7 @@
   tracker_->WaitForFetchForTesting(123123123);
 
   base::Time out_network_time;
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SUCCESSFUL_SYNC,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
   // Should see backoff in the error case.
   EXPECT_EQ(base::TimeDelta::FromMinutes(120),
@@ -717,7 +717,7 @@
   tracker_->SetMaxResponseSizeForTesting(3);
   EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
   tracker_->WaitForFetchForTesting(123123123);
-  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SYNC,
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SUCCESSFUL_SYNC,
             tracker_->GetNetworkTime(&out_network_time, nullptr));
 
   histograms.ExpectTotalCount(kFetchFailedHistogram, 1);
@@ -734,4 +734,60 @@
   histograms.ExpectBucketCount(kFetchValidHistogram, true, 1);
 }
 
+TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkFirstSyncPending) {
+  base::HistogramTester histograms;
+  histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
+  histograms.ExpectTotalCount(kFetchValidHistogram, 0);
+
+  test_server_->RegisterRequestHandler(
+      base::Bind(&NetworkTimeTrackerTest::BadDataResponseHandler));
+  EXPECT_TRUE(test_server_->Start());
+  base::StringPiece key = {reinterpret_cast<const char*>(kDevKeyPubBytes),
+                           sizeof(kDevKeyPubBytes)};
+  tracker_->SetPublicKeyForTesting(key);
+  tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
+  EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
+
+  // Do not wait for the fetch to complete; ask for the network time
+  // immediately while the request is still pending.
+  base::Time out_network_time;
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_FIRST_SYNC_PENDING,
+            tracker_->GetNetworkTime(&out_network_time, nullptr));
+  histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
+  histograms.ExpectTotalCount(kFetchValidHistogram, 0);
+
+  tracker_->WaitForFetchForTesting(123123123);
+}
+
+TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkSubseqeuntSyncPending) {
+  base::HistogramTester histograms;
+  histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
+  histograms.ExpectTotalCount(kFetchValidHistogram, 0);
+
+  test_server_->RegisterRequestHandler(
+      base::Bind(&NetworkTimeTrackerTest::BadDataResponseHandler));
+  EXPECT_TRUE(test_server_->Start());
+  base::StringPiece key = {reinterpret_cast<const char*>(kDevKeyPubBytes),
+                           sizeof(kDevKeyPubBytes)};
+  tracker_->SetPublicKeyForTesting(key);
+  tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
+  EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
+  tracker_->WaitForFetchForTesting(123123123);
+
+  base::Time out_network_time;
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_NO_SUCCESSFUL_SYNC,
+            tracker_->GetNetworkTime(&out_network_time, nullptr));
+
+  // After one sync attempt failed, kick off another one, and ask for
+  // the network time while it is still pending.
+  EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
+  EXPECT_EQ(NetworkTimeTracker::NETWORK_TIME_SUBSEQUENT_SYNC_PENDING,
+            tracker_->GetNetworkTime(&out_network_time, nullptr));
+  histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
+  histograms.ExpectTotalCount(kFetchValidHistogram, 1);
+  histograms.ExpectBucketCount(kFetchValidHistogram, false, 1);
+
+  tracker_->WaitForFetchForTesting(123123123);
+}
+
 }  // namespace network_time
diff --git a/components/offline_pages/BUILD.gn b/components/offline_pages/BUILD.gn
index c1bf792..136503e 100644
--- a/components/offline_pages/BUILD.gn
+++ b/components/offline_pages/BUILD.gn
@@ -108,6 +108,7 @@
 if (is_android) {
   java_cpp_enum("offline_page_model_enums_java") {
     sources = [
+      "background/request_notifier.h",
       "background/request_queue.h",
       "background/save_page_request.h",
       "offline_page_types.h",
diff --git a/components/offline_pages/background/BUILD.gn b/components/offline_pages/background/BUILD.gn
index 4e41c85..a374107a 100644
--- a/components/offline_pages/background/BUILD.gn
+++ b/components/offline_pages/background/BUILD.gn
@@ -20,6 +20,7 @@
     "request_coordinator.h",
     "request_coordinator_event_logger.cc",
     "request_coordinator_event_logger.h",
+    "request_notifier.h",
     "request_picker.cc",
     "request_picker.h",
     "request_queue.cc",
diff --git a/components/offline_pages/background/offliner_policy.h b/components/offline_pages/background/offliner_policy.h
index 83abd4a4..a82f5e68 100644
--- a/components/offline_pages/background/offliner_policy.h
+++ b/components/offline_pages/background/offliner_policy.h
@@ -9,7 +9,8 @@
 const int kMaxStartedTries = 4;
 const int kMaxCompletedTries = 1;
 const int kBackgroundProcessingTimeBudgetSeconds = 170;
-const int kSinglePageTimeLimitSeconds = 120;
+const int kSinglePageTimeLimitWhenBackgroundScheduledSeconds = 120;
+const int kSinglePageTimeLimitForImmediateLoadSeconds = 300;
 const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
 }  // namespace
 
@@ -86,9 +87,16 @@
     return kBackgroundProcessingTimeBudgetSeconds;
   }
 
-  // How long do we allow a page to load before giving up on it
-  int GetSinglePageTimeLimitInSeconds() const {
-    return kSinglePageTimeLimitSeconds;
+  // How long do we allow a page to load before giving up on it when
+  // background loading was scheduled.
+  int GetSinglePageTimeLimitWhenBackgroundScheduledInSeconds() const {
+    return kSinglePageTimeLimitWhenBackgroundScheduledSeconds;
+  }
+
+  // How long do we allow a page to load before giving up on it when
+  // immediately background loading.
+  int GetSinglePageTimeLimitForImmediateLoadInSeconds() const {
+    return kSinglePageTimeLimitForImmediateLoadSeconds;
   }
 
   // How long we allow requests to remain in the system before giving up.
@@ -103,6 +111,7 @@
   int max_started_tries_;
   int max_completed_tries_;
 };
-}
+}  // namespace offline_pages
+
 
 #endif  // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc
index 087be6f..7d4eebf 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -4,7 +4,10 @@
 
 #include "components/offline_pages/background/request_coordinator.h"
 
+#include <limits>
+#include <string>
 #include <utility>
+#include <vector>
 
 #include "base/bind.h"
 #include "base/callback.h"
@@ -121,7 +124,7 @@
         network_quality_estimator)
     : is_busy_(false),
       is_starting_(false),
-      is_stopped_(false),
+      processing_state_(ProcessingWindowState::STOPPED),
       use_test_connection_type_(false),
       test_connection_type_(),
       offliner_(nullptr),
@@ -133,8 +136,6 @@
       network_quality_estimator_(network_quality_estimator),
       active_request_(nullptr),
       last_offlining_status_(Offliner::RequestStatus::UNKNOWN),
-      offliner_timeout_(base::TimeDelta::FromSeconds(
-          policy_->GetSinglePageTimeLimitInSeconds())),
       weak_ptr_factory_(this) {
   DCHECK(policy_ != nullptr);
   picker_.reset(
@@ -206,7 +207,6 @@
     is_busy_ = false;
     active_request_.reset();
   }
-
 }
 
 void RequestCoordinator::GetRequestsForSchedulingCallback(
@@ -324,7 +324,7 @@
   scheduler_->Schedule(GetTriggerConditions(kUserRequest));
 
   if (request.user_requested())
-    StartProcessingIfConnected();
+    StartImmediatelyIfConnected();
 }
 
 // Called in response to updating a request in the request queue.
@@ -354,7 +354,7 @@
   }
 
   if (available_user_request)
-    StartProcessingIfConnected();
+    StartImmediatelyIfConnected();
 }
 
 // When we successfully remove a request that completed successfully, move on to
@@ -392,7 +392,7 @@
 
 void RequestCoordinator::StopProcessing(
     Offliner::RequestStatus stop_status) {
-  is_stopped_ = true;
+  processing_state_ = ProcessingWindowState::STOPPED;
   StopPrerendering(stop_status);
 
   // Let the scheduler know we are done processing.
@@ -408,24 +408,31 @@
 bool RequestCoordinator::StartProcessing(
     const DeviceConditions& device_conditions,
     const base::Callback<void(bool)>& callback) {
+  return StartProcessingInternal(ProcessingWindowState::SCHEDULED_WINDOW,
+                                 device_conditions, callback);
+}
+
+bool RequestCoordinator::StartProcessingInternal(
+    const ProcessingWindowState processing_state,
+    const DeviceConditions& device_conditions,
+    const base::Callback<void(bool)>& callback) {
   current_conditions_.reset(new DeviceConditions(device_conditions));
   if (is_starting_ || is_busy_)
     return false;
   is_starting_ = true;
+  processing_state_ = processing_state;
+  scheduler_callback_ = callback;
 
   // Mark the time at which we started processing so we can check our time
   // budget.
   operation_start_time_ = base::Time::Now();
 
-  is_stopped_ = false;
-  scheduler_callback_ = callback;
-
   TryNextRequest();
 
   return true;
 }
 
-void RequestCoordinator::StartProcessingIfConnected() {
+void RequestCoordinator::StartImmediatelyIfConnected() {
   OfflinerImmediateStartStatus immediate_start_status = TryImmediateStart();
   UMA_HISTOGRAM_ENUMERATION(
       "OfflinePages.Background.ImmediateStartStatus", immediate_start_status,
@@ -458,7 +465,9 @@
   // (i.e., assume no battery).
   // TODO(dougarnett): Obtain actual battery conditions (from Android/Java).
   DeviceConditions device_conditions(false, 0, GetConnectionType());
-  if (StartProcessing(device_conditions, base::Bind(&EmptySchedulerCallback)))
+  if (StartProcessingInternal(ProcessingWindowState::IMMEDIATE_WINDOW,
+                              device_conditions,
+                              base::Bind(&EmptySchedulerCallback)))
     return OfflinerImmediateStartStatus::STARTED;
   else
     return OfflinerImmediateStartStatus::NOT_ACCEPTED;
@@ -495,7 +504,7 @@
   is_starting_ = false;
 
   // Make sure we were not stopped while picking.
-  if (!is_stopped_) {
+  if (processing_state_ != ProcessingWindowState::STOPPED) {
     // Send the request on to the offliner.
     SendRequestToOffliner(request);
   }
@@ -524,7 +533,7 @@
 void RequestCoordinator::SendRequestToOffliner(const SavePageRequest& request) {
   // Check that offlining didn't get cancelled while performing some async
   // steps.
-  if (is_stopped_)
+  if (processing_state_ == ProcessingWindowState::STOPPED)
     return;
 
   GetOffliner();
@@ -550,8 +559,16 @@
   if (offliner_->LoadAndSave(
           updated_request, base::Bind(&RequestCoordinator::OfflinerDoneCallback,
                                       weak_ptr_factory_.GetWeakPtr()))) {
-    // Start a watchdog timer to catch pre-renders running too long
-    watchdog_timer_.Start(FROM_HERE, offliner_timeout_, this,
+    base::TimeDelta timeout;
+    if (processing_state_ == ProcessingWindowState::SCHEDULED_WINDOW) {
+      timeout = base::TimeDelta::FromSeconds(
+          policy_->GetSinglePageTimeLimitWhenBackgroundScheduledInSeconds());
+    } else {
+      DCHECK(processing_state_ == ProcessingWindowState::IMMEDIATE_WINDOW);
+      timeout = base::TimeDelta::FromSeconds(
+          policy_->GetSinglePageTimeLimitForImmediateLoadInSeconds());
+    }
+    watchdog_timer_.Start(FROM_HERE, timeout, this,
                           &RequestCoordinator::HandleWatchdogTimeout);
   } else {
     is_busy_ = false;
@@ -644,7 +661,7 @@
     return;
   disabled_requests_.erase(request_id);
   // If we are not busy, start processing right away.
-  StartProcessingIfConnected();
+  StartImmediatelyIfConnected();
 }
 
 void RequestCoordinator::MarkRequestCompleted(int64_t request_id) {
diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h
index b03fe85d..c523edb 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -7,6 +7,7 @@
 
 #include <memory>
 #include <set>
+#include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
@@ -41,7 +42,6 @@
                            public RequestNotifier,
                            public base::SupportsUserData {
  public:
-
   // Nested observer class.  To make sure that no events are missed, the client
   // code should first register for notifications, then |GetAllRequests|, and
   // ignore all events before the return from |GetAllRequests|, and consume
@@ -178,7 +178,7 @@
   // Tracks whether the last offlining attempt got canceled.  This is reset by
   // the next StartProcessing() call.
   bool is_canceled() {
-    return is_stopped_;
+    return processing_state_ == ProcessingWindowState::STOPPED;
   }
 
   OfflineEventLogger* GetLogger() {
@@ -208,6 +208,12 @@
     STATUS_COUNT = 6,
   };
 
+  enum class ProcessingWindowState {
+    STOPPED,
+    SCHEDULED_WINDOW,
+    IMMEDIATE_WINDOW,
+  };
+
   // Receives the results of a get from the request queue, and turns that into
   // SavePageRequest objects for the caller of GetQueuedRequests.
   void GetQueuedRequestsCallback(
@@ -242,9 +248,13 @@
   void HandleRemovedRequests(BackgroundSavePageResult status,
                              std::unique_ptr<UpdateRequestsResult> result);
 
+  bool StartProcessingInternal(const ProcessingWindowState processing_state,
+                               const DeviceConditions& device_conditions,
+                               const base::Callback<void(bool)>& callback);
+
   // Start processing now if connected (but with conservative assumption
   // as to other device conditions).
-  void StartProcessingIfConnected();
+  void StartImmediatelyIfConnected();
 
   OfflinerImmediateStartStatus TryImmediateStart();
 
@@ -300,11 +310,7 @@
     test_connection_type_ = connection;
   }
 
-  void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) {
-    offliner_timeout_ = timeout;
-  }
-
-  void SetDeviceConditionsForTest(DeviceConditions& current_conditions) {
+  void SetDeviceConditionsForTest(const DeviceConditions& current_conditions) {
     current_conditions_.reset(new DeviceConditions(current_conditions));
   }
 
@@ -320,8 +326,8 @@
   // There is more than one path to start processing so this flag is used
   // to avoid race conditions before is_busy_ is established.
   bool is_starting_;
-  // True if the current processing window has been canceled.
-  bool is_stopped_;
+  // Identifies the type of current processing window or if processing stopped.
+  ProcessingWindowState processing_state_;
   // True if we should use the test connection type instead of the actual type.
   bool use_test_connection_type_;
   // For use by tests, a fake network connection type
@@ -361,8 +367,6 @@
   RequestCoordinatorEventLogger event_logger_;
   // Timer to watch for pre-render attempts running too long.
   base::OneShotTimer watchdog_timer_;
-  // How long to wait for an offliner request before giving up.
-  base::TimeDelta offliner_timeout_;
   // Allows us to pass a weak pointer to callbacks.
   base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_;
 
diff --git a/components/offline_pages/background/request_coordinator_unittest.cc b/components/offline_pages/background/request_coordinator_unittest.cc
index 06614b0d..6a2c95d 100644
--- a/components/offline_pages/background/request_coordinator_unittest.cc
+++ b/components/offline_pages/background/request_coordinator_unittest.cc
@@ -5,6 +5,7 @@
 #include "components/offline_pages/background/request_coordinator.h"
 
 #include <memory>
+#include <string>
 #include <utility>
 #include <vector>
 
@@ -39,7 +40,6 @@
 const ClientId kClientId2(kClientNamespace, kId2);
 const int kRequestId1(1);
 const int kRequestId2(2);
-const long kTestTimeoutSeconds = 1;
 const long kTestTimeBudgetSeconds = 200;
 const int kBatteryPercentageHigh = 75;
 const bool kPowerRequired = true;
@@ -306,10 +306,6 @@
     coordinator_->RequestNotPicked(non_user_requested_tasks_remaining);
   }
 
-  void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) {
-    coordinator_->SetOfflinerTimeoutForTest(timeout);
-  }
-
   void SetDeviceConditionsForTest(DeviceConditions device_conditions) {
     coordinator_->SetDeviceConditionsForTest(device_conditions);
   }
@@ -419,10 +415,10 @@
 
 TEST_F(RequestCoordinatorTest, StartProcessingWithRequestInProgress) {
   // Put the request on the queue.
-  EXPECT_TRUE(
+  EXPECT_NE(
       coordinator()->SavePageLater(
           kUrl1, kClientId1, kUserRequested,
-          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER) != 0);
+          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER), 0);
 
   // Set up for the call to StartProcessing by building arguments.
   DeviceConditions device_conditions(
@@ -445,10 +441,10 @@
 }
 
 TEST_F(RequestCoordinatorTest, SavePageLater) {
-  EXPECT_TRUE(
+  EXPECT_NE(
       coordinator()->SavePageLater(
           kUrl1, kClientId1, kUserRequested,
-          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER) != 0);
+          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER), 0);
 
   // Expect that a request got placed on the queue.
   coordinator()->queue()->GetRequests(
@@ -973,7 +969,7 @@
   EXPECT_TRUE(observer().completed_called());
 }
 
-TEST_F(RequestCoordinatorTest, WatchdogTimeout) {
+TEST_F(RequestCoordinatorTest, WatchdogTimeoutForScheduledProcessing) {
   // Build a request to use with the pre-renderer, and put it on the queue.
   offline_pages::SavePageRequest request(
       kRequestId1, kUrl1, kClientId1, base::Time::Now(), kUserRequested);
@@ -995,16 +991,15 @@
   // in progress by asking it to skip making the completion callback.
   EnableOfflinerCallback(false);
 
-  // Ask RequestCoordinator to stop waiting for the offliner after this many
-  // seconds.
-  SetOfflinerTimeoutForTest(base::TimeDelta::FromSeconds(kTestTimeoutSeconds));
-
   // Sending the request to the offliner.
   EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
   PumpLoop();
 
   // Advance the mock clock far enough to cause a watchdog timeout
-  AdvanceClockBy(base::TimeDelta::FromSeconds(kTestTimeoutSeconds + 1));
+  AdvanceClockBy(base::TimeDelta::FromSeconds(
+      coordinator()
+          ->policy()
+          ->GetSinglePageTimeLimitWhenBackgroundScheduledInSeconds() + 1));
   PumpLoop();
 
   // Wait for timeout to expire.  Use a TaskRunner with a DelayedTaskRunner
@@ -1019,6 +1014,51 @@
             last_offlining_status());
 }
 
+TEST_F(RequestCoordinatorTest, WatchdogTimeoutForImmediateProcessing) {
+  // Test only applies on non-svelte device.
+  if (base::SysInfo::IsLowEndDevice())
+    return;
+
+  // Set good network connection so that adding request will trigger
+  // immediate processing.
+  SetEffectiveConnectionTypeForTest(
+      net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_3G);
+
+  // Ensure that the new request does not finish - we simulate it being
+  // in progress by asking it to skip making the completion callback.
+  EnableOfflinerCallback(false);
+
+  EXPECT_NE(
+      coordinator()->SavePageLater(
+          kUrl1, kClientId1, kUserRequested,
+          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER), 0);
+  PumpLoop();
+
+  // Verify that immediate start from adding the request did happen.
+  EXPECT_TRUE(coordinator()->is_busy());
+
+  // Advance the mock clock 1 second before the watchdog timeout.
+  AdvanceClockBy(base::TimeDelta::FromSeconds(
+      coordinator()
+          ->policy()
+          ->GetSinglePageTimeLimitForImmediateLoadInSeconds() - 1));
+  PumpLoop();
+
+  // Verify still busy.
+  EXPECT_TRUE(coordinator()->is_busy());
+  EXPECT_FALSE(OfflinerWasCanceled());
+
+  // Advance the mock clock past the watchdog timeout now.
+  AdvanceClockBy(base::TimeDelta::FromSeconds(2));
+  PumpLoop();
+
+  // Verify the request timed out.
+  EXPECT_FALSE(coordinator()->is_busy());
+  EXPECT_TRUE(OfflinerWasCanceled());
+  EXPECT_EQ(Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT,
+            last_offlining_status());
+}
+
 TEST_F(RequestCoordinatorTest, TimeBudgetExceeded) {
   // Build two requests to use with the pre-renderer, and put it on the queue.
   offline_pages::SavePageRequest request1(
@@ -1154,10 +1194,10 @@
        SavePageStartsProcessingWhenConnectedAndNotLowEndDevice) {
   SetEffectiveConnectionTypeForTest(
       net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_3G);
-  EXPECT_TRUE(
+  EXPECT_NE(
       coordinator()->SavePageLater(
           kUrl1, kClientId1, kUserRequested,
-          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER) != 0);
+          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER), 0);
   PumpLoop();
 
   // Now whether processing triggered immediately depends on whether test
@@ -1170,10 +1210,10 @@
 }
 
 TEST_F(RequestCoordinatorTest, SavePageDoesntStartProcessingWhenDisconnected) {
-  EXPECT_TRUE(
+  EXPECT_NE(
       coordinator()->SavePageLater(
           kUrl1, kClientId1, kUserRequested,
-          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER) != 0);
+          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER), 0);
   PumpLoop();
   EXPECT_FALSE(is_busy());
 }
@@ -1182,17 +1222,16 @@
        SavePageDoesntStartProcessingWhenPoorlyConnected) {
   SetEffectiveConnectionTypeForTest(
       net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_SLOW_2G);
-  EXPECT_TRUE(
+  EXPECT_NE(
       coordinator()->SavePageLater(
           kUrl1, kClientId1, kUserRequested,
-          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER) != 0);
+          RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER), 0);
   PumpLoop();
   EXPECT_FALSE(is_busy());
 }
 
 TEST_F(RequestCoordinatorTest,
        ResumeStartsProcessingWhenConnectedAndNotLowEndDevice) {
-
   // Add a request to the queue.
   offline_pages::SavePageRequest request1(kRequestId1, kUrl1, kClientId1,
                                           base::Time::Now(), kUserRequested);
diff --git a/components/offline_pages/background/request_notifier.h b/components/offline_pages/background/request_notifier.h
index 7ed907d..611eac3 100644
--- a/components/offline_pages/background/request_notifier.h
+++ b/components/offline_pages/background/request_notifier.h
@@ -14,6 +14,7 @@
   // Status to return for failed notifications.
   // NOTE: for any changes to the enum, please also update related switch code
   // in RequestCoordinatorEventLogger.
+  // GENERATED_JAVA_ENUM_PACKAGE:org.chromium.components.offlinepages
   enum class BackgroundSavePageResult {
     SUCCESS,
     PRERENDER_FAILURE,
diff --git a/components/password_manager/content/browser/BUILD.gn b/components/password_manager/content/browser/BUILD.gn
index 55e313d..6624d81 100644
--- a/components/password_manager/content/browser/BUILD.gn
+++ b/components/password_manager/content/browser/BUILD.gn
@@ -19,7 +19,7 @@
   public_deps = [
     "//base",
     "//components/autofill/content/browser",
-    "//components/autofill/content/public/interfaces",
+    "//components/autofill/content/common:mojo_interfaces",
     "//components/autofill/core/common",
     "//components/keyed_service/content",
     "//components/password_manager/content/public/interfaces",
diff --git a/components/password_manager/content/browser/DEPS b/components/password_manager/content/browser/DEPS
index 91b3911d..d79664a 100644
--- a/components/password_manager/content/browser/DEPS
+++ b/components/password_manager/content/browser/DEPS
@@ -1,10 +1,10 @@
 include_rules = [
   "+components/autofill/core/browser",
   "+components/autofill/content/browser",
-  "+components/autofill/content/public/interfaces",
+  "+components/autofill/content/common",
   "+components/keyed_service/content",
   "+content/public/browser",
   "+net",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/WebKit/public/platform/modules/sensitive_input_visibility/sensitive_input_visibility_service.mojom.h",
 ]
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc
index b658e0bd..499dc191 100644
--- a/components/password_manager/content/browser/content_password_manager_driver.cc
+++ b/components/password_manager/content/browser/content_password_manager_driver.cc
@@ -24,7 +24,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/origin_util.h"
 #include "net/cert/cert_status_flags.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace password_manager {
 
diff --git a/components/password_manager/content/browser/content_password_manager_driver.h b/components/password_manager/content/browser/content_password_manager_driver.h
index fe695899..bd9ddb1 100644
--- a/components/password_manager/content/browser/content_password_manager_driver.h
+++ b/components/password_manager/content/browser/content_password_manager_driver.h
@@ -10,8 +10,8 @@
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_agent.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/core/common/password_form_field_prediction_map.h"
 #include "components/autofill/core/common/password_form_generation_data.h"
 #include "components/password_manager/core/browser/password_autofill_manager.h"
diff --git a/components/password_manager/content/browser/content_password_manager_driver_factory.h b/components/password_manager/content/browser/content_password_manager_driver_factory.h
index b8953185..da9172b2 100644
--- a/components/password_manager/content/browser/content_password_manager_driver_factory.h
+++ b/components/password_manager/content/browser/content_password_manager_driver_factory.h
@@ -11,7 +11,7 @@
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/supports_user_data.h"
-#include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
+#include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/password_manager/core/browser/password_autofill_manager.h"
 #include "components/password_manager/core/browser/password_generation_manager.h"
 #include "components/password_manager/core/browser/password_manager.h"
diff --git a/components/password_manager/content/browser/content_password_manager_driver_unittest.cc b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
index 7bdd57d4..325accc 100644
--- a/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
+++ b/components/password_manager/content/browser/content_password_manager_driver_unittest.cc
@@ -6,7 +6,7 @@
 
 #include "base/macros.h"
 #include "base/run_loop.h"
-#include "components/autofill/content/public/interfaces/autofill_agent.mojom.h"
+#include "components/autofill/content/common/autofill_agent.mojom.h"
 #include "components/autofill/core/browser/test_autofill_client.h"
 #include "components/password_manager/core/browser/stub_log_manager.h"
 #include "components/password_manager/core/browser/stub_password_manager_client.h"
@@ -15,7 +15,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/test_renderer_host.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -101,9 +101,9 @@
     ON_CALL(password_manager_client_, GetLogManager())
         .WillByDefault(Return(&log_manager_));
 
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         web_contents()->GetMainFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         autofill::mojom::PasswordAutofillAgent::Name_,
         base::Bind(&FakePasswordAutofillAgent::BindRequest,
diff --git a/components/password_manager/content/renderer/BUILD.gn b/components/password_manager/content/renderer/BUILD.gn
index ea5534d..ff053f3 100644
--- a/components/password_manager/content/renderer/BUILD.gn
+++ b/components/password_manager/content/renderer/BUILD.gn
@@ -15,7 +15,7 @@
     "//components/strings",
     "//content/public/common",
     "//content/public/renderer",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/WebKit/public:blink",
     "//url",
   ]
@@ -31,7 +31,7 @@
     ":renderer",
     "//content/public/renderer",
     "//content/test:test_support",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//testing/gmock",
     "//testing/gtest",
     "//third_party/WebKit/public:blink",
diff --git a/components/password_manager/content/renderer/DEPS b/components/password_manager/content/renderer/DEPS
index 30989a17..d30225b5 100644
--- a/components/password_manager/content/renderer/DEPS
+++ b/components/password_manager/content/renderer/DEPS
@@ -2,7 +2,7 @@
   "+content/public/common",
   "+content/public/renderer",
   "+content/test",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/WebKit/public/platform",
   "+third_party/WebKit/public/web",
 ]
diff --git a/components/password_manager/content/renderer/credential_manager_client.cc b/components/password_manager/content/renderer/credential_manager_client.cc
index 3d0c250d..24d26bc 100644
--- a/components/password_manager/content/renderer/credential_manager_client.cc
+++ b/components/password_manager/content/renderer/credential_manager_client.cc
@@ -15,7 +15,7 @@
 #include "components/password_manager/core/common/credential_manager_types.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/WebCredential.h"
 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h"
 #include "third_party/WebKit/public/platform/WebFederatedCredential.h"
diff --git a/components/password_manager/content/renderer/credential_manager_client_browsertest.cc b/components/password_manager/content/renderer/credential_manager_client_browsertest.cc
index 1ef5281..e995de4 100644
--- a/components/password_manager/content/renderer/credential_manager_client_browsertest.cc
+++ b/components/password_manager/content/renderer/credential_manager_client_browsertest.cc
@@ -16,7 +16,7 @@
 #include "content/public/renderer/render_view.h"
 #include "content/public/test/render_view_test.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/platform/WebCredential.h"
 #include "third_party/WebKit/public/platform/WebCredentialManagerClient.h"
@@ -83,9 +83,9 @@
     content::RenderViewTest::SetUp();
     client_.reset(new CredentialManagerClient(view_));
 
-    shell::InterfaceProvider* remote_interfaces =
+    service_manager::InterfaceProvider* remote_interfaces =
         view_->GetMainRenderFrame()->GetRemoteInterfaces();
-    shell::InterfaceProvider::TestApi test_api(remote_interfaces);
+    service_manager::InterfaceProvider::TestApi test_api(remote_interfaces);
     test_api.SetBinderForName(
         mojom::CredentialManager::Name_,
         base::Bind(&CredentialManagerClientTest::BindCredentialManager,
diff --git a/components/password_manager/sync/browser/DEPS b/components/password_manager/sync/browser/DEPS
index f209e86da..83c072e 100644
--- a/components/password_manager/sync/browser/DEPS
+++ b/components/password_manager/sync/browser/DEPS
@@ -4,7 +4,6 @@
   "+components/signin/core/browser",
   "+components/signin/core/common",
   "+components/sync/base",
-  "+components/sync/core",
   "+components/sync/driver",
   "+components/sync/engine",
   "+components/syncable_prefs",
diff --git a/components/prefs/pref_notifier_impl.cc b/components/prefs/pref_notifier_impl.cc
index 48dd57c2..a5e8e98 100644
--- a/components/prefs/pref_notifier_impl.cc
+++ b/components/prefs/pref_notifier_impl.cc
@@ -19,10 +19,8 @@
 
   // Verify that there are no pref observers when we shut down.
   for (const auto& observer_list : pref_observers_) {
-    PrefObserverList::Iterator obs_iterator(observer_list.second.get());
-    if (obs_iterator.GetNext()) {
+    if (observer_list.second->begin() != observer_list.second->end())
       LOG(WARNING) << "Pref observer found at shutdown.";
-    }
   }
 
   // Same for initialization observers.
diff --git a/components/prefs/pref_notifier_impl_unittest.cc b/components/prefs/pref_notifier_impl_unittest.cc
index 517a4039..06ab053 100644
--- a/components/prefs/pref_notifier_impl_unittest.cc
+++ b/components/prefs/pref_notifier_impl_unittest.cc
@@ -59,12 +59,9 @@
     if (observer_iterator == pref_observers()->end())
       return false;
 
-    PrefObserverList* observer_list = observer_iterator->second.get();
-    PrefObserverList::Iterator it(observer_list);
-    PrefObserver* existing_obs;
     size_t count = 0;
-    while ((existing_obs = it.GetNext()) != NULL) {
-      if (existing_obs == obs)
+    for (auto& existing_obs : *observer_iterator->second) {
+      if (&existing_obs == obs)
         count++;
     }
 
diff --git a/components/resources/autofill_scaled_resources.grdp b/components/resources/autofill_scaled_resources.grdp
index 1e525d7..c07f1d5b 100644
--- a/components/resources/autofill_scaled_resources.grdp
+++ b/components/resources/autofill_scaled_resources.grdp
@@ -30,7 +30,9 @@
 
   <structure type="chrome_scaled_image" name="IDR_CREDIT_CARD_CVC_HINT" file="autofill/credit_card_cvc_hint.png" />
   <structure type="chrome_scaled_image" name="IDR_CREDIT_CARD_CVC_HINT_AMEX" file="autofill/credit_card_cvc_hint_amex.png" />
-  <structure type="chrome_scaled_image" name="IDR_INFOBAR_AUTOFILL_CC" file="autofill/infobar_autofill_cc.png" />
+  <if expr="is_ios or is_android">
+    <structure type="chrome_scaled_image" name="IDR_INFOBAR_AUTOFILL_CC" file="autofill/infobar_autofill_cc.png" />
+  </if>
   <if expr="is_macosx or is_ios">
     <structure type="chrome_scaled_image" name="IDR_AUTOFILL_TOOLTIP_ICON" file="autofill/autofill_tooltip_icon.png" />
     <structure type="chrome_scaled_image" name="IDR_AUTOFILL_TOOLTIP_ICON_H" file="autofill/autofill_tooltip_icon_hover.png" />
diff --git a/components/safe_browsing_db/v4_local_database_manager.cc b/components/safe_browsing_db/v4_local_database_manager.cc
index e489946..65916ba 100644
--- a/components/safe_browsing_db/v4_local_database_manager.cc
+++ b/components/safe_browsing_db/v4_local_database_manager.cc
@@ -31,7 +31,9 @@
                 SB_THREAT_TYPE_URL_MALWARE),
        ListInfo(true, "UrlSoceng.store", GetUrlSocEngId(),
                 SB_THREAT_TYPE_URL_PHISHING),
-       ListInfo(false, "", GetChromeUrlApiId(), SB_THREAT_TYPE_API_ABUSE)});
+       ListInfo(false, "", GetChromeUrlApiId(), SB_THREAT_TYPE_API_ABUSE),
+       ListInfo(true, "UrlUws.store", GetUrlUwsId(),
+                SB_THREAT_TYPE_URL_UNWANTED)});
 }
 
 // Returns the severity information about a given SafeBrowsing list. The lowest
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.cc b/components/safe_browsing_db/v4_protocol_manager_util.cc
index c349b6b9..0202ec34 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.cc
+++ b/components/safe_browsing_db/v4_protocol_manager_util.cc
@@ -98,6 +98,10 @@
                         SOCIAL_ENGINEERING_PUBLIC);
 }
 
+const ListIdentifier GetUrlUwsId() {
+  return ListIdentifier(GetCurrentPlatformType(), URL, UNWANTED_SOFTWARE);
+}
+
 // The Safe Browsing V4 server URL prefix.
 const char kSbV4UrlPrefix[] = "https://safebrowsing.googleapis.com/v4";
 
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.h b/components/safe_browsing_db/v4_protocol_manager_util.h
index 34e2412..403a56f 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.h
+++ b/components/safe_browsing_db/v4_protocol_manager_util.h
@@ -133,6 +133,7 @@
 const ListIdentifier GetChromeUrlApiId();
 const ListIdentifier GetUrlMalwareId();
 const ListIdentifier GetUrlSocEngId();
+const ListIdentifier GetUrlUwsId();
 
 // Represents the state of each store.
 typedef base::hash_map<ListIdentifier, std::string> StoreStateMap;
diff --git a/components/safe_browsing_db/v4_store.cc b/components/safe_browsing_db/v4_store.cc
index faf61ec..d16b76d 100644
--- a/components/safe_browsing_db/v4_store.cc
+++ b/components/safe_browsing_db/v4_store.cc
@@ -217,8 +217,8 @@
   DCHECK(response->has_response_type());
   DCHECK_EQ(ListUpdateResponse::PARTIAL_UPDATE, response->response_type());
 
-  ApplyUpdateResult result =
-      ProcessUpdate(metric, hash_prefix_map_old, response);
+  ApplyUpdateResult result = ProcessUpdate(
+      metric, hash_prefix_map_old, response, false /* delay_checksum check */);
   if (result == APPLY_UPDATE_SUCCESS) {
     Checksum checksum = response->checksum();
     response.reset();
@@ -230,7 +230,8 @@
 ApplyUpdateResult V4Store::ProcessFullUpdateAndWriteToDisk(
     const std::string& metric,
     std::unique_ptr<ListUpdateResponse> response) {
-  ApplyUpdateResult result = ProcessFullUpdate(metric, response);
+  ApplyUpdateResult result =
+      ProcessFullUpdate(metric, response, false /* delay_checksum check */);
   if (result == APPLY_UPDATE_SUCCESS) {
     Checksum checksum = response->checksum();
     response.reset();
@@ -241,7 +242,8 @@
 
 ApplyUpdateResult V4Store::ProcessFullUpdate(
     const std::string& metric,
-    const std::unique_ptr<ListUpdateResponse>& response) {
+    const std::unique_ptr<ListUpdateResponse>& response,
+    bool delay_checksum_check) {
   DCHECK(response->has_response_type());
   DCHECK_EQ(ListUpdateResponse::FULL_UPDATE, response->response_type());
   // TODO(vakh): For a full update, we don't need to process the update in
@@ -249,13 +251,14 @@
   // checksum. It might save some CPU cycles to store the full update as-is and
   // walk the list of hash prefixes in lexographical order only for checksum
   // calculation.
-  return ProcessUpdate(metric, HashPrefixMap(), response);
+  return ProcessUpdate(metric, HashPrefixMap(), response, delay_checksum_check);
 }
 
 ApplyUpdateResult V4Store::ProcessUpdate(
     const std::string& metric,
     const HashPrefixMap& hash_prefix_map_old,
-    const std::unique_ptr<ListUpdateResponse>& response) {
+    const std::unique_ptr<ListUpdateResponse>& response,
+    bool delay_checksum_check) {
   const RepeatedField<int32>* raw_removals = nullptr;
   RepeatedField<int32> rice_removals;
   size_t removals_size = response->removals_size();
@@ -300,10 +303,25 @@
   }
 
   TimeTicks before = TimeTicks::Now();
-  apply_update_result = MergeUpdate(hash_prefix_map_old, hash_prefix_map,
-                                    raw_removals, expected_checksum);
-  if (apply_update_result != APPLY_UPDATE_SUCCESS) {
-    return apply_update_result;
+  if (delay_checksum_check) {
+    DCHECK(hash_prefix_map_old.empty());
+    DCHECK(!raw_removals);
+    // We delay the checksum check at startup to be able to load the DB
+    // quickly. In this case, the |hash_prefix_map_old| should be empty, so just
+    // copy over the |hash_prefix_map|.
+    hash_prefix_map_ = hash_prefix_map;
+
+    // Calculate the checksum asynchronously later and if it doesn't match,
+    // reset the store.
+    expected_checksum_ = expected_checksum;
+
+    apply_update_result = APPLY_UPDATE_SUCCESS;
+  } else {
+    apply_update_result = MergeUpdate(hash_prefix_map_old, hash_prefix_map,
+                                      raw_removals, expected_checksum);
+    if (apply_update_result != APPLY_UPDATE_SUCCESS) {
+      return apply_update_result;
+    }
   }
   RecordMergeUpdateTime(metric, TimeTicks::Now() - before, store_path_);
 
@@ -496,19 +514,6 @@
     return CHECKSUM_MISMATCH_FAILURE;
   }
 
-  if (old_prefixes_map.empty()) {
-    // If the old map is empty, which it is at startup, then just copy over the
-    // additions map.
-    DCHECK(!raw_removals);
-    hash_prefix_map_ = additions_map;
-
-    // Calculate the checksum asynchronously later and if it doesn't match,
-    // reset the store.
-    expected_checksum_ = expected_checksum;
-
-    return APPLY_UPDATE_SUCCESS;
-  }
-
   hash_prefix_map_.clear();
   ReserveSpaceInPrefixMap(old_prefixes_map, &hash_prefix_map_);
   ReserveSpaceInPrefixMap(additions_map, &hash_prefix_map_);
@@ -670,8 +675,8 @@
 
   std::unique_ptr<ListUpdateResponse> response(new ListUpdateResponse);
   response->Swap(file_format.mutable_list_update_response());
-  ApplyUpdateResult apply_update_result =
-      ProcessFullUpdate(kReadFromDisk, response);
+  ApplyUpdateResult apply_update_result = ProcessFullUpdate(
+      kReadFromDisk, response, true /* delay_checksum check */);
   RecordApplyUpdateResult(kReadFromDisk, apply_update_result, store_path_);
   if (apply_update_result != APPLY_UPDATE_SUCCESS) {
     hash_prefix_map_.clear();
diff --git a/components/safe_browsing_db/v4_store.h b/components/safe_browsing_db/v4_store.h
index befa6f9b..1b9e4d6 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing_db/v4_store.h
@@ -256,6 +256,7 @@
   FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesFailsChecksum);
   FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestChecksumErrorOnStartup);
   FRIEND_TEST_ALL_PREFIXES(V4StoreTest, WriteToDiskFails);
+  FRIEND_TEST_ALL_PREFIXES(V4StoreTest, FullUpdateFailsChecksumSynchronously);
   friend class V4StoreTest;
 
   // If |prefix_size| is within expected range, and |raw_hashes_length| is a
@@ -306,11 +307,12 @@
   // The SHA256 checksum of the final list of hash prefixes, in
   // lexicographically sorted order, must match |expected_checksum| (if it's not
   // empty).
-  ApplyUpdateResult MergeUpdate(const HashPrefixMap& old_hash_prefix_map,
-                                const HashPrefixMap& additions_map,
-                                const ::google::protobuf::RepeatedField<
-                                    ::google::protobuf::int32>* raw_removals,
-                                const std::string& expected_checksum);
+  ApplyUpdateResult MergeUpdate(
+      const HashPrefixMap& old_hash_prefix_map,
+      const HashPrefixMap& additions_map,
+      const ::google::protobuf::RepeatedField<::google::protobuf::int32>*
+          raw_removals,
+      const std::string& expected_checksum);
 
   // Processes the FULL_UPDATE |response| from the server, and writes the
   // merged V4Store to disk. If processing the |response| succeeds, it returns
@@ -325,10 +327,12 @@
   // the |response| succeeds, it returns APPLY_UPDATE_SUCCESS.
   // This method is called when we receive a FULL_UPDATE from the server, and
   // when we read a store file from disk on startup. The UMA metrics for all
-  // interesting sub-operations use the prefix |metric|.
+  // interesting sub-operations use the prefix |metric|. Delays the checksum
+  // check if |delay_checksum_check| is true.
   ApplyUpdateResult ProcessFullUpdate(
       const std::string& metric,
-      const std::unique_ptr<ListUpdateResponse>& response);
+      const std::unique_ptr<ListUpdateResponse>& response,
+      bool delay_checksum_check);
 
   // Merges the hash prefixes in |hash_prefix_map_old| and |response|, updates
   // the |hash_prefix_map_| and |state_| in the V4Store, and writes the merged
@@ -344,11 +348,13 @@
   // Merges the hash prefixes in |hash_prefix_map_old| and |response|, and
   // updates the |hash_prefix_map_| and |state_| in the V4Store. If processing
   // succeeds, it returns APPLY_UPDATE_SUCCESS. The UMA metrics for all
-  // interesting sub-operations use the prefix |metric|.
+  // interesting sub-operations use the prefix |metric|. Delays the checksum
+  // check if |delay_checksum_check| is true.
   ApplyUpdateResult ProcessUpdate(
       const std::string& metric,
       const HashPrefixMap& hash_prefix_map_old,
-      const std::unique_ptr<ListUpdateResponse>& response);
+      const std::unique_ptr<ListUpdateResponse>& response,
+      bool delay_checksum_check);
 
   // Reads the state of the store from the file on disk and returns the reason
   // for the failure or reports success.
diff --git a/components/safe_browsing_db/v4_store_unittest.cc b/components/safe_browsing_db/v4_store_unittest.cc
index 71b3e6f..c0138b7 100644
--- a/components/safe_browsing_db/v4_store_unittest.cc
+++ b/components/safe_browsing_db/v4_store_unittest.cc
@@ -57,12 +57,18 @@
                     file_format_string.size());
   }
 
-  void UpdatedStoreReadyAfterRiceRemovals(bool* called_back,
-                                          std::unique_ptr<V4Store> new_store) {
+  void UpdatedStoreReady(bool* called_back,
+                         bool expect_store,
+                         std::unique_ptr<V4Store> store) {
     *called_back = true;
-    EXPECT_EQ(2u, new_store->hash_prefix_map_.size());
-    EXPECT_EQ("22222", new_store->hash_prefix_map_[5]);
-    EXPECT_EQ("abcd", new_store->hash_prefix_map_[4]);
+    if (expect_store) {
+      ASSERT_TRUE(store);
+      EXPECT_EQ(2u, store->hash_prefix_map_.size());
+      EXPECT_EQ("22222", store->hash_prefix_map_[5]);
+      EXPECT_EQ("abcd", store->hash_prefix_map_[4]);
+    } else {
+      ASSERT_FALSE(store);
+    }
   }
 
   base::ScopedTempDir temp_dir_;
@@ -734,8 +740,8 @@
 
   bool called_back = false;
   UpdatedStoreReadyCallback store_ready_callback =
-      base::Bind(&V4StoreTest::UpdatedStoreReadyAfterRiceRemovals,
-                 base::Unretained(this), &called_back);
+      base::Bind(&V4StoreTest::UpdatedStoreReady, base::Unretained(this),
+                 &called_back, true /* expect_store */);
   EXPECT_FALSE(base::PathExists(store.store_path_));
   store.ApplyUpdate(std::move(lur), task_runner_, store_ready_callback);
   EXPECT_TRUE(base::PathExists(store.store_path_));
@@ -816,4 +822,30 @@
             V4Store(task_runner_, temp_dir_.GetPath()).WriteToDisk(Checksum()));
 }
 
+TEST_F(V4StoreTest, FullUpdateFailsChecksumSynchronously) {
+  V4Store store(task_runner_, store_path_);
+  bool called_back = false;
+  UpdatedStoreReadyCallback store_ready_callback =
+      base::Bind(&V4StoreTest::UpdatedStoreReady, base::Unretained(this),
+                 &called_back, false /* expect_store */);
+  EXPECT_FALSE(base::PathExists(store.store_path_));
+
+  // Now create a response with invalid checksum.
+  std::unique_ptr<ListUpdateResponse> lur(new ListUpdateResponse);
+  lur->set_response_type(ListUpdateResponse::FULL_UPDATE);
+  lur->mutable_checksum()->set_sha256(std::string(crypto::kSHA256Length, 0));
+  store.ApplyUpdate(std::move(lur), task_runner_, store_ready_callback);
+  // The update should fail synchronously and not create a store file.
+  EXPECT_FALSE(base::PathExists(store.store_path_));
+
+  // Run everything on the task runner to ensure there are no pending tasks.
+  task_runner_->RunPendingTasks();
+  base::RunLoop().RunUntilIdle();
+
+  // This ensures that the callback was called.
+  EXPECT_TRUE(called_back);
+  // Ensure that the file is still not created.
+  EXPECT_FALSE(base::PathExists(store.store_path_));
+}
+
 }  // namespace safe_browsing
diff --git a/components/security_interstitials/core/browser/resources/interstitial_v2.css b/components/security_interstitials/core/browser/resources/interstitial_v2.css
index ea9e1f9..014d7bd 100644
--- a/components/security_interstitials/core/browser/resources/interstitial_v2.css
+++ b/components/security_interstitials/core/browser/resources/interstitial_v2.css
@@ -61,6 +61,13 @@
   margin-top: 1em;
 }
 
+.debugging-content-fixed-width {
+  display: block;
+  font-family: monospace;
+  font-size: 1.2em;
+  margin-top: 0.5em;
+}
+
 .debugging-title {
   font-weight: bold;
 }
diff --git a/components/security_interstitials/core/browser/resources/interstitial_v2.js b/components/security_interstitials/core/browser/resources/interstitial_v2.js
index 332f6939..d4359be 100644
--- a/components/security_interstitials/core/browser/resources/interstitial_v2.js
+++ b/components/security_interstitials/core/browser/resources/interstitial_v2.js
@@ -68,8 +68,10 @@
  * (error-debugging-info) visible.
  * @param {string} title  The name of this debugging field.
  * @param {string} value  The value of the debugging field.
+ * @param {boolean=} fixedWidth If true, the value field is displayed fixed
+ *                              width.
  */
-function appendDebuggingField(title, value) {
+function appendDebuggingField(title, value, fixedWidth) {
   // The values input here are not trusted. Never use innerHTML on these
   // values!
   var spanTitle = document.createElement('span');
@@ -77,7 +79,10 @@
   spanTitle.innerText = title + ': ';
 
   var spanValue = document.createElement('span');
-  spanValue.classList.add('debugging-value');
+  spanValue.classList.add('debugging-content');
+  if (fixedWidth) {
+    spanValue.classList.add('debugging-content-fixed-width');
+  }
   spanValue.innerText = value;
 
   var pElem = document.createElement('p');
diff --git a/components/security_interstitials/core/browser/resources/ssl.js b/components/security_interstitials/core/browser/resources/ssl.js
index 2c1a2b5..4f180d3 100644
--- a/components/security_interstitials/core/browser/resources/ssl.js
+++ b/components/security_interstitials/core/browser/resources/ssl.js
@@ -12,7 +12,8 @@
   appendDebuggingField('Issuer', loadTimeData.getString('issuer'));
   appendDebuggingField('Expires on', loadTimeData.getString('expirationDate'));
   appendDebuggingField('Current date', loadTimeData.getString('currentDate'));
-  appendDebuggingField('PEM encoded chain', loadTimeData.getString('pem'));
+  appendDebuggingField('PEM encoded chain', loadTimeData.getString('pem'),
+                       true);
 
   $('error-code').addEventListener('click', toggleDebuggingInfo);
 }
diff --git a/components/ssl_errors/error_classification.cc b/components/ssl_errors/error_classification.cc
index b6867d7b..66aa42d 100644
--- a/components/ssl_errors/error_classification.cc
+++ b/components/ssl_errors/error_classification.cc
@@ -42,19 +42,32 @@
 // unavailable, why it was unavailable. This enum is being histogrammed
 // so do not reorder or remove values.
 enum NetworkClockState {
-  // The clock state relative to network time is unknown because the
-  // NetworkTimeTracker has no information from the network.
-  NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC = 0,
+  // Value 0 was NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC, which is obsolete
+  // in favor of the finer-grained values below.
+
   // The clock state relative to network time is unknown because the
   // user's clock has fallen out of sync with the latest information
   // from the network (due to e.g. suspend/resume).
-  NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST,
+  NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST = 1,
   // The clock is "close enough" to the network time.
   NETWORK_CLOCK_STATE_OK,
   // The clock is in the past relative to network time.
   NETWORK_CLOCK_STATE_CLOCK_IN_PAST,
   // The clock is in the future relative to network time.
   NETWORK_CLOCK_STATE_CLOCK_IN_FUTURE,
+  // The clock state relative to network time is unknown because no sync
+  // attempt has been made yet.
+  NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT,
+  // The clock state relative to network time is unknown because one or
+  // more sync attempts has failed.
+  NETWORK_CLOCK_STATE_UNKNOWN_NO_SUCCESSFUL_SYNC,
+  // The clock state relative to network time is unknown because the
+  // first sync attempt is still pending.
+  NETWORK_CLOCK_STATE_UNKNOWN_FIRST_SYNC_PENDING,
+  // The clock state relative to network time is unknown because one or
+  // more time query attempts have failed, and a subsequent sync attempt
+  // is still pending.
+  NETWORK_CLOCK_STATE_UNKNOWN_SUBSEQUENT_SYNC_PENDING,
   NETWORK_CLOCK_STATE_MAX
 };
 
@@ -243,8 +256,17 @@
     case network_time::NetworkTimeTracker::NETWORK_TIME_SYNC_LOST:
       network_state = NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST;
       break;
-    case network_time::NetworkTimeTracker::NETWORK_TIME_NO_SYNC:
-      network_state = NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC;
+    case network_time::NetworkTimeTracker::NETWORK_TIME_NO_SYNC_ATTEMPT:
+      network_state = NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT;
+      break;
+    case network_time::NetworkTimeTracker::NETWORK_TIME_NO_SUCCESSFUL_SYNC:
+      network_state = NETWORK_CLOCK_STATE_UNKNOWN_NO_SUCCESSFUL_SYNC;
+      break;
+    case network_time::NetworkTimeTracker::NETWORK_TIME_FIRST_SYNC_PENDING:
+      network_state = NETWORK_CLOCK_STATE_UNKNOWN_FIRST_SYNC_PENDING;
+      break;
+    case network_time::NetworkTimeTracker::NETWORK_TIME_SUBSEQUENT_SYNC_PENDING:
+      network_state = NETWORK_CLOCK_STATE_UNKNOWN_SUBSEQUENT_SYNC_PENDING;
       break;
   }
 
@@ -264,8 +286,11 @@
                             build_time_state, CLOCK_STATE_MAX);
 
   switch (network_state) {
-    case NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC:
     case NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST:
+    case NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT:
+    case NETWORK_CLOCK_STATE_UNKNOWN_NO_SUCCESSFUL_SYNC:
+    case NETWORK_CLOCK_STATE_UNKNOWN_FIRST_SYNC_PENDING:
+    case NETWORK_CLOCK_STATE_UNKNOWN_SUBSEQUENT_SYNC_PENDING:
       return build_time_state;
     case NETWORK_CLOCK_STATE_OK:
       return CLOCK_STATE_OK;
diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn
index 58c0eef..fbcf494 100644
--- a/components/sync/BUILD.gn
+++ b/components/sync/BUILD.gn
@@ -60,7 +60,6 @@
     "base/report_unrecoverable_error.cc",
     "base/report_unrecoverable_error.h",
     "base/stop_source.h",
-    "base/sync_db_util.h",
     "base/sync_prefs.cc",
     "base/sync_prefs.h",
     "base/syncer_error.cc",
@@ -76,51 +75,6 @@
     "base/unrecoverable_error_info.h",
     "base/weak_handle.cc",
     "base/weak_handle.h",
-    "core/activation_context.cc",
-    "core/activation_context.h",
-    "core/configure_reason.h",
-    "core/data_type_association_stats.cc",
-    "core/data_type_association_stats.h",
-    "core/data_type_debug_info_listener.cc",
-    "core/data_type_debug_info_listener.h",
-    "core/internal_components_factory.h",
-    "core/internal_components_factory_impl.cc",
-    "core/internal_components_factory_impl.h",
-    "core/model_type_connector.cc",
-    "core/model_type_connector.h",
-    "core/model_type_processor.cc",
-    "core/model_type_processor.h",
-    "core/model_type_processor_proxy.cc",
-    "core/model_type_processor_proxy.h",
-    "core/non_blocking_sync_common.cc",
-    "core/non_blocking_sync_common.h",
-    "core/shutdown_reason.h",
-    "core/sync_auth_provider.h",
-    "core/sync_db_util.cc",
-    "core/sync_encryption_handler.cc",
-    "core/sync_encryption_handler.h",
-    "core/sync_manager.cc",
-    "core/sync_manager.h",
-    "core/sync_manager_factory.cc",
-    "core/sync_manager_factory.h",
-    "core_impl/debug_info_event_listener.cc",
-    "core_impl/debug_info_event_listener.h",
-    "core_impl/js_mutation_event_observer.cc",
-    "core_impl/js_mutation_event_observer.h",
-    "core_impl/js_sync_encryption_handler_observer.cc",
-    "core_impl/js_sync_encryption_handler_observer.h",
-    "core_impl/js_sync_manager_observer.cc",
-    "core_impl/js_sync_manager_observer.h",
-    "core_impl/model_type_connector_proxy.cc",
-    "core_impl/model_type_connector_proxy.h",
-    "core_impl/protocol_event_buffer.cc",
-    "core_impl/protocol_event_buffer.h",
-    "core_impl/sync_encryption_handler_impl.cc",
-    "core_impl/sync_encryption_handler_impl.h",
-    "core_impl/sync_manager_impl.cc",
-    "core_impl/sync_manager_impl.h",
-    "core_impl/syncapi_internal.cc",
-    "core_impl/syncapi_internal.h",
     "device_info/device_count_metrics_provider.cc",
     "device_info/device_count_metrics_provider.h",
     "device_info/device_info.cc",
@@ -218,6 +172,8 @@
     "driver/ui_data_type_controller.cc",
     "driver/ui_data_type_controller.h",
     "driver/user_selectable_sync_type.h",
+    "engine/activation_context.cc",
+    "engine/activation_context.h",
     "engine/attachments/attachment_downloader.cc",
     "engine/attachments/attachment_downloader.h",
     "engine/attachments/attachment_store_backend.cc",
@@ -238,6 +194,7 @@
     "engine/attachments/on_disk_attachment_store.h",
     "engine/commit_queue.cc",
     "engine/commit_queue.h",
+    "engine/configure_reason.h",
     "engine/cycle/commit_counters.cc",
     "engine/cycle/commit_counters.h",
     "engine/cycle/model_neutral_state.cc",
@@ -250,6 +207,15 @@
     "engine/cycle/type_debug_info_observer.h",
     "engine/cycle/update_counters.cc",
     "engine/cycle/update_counters.h",
+    "engine/data_type_association_stats.cc",
+    "engine/data_type_association_stats.h",
+    "engine/data_type_debug_info_listener.cc",
+    "engine/data_type_debug_info_listener.h",
+    "engine/engine_components_factory.h",
+    "engine/engine_components_factory_impl.cc",
+    "engine/engine_components_factory_impl.h",
+    "engine/engine_util.cc",
+    "engine/engine_util.h",
     "engine/events/clear_server_data_request_event.cc",
     "engine/events/clear_server_data_request_event.h",
     "engine/events/clear_server_data_response_event.cc",
@@ -270,6 +236,12 @@
     "engine/events/protocol_event.h",
     "engine/model_safe_worker.cc",
     "engine/model_safe_worker.h",
+    "engine/model_type_connector.cc",
+    "engine/model_type_connector.h",
+    "engine/model_type_processor.cc",
+    "engine/model_type_processor.h",
+    "engine/model_type_processor_proxy.cc",
+    "engine/model_type_processor_proxy.h",
     "engine/net/http_bridge.cc",
     "engine/net/http_bridge.h",
     "engine/net/http_bridge_network_resources.cc",
@@ -277,10 +249,20 @@
     "engine/net/http_post_provider_factory.h",
     "engine/net/http_post_provider_interface.h",
     "engine/net/network_resources.h",
+    "engine/non_blocking_sync_common.cc",
+    "engine/non_blocking_sync_common.h",
     "engine/passive_model_worker.cc",
     "engine/passive_model_worker.h",
     "engine/polling_constants.cc",
     "engine/polling_constants.h",
+    "engine/shutdown_reason.h",
+    "engine/sync_auth_provider.h",
+    "engine/sync_encryption_handler.cc",
+    "engine/sync_encryption_handler.h",
+    "engine/sync_manager.cc",
+    "engine/sync_manager.h",
+    "engine/sync_manager_factory.cc",
+    "engine/sync_manager_factory.h",
     "engine/sync_status.cc",
     "engine/sync_status.h",
     "engine/sync_string_conversions.cc",
@@ -324,18 +306,30 @@
     "engine_impl/cycle/sync_cycle.h",
     "engine_impl/cycle/sync_cycle_context.cc",
     "engine_impl/cycle/sync_cycle_context.h",
+    "engine_impl/debug_info_event_listener.cc",
+    "engine_impl/debug_info_event_listener.h",
     "engine_impl/directory_commit_contribution.cc",
     "engine_impl/directory_commit_contribution.h",
     "engine_impl/directory_commit_contributor.cc",
     "engine_impl/directory_commit_contributor.h",
     "engine_impl/directory_update_handler.cc",
     "engine_impl/directory_update_handler.h",
+    "engine_impl/events/protocol_event_buffer.cc",
+    "engine_impl/events/protocol_event_buffer.h",
     "engine_impl/get_commit_ids.cc",
     "engine_impl/get_commit_ids.h",
     "engine_impl/get_updates_delegate.cc",
     "engine_impl/get_updates_delegate.h",
     "engine_impl/get_updates_processor.cc",
     "engine_impl/get_updates_processor.h",
+    "engine_impl/js_mutation_event_observer.cc",
+    "engine_impl/js_mutation_event_observer.h",
+    "engine_impl/js_sync_encryption_handler_observer.cc",
+    "engine_impl/js_sync_encryption_handler_observer.h",
+    "engine_impl/js_sync_manager_observer.cc",
+    "engine_impl/js_sync_manager_observer.h",
+    "engine_impl/model_type_connector_proxy.cc",
+    "engine_impl/model_type_connector_proxy.h",
     "engine_impl/model_type_registry.cc",
     "engine_impl/model_type_registry.h",
     "engine_impl/model_type_worker.cc",
@@ -356,8 +350,12 @@
     "engine_impl/process_updates_util.h",
     "engine_impl/sync_cycle_event.cc",
     "engine_impl/sync_cycle_event.h",
+    "engine_impl/sync_encryption_handler_impl.cc",
+    "engine_impl/sync_encryption_handler_impl.h",
     "engine_impl/sync_engine_event_listener.cc",
     "engine_impl/sync_engine_event_listener.h",
+    "engine_impl/sync_manager_impl.cc",
+    "engine_impl/sync_manager_impl.h",
     "engine_impl/sync_scheduler.cc",
     "engine_impl/sync_scheduler.h",
     "engine_impl/sync_scheduler_impl.cc",
@@ -503,6 +501,8 @@
     "syncable/scoped_kernel_lock.h",
     "syncable/scoped_parent_child_index_updater.cc",
     "syncable/scoped_parent_child_index_updater.h",
+    "syncable/sync_db_util.cc",
+    "syncable/sync_db_util.h",
     "syncable/syncable_base_transaction.cc",
     "syncable/syncable_base_transaction.h",
     "syncable/syncable_base_write_transaction.cc",
@@ -600,6 +600,7 @@
   configs += [ "//build/config/compiler:wexit_time_destructors" ]
 }
 
+# TODO(maxbogue): Refactor the test support targets to remove core references.
 static_library("test_support_sync_core") {
   testonly = true
   sources = [
@@ -670,23 +671,24 @@
   configs += [ "//build/config/compiler:wexit_time_destructors" ]
 }
 
+# TODO(maxbogue): Refactor the test support targets to remove core references.
 static_library("test_support_sync_core_impl") {
   testonly = true
   sources = [
-    "core/test/fake_model_type_connector.h",
-    "core/test/fake_model_type_processor.h",
-    "core/test/fake_sync_manager.h",
-    "core/test/sync_manager_factory_for_profile_sync_test.h",
-    "core/test/test_entry_factory.h",
-    "core/test/test_internal_components_factory.h",
-    "core_impl/test/fake_model_type_connector.cc",
-    "core_impl/test/fake_model_type_processor.cc",
-    "core_impl/test/fake_sync_manager.cc",
-    "core_impl/test/sync_manager_factory_for_profile_sync_test.cc",
-    "core_impl/test/sync_manager_for_profile_sync_test.cc",
-    "core_impl/test/sync_manager_for_profile_sync_test.h",
-    "core_impl/test/test_entry_factory.cc",
-    "core_impl/test/test_internal_components_factory.cc",
+    "engine/fake_model_type_connector.cc",
+    "engine/fake_model_type_connector.h",
+    "engine/fake_model_type_processor.cc",
+    "engine/fake_model_type_processor.h",
+    "engine/fake_sync_manager.cc",
+    "engine/fake_sync_manager.h",
+    "engine/sync_manager_factory_for_profile_sync_test.cc",
+    "engine/sync_manager_factory_for_profile_sync_test.h",
+    "engine/test_engine_components_factory.cc",
+    "engine/test_engine_components_factory.h",
+    "engine_impl/sync_manager_for_profile_sync_test.cc",
+    "engine_impl/sync_manager_for_profile_sync_test.h",
+    "engine_impl/test_entry_factory.cc",
+    "engine_impl/test_entry_factory.h",
     "model/data_type_error_handler_mock.cc",
     "model/data_type_error_handler_mock.h",
     "model/model_type_store_test_util.cc",
@@ -803,13 +805,6 @@
     "base/system_encryptor_unittest.cc",
     "base/unique_position_unittest.cc",
     "base/weak_handle_unittest.cc",
-    "core_impl/debug_info_event_listener_unittest.cc",
-    "core_impl/js_mutation_event_observer_unittest.cc",
-    "core_impl/js_sync_encryption_handler_observer_unittest.cc",
-    "core_impl/js_sync_manager_observer_unittest.cc",
-    "core_impl/protocol_event_buffer_unittest.cc",
-    "core_impl/sync_encryption_handler_impl_unittest.cc",
-    "core_impl/sync_manager_impl_unittest.cc",
     "device_info/device_count_metrics_provider_unittest.cc",
     "device_info/device_info_data_type_controller_unittest.cc",
     "device_info/device_info_service_unittest.cc",
@@ -848,12 +843,19 @@
     "engine_impl/backoff_delay_provider_unittest.cc",
     "engine_impl/cycle/nudge_tracker_unittest.cc",
     "engine_impl/cycle/status_controller_unittest.cc",
+    "engine_impl/debug_info_event_listener_unittest.cc",
     "engine_impl/directory_commit_contribution_unittest.cc",
     "engine_impl/directory_update_handler_unittest.cc",
+    "engine_impl/events/protocol_event_buffer_unittest.cc",
     "engine_impl/get_updates_processor_unittest.cc",
+    "engine_impl/js_mutation_event_observer_unittest.cc",
+    "engine_impl/js_sync_encryption_handler_observer_unittest.cc",
+    "engine_impl/js_sync_manager_observer_unittest.cc",
     "engine_impl/model_type_registry_unittest.cc",
     "engine_impl/model_type_worker_unittest.cc",
     "engine_impl/net/sync_server_connection_manager_unittest.cc",
+    "engine_impl/sync_encryption_handler_impl_unittest.cc",
+    "engine_impl/sync_manager_impl_unittest.cc",
     "engine_impl/sync_scheduler_impl_unittest.cc",
     "engine_impl/syncer_proto_util_unittest.cc",
     "engine_impl/syncer_unittest.cc",
diff --git a/components/sync/core/DEPS b/components/sync/core/DEPS
deleted file mode 100644
index ea821fe1..0000000
--- a/components/sync/core/DEPS
+++ /dev/null
@@ -1,13 +0,0 @@
-include_rules = [
-  "+components/sync/base",
-  "+components/sync/core_impl",
-  "+components/sync/engine",
-  "+components/sync/engine_impl",
-  "+components/sync/model",
-  "+components/sync/protocol",
-  "+components/sync/syncable",
-  "+components/sync/test",
-  "+net",
-  "+sql",
-  "+third_party/leveldatabase",
-]
diff --git a/components/sync/core_impl/DEPS b/components/sync/core_impl/DEPS
deleted file mode 100644
index d3147ec..0000000
--- a/components/sync/core_impl/DEPS
+++ /dev/null
@@ -1,20 +0,0 @@
-include_rules = [
-  "+components/sync/base",
-  "+components/sync/core",
-  "+components/sync/engine",
-  "+components/sync/engine_impl",
-  "+components/sync/js",
-  "+components/sync/model",
-  "+components/sync/protocol",
-  "+components/sync/syncable",
-  "+components/sync/test",
-  "+components/sync/base",
-  "+net/base",
-  "+net/cookies",
-  "+net/http",
-  "+net/test",
-  "+net/url_request",
-  "+sql",
-  "+third_party/leveldatabase",  # for ModelTypeStore implementation
-  "+third_party/protobuf",  # for unit test
-]
diff --git a/components/sync/core_impl/README b/components/sync/core_impl/README
deleted file mode 100644
index 32987bb..0000000
--- a/components/sync/core_impl/README
+++ /dev/null
@@ -1,32 +0,0 @@
-This file defines the "sync API", an interface to the syncer
-backend that exposes (1) the core functionality of maintaining a consistent
-local snapshot of a hierarchical object set; (2) a means to transactionally
-access and modify those objects; (3) a means to control client/server
-synchronization tasks, namely: pushing local object modifications to a
-server, pulling nonlocal object modifications from a server to this client,
-and resolving conflicts that may arise between the two; and (4) an
-abstraction of some external functionality that is to be provided by the
-host environment.
-
-This interface is used as the entry point into the syncer backend
-when the backend is compiled as a library and embedded in another
-application.  A goal for this interface layer is to depend on very few
-external types, so that an application can use the sync backend
-without introducing a dependency on specific types.  A non-goal is to
-have binary compatibility across versions or compilers; this allows the
-interface to use C++ classes.  An application wishing to use the sync API
-should ideally compile the syncer backend and this API as part of the
-application's own build, to avoid e.g. mismatches in calling convention,
-structure padding, or name mangling that could arise if there were a
-compiler mismatch.
-
-The schema of the objects in the sync domain is based on the model, which
-is essentially a hierarchy of items and folders similar to a filesystem,
-but with a few important differences.  The sync API contains fields
-such as URL to easily allow the embedding application to store web
-browser bookmarks.  Also, the sync API allows duplicate titles in a parent.
-Consequently, it does not support looking up an object by title
-and parent, since such a lookup is not uniquely determined.  Lastly,
-unlike a filesystem model, objects in the Sync API model have a strict
-ordering within a parent; the position is manipulable by callers, and
-children of a node can be enumerated in the order of their position.
diff --git a/components/sync/device_info/DEPS b/components/sync/device_info/DEPS
index 30d5261..d0e8a8e 100644
--- a/components/sync/device_info/DEPS
+++ b/components/sync/device_info/DEPS
@@ -1,7 +1,6 @@
 include_rules = [
   "+components/metrics",
   "+components/sync/base",
-  "+components/sync/core",
   "+components/sync/driver",
   "+components/sync/engine",
   "+components/sync/model",
diff --git a/components/sync/driver/DEPS b/components/sync/driver/DEPS
index a43beb1..6bfb5ae 100644
--- a/components/sync/driver/DEPS
+++ b/components/sync/driver/DEPS
@@ -7,7 +7,6 @@
   "+components/prefs",
   "+components/signin/core/browser",
   "+components/sync/base",
-  "+components/sync/core",
   "+components/sync/device_info",
   "+components/sync/engine",
   "+components/sync/model",
diff --git a/components/sync/driver/backend_data_type_configurer.h b/components/sync/driver/backend_data_type_configurer.h
index 8a3208a06..dcd6ed7 100644
--- a/components/sync/driver/backend_data_type_configurer.h
+++ b/components/sync/driver/backend_data_type_configurer.h
@@ -10,7 +10,7 @@
 
 #include "base/callback.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/configure_reason.h"
+#include "components/sync/engine/configure_reason.h"
 #include "components/sync/engine/model_safe_worker.h"
 
 namespace syncer {
diff --git a/components/sync/driver/backend_migrator.cc b/components/sync/driver/backend_migrator.cc
index aeef3d837..4a2d019 100644
--- a/components/sync/driver/backend_migrator.cc
+++ b/components/sync/driver/backend_migrator.cc
@@ -9,8 +9,8 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/tracked_objects.h"
-#include "components/sync/core/configure_reason.h"
 #include "components/sync/driver/sync_service.h"
+#include "components/sync/engine/configure_reason.h"
 #include "components/sync/protocol/sync.pb.h"
 #include "components/sync/syncable/directory.h"
 #include "components/sync/syncable/read_transaction.h"
diff --git a/components/sync/driver/data_type_manager.h b/components/sync/driver/data_type_manager.h
index e1f20d3f..b3d271e 100644
--- a/components/sync/driver/data_type_manager.h
+++ b/components/sync/driver/data_type_manager.h
@@ -10,9 +10,9 @@
 #include <string>
 
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/configure_reason.h"
 #include "components/sync/driver/data_type_controller.h"
 #include "components/sync/driver/data_type_status_table.h"
+#include "components/sync/engine/configure_reason.h"
 #include "components/sync/model/sync_error.h"
 
 namespace syncer {
diff --git a/components/sync/driver/data_type_manager_impl.cc b/components/sync/driver/data_type_manager_impl.cc
index f9e9a102..ab6e637d 100644
--- a/components/sync/driver/data_type_manager_impl.cc
+++ b/components/sync/driver/data_type_manager_impl.cc
@@ -16,10 +16,10 @@
 #include "base/strings/stringprintf.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/trace_event/trace_event.h"
-#include "components/sync/core/data_type_debug_info_listener.h"
 #include "components/sync/driver/data_type_encryption_handler.h"
 #include "components/sync/driver/data_type_manager_observer.h"
 #include "components/sync/driver/data_type_status_table.h"
+#include "components/sync/engine/data_type_debug_info_listener.h"
 
 namespace syncer {
 
diff --git a/components/sync/driver/data_type_manager_impl_unittest.cc b/components/sync/driver/data_type_manager_impl_unittest.cc
index d736e87..b76ff19e 100644
--- a/components/sync/driver/data_type_manager_impl_unittest.cc
+++ b/components/sync/driver/data_type_manager_impl_unittest.cc
@@ -10,12 +10,12 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/activation_context.h"
-#include "components/sync/core/configure_reason.h"
 #include "components/sync/driver/data_type_encryption_handler.h"
 #include "components/sync/driver/data_type_manager_observer.h"
 #include "components/sync/driver/data_type_status_table.h"
 #include "components/sync/driver/fake_data_type_controller.h"
+#include "components/sync/engine/activation_context.h"
+#include "components/sync/engine/configure_reason.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace syncer {
diff --git a/components/sync/driver/generic_change_processor_unittest.cc b/components/sync/driver/generic_change_processor_unittest.cc
index c2b889b..9cc9c20 100644
--- a/components/sync/driver/generic_change_processor_unittest.cc
+++ b/components/sync/driver/generic_change_processor_unittest.cc
@@ -12,12 +12,12 @@
 #include "base/run_loop.h"
 #include "base/strings/stringprintf.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/sync_encryption_handler.h"
 #include "components/sync/device_info/local_device_info_provider.h"
 #include "components/sync/driver/fake_sync_client.h"
 #include "components/sync/driver/sync_api_component_factory.h"
 #include "components/sync/engine/attachments/fake_attachment_downloader.h"
 #include "components/sync/engine/attachments/fake_attachment_uploader.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/model/attachments/attachment_id.h"
 #include "components/sync/model/attachments/attachment_service.h"
 #include "components/sync/model/data_type_error_handler_mock.h"
diff --git a/components/sync/driver/glue/sync_backend_host.h b/components/sync/driver/glue/sync_backend_host.h
index 69f1155..e20f318 100644
--- a/components/sync/driver/glue/sync_backend_host.h
+++ b/components/sync/driver/glue/sync_backend_host.h
@@ -14,12 +14,12 @@
 #include "base/threading/thread.h"
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/configure_reason.h"
-#include "components/sync/core/shutdown_reason.h"
-#include "components/sync/core/sync_manager.h"
-#include "components/sync/core/sync_manager_factory.h"
 #include "components/sync/driver/backend_data_type_configurer.h"
+#include "components/sync/engine/configure_reason.h"
 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
+#include "components/sync/engine/shutdown_reason.h"
+#include "components/sync/engine/sync_manager.h"
+#include "components/sync/engine/sync_manager_factory.h"
 
 class GURL;
 
diff --git a/components/sync/driver/glue/sync_backend_host_core.cc b/components/sync/driver/glue/sync_backend_host_core.cc
index 1eb7f639..8c3e250a 100644
--- a/components/sync/driver/glue/sync_backend_host_core.cc
+++ b/components/sync/driver/glue/sync_backend_host_core.cc
@@ -15,17 +15,17 @@
 #include "components/invalidation/public/invalidation_util.h"
 #include "components/invalidation/public/object_id_invalidation_map.h"
 #include "components/sync/base/invalidation_adapter.h"
-#include "components/sync/core/internal_components_factory.h"
-#include "components/sync/core/sync_manager.h"
-#include "components/sync/core/sync_manager_factory.h"
 #include "components/sync/device_info/local_device_info_provider_impl.h"
 #include "components/sync/driver/glue/sync_backend_registrar.h"
 #include "components/sync/engine/cycle/commit_counters.h"
 #include "components/sync/engine/cycle/status_counters.h"
 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
 #include "components/sync/engine/cycle/update_counters.h"
+#include "components/sync/engine/engine_components_factory.h"
 #include "components/sync/engine/events/protocol_event.h"
 #include "components/sync/engine/net/http_post_provider_factory.h"
+#include "components/sync/engine/sync_manager.h"
+#include "components/sync/engine/sync_manager_factory.h"
 
 // Helper macros to log with the syncer thread name; useful when there
 // are multiple syncers involved.
@@ -36,10 +36,6 @@
 
 static const int kSaveChangesIntervalSeconds = 10;
 
-namespace syncer {
-class InternalComponentsFactory;
-}  // namespace syncer
-
 namespace net {
 class URLFetcher;
 }
@@ -55,6 +51,8 @@
 
 namespace syncer {
 
+class EngineComponentsFactory;
+
 DoInitializeOptions::DoInitializeOptions(
     base::MessageLoop* sync_loop,
     SyncBackendRegistrar* registrar,
@@ -70,7 +68,7 @@
     bool delete_sync_data_folder,
     const std::string& restored_key_for_bootstrapping,
     const std::string& restored_keystore_key_for_bootstrapping,
-    std::unique_ptr<InternalComponentsFactory> internal_components_factory,
+    std::unique_ptr<EngineComponentsFactory> engine_components_factory,
     const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler,
     const base::Closure& report_unrecoverable_error_function,
     std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state,
@@ -90,7 +88,7 @@
       restored_key_for_bootstrapping(restored_key_for_bootstrapping),
       restored_keystore_key_for_bootstrapping(
           restored_keystore_key_for_bootstrapping),
-      internal_components_factory(std::move(internal_components_factory)),
+      engine_components_factory(std::move(engine_components_factory)),
       unrecoverable_error_handler(unrecoverable_error_handler),
       report_unrecoverable_error_function(report_unrecoverable_error_function),
       saved_nigori_state(std::move(saved_nigori_state)),
@@ -418,8 +416,8 @@
   args.restored_key_for_bootstrapping = options->restored_key_for_bootstrapping;
   args.restored_keystore_key_for_bootstrapping =
       options->restored_keystore_key_for_bootstrapping;
-  args.internal_components_factory =
-      std::move(options->internal_components_factory);
+  args.engine_components_factory =
+      std::move(options->engine_components_factory);
   args.encryptor = &encryptor_;
   args.unrecoverable_error_handler = options->unrecoverable_error_handler;
   args.report_unrecoverable_error_function =
diff --git a/components/sync/driver/glue/sync_backend_host_core.h b/components/sync/driver/glue/sync_backend_host_core.h
index de3a6f0..714059f0 100644
--- a/components/sync/driver/glue/sync_backend_host_core.h
+++ b/components/sync/driver/glue/sync_backend_host_core.h
@@ -18,10 +18,10 @@
 #include "components/invalidation/public/invalidation.h"
 #include "components/sync/base/cancelation_signal.h"
 #include "components/sync/base/system_encryptor.h"
-#include "components/sync/core/shutdown_reason.h"
-#include "components/sync/core/sync_encryption_handler.h"
 #include "components/sync/driver/glue/sync_backend_host_impl.h"
 #include "components/sync/engine/cycle/type_debug_info_observer.h"
+#include "components/sync/engine/shutdown_reason.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "url/gurl.h"
 
 namespace syncer {
@@ -45,7 +45,7 @@
       bool delete_sync_data_folder,
       const std::string& restored_key_for_bootstrapping,
       const std::string& restored_keystore_key_for_bootstrapping,
-      std::unique_ptr<InternalComponentsFactory> internal_components_factory,
+      std::unique_ptr<EngineComponentsFactory> engine_components_factory,
       const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler,
       const base::Closure& report_unrecoverable_error_function,
       std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state,
@@ -68,7 +68,7 @@
   bool delete_sync_data_folder;
   std::string restored_key_for_bootstrapping;
   std::string restored_keystore_key_for_bootstrapping;
-  std::unique_ptr<InternalComponentsFactory> internal_components_factory;
+  std::unique_ptr<EngineComponentsFactory> engine_components_factory;
   const WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler;
   base::Closure report_unrecoverable_error_function;
   std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state;
diff --git a/components/sync/driver/glue/sync_backend_host_impl.cc b/components/sync/driver/glue/sync_backend_host_impl.cc
index c4a9598..072c5f61 100644
--- a/components/sync/driver/glue/sync_backend_host_impl.cc
+++ b/components/sync/driver/glue/sync_backend_host_impl.cc
@@ -17,17 +17,17 @@
 #include "components/sync/base/experiments.h"
 #include "components/sync/base/invalidation_helper.h"
 #include "components/sync/base/sync_prefs.h"
-#include "components/sync/core/activation_context.h"
-#include "components/sync/core/internal_components_factory.h"
-#include "components/sync/core/internal_components_factory_impl.h"
-#include "components/sync/core/sync_manager_factory.h"
 #include "components/sync/driver/glue/sync_backend_host_core.h"
 #include "components/sync/driver/glue/sync_backend_registrar.h"
 #include "components/sync/driver/sync_client.h"
 #include "components/sync/driver/sync_driver_switches.h"
 #include "components/sync/driver/sync_frontend.h"
+#include "components/sync/engine/activation_context.h"
+#include "components/sync/engine/engine_components_factory.h"
+#include "components/sync/engine/engine_components_factory_impl.h"
 #include "components/sync/engine/events/protocol_event.h"
 #include "components/sync/engine/net/http_bridge.h"
+#include "components/sync/engine/sync_manager_factory.h"
 #include "components/sync/engine/sync_string_conversions.h"
 #include "components/sync/syncable/base_transaction.h"
 
@@ -94,18 +94,18 @@
   std::vector<scoped_refptr<ModelSafeWorker>> workers;
   registrar_->GetWorkers(&workers);
 
-  InternalComponentsFactory::Switches factory_switches = {
-      InternalComponentsFactory::ENCRYPTION_KEYSTORE,
-      InternalComponentsFactory::BACKOFF_NORMAL};
+  EngineComponentsFactory::Switches factory_switches = {
+      EngineComponentsFactory::ENCRYPTION_KEYSTORE,
+      EngineComponentsFactory::BACKOFF_NORMAL};
 
   base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
   if (cl->HasSwitch(switches::kSyncShortInitialRetryOverride)) {
     factory_switches.backoff_override =
-        InternalComponentsFactory::BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE;
+        EngineComponentsFactory::BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE;
   }
   if (cl->HasSwitch(switches::kSyncEnableGetUpdateAvoidance)) {
     factory_switches.pre_commit_updates_policy =
-        InternalComponentsFactory::FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE;
+        EngineComponentsFactory::FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE;
   }
 
   std::map<ModelType, int64_t> invalidation_versions;
@@ -120,8 +120,8 @@
       std::move(sync_manager_factory), delete_sync_data_folder,
       sync_prefs_->GetEncryptionBootstrapToken(),
       sync_prefs_->GetKeystoreEncryptionBootstrapToken(),
-      std::unique_ptr<InternalComponentsFactory>(
-          new InternalComponentsFactoryImpl(factory_switches)),
+      std::unique_ptr<EngineComponentsFactory>(
+          new EngineComponentsFactoryImpl(factory_switches)),
       unrecoverable_error_handler, report_unrecoverable_error_function,
       std::move(saved_nigori_state), invalidation_versions));
   InitCore(std::move(init_opts));
diff --git a/components/sync/driver/glue/sync_backend_host_impl.h b/components/sync/driver/glue/sync_backend_host_impl.h
index c4e66f5..cfeab2e 100644
--- a/components/sync/driver/glue/sync_backend_host_impl.h
+++ b/components/sync/driver/glue/sync_backend_host_impl.h
@@ -23,12 +23,12 @@
 #include "components/sync/base/extensions_activity.h"
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/configure_reason.h"
-#include "components/sync/core/sync_manager.h"
 #include "components/sync/driver/backend_data_type_configurer.h"
 #include "components/sync/driver/glue/sync_backend_host.h"
+#include "components/sync/engine/configure_reason.h"
 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
 #include "components/sync/engine/cycle/type_debug_info_observer.h"
+#include "components/sync/engine/sync_manager.h"
 #include "components/sync/protocol/encryption.pb.h"
 #include "components/sync/protocol/sync_protocol_error.h"
 
diff --git a/components/sync/driver/glue/sync_backend_host_impl_unittest.cc b/components/sync/driver/glue/sync_backend_host_impl_unittest.cc
index 65ba82c..ffeb1e92 100644
--- a/components/sync/driver/glue/sync_backend_host_impl_unittest.cc
+++ b/components/sync/driver/glue/sync_backend_host_impl_unittest.cc
@@ -23,18 +23,18 @@
 #include "components/sync/base/experiments.h"
 #include "components/sync/base/sync_prefs.h"
 #include "components/sync/base/test_unrecoverable_error_handler.h"
-#include "components/sync/core/sync_manager_factory.h"
-#include "components/sync/core/test/fake_sync_manager.h"
 #include "components/sync/device_info/device_info.h"
 #include "components/sync/driver/fake_sync_client.h"
 #include "components/sync/driver/sync_frontend.h"
 #include "components/sync/engine/cycle/commit_counters.h"
 #include "components/sync/engine/cycle/status_counters.h"
 #include "components/sync/engine/cycle/update_counters.h"
+#include "components/sync/engine/fake_sync_manager.h"
 #include "components/sync/engine/model_safe_worker.h"
 #include "components/sync/engine/net/http_bridge_network_resources.h"
 #include "components/sync/engine/net/network_resources.h"
 #include "components/sync/engine/passive_model_worker.h"
+#include "components/sync/engine/sync_manager_factory.h"
 #include "components/sync/test/callback_counter.h"
 #include "components/syncable_prefs/pref_service_syncable.h"
 #include "components/syncable_prefs/testing_pref_service_syncable.h"
diff --git a/components/sync/driver/glue/sync_backend_host_mock.cc b/components/sync/driver/glue/sync_backend_host_mock.cc
index 384c5174..f02c4a5 100644
--- a/components/sync/driver/glue/sync_backend_host_mock.cc
+++ b/components/sync/driver/glue/sync_backend_host_mock.cc
@@ -4,8 +4,8 @@
 
 #include "components/sync/driver/glue/sync_backend_host_mock.h"
 
-#include "components/sync/core/activation_context.h"
 #include "components/sync/driver/sync_frontend.h"
+#include "components/sync/engine/activation_context.h"
 
 namespace syncer {
 
diff --git a/components/sync/driver/glue/sync_backend_registrar.h b/components/sync/driver/glue/sync_backend_registrar.h
index 341dceff..8ed73b0 100644
--- a/components/sync/driver/glue/sync_backend_registrar.h
+++ b/components/sync/driver/glue/sync_backend_registrar.h
@@ -18,8 +18,8 @@
 #include "base/synchronization/lock.h"
 #include "base/threading/thread.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/sync_manager.h"
 #include "components/sync/engine/model_safe_worker.h"
+#include "components/sync/engine/sync_manager.h"
 
 class Profile;
 
diff --git a/components/sync/driver/model_association_manager.h b/components/sync/driver/model_association_manager.h
index e6b455c..40d9bba3 100644
--- a/components/sync/driver/model_association_manager.h
+++ b/components/sync/driver/model_association_manager.h
@@ -12,8 +12,8 @@
 #include "base/timer/timer.h"
 
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/data_type_association_stats.h"
 #include "components/sync/driver/data_type_manager.h"
+#include "components/sync/engine/data_type_association_stats.h"
 
 namespace syncer {
 
diff --git a/components/sync/driver/model_type_controller.cc b/components/sync/driver/model_type_controller.cc
index b549af5..e602c707 100644
--- a/components/sync/driver/model_type_controller.cc
+++ b/components/sync/driver/model_type_controller.cc
@@ -14,9 +14,9 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/sync/base/bind_to_task_runner.h"
 #include "components/sync/base/data_type_histogram.h"
-#include "components/sync/core/activation_context.h"
 #include "components/sync/driver/backend_data_type_configurer.h"
 #include "components/sync/driver/sync_client.h"
+#include "components/sync/engine/activation_context.h"
 #include "components/sync/model/data_type_error_handler_impl.h"
 #include "components/sync/model/model_type_change_processor.h"
 #include "components/sync/model/model_type_debug_info.h"
diff --git a/components/sync/driver/model_type_controller_unittest.cc b/components/sync/driver/model_type_controller_unittest.cc
index 817168b..603344dc 100644
--- a/components/sync/driver/model_type_controller_unittest.cc
+++ b/components/sync/driver/model_type_controller_unittest.cc
@@ -18,12 +18,12 @@
 #include "base/test/test_simple_task_runner.h"
 #include "base/threading/thread.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "components/sync/core/activation_context.h"
-#include "components/sync/core/model_type_processor_proxy.h"
-#include "components/sync/core/test/fake_model_type_processor.h"
 #include "components/sync/driver/backend_data_type_configurer.h"
 #include "components/sync/driver/fake_sync_client.h"
+#include "components/sync/engine/activation_context.h"
 #include "components/sync/engine/commit_queue.h"
+#include "components/sync/engine/fake_model_type_processor.h"
+#include "components/sync/engine/model_type_processor_proxy.h"
 #include "components/sync/model/fake_model_type_change_processor.h"
 #include "components/sync/model/stub_model_type_service.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/sync/driver/sync_frontend.h b/components/sync/driver/sync_frontend.h
index c1415e9..c68b96a88 100644
--- a/components/sync/driver/sync_frontend.h
+++ b/components/sync/driver/sync_frontend.h
@@ -9,8 +9,8 @@
 
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/sync_encryption_handler.h"
-#include "components/sync/core/sync_manager.h"
+#include "components/sync/engine/sync_encryption_handler.h"
+#include "components/sync/engine/sync_manager.h"
 #include "components/sync/protocol/sync_protocol_error.h"
 
 namespace sync_pb {
diff --git a/components/sync/driver/sync_service.cc b/components/sync/driver/sync_service.cc
index b27b87b5..7b65570 100644
--- a/components/sync/driver/sync_service.cc
+++ b/components/sync/driver/sync_service.cc
@@ -4,7 +4,7 @@
 
 #include "components/sync/driver/sync_service.h"
 
-#include "components/sync/core/sync_manager.h"
+#include "components/sync/engine/sync_manager.h"
 
 namespace syncer {
 
diff --git a/components/sync/driver/sync_service.h b/components/sync/driver/sync_service.h
index 44dd4cd..40528c46 100644
--- a/components/sync/driver/sync_service.h
+++ b/components/sync/driver/sync_service.h
@@ -14,9 +14,9 @@
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/connection_status.h"
 #include "components/sync/driver/data_type_encryption_handler.h"
 #include "components/sync/driver/sync_service_observer.h"
+#include "components/sync/engine/connection_status.h"
 #include "google_apis/gaia/google_service_auth_error.h"
 
 class GoogleServiceAuthError;
diff --git a/components/sync/engine/DEPS b/components/sync/engine/DEPS
index 0540ba4..120b16f 100644
--- a/components/sync/engine/DEPS
+++ b/components/sync/engine/DEPS
@@ -1,8 +1,8 @@
 include_rules = [
   "+components/sync/base",
-  # TODO(crbug.com/631271): Core should be split into driver/engine/model.
-  "+components/sync/core",
   "+components/sync/engine_impl",
   "+components/sync/model",
   "+components/sync/protocol",
+  "+components/sync/syncable",
+  "+components/sync/test",
 ]
diff --git a/components/sync/core/activation_context.cc b/components/sync/engine/activation_context.cc
similarity index 84%
rename from components/sync/core/activation_context.cc
rename to components/sync/engine/activation_context.cc
index 38e0c9d1..286b4c7b 100644
--- a/components/sync/core/activation_context.cc
+++ b/components/sync/engine/activation_context.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/activation_context.h"
+#include "components/sync/engine/activation_context.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/activation_context.h b/components/sync/engine/activation_context.h
similarity index 75%
rename from components/sync/core/activation_context.h
rename to components/sync/engine/activation_context.h
index 78f6f69c..337d492 100644
--- a/components/sync/core/activation_context.h
+++ b/components/sync/engine/activation_context.h
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_ACTIVATION_CONTEXT_H_
-#define COMPONENTS_SYNC_CORE_ACTIVATION_CONTEXT_H_
+#ifndef COMPONENTS_SYNC_ENGINE_ACTIVATION_CONTEXT_H_
+#define COMPONENTS_SYNC_ENGINE_ACTIVATION_CONTEXT_H_
 
 #include <memory>
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/sequenced_task_runner.h"
-#include "components/sync/core/model_type_processor.h"
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/model_type_processor.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/protocol/model_type_state.pb.h"
 
 namespace syncer {
@@ -32,4 +32,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_ACTIVATION_CONTEXT_H_
+#endif  // COMPONENTS_SYNC_ENGINE_ACTIVATION_CONTEXT_H_
diff --git a/components/sync/engine/commit_queue.h b/components/sync/engine/commit_queue.h
index 860f3ee..5224a62c 100644
--- a/components/sync/engine/commit_queue.h
+++ b/components/sync/engine/commit_queue.h
@@ -5,7 +5,7 @@
 #ifndef COMPONENTS_SYNC_ENGINE_COMMIT_QUEUE_H_
 #define COMPONENTS_SYNC_ENGINE_COMMIT_QUEUE_H_
 
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/configure_reason.h b/components/sync/engine/configure_reason.h
similarity index 91%
rename from components/sync/core/configure_reason.h
rename to components/sync/engine/configure_reason.h
index 0115ea9f..0f14b7bdf 100644
--- a/components/sync/core/configure_reason.h
+++ b/components/sync/engine/configure_reason.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_CONFIGURE_REASON_H_
-#define COMPONENTS_SYNC_CORE_CONFIGURE_REASON_H_
+#ifndef COMPONENTS_SYNC_ENGINE_CONFIGURE_REASON_H_
+#define COMPONENTS_SYNC_ENGINE_CONFIGURE_REASON_H_
 
 namespace syncer {
 
@@ -47,4 +47,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_CONFIGURE_REASON_H_
+#endif  // COMPONENTS_SYNC_ENGINE_CONFIGURE_REASON_H_
diff --git a/components/sync/core/connection_status.h b/components/sync/engine/connection_status.h
similarity index 70%
rename from components/sync/core/connection_status.h
rename to components/sync/engine/connection_status.h
index 2bcb541..a0a2b62 100644
--- a/components/sync/core/connection_status.h
+++ b/components/sync/engine/connection_status.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_CONNECTION_STATUS_H_
-#define COMPONENTS_SYNC_CORE_CONNECTION_STATUS_H_
+#ifndef COMPONENTS_SYNC_ENGINE_CONNECTION_STATUS_H_
+#define COMPONENTS_SYNC_ENGINE_CONNECTION_STATUS_H_
 
 namespace syncer {
 
@@ -17,4 +17,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_CONNECTION_STATUS_H_
+#endif  // COMPONENTS_SYNC_ENGINE_CONNECTION_STATUS_H_
diff --git a/components/sync/core/data_type_association_stats.cc b/components/sync/engine/data_type_association_stats.cc
similarity index 93%
rename from components/sync/core/data_type_association_stats.cc
rename to components/sync/engine/data_type_association_stats.cc
index c28b0eae..465dc15 100644
--- a/components/sync/core/data_type_association_stats.cc
+++ b/components/sync/engine/data_type_association_stats.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/data_type_association_stats.h"
+#include "components/sync/engine/data_type_association_stats.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/data_type_association_stats.h b/components/sync/engine/data_type_association_stats.h
similarity index 88%
rename from components/sync/core/data_type_association_stats.h
rename to components/sync/engine/data_type_association_stats.h
index a375c02..a5d9223 100644
--- a/components/sync/core/data_type_association_stats.h
+++ b/components/sync/engine/data_type_association_stats.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_DATA_TYPE_ASSOCIATION_STATS_H_
-#define COMPONENTS_SYNC_CORE_DATA_TYPE_ASSOCIATION_STATS_H_
+#ifndef COMPONENTS_SYNC_ENGINE_DATA_TYPE_ASSOCIATION_STATS_H_
+#define COMPONENTS_SYNC_ENGINE_DATA_TYPE_ASSOCIATION_STATS_H_
 
 #include <stdint.h>
 
@@ -51,4 +51,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_DATA_TYPE_ASSOCIATION_STATS_H_
+#endif  // COMPONENTS_SYNC_ENGINE_DATA_TYPE_ASSOCIATION_STATS_H_
diff --git a/components/sync/core/data_type_debug_info_listener.cc b/components/sync/engine/data_type_debug_info_listener.cc
similarity index 87%
rename from components/sync/core/data_type_debug_info_listener.cc
rename to components/sync/engine/data_type_debug_info_listener.cc
index 28358942..62cdddc 100644
--- a/components/sync/core/data_type_debug_info_listener.cc
+++ b/components/sync/engine/data_type_debug_info_listener.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/data_type_debug_info_listener.h"
+#include "components/sync/engine/data_type_debug_info_listener.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/data_type_debug_info_listener.h b/components/sync/engine/data_type_debug_info_listener.h
similarity index 84%
rename from components/sync/core/data_type_debug_info_listener.h
rename to components/sync/engine/data_type_debug_info_listener.h
index 93c6a16..881f4fb 100644
--- a/components/sync/core/data_type_debug_info_listener.h
+++ b/components/sync/engine/data_type_debug_info_listener.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_DATA_TYPE_DEBUG_INFO_LISTENER_H_
-#define COMPONENTS_SYNC_CORE_DATA_TYPE_DEBUG_INFO_LISTENER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_DATA_TYPE_DEBUG_INFO_LISTENER_H_
+#define COMPONENTS_SYNC_ENGINE_DATA_TYPE_DEBUG_INFO_LISTENER_H_
 
 #include <vector>
 
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/data_type_association_stats.h"
+#include "components/sync/engine/data_type_association_stats.h"
 
 namespace syncer {
 
@@ -48,4 +48,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_DATA_TYPE_DEBUG_INFO_LISTENER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_DATA_TYPE_DEBUG_INFO_LISTENER_H_
diff --git a/components/sync/core/internal_components_factory.h b/components/sync/engine/engine_components_factory.h
similarity index 86%
rename from components/sync/core/internal_components_factory.h
rename to components/sync/engine/engine_components_factory.h
index 779415d0..175af5c 100644
--- a/components/sync/core/internal_components_factory.h
+++ b/components/sync/engine/engine_components_factory.h
@@ -1,13 +1,9 @@
 // Copyright 2012 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
-//
-// InternalComponentsFactory exists so that tests can override creation of
-// components used by the SyncManager that are not exposed across the sync
-// API boundary.
 
-#ifndef COMPONENTS_SYNC_CORE_INTERNAL_COMPONENTS_FACTORY_H_
-#define COMPONENTS_SYNC_CORE_INTERNAL_COMPONENTS_FACTORY_H_
+#ifndef COMPONENTS_SYNC_ENGINE_ENGINE_COMPONENTS_FACTORY_H_
+#define COMPONENTS_SYNC_ENGINE_ENGINE_COMPONENTS_FACTORY_H_
 
 #include <memory>
 #include <string>
@@ -32,7 +28,9 @@
 class DirectoryBackingStore;
 }
 
-class InternalComponentsFactory {
+// EngineComponentsFactory exists so that tests can override creation of
+// components used by the SyncManager and other things inside engine/.
+class EngineComponentsFactory {
  public:
   enum EncryptionMethod {
     ENCRYPTION_LEGACY,
@@ -61,7 +59,7 @@
   // Configuration options for internal components. This struct is expected
   // to grow and shrink over time with transient features / experiments,
   // roughly following command line flags in chrome. Implementations of
-  // InternalComponentsFactory can use this information to build components
+  // EngineComponentsFactory can use this information to build components
   // with appropriate bells and whistles.
   struct Switches {
     EncryptionMethod encryption_method;
@@ -81,7 +79,7 @@
     STORAGE_INVALID
   };
 
-  virtual ~InternalComponentsFactory() {}
+  virtual ~EngineComponentsFactory() {}
 
   virtual std::unique_ptr<SyncScheduler> BuildScheduler(
       const std::string& name,
@@ -109,4 +107,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_INTERNAL_COMPONENTS_FACTORY_H_
+#endif  // COMPONENTS_SYNC_ENGINE_ENGINE_COMPONENTS_FACTORY_H_
diff --git a/components/sync/core/internal_components_factory_impl.cc b/components/sync/engine/engine_components_factory_impl.cc
similarity index 82%
rename from components/sync/core/internal_components_factory_impl.cc
rename to components/sync/engine/engine_components_factory_impl.cc
index 2fc73a41..73c7a551f 100644
--- a/components/sync/core/internal_components_factory_impl.cc
+++ b/components/sync/engine/engine_components_factory_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/internal_components_factory_impl.h"
+#include "components/sync/engine/engine_components_factory_impl.h"
 
 #include "components/sync/engine_impl/backoff_delay_provider.h"
 #include "components/sync/engine_impl/cycle/sync_cycle_context.h"
@@ -14,13 +14,13 @@
 
 namespace syncer {
 
-InternalComponentsFactoryImpl::InternalComponentsFactoryImpl(
+EngineComponentsFactoryImpl::EngineComponentsFactoryImpl(
     const Switches& switches)
     : switches_(switches) {}
 
-InternalComponentsFactoryImpl::~InternalComponentsFactoryImpl() {}
+EngineComponentsFactoryImpl::~EngineComponentsFactoryImpl() {}
 
-std::unique_ptr<SyncScheduler> InternalComponentsFactoryImpl::BuildScheduler(
+std::unique_ptr<SyncScheduler> EngineComponentsFactoryImpl::BuildScheduler(
     const std::string& name,
     SyncCycleContext* context,
     CancelationSignal* cancelation_signal) {
@@ -34,7 +34,7 @@
       name, delay.release(), context, new Syncer(cancelation_signal)));
 }
 
-std::unique_ptr<SyncCycleContext> InternalComponentsFactoryImpl::BuildContext(
+std::unique_ptr<SyncCycleContext> EngineComponentsFactoryImpl::BuildContext(
     ServerConnectionManager* connection_manager,
     syncable::Directory* directory,
     ExtensionsActivity* extensions_activity,
@@ -52,7 +52,7 @@
 }
 
 std::unique_ptr<syncable::DirectoryBackingStore>
-InternalComponentsFactoryImpl::BuildDirectoryBackingStore(
+EngineComponentsFactoryImpl::BuildDirectoryBackingStore(
     StorageOption storage,
     const std::string& dir_name,
     const base::FilePath& backing_filepath) {
@@ -65,7 +65,7 @@
   }
 }
 
-InternalComponentsFactory::Switches InternalComponentsFactoryImpl::GetSwitches()
+EngineComponentsFactory::Switches EngineComponentsFactoryImpl::GetSwitches()
     const {
   return switches_;
 }
diff --git a/components/sync/core/internal_components_factory_impl.h b/components/sync/engine/engine_components_factory_impl.h
similarity index 66%
rename from components/sync/core/internal_components_factory_impl.h
rename to components/sync/engine/engine_components_factory_impl.h
index 9836220..476bdf1 100644
--- a/components/sync/core/internal_components_factory_impl.h
+++ b/components/sync/engine/engine_components_factory_impl.h
@@ -2,25 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
-// An InternalComponentsFactory implementation designed for real production /
+// An EngineComponentsFactory implementation designed for real production /
 // normal use.
 
-#ifndef COMPONENTS_SYNC_CORE_INTERNAL_COMPONENTS_FACTORY_IMPL_H_
-#define COMPONENTS_SYNC_CORE_INTERNAL_COMPONENTS_FACTORY_IMPL_H_
+#ifndef COMPONENTS_SYNC_ENGINE_ENGINE_COMPONENTS_FACTORY_IMPL_H_
+#define COMPONENTS_SYNC_ENGINE_ENGINE_COMPONENTS_FACTORY_IMPL_H_
 
 #include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "components/sync/core/internal_components_factory.h"
+#include "components/sync/engine/engine_components_factory.h"
 
 namespace syncer {
 
-class InternalComponentsFactoryImpl : public InternalComponentsFactory {
+class EngineComponentsFactoryImpl : public EngineComponentsFactory {
  public:
-  explicit InternalComponentsFactoryImpl(const Switches& switches);
-  ~InternalComponentsFactoryImpl() override;
+  explicit EngineComponentsFactoryImpl(const Switches& switches);
+  ~EngineComponentsFactoryImpl() override;
 
   std::unique_ptr<SyncScheduler> BuildScheduler(
       const std::string& name,
@@ -45,9 +45,9 @@
 
  private:
   const Switches switches_;
-  DISALLOW_COPY_AND_ASSIGN(InternalComponentsFactoryImpl);
+  DISALLOW_COPY_AND_ASSIGN(EngineComponentsFactoryImpl);
 };
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_INTERNAL_COMPONENTS_FACTORY_IMPL_H_
+#endif  // COMPONENTS_SYNC_ENGINE_ENGINE_COMPONENTS_FACTORY_IMPL_H_
diff --git a/components/sync/core_impl/syncapi_internal.cc b/components/sync/engine/engine_util.cc
similarity index 97%
rename from components/sync/core_impl/syncapi_internal.cc
rename to components/sync/engine/engine_util.cc
index ca690bd7..e66bf13 100644
--- a/components/sync/core_impl/syncapi_internal.cc
+++ b/components/sync/engine/engine_util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/syncapi_internal.h"
+#include "components/sync/engine/engine_util.h"
 
 #include <stddef.h>
 
diff --git a/components/sync/core_impl/syncapi_internal.h b/components/sync/engine/engine_util.h
similarity index 87%
rename from components/sync/core_impl/syncapi_internal.h
rename to components/sync/engine/engine_util.h
index 443bf35f..76f67c4 100644
--- a/components/sync/core_impl/syncapi_internal.h
+++ b/components/sync/engine/engine_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_SYNCAPI_INTERNAL_H_
-#define COMPONENTS_SYNC_CORE_IMPL_SYNCAPI_INTERNAL_H_
+#ifndef COMPONENTS_SYNC_ENGINE_ENGINE_UTIL_H_
+#define COMPONENTS_SYNC_ENGINE_ENGINE_UTIL_H_
 
 // The functions defined are shared among some of the classes that implement
 // the internal sync API.  They are not to be used by clients of the API.
@@ -39,4 +39,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_SYNCAPI_INTERNAL_H_
+#endif  // COMPONENTS_SYNC_ENGINE_ENGINE_UTIL_H_
diff --git a/components/sync/core_impl/test/fake_model_type_connector.cc b/components/sync/engine/fake_model_type_connector.cc
similarity index 80%
rename from components/sync/core_impl/test/fake_model_type_connector.cc
rename to components/sync/engine/fake_model_type_connector.cc
index 73d66afa..59b80266 100644
--- a/components/sync/core_impl/test/fake_model_type_connector.cc
+++ b/components/sync/engine/fake_model_type_connector.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/test/fake_model_type_connector.h"
+#include "components/sync/engine/fake_model_type_connector.h"
 
-#include "components/sync/core/activation_context.h"
+#include "components/sync/engine/activation_context.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/test/fake_model_type_connector.h b/components/sync/engine/fake_model_type_connector.h
similarity index 70%
rename from components/sync/core/test/fake_model_type_connector.h
rename to components/sync/engine/fake_model_type_connector.h
index 54caf16..7c47378 100644
--- a/components/sync/core/test/fake_model_type_connector.h
+++ b/components/sync/engine/fake_model_type_connector.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_TEST_FAKE_MODEL_TYPE_CONNECTOR_H_
-#define COMPONENTS_SYNC_CORE_TEST_FAKE_MODEL_TYPE_CONNECTOR_H_
+#ifndef COMPONENTS_SYNC_ENGINE_FAKE_MODEL_TYPE_CONNECTOR_H_
+#define COMPONENTS_SYNC_ENGINE_FAKE_MODEL_TYPE_CONNECTOR_H_
 
 #include <memory>
 
-#include "components/sync/core/model_type_connector.h"
+#include "components/sync/engine/model_type_connector.h"
 
 namespace syncer {
 
@@ -25,4 +25,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_TEST_FAKE_MODEL_TYPE_CONNECTOR_H_
+#endif  // COMPONENTS_SYNC_ENGINE_FAKE_MODEL_TYPE_CONNECTOR_H_
diff --git a/components/sync/core_impl/test/fake_model_type_processor.cc b/components/sync/engine/fake_model_type_processor.cc
similarity index 92%
rename from components/sync/core_impl/test/fake_model_type_processor.cc
rename to components/sync/engine/fake_model_type_processor.cc
index 50c46c36..360841e 100644
--- a/components/sync/core_impl/test/fake_model_type_processor.cc
+++ b/components/sync/engine/fake_model_type_processor.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/test/fake_model_type_processor.h"
+#include "components/sync/engine/fake_model_type_processor.h"
 
 #include "components/sync/engine/commit_queue.h"
 
diff --git a/components/sync/core/test/fake_model_type_processor.h b/components/sync/engine/fake_model_type_processor.h
similarity index 76%
rename from components/sync/core/test/fake_model_type_processor.h
rename to components/sync/engine/fake_model_type_processor.h
index 8fc866d..0229307 100644
--- a/components/sync/core/test/fake_model_type_processor.h
+++ b/components/sync/engine/fake_model_type_processor.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_TEST_FAKE_MODEL_TYPE_PROCESSOR_H_
-#define COMPONENTS_SYNC_CORE_TEST_FAKE_MODEL_TYPE_PROCESSOR_H_
+#ifndef COMPONENTS_SYNC_ENGINE_FAKE_MODEL_TYPE_PROCESSOR_H_
+#define COMPONENTS_SYNC_ENGINE_FAKE_MODEL_TYPE_PROCESSOR_H_
 
 #include <memory>
 
-#include "components/sync/core/model_type_processor.h"
+#include "components/sync/engine/model_type_processor.h"
 
 namespace syncer {
 
@@ -27,4 +27,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_TEST_FAKE_MODEL_TYPE_PROCESSOR_H_
+#endif  // COMPONENTS_SYNC_ENGINE_FAKE_MODEL_TYPE_PROCESSOR_H_
diff --git a/components/sync/core_impl/test/fake_sync_manager.cc b/components/sync/engine/fake_sync_manager.cc
similarity index 94%
rename from components/sync/core_impl/test/fake_sync_manager.cc
rename to components/sync/engine/fake_sync_manager.cc
index 50762b4a..9dc6753 100644
--- a/components/sync/core_impl/test/fake_sync_manager.cc
+++ b/components/sync/engine/fake_sync_manager.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/test/fake_sync_manager.h"
+#include "components/sync/engine/fake_sync_manager.h"
 
 #include <cstddef>
 
@@ -16,8 +16,8 @@
 #include "base/single_thread_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/internal_components_factory.h"
-#include "components/sync/core/test/fake_model_type_connector.h"
+#include "components/sync/engine/engine_components_factory.h"
+#include "components/sync/engine/fake_model_type_connector.h"
 #include "components/sync/engine/net/http_post_provider_factory.h"
 #include "components/sync/syncable/directory.h"
 #include "components/sync/test/fake_sync_encryption_handler.h"
@@ -88,11 +88,11 @@
     TestUserShare::CreateRoot(it.Get(), share);
   }
 
-  FOR_EACH_OBSERVER(
-      SyncManager::Observer, observers_,
-      OnInitializationComplete(WeakHandle<JsBackend>(),
-                               WeakHandle<DataTypeDebugInfoListener>(), true,
-                               initial_sync_ended_types_));
+  for (auto& observer : observers_) {
+    observer.OnInitializationComplete(WeakHandle<JsBackend>(),
+                                      WeakHandle<DataTypeDebugInfoListener>(),
+                                      true, initial_sync_ended_types_);
+  }
 }
 
 ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() {
diff --git a/components/sync/core/test/fake_sync_manager.h b/components/sync/engine/fake_sync_manager.h
similarity index 96%
rename from components/sync/core/test/fake_sync_manager.h
rename to components/sync/engine/fake_sync_manager.h
index a01eb35..e90cf420 100644
--- a/components/sync/core/test/fake_sync_manager.h
+++ b/components/sync/engine/fake_sync_manager.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_TEST_FAKE_SYNC_MANAGER_H_
-#define COMPONENTS_SYNC_CORE_TEST_FAKE_SYNC_MANAGER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_
+#define COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_
 
 #include <memory>
 #include <string>
@@ -12,7 +12,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/observer_list.h"
-#include "components/sync/core/sync_manager.h"
+#include "components/sync/engine/sync_manager.h"
 #include "components/sync/syncable/test_user_share.h"
 
 class GURL;
@@ -156,4 +156,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_TEST_FAKE_SYNC_MANAGER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_
diff --git a/components/sync/core/model_type_connector.cc b/components/sync/engine/model_type_connector.cc
similarity index 83%
rename from components/sync/core/model_type_connector.cc
rename to components/sync/engine/model_type_connector.cc
index 937f71c..7e61f64f2 100644
--- a/components/sync/core/model_type_connector.cc
+++ b/components/sync/engine/model_type_connector.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/model_type_connector.h"
+#include "components/sync/engine/model_type_connector.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/model_type_connector.h b/components/sync/engine/model_type_connector.h
similarity index 88%
rename from components/sync/core/model_type_connector.h
rename to components/sync/engine/model_type_connector.h
index 4b95e9a..1917100 100644
--- a/components/sync/core/model_type_connector.h
+++ b/components/sync/engine/model_type_connector.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_MODEL_TYPE_CONNECTOR_H_
-#define COMPONENTS_SYNC_CORE_MODEL_TYPE_CONNECTOR_H_
+#ifndef COMPONENTS_SYNC_ENGINE_MODEL_TYPE_CONNECTOR_H_
+#define COMPONENTS_SYNC_ENGINE_MODEL_TYPE_CONNECTOR_H_
 
 #include <memory>
 
@@ -38,4 +38,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_MODEL_TYPE_CONNECTOR_H_
+#endif  // COMPONENTS_SYNC_ENGINE_MODEL_TYPE_CONNECTOR_H_
diff --git a/components/sync/core/model_type_processor.cc b/components/sync/engine/model_type_processor.cc
similarity index 83%
rename from components/sync/core/model_type_processor.cc
rename to components/sync/engine/model_type_processor.cc
index f1513d2..4bf9a7f3 100644
--- a/components/sync/core/model_type_processor.cc
+++ b/components/sync/engine/model_type_processor.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/model_type_processor.h"
+#include "components/sync/engine/model_type_processor.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/model_type_processor.h b/components/sync/engine/model_type_processor.h
similarity index 86%
rename from components/sync/core/model_type_processor.h
rename to components/sync/engine/model_type_processor.h
index 761f1e6..2af3de1 100644
--- a/components/sync/core/model_type_processor.h
+++ b/components/sync/engine/model_type_processor.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_H_
-#define COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_H_
+#ifndef COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_H_
+#define COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_H_
 
 #include <memory>
 
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/protocol/model_type_state.pb.h"
 
 namespace syncer {
@@ -44,4 +44,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_H_
+#endif  // COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_H_
diff --git a/components/sync/core/model_type_processor_proxy.cc b/components/sync/engine/model_type_processor_proxy.cc
similarity index 96%
rename from components/sync/core/model_type_processor_proxy.cc
rename to components/sync/engine/model_type_processor_proxy.cc
index 99cf796..5730192 100644
--- a/components/sync/core/model_type_processor_proxy.cc
+++ b/components/sync/engine/model_type_processor_proxy.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/model_type_processor_proxy.h"
+#include "components/sync/engine/model_type_processor_proxy.h"
 
 #include <utility>
 
diff --git a/components/sync/core/model_type_processor_proxy.h b/components/sync/engine/model_type_processor_proxy.h
similarity index 81%
rename from components/sync/core/model_type_processor_proxy.h
rename to components/sync/engine/model_type_processor_proxy.h
index 3a08d3f3..ad5046ff 100644
--- a/components/sync/core/model_type_processor_proxy.h
+++ b/components/sync/engine/model_type_processor_proxy.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_PROXY_H_
-#define COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_PROXY_H_
+#ifndef COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_PROXY_H_
+#define COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_PROXY_H_
 
 #include <memory>
 
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/sequenced_task_runner.h"
-#include "components/sync/core/model_type_processor.h"
+#include "components/sync/engine/model_type_processor.h"
 
 namespace syncer {
 
@@ -35,4 +35,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_MODEL_TYPE_PROCESSOR_PROXY_H_
+#endif  // COMPONENTS_SYNC_ENGINE_MODEL_TYPE_PROCESSOR_PROXY_H_
diff --git a/components/sync/core/non_blocking_sync_common.cc b/components/sync/engine/non_blocking_sync_common.cc
similarity index 92%
rename from components/sync/core/non_blocking_sync_common.cc
rename to components/sync/engine/non_blocking_sync_common.cc
index 51121b8..76c7c49 100644
--- a/components/sync/core/non_blocking_sync_common.cc
+++ b/components/sync/engine/non_blocking_sync_common.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/non_blocking_sync_common.h b/components/sync/engine/non_blocking_sync_common.h
similarity index 89%
rename from components/sync/core/non_blocking_sync_common.h
rename to components/sync/engine/non_blocking_sync_common.h
index 6066a02c..1914b743 100644
--- a/components/sync/core/non_blocking_sync_common.h
+++ b/components/sync/engine/non_blocking_sync_common.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_NON_BLOCKING_SYNC_COMMON_H_
-#define COMPONENTS_SYNC_CORE_NON_BLOCKING_SYNC_COMMON_H_
+#ifndef COMPONENTS_SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_
+#define COMPONENTS_SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_
 
 #include <stdint.h>
 
@@ -62,4 +62,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_NON_BLOCKING_SYNC_COMMON_H_
+#endif  // COMPONENTS_SYNC_ENGINE_NON_BLOCKING_SYNC_COMMON_H_
diff --git a/components/sync/core/shutdown_reason.h b/components/sync/engine/shutdown_reason.h
similarity index 75%
rename from components/sync/core/shutdown_reason.h
rename to components/sync/engine/shutdown_reason.h
index 193bf44..a61be8f 100644
--- a/components/sync/core/shutdown_reason.h
+++ b/components/sync/engine/shutdown_reason.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_SHUTDOWN_REASON_H_
-#define COMPONENTS_SYNC_CORE_SHUTDOWN_REASON_H_
+#ifndef COMPONENTS_SYNC_ENGINE_SHUTDOWN_REASON_H_
+#define COMPONENTS_SYNC_ENGINE_SHUTDOWN_REASON_H_
 
 namespace syncer {
 
@@ -16,4 +16,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_SHUTDOWN_REASON_H_
+#endif  // COMPONENTS_SYNC_ENGINE_SHUTDOWN_REASON_H_
diff --git a/components/sync/core/sync_auth_provider.h b/components/sync/engine/sync_auth_provider.h
similarity index 85%
rename from components/sync/core/sync_auth_provider.h
rename to components/sync/engine/sync_auth_provider.h
index 350c080c..3602c826 100644
--- a/components/sync/core/sync_auth_provider.h
+++ b/components/sync/engine/sync_auth_provider.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_SYNC_AUTH_PROVIDER_H_
-#define COMPONENTS_SYNC_CORE_SYNC_AUTH_PROVIDER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_SYNC_AUTH_PROVIDER_H_
+#define COMPONENTS_SYNC_ENGINE_SYNC_AUTH_PROVIDER_H_
 
 #include <string>
 
@@ -33,4 +33,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_SYNC_AUTH_PROVIDER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_SYNC_AUTH_PROVIDER_H_
diff --git a/components/sync/core/sync_encryption_handler.cc b/components/sync/engine/sync_encryption_handler.cc
similarity index 91%
rename from components/sync/core/sync_encryption_handler.cc
rename to components/sync/engine/sync_encryption_handler.cc
index 33c7639..a14aec02 100644
--- a/components/sync/core/sync_encryption_handler.cc
+++ b/components/sync/engine/sync_encryption_handler.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/sync_encryption_handler.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/sync_encryption_handler.h b/components/sync/engine/sync_encryption_handler.h
similarity index 97%
rename from components/sync/core/sync_encryption_handler.h
rename to components/sync/engine/sync_encryption_handler.h
index 41a7b95e..52c5750f 100644
--- a/components/sync/core/sync_encryption_handler.h
+++ b/components/sync/engine/sync_encryption_handler.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_
-#define COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_
+#define COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_
 
 #include <string>
 
@@ -172,4 +172,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_SYNC_ENCRYPTION_HANDLER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_SYNC_ENCRYPTION_HANDLER_H_
diff --git a/components/sync/core/sync_manager.cc b/components/sync/engine/sync_manager.cc
similarity index 93%
rename from components/sync/core/sync_manager.cc
rename to components/sync/engine/sync_manager.cc
index 1f74dad..34cba62 100644
--- a/components/sync/core/sync_manager.cc
+++ b/components/sync/engine/sync_manager.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/sync_manager.h"
+#include "components/sync/engine/sync_manager.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/sync_manager.h b/components/sync/engine/sync_manager.h
similarity index 96%
rename from components/sync/core/sync_manager.h
rename to components/sync/engine/sync_manager.h
index 9df6916..71bfcdc8 100644
--- a/components/sync/core/sync_manager.h
+++ b/components/sync/engine/sync_manager.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_
-#define COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_H_
+#define COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_H_
 
 #include <stdint.h>
 
@@ -19,15 +19,15 @@
 #include "components/sync/base/invalidation_interface.h"
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/configure_reason.h"
-#include "components/sync/core/connection_status.h"
-#include "components/sync/core/internal_components_factory.h"
-#include "components/sync/core/model_type_connector.h"
-#include "components/sync/core/shutdown_reason.h"
-#include "components/sync/core/sync_encryption_handler.h"
+#include "components/sync/engine/configure_reason.h"
+#include "components/sync/engine/connection_status.h"
+#include "components/sync/engine/engine_components_factory.h"
 #include "components/sync/engine/events/protocol_event.h"
 #include "components/sync/engine/model_safe_worker.h"
+#include "components/sync/engine/model_type_connector.h"
 #include "components/sync/engine/net/http_post_provider_factory.h"
+#include "components/sync/engine/shutdown_reason.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/engine/sync_status.h"
 #include "components/sync/protocol/sync_protocol_error.h"
 #include "components/sync/syncable/change_record.h"
@@ -45,8 +45,8 @@
 class CancelationSignal;
 class DataTypeDebugInfoListener;
 class Encryptor;
+class EngineComponentsFactory;
 class ExtensionsActivity;
-class InternalComponentsFactory;
 class JsBackend;
 class JsEventHandler;
 class ProtocolEvent;
@@ -245,7 +245,7 @@
     std::string restored_key_for_bootstrapping;
     std::string restored_keystore_key_for_bootstrapping;
 
-    std::unique_ptr<InternalComponentsFactory> internal_components_factory;
+    std::unique_ptr<EngineComponentsFactory> engine_components_factory;
 
     // Must outlive SyncManager.
     Encryptor* encryptor;
@@ -399,4 +399,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_H_
diff --git a/components/sync/core/sync_manager_factory.cc b/components/sync/engine/sync_manager_factory.cc
similarity index 80%
rename from components/sync/core/sync_manager_factory.cc
rename to components/sync/engine/sync_manager_factory.cc
index 73a3f53..eae0ff3f4 100644
--- a/components/sync/core/sync_manager_factory.cc
+++ b/components/sync/engine/sync_manager_factory.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/sync_manager_factory.h"
+#include "components/sync/engine/sync_manager_factory.h"
 
-#include "components/sync/core_impl/sync_manager_impl.h"
+#include "components/sync/engine_impl/sync_manager_impl.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/sync_manager_factory.h b/components/sync/engine/sync_manager_factory.h
similarity index 78%
rename from components/sync/core/sync_manager_factory.h
rename to components/sync/engine/sync_manager_factory.h
index 827d5b6..64fc67c 100644
--- a/components/sync/core/sync_manager_factory.h
+++ b/components/sync/engine/sync_manager_factory.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_SYNC_MANAGER_FACTORY_H_
-#define COMPONENTS_SYNC_CORE_SYNC_MANAGER_FACTORY_H_
+#ifndef COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_FACTORY_H_
+#define COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_FACTORY_H_
 
 #include <memory>
 #include <string>
@@ -29,4 +29,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_SYNC_MANAGER_FACTORY_H_
+#endif  // COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_FACTORY_H_
diff --git a/components/sync/core_impl/test/sync_manager_factory_for_profile_sync_test.cc b/components/sync/engine/sync_manager_factory_for_profile_sync_test.cc
similarity index 82%
rename from components/sync/core_impl/test/sync_manager_factory_for_profile_sync_test.cc
rename to components/sync/engine/sync_manager_factory_for_profile_sync_test.cc
index f007d03..1911dfb 100644
--- a/components/sync/core_impl/test/sync_manager_factory_for_profile_sync_test.cc
+++ b/components/sync/engine/sync_manager_factory_for_profile_sync_test.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/test/sync_manager_factory_for_profile_sync_test.h"
+#include "components/sync/engine/sync_manager_factory_for_profile_sync_test.h"
 
-#include "components/sync/core_impl/test/sync_manager_for_profile_sync_test.h"
+#include "components/sync/engine_impl/sync_manager_for_profile_sync_test.h"
 
 namespace syncer {
 
diff --git a/components/sync/core/test/sync_manager_factory_for_profile_sync_test.h b/components/sync/engine/sync_manager_factory_for_profile_sync_test.h
similarity index 69%
rename from components/sync/core/test/sync_manager_factory_for_profile_sync_test.h
rename to components/sync/engine/sync_manager_factory_for_profile_sync_test.h
index 91946af8..2956cb3 100644
--- a/components/sync/core/test/sync_manager_factory_for_profile_sync_test.h
+++ b/components/sync/engine/sync_manager_factory_for_profile_sync_test.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_TEST_SYNC_MANAGER_FACTORY_FOR_PROFILE_SYNC_TEST_H_
-#define COMPONENTS_SYNC_CORE_TEST_SYNC_MANAGER_FACTORY_FOR_PROFILE_SYNC_TEST_H_
+#ifndef COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_FACTORY_FOR_PROFILE_SYNC_TEST_H_
+#define COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_FACTORY_FOR_PROFILE_SYNC_TEST_H_
 
 #include <memory>
 #include <string>
 
 #include "base/callback.h"
-#include "components/sync/core/sync_manager_factory.h"
+#include "components/sync/engine/sync_manager_factory.h"
 
 namespace syncer {
 
@@ -26,4 +26,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_TEST_SYNC_MANAGER_FACTORY_FOR_PROFILE_SYNC_TEST_H_
+#endif  // COMPONENTS_SYNC_ENGINE_SYNC_MANAGER_FACTORY_FOR_PROFILE_SYNC_TEST_H_
diff --git a/components/sync/engine/sync_status.h b/components/sync/engine/sync_status.h
index 6ca634fe..6447415d 100644
--- a/components/sync/engine/sync_status.h
+++ b/components/sync/engine/sync_status.h
@@ -11,7 +11,7 @@
 #include "base/time/time.h"
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/passphrase_type.h"
-#include "components/sync/core/sync_encryption_handler.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/protocol/sync_protocol_error.h"
 
 namespace syncer {
diff --git a/components/sync/engine/sync_string_conversions.h b/components/sync/engine/sync_string_conversions.h
index c3acb59..ed22001 100644
--- a/components/sync/engine/sync_string_conversions.h
+++ b/components/sync/engine/sync_string_conversions.h
@@ -5,8 +5,8 @@
 #ifndef COMPONENTS_SYNC_ENGINE_SYNC_STRING_CONVERSIONS_H_
 #define COMPONENTS_SYNC_ENGINE_SYNC_STRING_CONVERSIONS_H_
 
-#include "components/sync/core/connection_status.h"
-#include "components/sync/core/sync_encryption_handler.h"
+#include "components/sync/engine/connection_status.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 
 namespace syncer {
 
diff --git a/components/sync/core_impl/test/test_internal_components_factory.cc b/components/sync/engine/test_engine_components_factory.cc
similarity index 83%
rename from components/sync/core_impl/test/test_internal_components_factory.cc
rename to components/sync/engine/test_engine_components_factory.cc
index b6ab6c1..116c6d2b 100644
--- a/components/sync/core_impl/test/test_internal_components_factory.cc
+++ b/components/sync/engine/test_engine_components_factory.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/test/test_internal_components_factory.h"
+#include "components/sync/engine/test_engine_components_factory.h"
 
 #include "components/sync/engine_impl/cycle/sync_cycle_context.h"
 #include "components/sync/syncable/in_memory_directory_backing_store.h"
@@ -12,7 +12,7 @@
 
 namespace syncer {
 
-TestInternalComponentsFactory::TestInternalComponentsFactory(
+TestEngineComponentsFactory::TestEngineComponentsFactory(
     const Switches& switches,
     StorageOption option,
     StorageOption* storage_used)
@@ -20,16 +20,16 @@
       storage_override_(option),
       storage_used_(storage_used) {}
 
-TestInternalComponentsFactory::~TestInternalComponentsFactory() {}
+TestEngineComponentsFactory::~TestEngineComponentsFactory() {}
 
-std::unique_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler(
+std::unique_ptr<SyncScheduler> TestEngineComponentsFactory::BuildScheduler(
     const std::string& name,
     SyncCycleContext* context,
     CancelationSignal* cancelation_signal) {
   return std::unique_ptr<SyncScheduler>(new FakeSyncScheduler());
 }
 
-std::unique_ptr<SyncCycleContext> TestInternalComponentsFactory::BuildContext(
+std::unique_ptr<SyncCycleContext> TestEngineComponentsFactory::BuildContext(
     ServerConnectionManager* connection_manager,
     syncable::Directory* directory,
     ExtensionsActivity* monitor,
@@ -49,7 +49,7 @@
 }
 
 std::unique_ptr<syncable::DirectoryBackingStore>
-TestInternalComponentsFactory::BuildDirectoryBackingStore(
+TestEngineComponentsFactory::BuildDirectoryBackingStore(
     StorageOption storage,
     const std::string& dir_name,
     const base::FilePath& backing_filepath) {
@@ -72,7 +72,7 @@
   return std::unique_ptr<syncable::DirectoryBackingStore>();
 }
 
-InternalComponentsFactory::Switches TestInternalComponentsFactory::GetSwitches()
+EngineComponentsFactory::Switches TestEngineComponentsFactory::GetSwitches()
     const {
   return switches_;
 }
diff --git a/components/sync/core/test/test_internal_components_factory.h b/components/sync/engine/test_engine_components_factory.h
similarity index 64%
rename from components/sync/core/test/test_internal_components_factory.h
rename to components/sync/engine/test_engine_components_factory.h
index f60aa73..575f8c5 100644
--- a/components/sync/core/test/test_internal_components_factory.h
+++ b/components/sync/engine/test_engine_components_factory.h
@@ -2,24 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_
-#define COMPONENTS_SYNC_CORE_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_
+#ifndef COMPONENTS_SYNC_ENGINE_TEST_ENGINE_COMPONENTS_FACTORY_H_
+#define COMPONENTS_SYNC_ENGINE_TEST_ENGINE_COMPONENTS_FACTORY_H_
 
 #include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
-#include "components/sync/core/internal_components_factory.h"
+#include "components/sync/engine/engine_components_factory.h"
 
 namespace syncer {
 
-class TestInternalComponentsFactory : public InternalComponentsFactory {
+class TestEngineComponentsFactory : public EngineComponentsFactory {
  public:
-  explicit TestInternalComponentsFactory(const Switches& switches,
-                                         StorageOption option,
-                                         StorageOption* storage_used);
-  ~TestInternalComponentsFactory() override;
+  explicit TestEngineComponentsFactory(const Switches& switches,
+                                       StorageOption option,
+                                       StorageOption* storage_used);
+  ~TestEngineComponentsFactory() override;
 
   std::unique_ptr<SyncScheduler> BuildScheduler(
       const std::string& name,
@@ -47,9 +47,9 @@
   const StorageOption storage_override_;
   StorageOption* storage_used_;
 
-  DISALLOW_COPY_AND_ASSIGN(TestInternalComponentsFactory);
+  DISALLOW_COPY_AND_ASSIGN(TestEngineComponentsFactory);
 };
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_
+#endif  // COMPONENTS_SYNC_ENGINE_TEST_ENGINE_COMPONENTS_FACTORY_H_
diff --git a/components/sync/engine_impl/DEPS b/components/sync/engine_impl/DEPS
index 8ff035d..da0a62e3 100644
--- a/components/sync/engine_impl/DEPS
+++ b/components/sync/engine_impl/DEPS
@@ -1,10 +1,11 @@
 include_rules = [
   "+components/sync/base",
-  # TODO(crbug.com/631271): Core should be split into driver/engine/api.
-  "+components/sync/core",
   "+components/sync/engine",
+  "+components/sync/js",
   "+components/sync/model",
   "+components/sync/protocol",
   "+components/sync/syncable",
   "+components/sync/test",
+  "+net/base",
+  "+third_party/protobuf",
 ]
diff --git a/components/sync/engine_impl/apply_control_data_updates_unittest.cc b/components/sync/engine_impl/apply_control_data_updates_unittest.cc
index 878d596..17ce931 100644
--- a/components/sync/engine_impl/apply_control_data_updates_unittest.cc
+++ b/components/sync/engine_impl/apply_control_data_updates_unittest.cc
@@ -16,9 +16,9 @@
 #include "base/message_loop/message_loop.h"
 #include "base/strings/stringprintf.h"
 #include "components/sync/base/cryptographer.h"
-#include "components/sync/core/test/test_entry_factory.h"
 #include "components/sync/engine_impl/syncer.h"
 #include "components/sync/engine_impl/syncer_util.h"
+#include "components/sync/engine_impl/test_entry_factory.h"
 #include "components/sync/protocol/nigori_specifics.pb.h"
 #include "components/sync/syncable/directory.h"
 #include "components/sync/syncable/mutable_entry.h"
diff --git a/components/sync/core_impl/debug_info_event_listener.cc b/components/sync/engine_impl/debug_info_event_listener.cc
similarity index 99%
rename from components/sync/core_impl/debug_info_event_listener.cc
rename to components/sync/engine_impl/debug_info_event_listener.cc
index 2d03fc3..511e584 100644
--- a/components/sync/core_impl/debug_info_event_listener.cc
+++ b/components/sync/engine_impl/debug_info_event_listener.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/debug_info_event_listener.h"
+#include "components/sync/engine_impl/debug_info_event_listener.h"
 
 #include <stddef.h>
 
diff --git a/components/sync/core_impl/debug_info_event_listener.h b/components/sync/engine_impl/debug_info_event_listener.h
similarity index 92%
rename from components/sync/core_impl/debug_info_event_listener.h
rename to components/sync/engine_impl/debug_info_event_listener.h
index cd70cb03..a3cfb45 100644
--- a/components/sync/core_impl/debug_info_event_listener.h
+++ b/components/sync/engine_impl/debug_info_event_listener.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_DEBUG_INFO_EVENT_LISTENER_H_
-#define COMPONENTS_SYNC_CORE_IMPL_DEBUG_INFO_EVENT_LISTENER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_DEBUG_INFO_EVENT_LISTENER_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_DEBUG_INFO_EVENT_LISTENER_H_
 
 #include <deque>
 #include <string>
@@ -14,10 +14,10 @@
 #include "base/macros.h"
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/data_type_debug_info_listener.h"
-#include "components/sync/core/sync_encryption_handler.h"
-#include "components/sync/core/sync_manager.h"
 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
+#include "components/sync/engine/data_type_debug_info_listener.h"
+#include "components/sync/engine/sync_encryption_handler.h"
+#include "components/sync/engine/sync_manager.h"
 #include "components/sync/engine_impl/cycle/debug_info_getter.h"
 #include "components/sync/js/js_backend.h"
 #include "components/sync/protocol/sync.pb.h"
@@ -116,4 +116,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_DEBUG_INFO_EVENT_LISTENER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_DEBUG_INFO_EVENT_LISTENER_H_
diff --git a/components/sync/core_impl/debug_info_event_listener_unittest.cc b/components/sync/engine_impl/debug_info_event_listener_unittest.cc
similarity index 96%
rename from components/sync/core_impl/debug_info_event_listener_unittest.cc
rename to components/sync/engine_impl/debug_info_event_listener_unittest.cc
index eb0e173..f7d8ad04 100644
--- a/components/sync/core_impl/debug_info_event_listener_unittest.cc
+++ b/components/sync/engine_impl/debug_info_event_listener_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/debug_info_event_listener.h"
+#include "components/sync/engine_impl/debug_info_event_listener.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/components/sync/engine_impl/directory_update_handler_unittest.cc b/components/sync/engine_impl/directory_update_handler_unittest.cc
index 15e0de0..4dde95ac 100644
--- a/components/sync/engine_impl/directory_update_handler_unittest.cc
+++ b/components/sync/engine_impl/directory_update_handler_unittest.cc
@@ -14,10 +14,10 @@
 #include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "components/sync/base/attachment_id_proto.h"
-#include "components/sync/core/test/test_entry_factory.h"
 #include "components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h"
 #include "components/sync/engine_impl/cycle/status_controller.h"
 #include "components/sync/engine_impl/syncer_proto_util.h"
+#include "components/sync/engine_impl/test_entry_factory.h"
 #include "components/sync/protocol/sync.pb.h"
 #include "components/sync/syncable/directory.h"
 #include "components/sync/syncable/entry.h"
diff --git a/components/sync/core_impl/protocol_event_buffer.cc b/components/sync/engine_impl/events/protocol_event_buffer.cc
similarity index 91%
rename from components/sync/core_impl/protocol_event_buffer.cc
rename to components/sync/engine_impl/events/protocol_event_buffer.cc
index aefc858..785ad67a 100644
--- a/components/sync/core_impl/protocol_event_buffer.cc
+++ b/components/sync/engine_impl/events/protocol_event_buffer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/protocol_event_buffer.h"
+#include "components/sync/engine_impl/events/protocol_event_buffer.h"
 
 #include "components/sync/engine/events/protocol_event.h"
 
diff --git a/components/sync/core_impl/protocol_event_buffer.h b/components/sync/engine_impl/events/protocol_event_buffer.h
similarity index 82%
rename from components/sync/core_impl/protocol_event_buffer.h
rename to components/sync/engine_impl/events/protocol_event_buffer.h
index f0c07a5..bca62fb 100644
--- a/components/sync/core_impl/protocol_event_buffer.h
+++ b/components/sync/engine_impl/events/protocol_event_buffer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_PROTOCOL_EVENT_BUFFER_H_
-#define COMPONENTS_SYNC_CORE_IMPL_PROTOCOL_EVENT_BUFFER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_EVENTS_PROTOCOL_EVENT_BUFFER_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_EVENTS_PROTOCOL_EVENT_BUFFER_H_
 
 #include <stddef.h>
 
@@ -41,4 +41,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_PROTOCOL_EVENT_BUFFER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_EVENTS_PROTOCOL_EVENT_BUFFER_H_
diff --git a/components/sync/core_impl/protocol_event_buffer_unittest.cc b/components/sync/engine_impl/events/protocol_event_buffer_unittest.cc
similarity index 96%
rename from components/sync/core_impl/protocol_event_buffer_unittest.cc
rename to components/sync/engine_impl/events/protocol_event_buffer_unittest.cc
index b545e02e..ce255d0 100644
--- a/components/sync/core_impl/protocol_event_buffer_unittest.cc
+++ b/components/sync/engine_impl/events/protocol_event_buffer_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/protocol_event_buffer.h"
+#include "components/sync/engine_impl/events/protocol_event_buffer.h"
 
 #include <stdint.h>
 
diff --git a/components/sync/core_impl/js_mutation_event_observer.cc b/components/sync/engine_impl/js_mutation_event_observer.cc
similarity index 97%
rename from components/sync/core_impl/js_mutation_event_observer.cc
rename to components/sync/engine_impl/js_mutation_event_observer.cc
index a387e1e5..976c26b9 100644
--- a/components/sync/core_impl/js_mutation_event_observer.cc
+++ b/components/sync/engine_impl/js_mutation_event_observer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/js_mutation_event_observer.h"
+#include "components/sync/engine_impl/js_mutation_event_observer.h"
 
 #include <stddef.h>
 
diff --git a/components/sync/core_impl/js_mutation_event_observer.h b/components/sync/engine_impl/js_mutation_event_observer.h
similarity index 88%
rename from components/sync/core_impl/js_mutation_event_observer.h
rename to components/sync/engine_impl/js_mutation_event_observer.h
index e9d4440e..ed3d81e 100644
--- a/components/sync/core_impl/js_mutation_event_observer.h
+++ b/components/sync/engine_impl/js_mutation_event_observer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_
-#define COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_
 
 #include <stdint.h>
 
@@ -14,7 +14,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/sync_manager.h"
+#include "components/sync/engine/sync_manager.h"
 #include "components/sync/syncable/transaction_observer.h"
 
 namespace tracked_objects {
@@ -67,4 +67,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_
diff --git a/components/sync/core_impl/js_mutation_event_observer_unittest.cc b/components/sync/engine_impl/js_mutation_event_observer_unittest.cc
similarity index 97%
rename from components/sync/core_impl/js_mutation_event_observer_unittest.cc
rename to components/sync/engine_impl/js_mutation_event_observer_unittest.cc
index 7fef0152..a6dfe74 100644
--- a/components/sync/core_impl/js_mutation_event_observer_unittest.cc
+++ b/components/sync/engine_impl/js_mutation_event_observer_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/js_mutation_event_observer.h"
+#include "components/sync/engine_impl/js_mutation_event_observer.h"
 
 #include "base/run_loop.h"
 #include "base/values.h"
diff --git a/components/sync/core_impl/js_sync_encryption_handler_observer.cc b/components/sync/engine_impl/js_sync_encryption_handler_observer.cc
similarity index 97%
rename from components/sync/core_impl/js_sync_encryption_handler_observer.cc
rename to components/sync/engine_impl/js_sync_encryption_handler_observer.cc
index 9bae2d3..3f430df 100644
--- a/components/sync/core_impl/js_sync_encryption_handler_observer.cc
+++ b/components/sync/engine_impl/js_sync_encryption_handler_observer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/js_sync_encryption_handler_observer.h"
+#include "components/sync/engine_impl/js_sync_encryption_handler_observer.h"
 
 #include <cstddef>
 
diff --git a/components/sync/core_impl/js_sync_encryption_handler_observer.h b/components/sync/engine_impl/js_sync_encryption_handler_observer.h
similarity index 87%
rename from components/sync/core_impl/js_sync_encryption_handler_observer.h
rename to components/sync/engine_impl/js_sync_encryption_handler_observer.h
index fc1e831f..1339f013 100644
--- a/components/sync/core_impl/js_sync_encryption_handler_observer.h
+++ b/components/sync/engine_impl/js_sync_encryption_handler_observer.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
-#define COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
 
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/sync_encryption_handler.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/protocol/sync_protocol_error.h"
 
 namespace tracked_objects {
@@ -58,4 +58,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_JS_SYNC_ENCRYPTION_HANDLER_OBSERVER_H_
diff --git a/components/sync/core_impl/js_sync_encryption_handler_observer_unittest.cc b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
similarity index 98%
rename from components/sync/core_impl/js_sync_encryption_handler_observer_unittest.cc
rename to components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
index f3d8410..ff3f04e7 100644
--- a/components/sync/core_impl/js_sync_encryption_handler_observer_unittest.cc
+++ b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/js_sync_encryption_handler_observer.h"
+#include "components/sync/engine_impl/js_sync_encryption_handler_observer.h"
 
 #include "base/location.h"
 #include "base/run_loop.h"
diff --git a/components/sync/core_impl/js_sync_manager_observer.cc b/components/sync/engine_impl/js_sync_manager_observer.cc
similarity index 97%
rename from components/sync/core_impl/js_sync_manager_observer.cc
rename to components/sync/engine_impl/js_sync_manager_observer.cc
index 62acd86..eb3da25 100644
--- a/components/sync/core_impl/js_sync_manager_observer.cc
+++ b/components/sync/engine_impl/js_sync_manager_observer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/js_sync_manager_observer.h"
+#include "components/sync/engine_impl/js_sync_manager_observer.h"
 
 #include <cstddef>
 
diff --git a/components/sync/core_impl/js_sync_manager_observer.h b/components/sync/engine_impl/js_sync_manager_observer.h
similarity index 86%
rename from components/sync/core_impl/js_sync_manager_observer.h
rename to components/sync/engine_impl/js_sync_manager_observer.h
index 1e74ea0..3bf99b1 100644
--- a/components/sync/core_impl/js_sync_manager_observer.h
+++ b/components/sync/engine_impl/js_sync_manager_observer.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_
-#define COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_
 
 #include <string>
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/sync_manager.h"
+#include "components/sync/engine/sync_manager.h"
 #include "components/sync/protocol/sync_protocol_error.h"
 
 namespace tracked_objects {
@@ -54,4 +54,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_JS_SYNC_MANAGER_OBSERVER_H_
diff --git a/components/sync/core_impl/js_sync_manager_observer_unittest.cc b/components/sync/engine_impl/js_sync_manager_observer_unittest.cc
similarity index 96%
rename from components/sync/core_impl/js_sync_manager_observer_unittest.cc
rename to components/sync/engine_impl/js_sync_manager_observer_unittest.cc
index b757f0a..5279ab38 100644
--- a/components/sync/core_impl/js_sync_manager_observer_unittest.cc
+++ b/components/sync/engine_impl/js_sync_manager_observer_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/js_sync_manager_observer.h"
+#include "components/sync/engine_impl/js_sync_manager_observer.h"
 
 #include <vector>
 
@@ -10,7 +10,7 @@
 #include "base/run_loop.h"
 #include "base/values.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/connection_status.h"
+#include "components/sync/engine/connection_status.h"
 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
 #include "components/sync/engine/sync_string_conversions.h"
 #include "components/sync/js/js_event_details.h"
diff --git a/components/sync/core_impl/model_type_connector_proxy.cc b/components/sync/engine_impl/model_type_connector_proxy.cc
similarity index 90%
rename from components/sync/core_impl/model_type_connector_proxy.cc
rename to components/sync/engine_impl/model_type_connector_proxy.cc
index 23f95a8..c863117 100644
--- a/components/sync/core_impl/model_type_connector_proxy.cc
+++ b/components/sync/engine_impl/model_type_connector_proxy.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/model_type_connector_proxy.h"
+#include "components/sync/engine_impl/model_type_connector_proxy.h"
 
 #include "base/bind.h"
 #include "base/location.h"
 #include "base/single_thread_task_runner.h"
-#include "components/sync/core/activation_context.h"
+#include "components/sync/engine/activation_context.h"
 
 namespace syncer {
 
diff --git a/components/sync/core_impl/model_type_connector_proxy.h b/components/sync/engine_impl/model_type_connector_proxy.h
similarity index 83%
rename from components/sync/core_impl/model_type_connector_proxy.h
rename to components/sync/engine_impl/model_type_connector_proxy.h
index 7b233200..ddf751b 100644
--- a/components/sync/core_impl/model_type_connector_proxy.h
+++ b/components/sync/engine_impl/model_type_connector_proxy.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_
-#define COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_
 
 #include <memory>
 
 #include "base/memory/weak_ptr.h"
 #include "base/sequenced_task_runner.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/model_type_connector.h"
+#include "components/sync/engine/model_type_connector.h"
 
 namespace syncer {
 
@@ -41,4 +41,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_CONNECTOR_PROXY_H_
diff --git a/components/sync/engine_impl/model_type_registry.cc b/components/sync/engine_impl/model_type_registry.cc
index 3eca73c7..9854d5b 100644
--- a/components/sync/engine_impl/model_type_registry.cc
+++ b/components/sync/engine_impl/model_type_registry.cc
@@ -13,9 +13,9 @@
 #include "base/observer_list.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/sync/base/cryptographer.h"
-#include "components/sync/core/activation_context.h"
-#include "components/sync/core/model_type_processor.h"
+#include "components/sync/engine/activation_context.h"
 #include "components/sync/engine/commit_queue.h"
+#include "components/sync/engine/model_type_processor.h"
 #include "components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h"
 #include "components/sync/engine_impl/directory_commit_contributor.h"
 #include "components/sync/engine_impl/directory_update_handler.h"
diff --git a/components/sync/engine_impl/model_type_registry.h b/components/sync/engine_impl/model_type_registry.h
index f73b466..2e217747 100644
--- a/components/sync/engine_impl/model_type_registry.h
+++ b/components/sync/engine_impl/model_type_registry.h
@@ -14,11 +14,11 @@
 #include "base/memory/scoped_vector.h"
 #include "base/memory/weak_ptr.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/model_type_connector.h"
-#include "components/sync/core/non_blocking_sync_common.h"
-#include "components/sync/core/sync_encryption_handler.h"
 #include "components/sync/engine/cycle/type_debug_info_observer.h"
 #include "components/sync/engine/model_safe_worker.h"
+#include "components/sync/engine/model_type_connector.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/engine_impl/nudge_handler.h"
 
 namespace syncer {
diff --git a/components/sync/engine_impl/model_type_registry_unittest.cc b/components/sync/engine_impl/model_type_registry_unittest.cc
index ab2d541c..e0a73a2 100644
--- a/components/sync/engine_impl/model_type_registry_unittest.cc
+++ b/components/sync/engine_impl/model_type_registry_unittest.cc
@@ -9,8 +9,8 @@
 #include "base/deferred_sequenced_task_runner.h"
 #include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
-#include "components/sync/core/activation_context.h"
-#include "components/sync/core/test/fake_model_type_processor.h"
+#include "components/sync/engine/activation_context.h"
+#include "components/sync/engine/fake_model_type_processor.h"
 #include "components/sync/protocol/model_type_state.pb.h"
 #include "components/sync/syncable/directory.h"
 #include "components/sync/syncable/model_neutral_mutable_entry.h"
diff --git a/components/sync/engine_impl/model_type_worker.cc b/components/sync/engine_impl/model_type_worker.cc
index fa9bea2d..25422f6 100644
--- a/components/sync/engine_impl/model_type_worker.cc
+++ b/components/sync/engine_impl/model_type_worker.cc
@@ -16,7 +16,7 @@
 #include "base/memory/ptr_util.h"
 #include "base/strings/stringprintf.h"
 #include "components/sync/base/time.h"
-#include "components/sync/core/model_type_processor.h"
+#include "components/sync/engine/model_type_processor.h"
 #include "components/sync/engine_impl/commit_contribution.h"
 #include "components/sync/engine_impl/non_blocking_type_commit_contribution.h"
 #include "components/sync/engine_impl/worker_entity_tracker.h"
diff --git a/components/sync/engine_impl/model_type_worker.h b/components/sync/engine_impl/model_type_worker.h
index 46a69b6..c5fb715 100644
--- a/components/sync/engine_impl/model_type_worker.h
+++ b/components/sync/engine_impl/model_type_worker.h
@@ -15,9 +15,9 @@
 #include "base/threading/thread_checker.h"
 #include "components/sync/base/cryptographer.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/non_blocking_sync_common.h"
-#include "components/sync/core/sync_encryption_handler.h"
 #include "components/sync/engine/commit_queue.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/engine_impl/commit_contributor.h"
 #include "components/sync/engine_impl/nudge_handler.h"
 #include "components/sync/engine_impl/update_handler.h"
diff --git a/components/sync/engine_impl/model_type_worker_unittest.cc b/components/sync/engine_impl/model_type_worker_unittest.cc
index 5ce5a7f7..47b5385 100644
--- a/components/sync/engine_impl/model_type_worker_unittest.cc
+++ b/components/sync/engine_impl/model_type_worker_unittest.cc
@@ -12,7 +12,7 @@
 #include "base/memory/ptr_util.h"
 #include "base/strings/stringprintf.h"
 #include "components/sync/base/fake_encryptor.h"
-#include "components/sync/core/model_type_processor.h"
+#include "components/sync/engine/model_type_processor.h"
 #include "components/sync/engine_impl/commit_contribution.h"
 #include "components/sync/engine_impl/cycle/status_controller.h"
 #include "components/sync/syncable/syncable_util.h"
diff --git a/components/sync/engine_impl/non_blocking_type_commit_contribution.cc b/components/sync/engine_impl/non_blocking_type_commit_contribution.cc
index f8e8cfb..a7aedb52 100644
--- a/components/sync/engine_impl/non_blocking_type_commit_contribution.cc
+++ b/components/sync/engine_impl/non_blocking_type_commit_contribution.cc
@@ -7,7 +7,7 @@
 #include <algorithm>
 
 #include "base/values.h"
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/engine_impl/model_type_worker.h"
 #include "components/sync/protocol/proto_value_conversions.h"
 
diff --git a/components/sync/core_impl/sync_encryption_handler_impl.cc b/components/sync/engine_impl/sync_encryption_handler_impl.cc
similarity index 93%
rename from components/sync/core_impl/sync_encryption_handler_impl.cc
rename to components/sync/engine_impl/sync_encryption_handler_impl.cc
index d431c49..f552d57 100644
--- a/components/sync/core_impl/sync_encryption_handler_impl.cc
+++ b/components/sync/engine_impl/sync_encryption_handler_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/sync_encryption_handler_impl.h"
+#include "components/sync/engine_impl/sync_encryption_handler_impl.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -296,14 +296,15 @@
 
   // Always trigger an encrypted types and cryptographer state change event at
   // init time so observers get the initial values.
-  FOR_EACH_OBSERVER(Observer, observers_,
-                    OnEncryptedTypesChanged(
-                        UnlockVault(trans.GetWrappedTrans()).encrypted_types,
-                        encrypt_everything_));
-  FOR_EACH_OBSERVER(
-      SyncEncryptionHandler::Observer, observers_,
-      OnCryptographerStateChanged(
-          &UnlockVaultMutable(trans.GetWrappedTrans())->cryptographer));
+  for (auto& observer : observers_) {
+    observer.OnEncryptedTypesChanged(
+        UnlockVault(trans.GetWrappedTrans()).encrypted_types,
+        encrypt_everything_);
+  }
+  for (auto& observer : observers_) {
+    observer.OnCryptographerStateChanged(
+        &UnlockVaultMutable(trans.GetWrappedTrans())->cryptographer);
+  }
 
   // If the cryptographer is not ready (either it has pending keys or we
   // failed to initialize it), we don't want to try and re-encrypt the data.
@@ -394,10 +395,10 @@
           DVLOG(1) << "Setting explicit passphrase for encryption.";
           *passphrase_type = PassphraseType::CUSTOM_PASSPHRASE;
           custom_passphrase_time_ = base::Time::Now();
-          FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                            OnPassphraseTypeChanged(
-                                *passphrase_type,
-                                GetExplicitPassphraseTime(*passphrase_type)));
+          for (auto& observer : observers_) {
+            observer.OnPassphraseTypeChanged(
+                *passphrase_type, GetExplicitPassphraseTime(*passphrase_type));
+          }
         } else {
           DVLOG(1) << "Setting implicit passphrase for encryption.";
         }
@@ -644,9 +645,10 @@
                               weak_ptr_factory_.GetWeakPtr()));
   }
 
-  FOR_EACH_OBSERVER(
-      SyncEncryptionHandler::Observer, observers_,
-      OnCryptographerStateChanged(&UnlockVaultMutable(trans)->cryptographer));
+  for (auto& observer : observers_) {
+    observer.OnCryptographerStateChanged(
+        &UnlockVaultMutable(trans)->cryptographer);
+  }
 }
 
 void SyncEncryptionHandlerImpl::UpdateNigoriFromEncryptedTypes(
@@ -693,9 +695,10 @@
   std::string keystore_bootstrap = PackKeystoreBootstrapToken(
       old_keystore_keys_, keystore_key_, cryptographer->encryptor());
 
-  FOR_EACH_OBSERVER(
-      SyncEncryptionHandler::Observer, observers_,
-      OnBootstrapTokenUpdated(keystore_bootstrap, KEYSTORE_BOOTSTRAP_TOKEN));
+  for (auto& observer : observers_) {
+    observer.OnBootstrapTokenUpdated(keystore_bootstrap,
+                                     KEYSTORE_BOOTSTRAP_TOKEN);
+  }
   DVLOG(1) << "Keystore bootstrap token updated.";
 
   // If this is a first time sync, we get the encryption keys before we process
@@ -854,8 +857,9 @@
   DVLOG(1) << "Re-encrypt everything complete.";
 
   // NOTE: We notify from within a transaction.
-  FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                    OnEncryptionComplete());
+  for (auto& observer : observers_) {
+    observer.OnEncryptionComplete();
+  }
 }
 
 bool SyncEncryptionHandlerImpl::ApplyNigoriUpdateImpl(
@@ -892,10 +896,10 @@
                << PassphraseTypeToString(*passphrase_type) << " to "
                << PassphraseTypeToString(nigori_passphrase_type);
       *passphrase_type = nigori_passphrase_type;
-      FOR_EACH_OBSERVER(
-          SyncEncryptionHandler::Observer, observers_,
-          OnPassphraseTypeChanged(*passphrase_type,
-                                  GetExplicitPassphraseTime(*passphrase_type)));
+      for (auto& observer : observers_) {
+        observer.OnPassphraseTypeChanged(
+            *passphrase_type, GetExplicitPassphraseTime(*passphrase_type));
+      }
     }
     if (*passphrase_type == PassphraseType::KEYSTORE_PASSPHRASE &&
         encrypt_everything_) {
@@ -908,10 +912,10 @@
       DVLOG(1) << "Changing passphrase state to FROZEN_IMPLICIT_PASSPHRASE "
                << "due to full encryption.";
       *passphrase_type = PassphraseType::FROZEN_IMPLICIT_PASSPHRASE;
-      FOR_EACH_OBSERVER(
-          SyncEncryptionHandler::Observer, observers_,
-          OnPassphraseTypeChanged(*passphrase_type,
-                                  GetExplicitPassphraseTime(*passphrase_type)));
+      for (auto& observer : observers_) {
+        observer.OnPassphraseTypeChanged(
+            *passphrase_type, GetExplicitPassphraseTime(*passphrase_type));
+      }
     }
   } else {
     // It's possible that while we're waiting for migration a client that does
@@ -919,10 +923,10 @@
     if (nigori.keybag_is_frozen() &&
         *passphrase_type != PassphraseType::CUSTOM_PASSPHRASE) {
       *passphrase_type = PassphraseType::CUSTOM_PASSPHRASE;
-      FOR_EACH_OBSERVER(
-          SyncEncryptionHandler::Observer, observers_,
-          OnPassphraseTypeChanged(*passphrase_type,
-                                  GetExplicitPassphraseTime(*passphrase_type)));
+      for (auto& observer : observers_) {
+        observer.OnPassphraseTypeChanged(
+            *passphrase_type, GetExplicitPassphraseTime(*passphrase_type));
+      }
     }
   }
 
@@ -973,14 +977,16 @@
   if (cryptographer->has_pending_keys()) {
     DVLOG(1) << "OnPassphraseRequired Sent";
     sync_pb::EncryptedData pending_keys = cryptographer->GetPendingKeys();
-    FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                      OnPassphraseRequired(REASON_DECRYPTION, pending_keys));
+    for (auto& observer : observers_) {
+      observer.OnPassphraseRequired(REASON_DECRYPTION, pending_keys);
+    }
   } else if (!cryptographer->is_ready()) {
     DVLOG(1) << "OnPassphraseRequired sent because cryptographer is not "
              << "ready";
-    FOR_EACH_OBSERVER(
-        SyncEncryptionHandler::Observer, observers_,
-        OnPassphraseRequired(REASON_ENCRYPTION, sync_pb::EncryptedData()));
+    for (auto& observer : observers_) {
+      observer.OnPassphraseRequired(REASON_ENCRYPTION,
+                                    sync_pb::EncryptedData());
+    }
   }
 
   // Check if the current local encryption state is stricter/newer than the
@@ -1090,9 +1096,9 @@
     if (!encrypt_everything_) {
       encrypt_everything_ = true;
       *encrypted_types = EncryptableUserTypes();
-      FOR_EACH_OBSERVER(
-          Observer, observers_,
-          OnEncryptedTypesChanged(*encrypted_types, encrypt_everything_));
+      for (auto& observer : observers_) {
+        observer.OnEncryptedTypesChanged(*encrypted_types, encrypt_everything_);
+      }
     }
     DCHECK(*encrypted_types == EncryptableUserTypes());
     return false;
@@ -1143,10 +1149,10 @@
       &UnlockVaultMutable(trans->GetWrappedTrans())->passphrase_type;
   *passphrase_type = PassphraseType::CUSTOM_PASSPHRASE;
   custom_passphrase_time_ = base::Time::Now();
-  FOR_EACH_OBSERVER(
-      SyncEncryptionHandler::Observer, observers_,
-      OnPassphraseTypeChanged(*passphrase_type,
-                              GetExplicitPassphraseTime(*passphrase_type)));
+  for (auto& observer : observers_) {
+    observer.OnPassphraseTypeChanged(
+        *passphrase_type, GetExplicitPassphraseTime(*passphrase_type));
+  }
   FinishSetPassphrase(true, bootstrap_token, trans, nigori_node);
 }
 
@@ -1161,8 +1167,9 @@
              sync_pb::NigoriSpecifics::CUSTOM_PASSPHRASE ||
          nigori_state.nigori_specifics.passphrase_type() ==
              sync_pb::NigoriSpecifics::FROZEN_IMPLICIT_PASSPHRASE);
-  FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                    OnLocalSetPassphraseEncryption(nigori_state));
+  for (auto& observer : observers_) {
+    observer.OnLocalSetPassphraseEncryption(nigori_state);
+  }
 }
 
 void SyncEncryptionHandlerImpl::DecryptPendingKeysWithExplicitPassphrase(
@@ -1210,19 +1217,20 @@
     WriteTransaction* trans,
     WriteNode* nigori_node) {
   DCHECK(thread_checker_.CalledOnValidThread());
-  FOR_EACH_OBSERVER(
-      SyncEncryptionHandler::Observer, observers_,
-      OnCryptographerStateChanged(
-          &UnlockVaultMutable(trans->GetWrappedTrans())->cryptographer));
+  for (auto& observer : observers_) {
+    observer.OnCryptographerStateChanged(
+        &UnlockVaultMutable(trans->GetWrappedTrans())->cryptographer);
+  }
 
   // It's possible we need to change the bootstrap token even if we failed to
   // set the passphrase (for example if we need to preserve the new GAIA
   // passphrase).
   if (!bootstrap_token.empty()) {
     DVLOG(1) << "Passphrase bootstrap token updated.";
-    FOR_EACH_OBSERVER(
-        SyncEncryptionHandler::Observer, observers_,
-        OnBootstrapTokenUpdated(bootstrap_token, PASSPHRASE_BOOTSTRAP_TOKEN));
+    for (auto& observer : observers_) {
+      observer.OnBootstrapTokenUpdated(bootstrap_token,
+                                       PASSPHRASE_BOOTSTRAP_TOKEN);
+    }
   }
 
   const Cryptographer& cryptographer =
@@ -1232,13 +1240,15 @@
       LOG(ERROR) << "Attempt to change passphrase failed while cryptographer "
                  << "was ready.";
     } else if (cryptographer.has_pending_keys()) {
-      FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                        OnPassphraseRequired(REASON_DECRYPTION,
-                                             cryptographer.GetPendingKeys()));
+      for (auto& observer : observers_) {
+        observer.OnPassphraseRequired(REASON_DECRYPTION,
+                                      cryptographer.GetPendingKeys());
+      }
     } else {
-      FOR_EACH_OBSERVER(
-          SyncEncryptionHandler::Observer, observers_,
-          OnPassphraseRequired(REASON_ENCRYPTION, sync_pb::EncryptedData()));
+      for (auto& observer : observers_) {
+        observer.OnPassphraseRequired(REASON_ENCRYPTION,
+                                      sync_pb::EncryptedData());
+      }
     }
     return;
   }
@@ -1274,8 +1284,9 @@
 
   // Must do this after OnPassphraseTypeChanged, in order to ensure the PSS
   // checks the passphrase state after it has been set.
-  FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                    OnPassphraseAccepted());
+  for (auto& observer : observers_) {
+    observer.OnPassphraseAccepted();
+  }
 
   // Does nothing if everything is already encrypted.
   // TODO(zea): If we just migrated and enabled encryption, this will be
@@ -1294,9 +1305,9 @@
   ModelTypeSet* encrypted_types = &UnlockVaultMutable(trans)->encrypted_types;
   if (!encrypted_types->HasAll(new_encrypted_types)) {
     *encrypted_types = new_encrypted_types;
-    FOR_EACH_OBSERVER(
-        Observer, observers_,
-        OnEncryptedTypesChanged(*encrypted_types, encrypt_everything_));
+    for (auto& observer : observers_) {
+      observer.OnEncryptedTypesChanged(*encrypted_types, encrypt_everything_);
+    }
   }
 }
 
@@ -1427,8 +1438,9 @@
         return false;
       }
       if (!cryptographer_was_ready && cryptographer->is_ready()) {
-        FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                          OnPassphraseAccepted());
+        for (auto& observer : observers_) {
+          observer.OnPassphraseAccepted();
+        }
       }
     } else {
       // We're in backwards compatible mode -- either the account has an
@@ -1482,14 +1494,15 @@
         TimeToProtoTime(custom_passphrase_time_));
   }
 
-  FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                    OnCryptographerStateChanged(cryptographer));
+  for (auto& observer : observers_) {
+    observer.OnCryptographerStateChanged(cryptographer);
+  }
   if (*passphrase_type != new_passphrase_type) {
     *passphrase_type = new_passphrase_type;
-    FOR_EACH_OBSERVER(
-        SyncEncryptionHandler::Observer, observers_,
-        OnPassphraseTypeChanged(*passphrase_type,
-                                GetExplicitPassphraseTime(*passphrase_type)));
+    for (auto& observer : observers_) {
+      observer.OnPassphraseTypeChanged(
+          *passphrase_type, GetExplicitPassphraseTime(*passphrase_type));
+    }
   }
 
   if (new_encrypt_everything && !encrypt_everything_) {
@@ -1582,9 +1595,9 @@
   }
   encrypt_everything_ = true;
   *encrypted_types = EncryptableUserTypes();
-  FOR_EACH_OBSERVER(
-      Observer, observers_,
-      OnEncryptedTypesChanged(*encrypted_types, encrypt_everything_));
+  for (auto& observer : observers_) {
+    observer.OnEncryptedTypesChanged(*encrypted_types, encrypt_everything_);
+  }
 }
 
 bool SyncEncryptionHandlerImpl::DecryptPendingKeysWithKeystoreKey(
@@ -1644,13 +1657,18 @@
       std::string bootstrap_token;
       cryptographer->GetBootstrapToken(&bootstrap_token);
       DVLOG(1) << "Keystore decryptor token decrypted pending keys.";
-      FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                        OnPassphraseAccepted());
-      FOR_EACH_OBSERVER(
-          SyncEncryptionHandler::Observer, observers_,
-          OnBootstrapTokenUpdated(bootstrap_token, PASSPHRASE_BOOTSTRAP_TOKEN));
-      FOR_EACH_OBSERVER(SyncEncryptionHandler::Observer, observers_,
-                        OnCryptographerStateChanged(cryptographer));
+      // Note: These are separate loops to match previous functionality and not
+      // out of explicit knowledge that they must be.
+      for (auto& observer : observers_) {
+        observer.OnPassphraseAccepted();
+      }
+      for (auto& observer : observers_) {
+        observer.OnBootstrapTokenUpdated(bootstrap_token,
+                                         PASSPHRASE_BOOTSTRAP_TOKEN);
+      }
+      for (auto& observer : observers_) {
+        observer.OnCryptographerStateChanged(cryptographer);
+      }
       return true;
     }
   }
diff --git a/components/sync/core_impl/sync_encryption_handler_impl.h b/components/sync/engine_impl/sync_encryption_handler_impl.h
similarity index 97%
rename from components/sync/core_impl/sync_encryption_handler_impl.h
rename to components/sync/engine_impl/sync_encryption_handler_impl.h
index 1ea81a64..cb0f74b 100644
--- a/components/sync/core_impl/sync_encryption_handler_impl.h
+++ b/components/sync/engine_impl/sync_encryption_handler_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_
-#define COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_
 
 #include <string>
 #include <vector>
@@ -16,7 +16,7 @@
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
 #include "components/sync/base/cryptographer.h"
-#include "components/sync/core/sync_encryption_handler.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/syncable/nigori_handler.h"
 
 namespace syncer {
@@ -320,4 +320,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_ENCRYPTION_HANDLER_IMPL_H_
diff --git a/components/sync/core_impl/sync_encryption_handler_impl_unittest.cc b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
similarity index 99%
rename from components/sync/core_impl/sync_encryption_handler_impl_unittest.cc
rename to components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
index 99eb4dd..0b6cc1a9 100644
--- a/components/sync/core_impl/sync_encryption_handler_impl_unittest.cc
+++ b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/sync_encryption_handler_impl.h"
+#include "components/sync/engine_impl/sync_encryption_handler_impl.h"
 
 #include <stdint.h>
 
diff --git a/components/sync/core_impl/test/sync_manager_for_profile_sync_test.cc b/components/sync/engine_impl/sync_manager_for_profile_sync_test.cc
similarity index 93%
rename from components/sync/core_impl/test/sync_manager_for_profile_sync_test.cc
rename to components/sync/engine_impl/sync_manager_for_profile_sync_test.cc
index ef8fbf9c..2d946e3e 100644
--- a/components/sync/core_impl/test/sync_manager_for_profile_sync_test.cc
+++ b/components/sync/engine_impl/sync_manager_for_profile_sync_test.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/test/sync_manager_for_profile_sync_test.h"
+#include "components/sync/engine_impl/sync_manager_for_profile_sync_test.h"
 
 #include "components/sync/syncable/directory.h"
 #include "components/sync/syncable/test_user_share.h"
diff --git a/components/sync/core_impl/test/sync_manager_for_profile_sync_test.h b/components/sync/engine_impl/sync_manager_for_profile_sync_test.h
similarity index 72%
rename from components/sync/core_impl/test/sync_manager_for_profile_sync_test.h
rename to components/sync/engine_impl/sync_manager_for_profile_sync_test.h
index 00d590d..3292d87 100644
--- a/components/sync/core_impl/test/sync_manager_for_profile_sync_test.h
+++ b/components/sync/engine_impl/sync_manager_for_profile_sync_test.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_TEST_SYNC_MANAGER_FOR_PROFILE_SYNC_TEST_H_
-#define COMPONENTS_SYNC_CORE_IMPL_TEST_SYNC_MANAGER_FOR_PROFILE_SYNC_TEST_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNC_MANAGER_FOR_PROFILE_SYNC_TEST_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_MANAGER_FOR_PROFILE_SYNC_TEST_H_
 
 #include <string>
 
 #include "base/callback.h"
 #include "base/compiler_specific.h"
-#include "components/sync/core_impl/sync_manager_impl.h"
+#include "components/sync/engine_impl/sync_manager_impl.h"
 
 namespace syncer {
 
@@ -27,4 +27,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_TEST_SYNC_MANAGER_FOR_PROFILE_SYNC_TEST_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_MANAGER_FOR_PROFILE_SYNC_TEST_H_
diff --git a/components/sync/core_impl/sync_manager_impl.cc b/components/sync/engine_impl/sync_manager_impl.cc
similarity index 94%
rename from components/sync/core_impl/sync_manager_impl.cc
rename to components/sync/engine_impl/sync_manager_impl.cc
index eb0761e..c0d18be 100644
--- a/components/sync/core_impl/sync_manager_impl.cc
+++ b/components/sync/engine_impl/sync_manager_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core_impl/sync_manager_impl.h"
+#include "components/sync/engine_impl/sync_manager_impl.h"
 
 #include <stddef.h>
 
@@ -24,13 +24,13 @@
 #include "components/sync/base/experiments.h"
 #include "components/sync/base/invalidation_interface.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/configure_reason.h"
-#include "components/sync/core/internal_components_factory.h"
-#include "components/sync/core_impl/model_type_connector_proxy.h"
-#include "components/sync/core_impl/syncapi_internal.h"
+#include "components/sync/engine/configure_reason.h"
+#include "components/sync/engine/engine_components_factory.h"
+#include "components/sync/engine/engine_util.h"
 #include "components/sync/engine/net/http_post_provider_factory.h"
 #include "components/sync/engine/polling_constants.h"
 #include "components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h"
+#include "components/sync/engine_impl/model_type_connector_proxy.h"
 #include "components/sync/engine_impl/net/sync_server_connection_manager.h"
 #include "components/sync/engine_impl/sync_scheduler.h"
 #include "components/sync/engine_impl/syncer_types.h"
@@ -251,8 +251,8 @@
   DCHECK(absolute_db_path.IsAbsolute());
 
   std::unique_ptr<syncable::DirectoryBackingStore> backing_store =
-      args->internal_components_factory->BuildDirectoryBackingStore(
-          InternalComponentsFactory::STORAGE_ON_DISK,
+      args->engine_components_factory->BuildDirectoryBackingStore(
+          EngineComponentsFactory::STORAGE_ON_DISK,
           args->credentials.account_id, absolute_db_path);
 
   DCHECK(backing_store.get());
@@ -305,11 +305,11 @@
   std::vector<SyncEngineEventListener*> listeners;
   listeners.push_back(&allstatus_);
   listeners.push_back(this);
-  cycle_context_ = args->internal_components_factory->BuildContext(
+  cycle_context_ = args->engine_components_factory->BuildContext(
       connection_manager_.get(), directory(), args->extensions_activity,
       listeners, &debug_info_event_listener_, model_type_registry_.get(),
       args->invalidator_client_id);
-  scheduler_ = args->internal_components_factory->BuildScheduler(
+  scheduler_ = args->engine_components_factory->BuildScheduler(
       name_, cycle_context_.get(), args->cancelation_signal);
 
   scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time());
@@ -326,19 +326,21 @@
 }
 
 void SyncManagerImpl::NotifyInitializationSuccess() {
-  FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                    OnInitializationComplete(
-                        MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
-                        MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()),
-                        true, InitialSyncEndedTypes()));
+  for (auto& observer : observers_) {
+    observer.OnInitializationComplete(
+        MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
+        MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()), true,
+        InitialSyncEndedTypes());
+  }
 }
 
 void SyncManagerImpl::NotifyInitializationFailure() {
-  FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                    OnInitializationComplete(
-                        MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
-                        MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()),
-                        false, ModelTypeSet()));
+  for (auto& observer : observers_) {
+    observer.OnInitializationComplete(
+        MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
+        MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()), false,
+        ModelTypeSet());
+  }
 }
 
 void SyncManagerImpl::OnPassphraseRequired(
@@ -579,19 +581,22 @@
     const ServerConnectionEvent& event) {
   DCHECK(thread_checker_.CalledOnValidThread());
   if (event.connection_code == HttpResponse::SERVER_CONNECTION_OK) {
-    FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                      OnConnectionStatusChange(CONNECTION_OK));
+    for (auto& observer : observers_) {
+      observer.OnConnectionStatusChange(CONNECTION_OK);
+    }
   }
 
   if (event.connection_code == HttpResponse::SYNC_AUTH_ERROR) {
     observing_network_connectivity_changes_ = false;
-    FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                      OnConnectionStatusChange(CONNECTION_AUTH_ERROR));
+    for (auto& observer : observers_) {
+      observer.OnConnectionStatusChange(CONNECTION_AUTH_ERROR);
+    }
   }
 
   if (event.connection_code == HttpResponse::SYNC_SERVER_ERROR) {
-    FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                      OnConnectionStatusChange(CONNECTION_SERVER_ERROR));
+    for (auto& observer : observers_) {
+      observer.OnConnectionStatusChange(CONNECTION_SERVER_ERROR);
+    }
   }
 }
 
@@ -817,14 +822,16 @@
     }
 
     DVLOG(1) << "Sending OnSyncCycleCompleted";
-    FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                      OnSyncCycleCompleted(event.snapshot));
+    for (auto& observer : observers_) {
+      observer.OnSyncCycleCompleted(event.snapshot);
+    }
   }
 }
 
 void SyncManagerImpl::OnActionableError(const SyncProtocolError& error) {
-  FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                    OnActionableError(error));
+  for (auto& observer : observers_) {
+    observer.OnActionableError(error);
+  }
 }
 
 void SyncManagerImpl::OnRetryTimeChanged(base::Time) {}
@@ -832,13 +839,16 @@
 void SyncManagerImpl::OnThrottledTypesChanged(ModelTypeSet) {}
 
 void SyncManagerImpl::OnMigrationRequested(ModelTypeSet types) {
-  FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
-                    OnMigrationRequested(types));
+  for (auto& observer : observers_) {
+    observer.OnMigrationRequested(types);
+  }
 }
 
 void SyncManagerImpl::OnProtocolEvent(const ProtocolEvent& event) {
   protocol_event_buffer_.RecordProtocolEvent(event);
-  FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnProtocolEvent(event));
+  for (auto& observer : observers_) {
+    observer.OnProtocolEvent(event);
+  }
 }
 
 void SyncManagerImpl::SetJsEventHandler(
diff --git a/components/sync/core_impl/sync_manager_impl.h b/components/sync/engine_impl/sync_manager_impl.h
similarity index 95%
rename from components/sync/core_impl/sync_manager_impl.h
rename to components/sync/engine_impl/sync_manager_impl.h
index 4784138..f7c7614 100644
--- a/components/sync/core_impl/sync_manager_impl.h
+++ b/components/sync/engine_impl/sync_manager_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_IMPL_SYNC_MANAGER_IMPL_H_
-#define COMPONENTS_SYNC_CORE_IMPL_SYNC_MANAGER_IMPL_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNC_MANAGER_IMPL_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_SYNC_MANAGER_IMPL_H_
 
 #include <stdint.h>
 
@@ -16,16 +16,16 @@
 #include "base/macros.h"
 #include "components/sync/base/cryptographer.h"
 #include "components/sync/base/time.h"
-#include "components/sync/core/sync_manager.h"
-#include "components/sync/core_impl/debug_info_event_listener.h"
-#include "components/sync/core_impl/js_mutation_event_observer.h"
-#include "components/sync/core_impl/js_sync_encryption_handler_observer.h"
-#include "components/sync/core_impl/js_sync_manager_observer.h"
-#include "components/sync/core_impl/protocol_event_buffer.h"
-#include "components/sync/core_impl/sync_encryption_handler_impl.h"
+#include "components/sync/engine/sync_manager.h"
 #include "components/sync/engine_impl/all_status.h"
+#include "components/sync/engine_impl/debug_info_event_listener.h"
+#include "components/sync/engine_impl/events/protocol_event_buffer.h"
+#include "components/sync/engine_impl/js_mutation_event_observer.h"
+#include "components/sync/engine_impl/js_sync_encryption_handler_observer.h"
+#include "components/sync/engine_impl/js_sync_manager_observer.h"
 #include "components/sync/engine_impl/net/server_connection_manager.h"
 #include "components/sync/engine_impl/nudge_handler.h"
+#include "components/sync/engine_impl/sync_encryption_handler_impl.h"
 #include "components/sync/engine_impl/sync_engine_event_listener.h"
 #include "components/sync/js/js_backend.h"
 #include "components/sync/syncable/change_reorder_buffer.h"
@@ -340,4 +340,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_IMPL_SYNC_MANAGER_IMPL_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_SYNC_MANAGER_IMPL_H_
diff --git a/components/sync/core_impl/sync_manager_impl_unittest.cc b/components/sync/engine_impl/sync_manager_impl_unittest.cc
similarity index 98%
rename from components/sync/core_impl/sync_manager_impl_unittest.cc
rename to components/sync/engine_impl/sync_manager_impl_unittest.cc
index 1e451fae..d158f128 100644
--- a/components/sync/core_impl/sync_manager_impl_unittest.cc
+++ b/components/sync/engine_impl/sync_manager_impl_unittest.cc
@@ -6,7 +6,7 @@
 // functionality is provided by the Syncable layer, which has its own
 // unit tests. We'll test SyncApi specific things in this harness.
 
-#include "components/sync/core_impl/sync_manager_impl.h"
+#include "components/sync/engine_impl/sync_manager_impl.h"
 
 #include <cstddef>
 #include <memory>
@@ -29,16 +29,16 @@
 #include "components/sync/base/fake_encryptor.h"
 #include "components/sync/base/mock_unrecoverable_error_handler.h"
 #include "components/sync/base/model_type_test_util.h"
-#include "components/sync/core/test/test_entry_factory.h"
-#include "components/sync/core/test/test_internal_components_factory.h"
-#include "components/sync/core_impl/syncapi_internal.h"
+#include "components/sync/engine/engine_util.h"
 #include "components/sync/engine/events/protocol_event.h"
 #include "components/sync/engine/model_safe_worker.h"
 #include "components/sync/engine/net/http_post_provider_factory.h"
 #include "components/sync/engine/net/http_post_provider_interface.h"
 #include "components/sync/engine/polling_constants.h"
+#include "components/sync/engine/test_engine_components_factory.h"
 #include "components/sync/engine_impl/cycle/sync_cycle.h"
 #include "components/sync/engine_impl/sync_scheduler.h"
+#include "components/sync/engine_impl/test_entry_factory.h"
 #include "components/sync/js/js_event_handler.h"
 #include "components/sync/js/js_test_util.h"
 #include "components/sync/protocol/bookmark_specifics.pb.h"
@@ -941,8 +941,7 @@
   enum EncryptionStatus { UNINITIALIZED, DEFAULT_ENCRYPTION, FULL_ENCRYPTION };
 
   SyncManagerTest() : sync_manager_("Test sync manager") {
-    switches_.encryption_method =
-        InternalComponentsFactory::ENCRYPTION_KEYSTORE;
+    switches_.encryption_method = EngineComponentsFactory::ENCRYPTION_KEYSTORE;
   }
 
   virtual ~SyncManagerTest() {}
@@ -988,7 +987,7 @@
     args.change_delegate = this;
     args.credentials = credentials;
     args.invalidator_client_id = "fake_invalidator_client_id";
-    args.internal_components_factory.reset(GetFactory());
+    args.engine_components_factory.reset(GetFactory());
     args.encryptor = &encryptor_;
     args.unrecoverable_error_handler =
         MakeWeakHandle(mock_unrecoverable_error_handler_.GetWeakPtr());
@@ -998,7 +997,7 @@
     sync_manager_.GetEncryptionHandler()->AddObserver(&encryption_observer_);
 
     EXPECT_TRUE(js_backend_.IsInitialized());
-    EXPECT_EQ(InternalComponentsFactory::STORAGE_ON_DISK, storage_used_);
+    EXPECT_EQ(EngineComponentsFactory::STORAGE_ON_DISK, storage_used_);
 
     if (initialization_succeeded_) {
       for (ModelSafeRoutingInfo::iterator i = routing_info.begin();
@@ -1108,9 +1107,9 @@
     return true;
   }
 
-  virtual InternalComponentsFactory* GetFactory() {
-    return new TestInternalComponentsFactory(
-        GetSwitches(), InternalComponentsFactory::STORAGE_IN_MEMORY,
+  virtual EngineComponentsFactory* GetFactory() {
+    return new TestEngineComponentsFactory(
+        GetSwitches(), EngineComponentsFactory::STORAGE_IN_MEMORY,
         &storage_used_);
   }
 
@@ -1159,7 +1158,7 @@
     }
   }
 
-  InternalComponentsFactory::Switches GetSwitches() const { return switches_; }
+  EngineComponentsFactory::Switches GetSwitches() const { return switches_; }
 
   void ExpectPassphraseAcceptance() {
     EXPECT_CALL(encryption_observer_, OnPassphraseAccepted());
@@ -1202,8 +1201,8 @@
   bool initialization_succeeded_;
   StrictMock<SyncManagerObserverMock> manager_observer_;
   StrictMock<SyncEncryptionHandlerObserverMock> encryption_observer_;
-  InternalComponentsFactory::Switches switches_;
-  InternalComponentsFactory::StorageOption storage_used_;
+  EngineComponentsFactory::Switches switches_;
+  EngineComponentsFactory::StorageOption storage_used_;
   MockUnrecoverableErrorHandler mock_unrecoverable_error_handler_;
 };
 
@@ -2542,16 +2541,15 @@
   MOCK_METHOD1(ScheduleConfiguration, void(const ConfigurationParams&));
 };
 
-class ComponentsFactory : public TestInternalComponentsFactory {
+class ComponentsFactory : public TestEngineComponentsFactory {
  public:
   ComponentsFactory(const Switches& switches,
                     SyncScheduler* scheduler_to_use,
                     SyncCycleContext** cycle_context,
-                    InternalComponentsFactory::StorageOption* storage_used)
-      : TestInternalComponentsFactory(
-            switches,
-            InternalComponentsFactory::STORAGE_IN_MEMORY,
-            storage_used),
+                    EngineComponentsFactory::StorageOption* storage_used)
+      : TestEngineComponentsFactory(switches,
+                                    EngineComponentsFactory::STORAGE_IN_MEMORY,
+                                    storage_used),
         scheduler_to_use_(scheduler_to_use),
         cycle_context_(cycle_context) {}
   ~ComponentsFactory() override {}
@@ -2572,7 +2570,7 @@
 class SyncManagerTestWithMockScheduler : public SyncManagerTest {
  public:
   SyncManagerTestWithMockScheduler() : scheduler_(NULL) {}
-  InternalComponentsFactory* GetFactory() override {
+  EngineComponentsFactory* GetFactory() override {
     scheduler_ = new MockSyncScheduler();
     return new ComponentsFactory(GetSwitches(), scheduler_, &cycle_context_,
                                  &storage_used_);
@@ -3336,15 +3334,15 @@
 // During initialization SyncManagerImpl loads sqlite database. If it fails to
 // do so it should fail initialization. This test verifies this behavior.
 // Test reuses SyncManagerImpl initialization from SyncManagerTest but overrides
-// InternalComponentsFactory to return DirectoryBackingStore that always fails
+// EngineComponentsFactory to return DirectoryBackingStore that always fails
 // to load.
 class SyncManagerInitInvalidStorageTest : public SyncManagerTest {
  public:
   SyncManagerInitInvalidStorageTest() {}
 
-  InternalComponentsFactory* GetFactory() override {
-    return new TestInternalComponentsFactory(
-        GetSwitches(), InternalComponentsFactory::STORAGE_INVALID,
+  EngineComponentsFactory* GetFactory() override {
+    return new TestEngineComponentsFactory(
+        GetSwitches(), EngineComponentsFactory::STORAGE_INVALID,
         &storage_used_);
   }
 };
diff --git a/components/sync/engine_impl/syncer_util_unittest.cc b/components/sync/engine_impl/syncer_util_unittest.cc
index 89148c1d0..5c64a61 100644
--- a/components/sync/engine_impl/syncer_util_unittest.cc
+++ b/components/sync/engine_impl/syncer_util_unittest.cc
@@ -9,7 +9,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/rand_util.h"
 #include "components/sync/base/unique_position.h"
-#include "components/sync/core/test/test_entry_factory.h"
+#include "components/sync/engine_impl/test_entry_factory.h"
 #include "components/sync/protocol/sync.pb.h"
 #include "components/sync/syncable/syncable_write_transaction.h"
 #include "components/sync/test/engine/test_directory_setter_upper.h"
diff --git a/components/sync/core_impl/test/test_entry_factory.cc b/components/sync/engine_impl/test_entry_factory.cc
similarity index 99%
rename from components/sync/core_impl/test/test_entry_factory.cc
rename to components/sync/engine_impl/test_entry_factory.cc
index d4f1226..cf0dfde 100644
--- a/components/sync/core_impl/test/test_entry_factory.cc
+++ b/components/sync/engine_impl/test_entry_factory.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/core/test/test_entry_factory.h"
+#include "components/sync/engine_impl/test_entry_factory.h"
 
 #include "components/sync/syncable/directory.h"
 #include "components/sync/syncable/entry.h"
diff --git a/components/sync/core/test/test_entry_factory.h b/components/sync/engine_impl/test_entry_factory.h
similarity index 96%
rename from components/sync/core/test/test_entry_factory.h
rename to components/sync/engine_impl/test_entry_factory.h
index dc33883..fc8b124a 100644
--- a/components/sync/core/test/test_entry_factory.h
+++ b/components/sync/engine_impl/test_entry_factory.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_CORE_TEST_TEST_ENTRY_FACTORY_H_
-#define COMPONENTS_SYNC_CORE_TEST_TEST_ENTRY_FACTORY_H_
+#ifndef COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_
+#define COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_
 
 #include <stdint.h>
 
@@ -133,4 +133,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_CORE_TEST_TEST_ENTRY_FACTORY_H_
+#endif  // COMPONENTS_SYNC_ENGINE_IMPL_TEST_ENTRY_FACTORY_H_
diff --git a/components/sync/engine_impl/worker_entity_tracker.h b/components/sync/engine_impl/worker_entity_tracker.h
index fc26c97..ae9e587 100644
--- a/components/sync/engine_impl/worker_entity_tracker.h
+++ b/components/sync/engine_impl/worker_entity_tracker.h
@@ -12,7 +12,7 @@
 
 #include "base/macros.h"
 #include "base/time/time.h"
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/protocol/sync.pb.h"
 
 namespace syncer {
diff --git a/components/sync/model/DEPS b/components/sync/model/DEPS
index 4dbc4b3..edaa137 100644
--- a/components/sync/model/DEPS
+++ b/components/sync/model/DEPS
@@ -1,7 +1,6 @@
 include_rules = [
   "+components/sync/base",
   "+components/sync/engine",
-  "+components/sync/core",
   "+components/sync/model_impl",
   "+components/sync/protocol",
   # TODO(maxbogue): Move GenerateSyncableHash to base.
diff --git a/components/sync/model/fake_model_type_service.h b/components/sync/model/fake_model_type_service.h
index 3c9aa15b..4cc7844 100644
--- a/components/sync/model/fake_model_type_service.h
+++ b/components/sync/model/fake_model_type_service.h
@@ -9,7 +9,7 @@
 #include <memory>
 #include <string>
 
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/model/entity_data.h"
 #include "components/sync/model/metadata_batch.h"
 #include "components/sync/model/model_type_service.h"
diff --git a/components/sync/model/model_type_change_processor.h b/components/sync/model/model_type_change_processor.h
index d1b2947..bb1194a 100644
--- a/components/sync/model/model_type_change_processor.h
+++ b/components/sync/model/model_type_change_processor.h
@@ -9,7 +9,7 @@
 #include <string>
 
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/activation_context.h"
+#include "components/sync/engine/activation_context.h"
 #include "components/sync/model/data_type_error_handler.h"
 #include "components/sync/model/entity_data.h"
 #include "components/sync/model/sync_error_factory.h"
diff --git a/components/sync/model/model_type_service.h b/components/sync/model/model_type_service.h
index 62b7f9fc..9e63c8f 100644
--- a/components/sync/model/model_type_service.h
+++ b/components/sync/model/model_type_service.h
@@ -11,7 +11,7 @@
 
 #include "base/callback.h"
 #include "base/memory/weak_ptr.h"
-#include "components/sync/core/activation_context.h"
+#include "components/sync/engine/activation_context.h"
 #include "components/sync/model/conflict_resolution.h"
 #include "components/sync/model/data_type_error_handler.h"
 #include "components/sync/model/entity_change.h"
diff --git a/components/sync/model/simple_metadata_change_list.h b/components/sync/model/simple_metadata_change_list.h
index 32b0dfc..ef530e5 100644
--- a/components/sync/model/simple_metadata_change_list.h
+++ b/components/sync/model/simple_metadata_change_list.h
@@ -9,7 +9,7 @@
 #include <memory>
 #include <string>
 
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/model/metadata_change_list.h"
 #include "components/sync/model/model_type_store.h"
 #include "components/sync/protocol/entity_metadata.pb.h"
diff --git a/components/sync/model_impl/DEPS b/components/sync/model_impl/DEPS
index 23220381..8fcf786 100644
--- a/components/sync/model_impl/DEPS
+++ b/components/sync/model_impl/DEPS
@@ -1,6 +1,5 @@
 include_rules = [
   "+components/sync/base",
-  "+components/sync/core",
   "+components/sync/engine",
   "+components/sync/model",
   "+components/sync/protocol",
diff --git a/components/sync/model_impl/processor_entity_tracker.cc b/components/sync/model_impl/processor_entity_tracker.cc
index bee536f..cbee3fe6 100644
--- a/components/sync/model_impl/processor_entity_tracker.cc
+++ b/components/sync/model_impl/processor_entity_tracker.cc
@@ -7,7 +7,7 @@
 #include "base/base64.h"
 #include "base/sha1.h"
 #include "components/sync/base/time.h"
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/syncable/syncable_util.h"
 
 namespace syncer {
diff --git a/components/sync/model_impl/processor_entity_tracker_unittest.cc b/components/sync/model_impl/processor_entity_tracker_unittest.cc
index fd3ccdb..9803797 100644
--- a/components/sync/model_impl/processor_entity_tracker_unittest.cc
+++ b/components/sync/model_impl/processor_entity_tracker_unittest.cc
@@ -9,7 +9,7 @@
 #include "base/memory/ptr_util.h"
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/time.h"
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/protocol/sync.pb.h"
 #include "components/sync/syncable/syncable_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/sync/model_impl/shared_model_type_processor.cc b/components/sync/model_impl/shared_model_type_processor.cc
index 06d0a1a9..7f543d4 100644
--- a/components/sync/model_impl/shared_model_type_processor.cc
+++ b/components/sync/model_impl/shared_model_type_processor.cc
@@ -12,9 +12,9 @@
 #include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "components/sync/core/activation_context.h"
-#include "components/sync/core/model_type_processor_proxy.h"
+#include "components/sync/engine/activation_context.h"
 #include "components/sync/engine/commit_queue.h"
+#include "components/sync/engine/model_type_processor_proxy.h"
 #include "components/sync/model_impl/processor_entity_tracker.h"
 #include "components/sync/syncable/syncable_util.h"
 
diff --git a/components/sync/model_impl/shared_model_type_processor.h b/components/sync/model_impl/shared_model_type_processor.h
index 6b36e52..2460c55 100644
--- a/components/sync/model_impl/shared_model_type_processor.h
+++ b/components/sync/model_impl/shared_model_type_processor.h
@@ -13,9 +13,9 @@
 #include "base/memory/weak_ptr.h"
 #include "base/threading/non_thread_safe.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/model_type_processor.h"
-#include "components/sync/core/non_blocking_sync_common.h"
 #include "components/sync/engine/cycle/status_counters.h"
+#include "components/sync/engine/model_type_processor.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/model/data_batch.h"
 #include "components/sync/model/data_type_error_handler.h"
 #include "components/sync/model/metadata_batch.h"
diff --git a/components/sync/model_impl/shared_model_type_processor_unittest.cc b/components/sync/model_impl/shared_model_type_processor_unittest.cc
index c2d9594..a42ddf1b 100644
--- a/components/sync/model_impl/shared_model_type_processor_unittest.cc
+++ b/components/sync/model_impl/shared_model_type_processor_unittest.cc
@@ -16,7 +16,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "components/sync/base/time.h"
-#include "components/sync/core/activation_context.h"
+#include "components/sync/engine/activation_context.h"
 #include "components/sync/engine/commit_queue.h"
 #include "components/sync/model/data_type_error_handler_mock.h"
 #include "components/sync/model/fake_model_type_service.h"
diff --git a/components/sync/syncable/DEPS b/components/sync/syncable/DEPS
index 4e81e41b..93eb3c8 100644
--- a/components/sync/syncable/DEPS
+++ b/components/sync/syncable/DEPS
@@ -1,7 +1,5 @@
 include_rules = [
   "+components/sync/base",
-  "+components/sync/core",
-  "+components/sync/core_impl",
   "+components/sync/engine",
   "+components/sync/model",
   "+components/sync/protocol",
diff --git a/components/sync/syncable/base_node.cc b/components/sync/syncable/base_node.cc
index 2dc3078..58096c3 100644
--- a/components/sync/syncable/base_node.cc
+++ b/components/sync/syncable/base_node.cc
@@ -9,7 +9,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "components/sync/base/time.h"
-#include "components/sync/core_impl/syncapi_internal.h"
+#include "components/sync/engine/engine_util.h"
 #include "components/sync/protocol/app_specifics.pb.h"
 #include "components/sync/protocol/autofill_specifics.pb.h"
 #include "components/sync/protocol/bookmark_specifics.pb.h"
diff --git a/components/sync/core/sync_db_util.cc b/components/sync/syncable/sync_db_util.cc
similarity index 95%
rename from components/sync/core/sync_db_util.cc
rename to components/sync/syncable/sync_db_util.cc
index 15af7e3..4e8c528 100644
--- a/components/sync/core/sync_db_util.cc
+++ b/components/sync/syncable/sync_db_util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/sync/base/sync_db_util.h"
+#include "components/sync/syncable/sync_db_util.h"
 
 #include "base/files/file_path.h"
 #include "base/single_thread_task_runner.h"
diff --git a/components/sync/base/sync_db_util.h b/components/sync/syncable/sync_db_util.h
similarity index 83%
rename from components/sync/base/sync_db_util.h
rename to components/sync/syncable/sync_db_util.h
index e5e7342..dde5c11 100644
--- a/components/sync/base/sync_db_util.h
+++ b/components/sync/syncable/sync_db_util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SYNC_BASE_SYNC_DB_UTIL_H_
-#define COMPONENTS_SYNC_BASE_SYNC_DB_UTIL_H_
+#ifndef COMPONENTS_SYNC_SYNCABLE_SYNC_DB_UTIL_H_
+#define COMPONENTS_SYNC_SYNCABLE_SYNC_DB_UTIL_H_
 
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
@@ -26,4 +26,4 @@
 
 }  // namespace syncer
 
-#endif  // COMPONENTS_SYNC_BASE_SYNC_DB_UTIL_H_
+#endif  // COMPONENTS_SYNC_SYNCABLE_SYNC_DB_UTIL_H_
diff --git a/components/sync/syncable/user_share.h b/components/sync/syncable/user_share.h
index 295a53eb..e103b61 100644
--- a/components/sync/syncable/user_share.h
+++ b/components/sync/syncable/user_share.h
@@ -8,7 +8,7 @@
 #include <memory>
 #include <string>
 
-#include "components/sync/core/sync_manager.h"
+#include "components/sync/engine/sync_manager.h"
 
 namespace syncer {
 
diff --git a/components/sync/syncable/write_node.cc b/components/sync/syncable/write_node.cc
index ee689b6f..ede4038 100644
--- a/components/sync/syncable/write_node.cc
+++ b/components/sync/syncable/write_node.cc
@@ -10,7 +10,7 @@
 #include "base/strings/utf_string_conversions.h"
 #include "base/values.h"
 #include "components/sync/base/cryptographer.h"
-#include "components/sync/core_impl/syncapi_internal.h"
+#include "components/sync/engine/engine_util.h"
 #include "components/sync/protocol/bookmark_specifics.pb.h"
 #include "components/sync/protocol/typed_url_specifics.pb.h"
 #include "components/sync/syncable/base_transaction.h"
diff --git a/components/sync/test/engine/mock_model_type_processor.h b/components/sync/test/engine/mock_model_type_processor.h
index 29b2d89a..bc0bb78 100644
--- a/components/sync/test/engine/mock_model_type_processor.h
+++ b/components/sync/test/engine/mock_model_type_processor.h
@@ -15,8 +15,8 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "components/sync/core/model_type_processor.h"
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/model_type_processor.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/protocol/model_type_state.pb.h"
 
 namespace syncer {
diff --git a/components/sync/test/engine/mock_model_type_worker.h b/components/sync/test/engine/mock_model_type_worker.h
index 2d5a2fd..28ad55a 100644
--- a/components/sync/test/engine/mock_model_type_worker.h
+++ b/components/sync/test/engine/mock_model_type_worker.h
@@ -14,9 +14,9 @@
 #include <vector>
 
 #include "base/macros.h"
-#include "components/sync/core/model_type_processor.h"
-#include "components/sync/core/non_blocking_sync_common.h"
 #include "components/sync/engine/commit_queue.h"
+#include "components/sync/engine/model_type_processor.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 #include "components/sync/protocol/model_type_state.pb.h"
 #include "components/sync/protocol/sync.pb.h"
 
diff --git a/components/sync/test/engine/single_type_mock_server.h b/components/sync/test/engine/single_type_mock_server.h
index 8c8c6fc..6ed5ba4f 100644
--- a/components/sync/test/engine/single_type_mock_server.h
+++ b/components/sync/test/engine/single_type_mock_server.h
@@ -14,7 +14,7 @@
 
 #include "base/macros.h"
 #include "components/sync/base/model_type.h"
-#include "components/sync/core/non_blocking_sync_common.h"
+#include "components/sync/engine/non_blocking_sync_common.h"
 
 namespace syncer {
 
diff --git a/components/sync/test/fake_sync_encryption_handler.h b/components/sync/test/fake_sync_encryption_handler.h
index d90d1c0..af0af03 100644
--- a/components/sync/test/fake_sync_encryption_handler.h
+++ b/components/sync/test/fake_sync_encryption_handler.h
@@ -11,7 +11,7 @@
 #include "base/observer_list.h"
 #include "components/sync/base/cryptographer.h"
 #include "components/sync/base/fake_encryptor.h"
-#include "components/sync/core/sync_encryption_handler.h"
+#include "components/sync/engine/sync_encryption_handler.h"
 #include "components/sync/syncable/nigori_handler.h"
 
 namespace syncer {
diff --git a/components/sync/tools/DEPS b/components/sync/tools/DEPS
index 8cd68a8..5decc2c 100644
--- a/components/sync/tools/DEPS
+++ b/components/sync/tools/DEPS
@@ -1,7 +1,6 @@
 include_rules = [
   "+components/invalidation",
   "+components/sync/base",
-  "+components/sync/core",
   "+components/sync/driver",
   "+components/sync/engine",
   "+components/sync/syncable",
diff --git a/components/sync/tools/sync_client.cc b/components/sync/tools/sync_client.cc
index 7587eb77..c6a2e578 100644
--- a/components/sync/tools/sync_client.cc
+++ b/components/sync/tools/sync_client.cc
@@ -34,12 +34,12 @@
 #include "components/sync/base/model_type.h"
 #include "components/sync/base/unrecoverable_error_handler.h"
 #include "components/sync/base/weak_handle.h"
-#include "components/sync/core/internal_components_factory_impl.h"
-#include "components/sync/core/sync_manager.h"
-#include "components/sync/core/sync_manager_factory.h"
+#include "components/sync/engine/engine_components_factory_impl.h"
 #include "components/sync/engine/net/http_bridge.h"
 #include "components/sync/engine/net/http_post_provider_factory.h"
 #include "components/sync/engine/passive_model_worker.h"
+#include "components/sync/engine/sync_manager.h"
+#include "components/sync/engine/sync_manager_factory.h"
 #include "components/sync/js/js_event_details.h"
 #include "components/sync/js/js_event_handler.h"
 #include "components/sync/syncable/base_node.h"
@@ -409,9 +409,9 @@
   const char kRestoredKeyForBootstrapping[] = "";
   const char kRestoredKeystoreKeyForBootstrapping[] = "";
   NullEncryptor null_encryptor;
-  InternalComponentsFactoryImpl::Switches factory_switches = {
-      InternalComponentsFactory::ENCRYPTION_KEYSTORE,
-      InternalComponentsFactory::BACKOFF_NORMAL};
+  EngineComponentsFactoryImpl::Switches factory_switches = {
+      EngineComponentsFactory::ENCRYPTION_KEYSTORE,
+      EngineComponentsFactory::BACKOFF_NORMAL};
   CancelationSignal scm_cancelation_signal;
 
   SyncManager::InitArgs args;
@@ -427,8 +427,8 @@
   args.restored_key_for_bootstrapping = kRestoredKeyForBootstrapping;
   args.restored_keystore_key_for_bootstrapping =
       kRestoredKeystoreKeyForBootstrapping;
-  args.internal_components_factory.reset(
-      new InternalComponentsFactoryImpl(factory_switches));
+  args.engine_components_factory.reset(
+      new EngineComponentsFactoryImpl(factory_switches));
   args.encryptor = &null_encryptor;
   args.unrecoverable_error_handler = WeakHandle<UnrecoverableErrorHandler>();
   args.report_unrecoverable_error_function =
diff --git a/components/sync_bookmarks/bookmark_model_associator.cc b/components/sync_bookmarks/bookmark_model_associator.cc
index 8bbf659..cc8532c 100644
--- a/components/sync_bookmarks/bookmark_model_associator.cc
+++ b/components/sync_bookmarks/bookmark_model_associator.cc
@@ -20,8 +20,8 @@
 #include "components/bookmarks/browser/bookmark_model.h"
 #include "components/sync/base/cryptographer.h"
 #include "components/sync/base/data_type_histogram.h"
-#include "components/sync/core_impl/syncapi_internal.h"
 #include "components/sync/driver/sync_client.h"
+#include "components/sync/engine/engine_util.h"
 #include "components/sync/model/sync_error.h"
 #include "components/sync/model/sync_merge_result.h"
 #include "components/sync/syncable/delete_journal.h"
diff --git a/components/translate/content/renderer/BUILD.gn b/components/translate/content/renderer/BUILD.gn
index 0a16d44..17ab7fa 100644
--- a/components/translate/content/renderer/BUILD.gn
+++ b/components/translate/content/renderer/BUILD.gn
@@ -17,7 +17,7 @@
     "//components/translate/core/language_detection",
     "//content/public/common",
     "//content/public/renderer",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/WebKit/public:blink",
     "//third_party/cld",
     "//url",
diff --git a/components/translate/content/renderer/DEPS b/components/translate/content/renderer/DEPS
index b95e8bf..536db3e 100644
--- a/components/translate/content/renderer/DEPS
+++ b/components/translate/content/renderer/DEPS
@@ -1,6 +1,6 @@
 include_rules = [
   "+content/public/renderer",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+third_party/cld_2",
   "+third_party/WebKit/public/web",
   "+v8",
diff --git a/components/translate/content/renderer/translate_helper.cc b/components/translate/content/renderer/translate_helper.cc
index 88703d8..23c25194 100644
--- a/components/translate/content/renderer/translate_helper.cc
+++ b/components/translate/content/renderer/translate_helper.cc
@@ -22,7 +22,7 @@
 #include "content/public/common/url_constants.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_thread.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
diff --git a/components/typemaps.gni b/components/typemaps.gni
index f173d9c..ec96c87 100644
--- a/components/typemaps.gni
+++ b/components/typemaps.gni
@@ -3,7 +3,7 @@
 # found in the LICENSE file.
 
 typemaps = [
-  "//components/autofill/content/public/cpp/autofill_types.typemap",
+  "//components/autofill/content/common/autofill_types.typemap",
   "//components/password_manager/content/public/cpp/credential_manager.typemap",
   "//components/safe_json/public/interfaces/safe_json.typemap",
   "//components/translate/content/common/translate.typemap",
diff --git a/components/visitedlink/DEPS b/components/visitedlink/DEPS
index e7d54f9..3b5a8bc 100644
--- a/components/visitedlink/DEPS
+++ b/components/visitedlink/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
   "+mojo/public",
   "+content/public/common",
-  "+services/shell/public",
+  "+services/service_manager/public",
 ]
diff --git a/components/visitedlink/browser/visitedlink_event_listener.cc b/components/visitedlink/browser/visitedlink_event_listener.cc
index 37cdcd50..a116e98 100644
--- a/components/visitedlink/browser/visitedlink_event_listener.cc
+++ b/components/visitedlink/browser/visitedlink_event_listener.cc
@@ -11,7 +11,7 @@
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_widget_host.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 using base::Time;
 using base::TimeDelta;
diff --git a/components/visitedlink/test/visitedlink_unittest.cc b/components/visitedlink/test/visitedlink_unittest.cc
index bd97df3a..d53c5a4d 100644
--- a/components/visitedlink/test/visitedlink_unittest.cc
+++ b/components/visitedlink/test/visitedlink_unittest.cc
@@ -35,7 +35,7 @@
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_renderer_host.h"
 #include "content/public/test/test_utils.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -597,8 +597,8 @@
       content::BrowserContext* browser_context,
       VisitCountingContext* context)
       : MockRenderProcessHost(browser_context), widgets_(0) {
-    SetRemoteInterfaces(base::MakeUnique<shell::InterfaceProvider>());
-    shell::InterfaceProvider::TestApi test_api(GetRemoteInterfaces());
+    SetRemoteInterfaces(base::MakeUnique<service_manager::InterfaceProvider>());
+    service_manager::InterfaceProvider::TestApi test_api(GetRemoteInterfaces());
     test_api.SetBinderForName(
         mojom::VisitedLinkNotificationSink::Name_,
         base::Bind(&VisitCountingContext::Bind, base::Unretained(context)));
diff --git a/components/web_cache/browser/BUILD.gn b/components/web_cache/browser/BUILD.gn
index 00f49a4..a8634b6 100644
--- a/components/web_cache/browser/BUILD.gn
+++ b/components/web_cache/browser/BUILD.gn
@@ -16,7 +16,7 @@
     "//components/web_cache/public/interfaces",
     "//content/public/browser",
     "//content/public/common",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/WebKit/public:blink_headers",
   ]
 }
diff --git a/components/web_cache/browser/DEPS b/components/web_cache/browser/DEPS
index b90a1ede..48b73076 100644
--- a/components/web_cache/browser/DEPS
+++ b/components/web_cache/browser/DEPS
@@ -1,6 +1,6 @@
 include_rules = [
   "+content/public/browser",
   "+content/public",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/WebKit/public/web",
 ]
diff --git a/components/web_cache/browser/web_cache_manager.cc b/components/web_cache/browser/web_cache_manager.cc
index f82b216a..97d1e19 100644
--- a/components/web_cache/browser/web_cache_manager.cc
+++ b/components/web_cache/browser/web_cache_manager.cc
@@ -22,7 +22,7 @@
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/render_process_host.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 using base::Time;
 using base::TimeDelta;
diff --git a/components/web_cache/renderer/BUILD.gn b/components/web_cache/renderer/BUILD.gn
index fdc2b05..b386fc7 100644
--- a/components/web_cache/renderer/BUILD.gn
+++ b/components/web_cache/renderer/BUILD.gn
@@ -13,7 +13,7 @@
     "//components/web_cache/public/interfaces",
     "//content/public/common",
     "//content/public/renderer",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/WebKit/public:blink",
   ]
 }
diff --git a/components/web_cache/renderer/DEPS b/components/web_cache/renderer/DEPS
index 4c81f94..c001589f 100644
--- a/components/web_cache/renderer/DEPS
+++ b/components/web_cache/renderer/DEPS
@@ -2,6 +2,6 @@
   "+content/public/common",
   "+content/public/renderer",
   "+mojo/public",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/WebKit/public/web",
 ]
diff --git a/components/web_cache/renderer/web_cache_impl.cc b/components/web_cache/renderer/web_cache_impl.cc
index dfe8e7e0..7acf69dc 100644
--- a/components/web_cache/renderer/web_cache_impl.cc
+++ b/components/web_cache/renderer/web_cache_impl.cc
@@ -9,13 +9,13 @@
 #include "base/bind.h"
 #include "base/numerics/safe_conversions.h"
 #include "content/public/renderer/render_thread.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/web/WebCache.h"
 
 namespace web_cache {
 
 WebCacheImpl::WebCacheImpl() : clear_cache_state_(kInit) {
-  shell::InterfaceRegistry* registry =
+  service_manager::InterfaceRegistry* registry =
       content::RenderThread::Get()->GetInterfaceRegistry();
   registry->AddInterface(
       base::Bind(&WebCacheImpl::BindRequest, base::Unretained(this)));
diff --git a/components/webcrypto/algorithms/aes_kw.cc b/components/webcrypto/algorithms/aes_kw.cc
index f64e1db..d1bf022 100644
--- a/components/webcrypto/algorithms/aes_kw.cc
+++ b/components/webcrypto/algorithms/aes_kw.cc
@@ -2,18 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <openssl/aead.h>
+#include <openssl/aes.h>
 #include <stddef.h>
 #include <stdint.h>
 
 #include <vector>
 
-#include "base/logging.h"
+#include "base/location.h"
 #include "base/memory/ptr_util.h"
 #include "base/numerics/safe_math.h"
-#include "base/stl_util.h"
 #include "components/webcrypto/algorithms/aes.h"
-#include "components/webcrypto/algorithms/util.h"
 #include "components/webcrypto/blink_key_handle.h"
 #include "components/webcrypto/crypto_data.h"
 #include "components/webcrypto/status.h"
@@ -23,41 +21,6 @@
 
 namespace {
 
-const EVP_AEAD* GetAesKwAlgorithmFromKeySize(size_t key_size_bytes) {
-  switch (key_size_bytes) {
-    case 16:
-      return EVP_aead_aes_128_key_wrap();
-    case 32:
-      return EVP_aead_aes_256_key_wrap();
-    default:
-      return NULL;
-  }
-}
-
-Status AesKwEncryptDecrypt(EncryptOrDecrypt mode,
-                           const blink::WebCryptoAlgorithm& algorithm,
-                           const blink::WebCryptoKey& key,
-                           const CryptoData& data,
-                           std::vector<uint8_t>* buffer) {
-  // These length checks are done in order to give a more specific error. These
-  // are not required for correctness.
-  if ((mode == ENCRYPT && data.byte_length() < 16) ||
-      (mode == DECRYPT && data.byte_length() < 24)) {
-    return Status::ErrorDataTooSmall();
-  }
-  if (data.byte_length() % 8)
-    return Status::ErrorInvalidAesKwDataLength();
-
-  const std::vector<uint8_t>& raw_key = GetSymmetricKeyData(key);
-
-  return AeadEncryptDecrypt(mode, raw_key, data,
-                            8,             // tag_length_bytes
-                            CryptoData(),  // iv
-                            CryptoData(),  // additional_data
-                            GetAesKwAlgorithmFromKeySize(raw_key.size()),
-                            buffer);
-}
-
 class AesKwImplementation : public AesAlgorithm {
  public:
   AesKwImplementation()
@@ -69,14 +32,72 @@
                  const blink::WebCryptoKey& key,
                  const CryptoData& data,
                  std::vector<uint8_t>* buffer) const override {
-    return AesKwEncryptDecrypt(ENCRYPT, algorithm, key, data, buffer);
+    crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
+
+    // These length checks are done in order to give a more specific
+    // error. These are not required for correctness.
+    if (data.byte_length() < 16)
+      return Status::ErrorDataTooSmall();
+    if (data.byte_length() % 8)
+      return Status::ErrorInvalidAesKwDataLength();
+
+    // Key import validates key sizes, so the bits computation will not
+    // overflow.
+    const std::vector<uint8_t>& raw_key = GetSymmetricKeyData(key);
+    AES_KEY aes_key;
+    if (AES_set_encrypt_key(raw_key.data(),
+                            static_cast<unsigned>(raw_key.size() * 8),
+                            &aes_key) < 0) {
+      return Status::OperationError();
+    }
+
+    // Key wrap's overhead is 8 bytes.
+    base::CheckedNumeric<size_t> length(data.byte_length());
+    length += 8;
+    if (!length.IsValid())
+      return Status::ErrorDataTooLarge();
+
+    buffer->resize(length.ValueOrDie());
+    if (AES_wrap_key(&aes_key, nullptr /* default IV */, buffer->data(),
+                     data.bytes(), data.byte_length()) < 0) {
+      return Status::OperationError();
+    }
+
+    return Status::Success();
   }
 
   Status Decrypt(const blink::WebCryptoAlgorithm& algorithm,
                  const blink::WebCryptoKey& key,
                  const CryptoData& data,
                  std::vector<uint8_t>* buffer) const override {
-    return AesKwEncryptDecrypt(DECRYPT, algorithm, key, data, buffer);
+    crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
+
+    // These length checks are done in order to give a more specific
+    // error. These are not required for correctness.
+    if (data.byte_length() < 24)
+      return Status::ErrorDataTooSmall();
+    if (data.byte_length() % 8)
+      return Status::ErrorInvalidAesKwDataLength();
+
+    // Key import validates key sizes, so the bits computation will not
+    // overflow.
+    const std::vector<uint8_t>& raw_key = GetSymmetricKeyData(key);
+    AES_KEY aes_key;
+    if (AES_set_decrypt_key(raw_key.data(),
+                            static_cast<unsigned>(raw_key.size() * 8),
+                            &aes_key) < 0) {
+      return Status::OperationError();
+    }
+
+    // Key wrap's overhead is 8 bytes.
+    buffer->resize(data.byte_length() - 8);
+
+    if (AES_unwrap_key(&aes_key, nullptr /* default IV */, buffer->data(),
+                       data.bytes(), data.byte_length()) < 0) {
+      return Status::OperationError();
+    }
+
+    return Status::Success();
   }
 };
 
diff --git a/components/wifi_sync/DEPS b/components/wifi_sync/DEPS
index 1497687..9fd3dff 100644
--- a/components/wifi_sync/DEPS
+++ b/components/wifi_sync/DEPS
@@ -5,7 +5,6 @@
   "+components/keyed_service/content",
   "+components/keyed_service/core",
   "+components/onc",
-  "+components/sync/core/attachments",
   "+components/sync/model",
   "+components/sync/protocol",
   "+content/public/browser",
diff --git a/components/zoom/zoom_controller.h b/components/zoom/zoom_controller.h
index a0b8687..159b748 100644
--- a/components/zoom/zoom_controller.h
+++ b/components/zoom/zoom_controller.h
@@ -105,7 +105,8 @@
   }
 
   // Convenience method to quickly check if the tab's at default zoom.
-  bool IsAtDefaultZoom() const;
+  // Virtual for testing.
+  virtual bool IsAtDefaultZoom() const;
 
   // Returns which image should be loaded for the current zoom level.
   RelativeZoom GetZoomRelativeToDefault() const;
diff --git a/content/app/BUILD.gn b/content/app/BUILD.gn
index 5aec2e80d..9c60650 100644
--- a/content/app/BUILD.gn
+++ b/content/app/BUILD.gn
@@ -26,7 +26,7 @@
     "//content:sandbox_helper_win",
     "//content/public/common:common_sources",
     "//crypto",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
     "//mojo/edk/system",
     "//third_party/WebKit/public:mojo_bindings",
     "//ui/base",
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 03f3b91b..d9975c1a 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -93,11 +93,11 @@
     "//services/file:lib",
     "//services/file/public/cpp",
     "//services/file/public/interfaces",
-    "//services/shell",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner/common",
-    "//services/shell/runner/host:lib",
+    "//services/service_manager",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner/common",
+    "//services/service_manager/runner/host:lib",
     "//skia",
     "//sql",
     "//storage/browser",
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 7854c3e..ee26b1b3 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -402,13 +402,6 @@
   return rwhva->GetCachedBackgroundColor();
 }
 
-void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) {
-  if (should_pause)
-    web_contents_->GetGeolocationServiceContext()->PauseUpdates();
-  else
-    web_contents_->GetGeolocationServiceContext()->ResumeUpdates();
-}
-
 // All positions and sizes are in CSS pixels.
 // Note that viewport_width/height is a best effort based.
 // ContentViewCore has the actual information about the physical viewport size.
diff --git a/content/browser/android/content_view_core_impl.h b/content/browser/android/content_view_core_impl.h
index 387d4a5..29dcb83 100644
--- a/content/browser/android/content_view_core_impl.h
+++ b/content/browser/android/content_view_core_impl.h
@@ -63,7 +63,6 @@
   WebContents* GetWebContents() const override;
   ui::WindowAndroid* GetWindowAndroid() const override;
   void ShowPastePopup(int x, int y) override;
-  void PauseOrResumeGeolocation(bool should_pause) override;
 
   void AddObserver(ContentViewCoreImplObserver* observer);
   void RemoveObserver(ContentViewCoreImplObserver* observer);
diff --git a/content/browser/android/java_interfaces_impl.cc b/content/browser/android/java_interfaces_impl.cc
index df2d8d6..2cc2b5701 100644
--- a/content/browser/android/java_interfaces_impl.cc
+++ b/content/browser/android/java_interfaces_impl.cc
@@ -15,7 +15,7 @@
 #include "content/public/browser/web_contents.h"
 #include "jni/InterfaceRegistrarImpl_jni.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace content {
 
@@ -24,7 +24,7 @@
 class JavaInterfaceProviderHolder {
  public:
   JavaInterfaceProviderHolder() {
-    shell::mojom::InterfaceProviderPtr provider;
+    service_manager::mojom::InterfaceProviderPtr provider;
     JNIEnv* env = base::android::AttachCurrentThread();
     Java_InterfaceRegistrarImpl_createInterfaceRegistryForContext(
         env, mojo::GetProxy(&provider).PassMessagePipe().release().value(),
@@ -37,20 +37,22 @@
     return base::Singleton<JavaInterfaceProviderHolder>::get();
   }
 
-  shell::InterfaceProvider* GetJavaInterfaces() { return &interface_provider_; }
+  service_manager::InterfaceProvider* GetJavaInterfaces() {
+    return &interface_provider_;
+  }
 
  private:
-  shell::InterfaceProvider interface_provider_;
+  service_manager::InterfaceProvider interface_provider_;
 };
 
 }  // namespace
 
-shell::InterfaceProvider* GetGlobalJavaInterfaces() {
+service_manager::InterfaceProvider* GetGlobalJavaInterfaces() {
   return JavaInterfaceProviderHolder::GetInstance()->GetJavaInterfaces();
 }
 
 void BindInterfaceRegistryForWebContents(
-    shell::mojom::InterfaceProviderRequest request,
+    service_manager::mojom::InterfaceProviderRequest request,
     WebContents* web_contents) {
   JNIEnv* env = base::android::AttachCurrentThread();
   Java_InterfaceRegistrarImpl_createInterfaceRegistryForWebContents(
diff --git a/content/browser/android/java_interfaces_impl.h b/content/browser/android/java_interfaces_impl.h
index e49ddcd..f78c063d 100644
--- a/content/browser/android/java_interfaces_impl.h
+++ b/content/browser/android/java_interfaces_impl.h
@@ -6,13 +6,13 @@
 #define CONTENT_BROWSER_ANDROID_JAVA_INTERFACES_IMPL_H_
 
 #include "content/public/browser/android/java_interfaces.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
 namespace content {
 class WebContents;
 
 void BindInterfaceRegistryForWebContents(
-    shell::mojom::InterfaceProviderRequest request,
+    service_manager::mojom::InterfaceProviderRequest request,
     WebContents* web_contents);
 
 }  // namespace content
diff --git a/content/browser/battery_status/battery_monitor_integration_browsertest.cc b/content/browser/battery_status/battery_monitor_integration_browsertest.cc
index b2e9e10..1daebec 100644
--- a/content/browser/battery_status/battery_monitor_integration_browsertest.cc
+++ b/content/browser/battery_status/battery_monitor_integration_browsertest.cc
@@ -20,7 +20,7 @@
 #include "content/shell/browser/shell_content_browser_client.h"
 #include "device/battery/battery_monitor.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 // These tests run against a dummy implementation of the BatteryMonitor service.
 // That is, they verify that the service implementation is correctly exposed to
@@ -89,7 +89,7 @@
 class TestContentBrowserClient : public ContentBrowserClient {
  public:
   void ExposeInterfacesToRenderer(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       RenderProcessHost* render_process_host) override {
     scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
         BrowserThread::GetTaskRunnerForThread(BrowserThread::UI);
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc
index bb6a646..a4d64a8 100644
--- a/content/browser/browser_child_process_host_impl.cc
+++ b/content/browser/browser_child_process_host_impl.cc
@@ -312,7 +312,8 @@
   child_process_host_->AddFilter(filter->GetFilter());
 }
 
-shell::InterfaceProvider* BrowserChildProcessHostImpl::GetRemoteInterfaces() {
+service_manager::InterfaceProvider*
+BrowserChildProcessHostImpl::GetRemoteInterfaces() {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (!child_connection_)
     return nullptr;
diff --git a/content/browser/browser_child_process_host_impl.h b/content/browser/browser_child_process_host_impl.h
index c88ec6e..6d930635 100644
--- a/content/browser/browser_child_process_host_impl.h
+++ b/content/browser/browser_child_process_host_impl.h
@@ -32,7 +32,7 @@
 class CommandLine;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -88,7 +88,7 @@
   bool CanShutdown() override;
   void OnChildDisconnected() override;
   const base::Process& GetProcess() const override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
   bool OnMessageReceived(const IPC::Message& message) override;
   void OnChannelConnected(int32_t peer_pid) override;
   void OnChannelError() override;
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index a7c63e5..e506041 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -42,9 +42,9 @@
 #include "services/file/file_service.h"
 #include "services/file/public/cpp/constants.h"
 #include "services/file/user_id_map.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 #include "storage/browser/database/database_tracker.h"
 #include "storage/browser/fileapi/external_mount_points.h"
 
@@ -150,9 +150,9 @@
 class BrowserContextServiceManagerConnectionHolder
     : public base::SupportsUserData::Data {
  public:
-   BrowserContextServiceManagerConnectionHolder(
-      std::unique_ptr<shell::Connection> connection,
-      shell::mojom::ServiceRequest request)
+  BrowserContextServiceManagerConnectionHolder(
+      std::unique_ptr<service_manager::Connection> connection,
+      service_manager::mojom::ServiceRequest request)
       : root_connection_(std::move(connection)),
         service_manager_connection_(ServiceManagerConnection::Create(
             std::move(request),
@@ -164,7 +164,7 @@
   }
 
  private:
-  std::unique_ptr<shell::Connection> root_connection_;
+  std::unique_ptr<service_manager::Connection> root_connection_;
   std::unique_ptr<ServiceManagerConnection> service_manager_connection_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserContextServiceManagerConnectionHolder);
@@ -435,12 +435,13 @@
     // NOTE: Many unit tests create a TestBrowserContext without initializing
     // Mojo or the global service manager connection.
 
-    shell::mojom::ServicePtr service;
-    shell::mojom::ServiceRequest service_request = mojo::GetProxy(&service);
+    service_manager::mojom::ServicePtr service;
+    service_manager::mojom::ServiceRequest service_request =
+        mojo::GetProxy(&service);
 
-    shell::mojom::PIDReceiverPtr pid_receiver;
-    shell::Connector::ConnectParams params(
-        shell::Identity(kBrowserServiceName, new_id));
+    service_manager::mojom::PIDReceiverPtr pid_receiver;
+    service_manager::Connector::ConnectParams params(
+        service_manager::Identity(kBrowserServiceName, new_id));
     params.set_client_process_connection(std::move(service),
                                          mojo::GetProxy(&pid_receiver));
     pid_receiver->SetPID(base::GetCurrentProcId());
@@ -489,7 +490,7 @@
 }
 
 // static
-shell::Connector* BrowserContext::GetConnectorFor(
+service_manager::Connector* BrowserContext::GetConnectorFor(
     BrowserContext* browser_context) {
   ServiceManagerConnection* connection =
       GetServiceManagerConnectionFor(browser_context);
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 654db69..b2a5fc3 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -75,6 +75,7 @@
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/tracing_controller.h"
 #include "content/public/common/content_client.h"
+#include "content/public/common/content_features.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/main_function_params.h"
 #include "content/public/common/result_codes.h"
@@ -89,7 +90,7 @@
 #include "net/socket/client_socket_factory.h"
 #include "net/ssl/ssl_config_service.h"
 #include "ppapi/features/features.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 #include "skia/ext/event_tracer_impl.h"
 #include "skia/ext/skia_memory_dump_provider.h"
 #include "sql/sql_memory_dump_provider.h"
@@ -746,19 +747,7 @@
       command_line->GetSwitchValueASCII(switches::kEnableFeatures),
       command_line->GetSwitchValueASCII(switches::kDisableFeatures));
 
-  // TODO(chrisha): Abstract away this construction mess to a helper function,
-  // once MemoryPressureMonitor is made a concrete class.
-#if defined(OS_CHROMEOS)
-  if (chromeos::switches::MemoryPressureHandlingEnabled()) {
-    memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor(
-        chromeos::switches::GetMemoryPressureThresholds()));
-  }
-#elif defined(OS_MACOSX)
-  memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor());
-#elif defined(OS_WIN)
-  memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor(
-      parsed_command_line_));
-#endif
+  InitializeMemoryManagementComponent();
 
 #if defined(ENABLE_PLUGINS)
   // Prior to any processing happening on the IO thread, we create the
@@ -1211,7 +1200,7 @@
   InitializeMojo();
 
 #if defined(USE_AURA)
-  if (shell::ShellIsRemote()) {
+  if (service_manager::ServiceManagerIsRemote()) {
     base::CommandLine::ForCurrentProcess()->AppendSwitch(
         switches::kIsRunningInMash);
   }
@@ -1248,7 +1237,7 @@
   established_gpu_channel = true;
   if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() ||
       parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) ||
-      shell::ShellIsRemote()) {
+      service_manager::ServiceManagerIsRemote()) {
     established_gpu_channel = always_uses_gpu = false;
   }
   gpu::GpuChannelEstablishFactory* factory =
@@ -1369,7 +1358,7 @@
   // ChildProcess instance which is created by the renderer thread.
   if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) &&
       !established_gpu_channel && always_uses_gpu && !UsingInProcessGpu() &&
-      !shell::ShellIsRemote()) {
+      !service_manager::ServiceManagerIsRemote()) {
     TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process",
                          TRACE_EVENT_SCOPE_THREAD);
     BrowserThread::PostTask(
@@ -1396,6 +1385,28 @@
          parsed_command_line_.HasSwitch(switches::kInProcessGPU);
 }
 
+void BrowserMainLoop::InitializeMemoryManagementComponent() {
+  if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) {
+    // Disable MemoryPressureListener when memory coordinator is enabled.
+    base::MemoryPressureListener::SetNotificationsSuppressed(true);
+    return;
+  }
+
+  // TODO(chrisha): Abstract away this construction mess to a helper function,
+  // once MemoryPressureMonitor is made a concrete class.
+#if defined(OS_CHROMEOS)
+  if (chromeos::switches::MemoryPressureHandlingEnabled()) {
+    memory_pressure_monitor_.reset(new base::chromeos::MemoryPressureMonitor(
+        chromeos::switches::GetMemoryPressureThresholds()));
+  }
+#elif defined(OS_MACOSX)
+  memory_pressure_monitor_.reset(new base::mac::MemoryPressureMonitor());
+#elif defined(OS_WIN)
+  memory_pressure_monitor_.reset(CreateWinMemoryPressureMonitor(
+      parsed_command_line_));
+#endif
+}
+
 bool BrowserMainLoop::InitializeToolkit() {
   TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit");
 
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h
index ec0ec8b..1464de7c 100644
--- a/content/browser/browser_main_loop.h
+++ b/content/browser/browser_main_loop.h
@@ -190,6 +190,8 @@
   void CreateAudioManager();
   bool UsingInProcessGpu() const;
 
+  void InitializeMemoryManagementComponent();
+
   // Quick reference for initialization order:
   // Constructor
   // Init()
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index 5657882d..51b8c59 100644
--- a/content/browser/browser_thread_impl.cc
+++ b/content/browser/browser_thread_impl.cc
@@ -190,7 +190,9 @@
       BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING) ||
       BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER) ||
       BrowserThread::CurrentlyOn(BrowserThread::CACHE)) {
-    base::MessageLoop::current()->DisallowNesting();
+    base::MessageLoop* message_loop = base::MessageLoop::current();
+    message_loop->DisallowNesting();
+    message_loop->DisallowTaskObservers();
   }
 
   using base::subtle::AtomicWord;
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
index 2f61190..b5accf789 100644
--- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
@@ -40,7 +40,7 @@
     gfx::SwapResult result,
     const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
   RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
-  client_->DidSwapBuffersComplete();
+  client_->DidReceiveSwapBuffersAck();
 }
 
 void GpuBrowserCompositorOutputSurface::OnReflectorChanged() {
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 9bf452a..fdb0fc4 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -47,7 +47,7 @@
 #include "gpu/command_buffer/client/shared_memory_limits.h"
 #include "gpu/command_buffer/common/mailbox.h"
 #include "gpu/ipc/client/gpu_channel_host.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 #include "third_party/khronos/GLES2/gl2.h"
 #include "ui/compositor/compositor.h"
 #include "ui/compositor/compositor_constants.h"
@@ -100,7 +100,7 @@
 const int kNumRetriesBeforeSoftwareFallback = 4;
 
 bool IsUsingMus() {
-  return shell::ShellIsRemote();
+  return service_manager::ServiceManagerIsRemote();
 }
 
 scoped_refptr<content::ContextProviderCommandBuffer> CreateContextCommon(
@@ -197,7 +197,7 @@
 GpuProcessTransportFactory::CreateSoftwareOutputDevice(
     ui::Compositor* compositor) {
 #if defined(USE_AURA)
-  if (shell::ShellIsRemote()) {
+  if (service_manager::ServiceManagerIsRemote()) {
     NOTREACHED();
     return nullptr;
   }
diff --git a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
index 122a395..8fdff08b 100644
--- a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc
@@ -181,7 +181,7 @@
 }
 
 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete() {
-  client_->DidSwapBuffersComplete();
+  client_->DidReceiveSwapBuffersAck();
 }
 
 }  // namespace content
diff --git a/content/browser/compositor/software_browser_compositor_output_surface.cc b/content/browser/compositor/software_browser_compositor_output_surface.cc
index 721166e..83d81bdc 100644
--- a/content/browser/compositor/software_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/software_browser_compositor_output_surface.cc
@@ -85,7 +85,7 @@
 }
 
 void SoftwareBrowserCompositorOutputSurface::SwapBuffersCallback() {
-  client_->DidSwapBuffersComplete();
+  client_->DidReceiveSwapBuffersAck();
 }
 
 bool SoftwareBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const {
diff --git a/content/browser/compositor/vulkan_browser_compositor_output_surface.cc b/content/browser/compositor/vulkan_browser_compositor_output_surface.cc
index 07d81ae..31ef0b7 100644
--- a/content/browser/compositor/vulkan_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/vulkan_browser_compositor_output_surface.cc
@@ -48,7 +48,7 @@
     gfx::SwapResult result,
     const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
   RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
-  client_->DidSwapBuffersComplete();
+  client_->DidReceiveSwapBuffersAck();
 }
 
 void VulkanBrowserCompositorOutputSurface::SwapBuffers(
diff --git a/content/browser/devtools/protocol/memory_handler.cc b/content/browser/devtools/protocol/memory_handler.cc
index 9107fa9..2670642 100644
--- a/content/browser/devtools/protocol/memory_handler.cc
+++ b/content/browser/devtools/protocol/memory_handler.cc
@@ -7,6 +7,7 @@
 #include "base/memory/memory_pressure_listener.h"
 #include "base/strings/stringprintf.h"
 #include "content/browser/memory/memory_pressure_controller_impl.h"
+#include "content/public/common/content_features.h"
 
 namespace content {
 namespace devtools {
@@ -18,6 +19,11 @@
 
 MemoryHandler::Response MemoryHandler::SetPressureNotificationsSuppressed(
     bool suppressed) {
+  if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) {
+    return Response::InvalidParams(
+        "Cannot enable/disable notifications when memory coordinator is "
+        "enabled");
+  }
   content::MemoryPressureControllerImpl::GetInstance()
       ->SetPressureNotificationsSuppressedInAllProcesses(suppressed);
   return Response::OK();
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc
index 528f713..dbf028e 100644
--- a/content/browser/dom_storage/dom_storage_context_wrapper.cc
+++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc
@@ -32,8 +32,8 @@
 #include "mojo/common/common_type_converters.h"
 #include "services/file/public/cpp/constants.h"
 #include "services/file/public/interfaces/file_system.mojom.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace content {
 namespace {
@@ -83,7 +83,8 @@
 // for now).
 class DOMStorageContextWrapper::MojoState {
  public:
-  MojoState(shell::Connector* connector, const base::FilePath& subdirectory)
+  MojoState(service_manager::Connector* connector,
+            const base::FilePath& subdirectory)
       : connector_(connector),
         // TODO(michaeln): Enable writing to disk when db is versioned,
         // for now using an empty subdirectory to use an in-memory db.
@@ -102,7 +103,7 @@
   }
 
   void OnUserServiceConnectionComplete() {
-    CHECK_EQ(shell::mojom::ConnectResult::SUCCEEDED,
+    CHECK_EQ(service_manager::mojom::ConnectResult::SUCCEEDED,
              file_service_connection_->GetResult());
   }
 
@@ -123,7 +124,7 @@
   // Maps between an origin and its prefixed LevelDB view.
   std::map<url::Origin, std::unique_ptr<LevelDBWrapperImpl>> level_db_wrappers_;
 
-  shell::Connector* const connector_;
+  service_manager::Connector* const connector_;
   const base::FilePath subdirectory_;
 
   enum ConnectionState {
@@ -132,7 +133,7 @@
     CONNECTION_FINISHED
   } connection_state_;
 
-  std::unique_ptr<shell::Connection> file_service_connection_;
+  std::unique_ptr<service_manager::Connection> file_service_connection_;
 
   file::mojom::FileSystemPtr file_system_;
   filesystem::mojom::DirectoryPtr directory_;
@@ -262,7 +263,7 @@
 }
 
 DOMStorageContextWrapper::DOMStorageContextWrapper(
-    shell::Connector* connector,
+    service_manager::Connector* connector,
     const base::FilePath& profile_path,
     const base::FilePath& local_partition_path,
     storage::SpecialStoragePolicy* special_storage_policy) {
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.h b/content/browser/dom_storage/dom_storage_context_wrapper.h
index d58bdf2..104ae996 100644
--- a/content/browser/dom_storage/dom_storage_context_wrapper.h
+++ b/content/browser/dom_storage/dom_storage_context_wrapper.h
@@ -22,7 +22,7 @@
 class FilePath;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -44,7 +44,7 @@
  public:
   // If |data_path| is empty, nothing will be saved to disk.
   DOMStorageContextWrapper(
-      shell::Connector* connector,
+      service_manager::Connector* connector,
       const base::FilePath& data_path,
       const base::FilePath& local_partition_path,
       storage::SpecialStoragePolicy* special_storage_policy);
diff --git a/content/browser/frame_host/navigator.h b/content/browser/frame_host/navigator.h
index 3424428f..3e623d3 100644
--- a/content/browser/frame_host/navigator.h
+++ b/content/browser/frame_host/navigator.h
@@ -114,7 +114,6 @@
       const GURL& url,
       bool uses_post,
       const scoped_refptr<ResourceRequestBodyImpl>& body,
-      const std::string& extra_headers,
       SiteInstance* source_site_instance,
       const Referrer& referrer,
       WindowOpenDisposition disposition,
@@ -135,8 +134,7 @@
       const GlobalRequestID& transferred_global_request_id,
       bool should_replace_current_entry,
       const std::string& method,
-      scoped_refptr<ResourceRequestBodyImpl> post_body,
-      const std::string& extra_headers) {}
+      scoped_refptr<ResourceRequestBodyImpl> post_body) {}
 
   // PlzNavigate
   // Called after receiving a BeforeUnloadACK IPC from the renderer. If
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index 6753663..8e704b1 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -423,10 +423,10 @@
     CHECK_EQ(controller_->GetPendingEntry(), &entry);
 
   if (controller_->GetPendingEntryIndex() == -1 &&
-      IsRendererDebugURL(dest_url)) {
+      dest_url.SchemeIs(url::kJavaScriptScheme)) {
     // If the pending entry index is -1 (which means a new navigation rather
-    // than a history one), and the user typed in a debug URL, don't add it to
-    // the session history.
+    // than a history one), and the user typed in a javascript: URL, don't add
+    // it to the session history.
     //
     // This is a hack. What we really want is to avoid adding to the history any
     // URL that doesn't generate content, and what would be great would be if we
@@ -692,7 +692,6 @@
     const GURL& url,
     bool uses_post,
     const scoped_refptr<ResourceRequestBodyImpl>& body,
-    const std::string& extra_headers,
     SiteInstance* source_site_instance,
     const Referrer& referrer,
     WindowOpenDisposition disposition,
@@ -738,7 +737,6 @@
                        true /* is_renderer_initiated */);
   params.uses_post = uses_post;
   params.post_data = body;
-  params.extra_headers = extra_headers;
   params.source_site_instance = source_site_instance;
   if (redirect_chain.size() > 0)
     params.redirect_chain = redirect_chain;
@@ -781,8 +779,7 @@
     const GlobalRequestID& transferred_global_request_id,
     bool should_replace_current_entry,
     const std::string& method,
-    scoped_refptr<ResourceRequestBodyImpl> post_body,
-    const std::string& extra_headers) {
+    scoped_refptr<ResourceRequestBodyImpl> post_body) {
   // |method != "POST"| should imply absence of |post_body|.
   if (method != "POST" && post_body) {
     NOTREACHED();
@@ -842,7 +839,6 @@
     CHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
     if (controller_->GetLastCommittedEntry()) {
       entry = controller_->GetLastCommittedEntry()->Clone();
-      entry->set_extra_headers(extra_headers);
     } else {
       // If there's no last committed entry, create an entry for about:blank
       // with a subframe entry for our destination.
@@ -850,7 +846,7 @@
       entry = NavigationEntryImpl::FromNavigationEntry(
           controller_->CreateNavigationEntry(
               GURL(url::kAboutBlankURL), referrer_to_use, page_transition,
-              is_renderer_initiated, extra_headers,
+              is_renderer_initiated, std::string(),
               controller_->GetBrowserContext()));
     }
     entry->AddOrUpdateFrameEntry(
@@ -863,7 +859,7 @@
     entry = NavigationEntryImpl::FromNavigationEntry(
         controller_->CreateNavigationEntry(
             dest_url, referrer_to_use, page_transition, is_renderer_initiated,
-            extra_headers, controller_->GetBrowserContext()));
+            std::string(), controller_->GetBrowserContext()));
     entry->root_node()->frame_entry->set_source_site_instance(
         static_cast<SiteInstanceImpl*>(source_site_instance));
     entry->SetRedirectChain(redirect_chain);
@@ -987,7 +983,12 @@
   NavigationRequest* navigation_request = frame_tree_node->navigation_request();
   DCHECK(navigation_request);
 
-  DiscardPendingEntryIfNeeded(navigation_request->navigation_handle());
+  // With PlzNavigate, debug URLs will give a failed navigation because the
+  // WebUI backend won't find a handler for them. They will be processed in the
+  // renderer, however do not discard the pending entry so that the URL bar
+  // shows them correctly.
+  if (!IsRendererDebugURL(navigation_request->navigation_handle()->GetURL()))
+    DiscardPendingEntryIfNeeded(navigation_request->navigation_handle());
 
   // If the request was canceled by the user do not show an error page.
   if (error_code == net::ERR_ABORTED) {
diff --git a/content/browser/frame_host/navigator_impl.h b/content/browser/frame_host/navigator_impl.h
index a2bf25c..b00b118 100644
--- a/content/browser/frame_host/navigator_impl.h
+++ b/content/browser/frame_host/navigator_impl.h
@@ -67,23 +67,22 @@
                       const GURL& url,
                       bool uses_post,
                       const scoped_refptr<ResourceRequestBodyImpl>& body,
-                      const std::string& extra_headers,
                       SiteInstance* source_site_instance,
                       const Referrer& referrer,
                       WindowOpenDisposition disposition,
                       bool should_replace_current_entry,
                       bool user_gesture) override;
-  void RequestTransferURL(RenderFrameHostImpl* render_frame_host,
-                          const GURL& url,
-                          SiteInstance* source_site_instance,
-                          const std::vector<GURL>& redirect_chain,
-                          const Referrer& referrer,
-                          ui::PageTransition page_transition,
-                          const GlobalRequestID& transferred_global_request_id,
-                          bool should_replace_current_entry,
-                          const std::string& method,
-                          scoped_refptr<ResourceRequestBodyImpl> post_body,
-                          const std::string& extra_headers) override;
+  void RequestTransferURL(
+      RenderFrameHostImpl* render_frame_host,
+      const GURL& url,
+      SiteInstance* source_site_instance,
+      const std::vector<GURL>& redirect_chain,
+      const Referrer& referrer,
+      ui::PageTransition page_transition,
+      const GlobalRequestID& transferred_global_request_id,
+      bool should_replace_current_entry,
+      const std::string& method,
+      scoped_refptr<ResourceRequestBodyImpl> post_body) override;
   void OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, bool proceed) override;
   void OnBeginNavigation(FrameTreeNode* frame_tree_node,
                          const CommonNavigationParams& common_params,
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 4c858241..da7dfa1 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -99,8 +99,8 @@
 #include "media/mojo/interfaces/service_factory.mojom.h"
 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/modules/shapedetection/shapedetection.mojom.h"
 #include "ui/accessibility/ax_tree.h"
 #include "ui/accessibility/ax_tree_update.h"
@@ -370,10 +370,15 @@
 
   // If this RenderFrameHost is swapping with a RenderFrameProxyHost, the
   // RenderFrame will already be deleted in the renderer process. Main frame
-  // RenderFrames will be cleaned up as part of deleting its RenderView. In all
-  // other cases, the RenderFrame should be cleaned up (if it exists).
-  if (is_active() && !frame_tree_node_->IsMainFrame() && render_frame_created_)
+  // RenderFrames will be cleaned up as part of deleting its RenderView if the
+  // RenderView isn't in use by other frames. In all other cases, the
+  // RenderFrame should be cleaned up (if it exists).
+  bool will_render_view_clean_up_render_frame =
+      frame_tree_node_->IsMainFrame() && render_view_host_->ref_count() == 1;
+  if (is_active() && render_frame_created_ &&
+      !will_render_view_clean_up_render_frame) {
     Send(new FrameMsg_Delete(routing_id_));
+  }
 
   // Null out the swapout timer; in crash dumps this member will be null only if
   // the dtor has run.  (It may also be null in tests.)
@@ -529,11 +534,12 @@
   return render_view_host_;
 }
 
-shell::InterfaceRegistry* RenderFrameHostImpl::GetInterfaceRegistry() {
+service_manager::InterfaceRegistry*
+RenderFrameHostImpl::GetInterfaceRegistry() {
   return interface_registry_.get();
 }
 
-shell::InterfaceProvider* RenderFrameHostImpl::GetRemoteInterfaces() {
+service_manager::InterfaceProvider* RenderFrameHostImpl::GetRemoteInterfaces() {
   return remote_interfaces_.get();
 }
 
@@ -855,23 +861,23 @@
 }
 
 void RenderFrameHostImpl::Create(
-    const shell::Identity& remote_identity,
+    const service_manager::Identity& remote_identity,
     media::mojom::ServiceFactoryRequest request) {
-  std::unique_ptr<shell::InterfaceRegistry> registry(
-      new shell::InterfaceRegistry);
+  std::unique_ptr<service_manager::InterfaceRegistry> registry(
+      new service_manager::InterfaceRegistry);
 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM)
   registry->AddInterface(
       base::Bind(&ProvisionFetcherImpl::Create, this));
 #endif
   GetContentClient()->browser()->ExposeInterfacesToMediaService(registry.get(),
                                                                 this);
-  shell::mojom::InterfaceProviderPtr interfaces;
+  service_manager::mojom::InterfaceProviderPtr interfaces;
   registry->Bind(GetProxy(&interfaces));
   media_registries_.push_back(std::move(registry));
 
   // TODO(slan): Use the BrowserContext Connector instead. See crbug.com/638950.
   media::mojom::MediaServicePtr media_service;
-  shell::Connector* connector =
+  service_manager::Connector* connector =
       ServiceManagerConnection::GetForProcess()->GetConnector();
   connector->ConnectToInterface("service:media", &media_service);
   media_service->CreateServiceFactory(std::move(request),
@@ -925,8 +931,7 @@
     params->widget_params->hidden = true;
   }
 
-  RenderProcessHostImpl::GetRendererInterface(GetProcess())->CreateFrame(
-      std::move(params));
+  GetProcess()->GetRendererInterface()->CreateFrame(std::move(params));
 
   // The RenderWidgetHost takes ownership of its view. It is tied to the
   // lifetime of the current RenderProcessHost for this RenderFrameHost.
@@ -2395,9 +2400,8 @@
                validated_url.possibly_invalid_spec());
   frame_tree_node_->navigator()->RequestOpenURL(
       this, validated_url, params.uses_post, params.resource_request_body,
-      params.extra_headers, source_site_instance, params.referrer,
-      params.disposition, params.should_replace_current_entry,
-      params.user_gesture);
+      source_site_instance, params.referrer, params.disposition,
+      params.should_replace_current_entry, params.user_gesture);
 }
 
 void RenderFrameHostImpl::Stop() {
@@ -2620,7 +2624,7 @@
   if (interface_registry_.get())
     return;
 
-  interface_registry_.reset(new shell::InterfaceRegistry);
+  interface_registry_.reset(new service_manager::InterfaceRegistry);
   if (!GetProcess()->GetRemoteInterfaces())
     return;
 
@@ -2630,11 +2634,10 @@
   frame_factory->CreateFrame(routing_id_, GetProxy(&frame_),
                              frame_host_binding_.CreateInterfacePtrAndBind());
 
-
-  shell::mojom::InterfaceProviderPtr remote_interfaces;
-  shell::mojom::InterfaceProviderRequest remote_interfaces_request =
+  service_manager::mojom::InterfaceProviderPtr remote_interfaces;
+  service_manager::mojom::InterfaceProviderRequest remote_interfaces_request =
       GetProxy(&remote_interfaces);
-  remote_interfaces_.reset(new shell::InterfaceProvider);
+  remote_interfaces_.reset(new service_manager::InterfaceProvider);
   remote_interfaces_->Bind(std::move(remote_interfaces));
   frame_->GetInterfaceProvider(std::move(remote_interfaces_request));
 }
@@ -2904,7 +2907,7 @@
 }
 
 void RenderFrameHostImpl::GetInterfaceProvider(
-    shell::mojom::InterfaceProviderRequest interfaces) {
+    service_manager::mojom::InterfaceProviderRequest interfaces) {
   interface_registry_->Bind(std::move(interfaces));
 }
 
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index 90059a0..fe2738d 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -38,8 +38,8 @@
 #include "content/public/common/javascript_message_type.h"
 #include "media/mojo/interfaces/service_factory.mojom.h"
 #include "net/http/http_response_headers.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h"
 #include "third_party/WebKit/public/web/WebTextDirection.h"
 #include "third_party/WebKit/public/web/WebTreeScopeType.h"
@@ -103,7 +103,7 @@
       public BrowserAccessibilityDelegate,
       public SiteInstanceImpl::Observer,
       public NON_EXPORTED_BASE(
-          shell::InterfaceFactory<media::mojom::ServiceFactory>) {
+          service_manager::InterfaceFactory<media::mojom::ServiceFactory>) {
  public:
   using AXTreeSnapshotCallback =
       base::Callback<void(
@@ -153,8 +153,8 @@
   void CopyImageAt(int x, int y) override;
   void SaveImageAt(int x, int y) override;
   RenderViewHost* GetRenderViewHost() override;
-  shell::InterfaceRegistry* GetInterfaceRegistry() override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceRegistry* GetInterfaceRegistry() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
   AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
   blink::WebPageVisibilityState GetVisibilityState() override;
   bool IsRenderFrameLive() override;
@@ -167,7 +167,7 @@
 
   // mojom::FrameHost
   void GetInterfaceProvider(
-      shell::mojom::InterfaceProviderRequest interfaces) override;
+      service_manager::mojom::InterfaceProviderRequest interfaces) override;
 
   // IPC::Sender
   bool Send(IPC::Message* msg) override;
@@ -207,8 +207,8 @@
   // SiteInstanceImpl::Observer
   void RenderProcessGone(SiteInstanceImpl* site_instance) override;
 
-  // shell::InterfaceFactory<media::mojom::ServiceFactory>
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<media::mojom::ServiceFactory>
+  void Create(const service_manager::Identity& remote_identity,
               media::mojom::ServiceFactoryRequest request) override;
 
   // Creates a RenderFrame in the renderer process.
@@ -965,8 +965,8 @@
   // SiteInstance.  May be null in tests.
   std::unique_ptr<TimeoutMonitor> swapout_event_monitor_timeout_;
 
-  std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
-  std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
+  std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
+  std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
 
 #if defined(OS_ANDROID)
   // The filter for MessagePort messages between an Android apps and web.
@@ -1053,7 +1053,8 @@
   // |FrameHostMsg_TextSurroundingSelectionResponse| message comes.
   TextSurroundingSelectionCallback text_surrounding_selection_callback_;
 
-  std::vector<std::unique_ptr<shell::InterfaceRegistry>> media_registries_;
+  std::vector<std::unique_ptr<service_manager::InterfaceRegistry>>
+      media_registries_;
 
   std::unique_ptr<AssociatedInterfaceProviderImpl>
       remote_associated_interfaces_;
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index ecdfe854..1a8acb9 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -230,7 +230,8 @@
     // with the new render frame if necessary.  Note that this call needs to
     // occur before initializing the RenderView; the flow of creating the
     // RenderView can cause browser-side code to execute that expects the this
-    // RFH's shell::InterfaceRegistry to be initialized (e.g., if the site is a
+    // RFH's service_manager::InterfaceRegistry to be initialized (e.g., if the
+    // site is a
     // WebUI site that is handled via Mojo, then Mojo WebUI code in //chrome
     // will add an interface to this RFH's InterfaceRegistry).
     dest_render_frame_host->SetUpMojoIfNeeded();
@@ -456,14 +457,6 @@
   std::vector<GURL> rest_of_chain = transfer_url_chain;
   rest_of_chain.pop_back();
 
-  // |extra_headers| passed to RequestTransferURL below are always empty for
-  // now, because there are no known scenarios where headers (from POST request
-  // made from one renderer) need to be forwarded into the renderer where that
-  // request ends up being transfered to.  In particular, XSSAuditor doesn't
-  // look at the headers (e.g. the Content-Type header) when analyzing the body
-  // of the POST request.
-  std::string extra_headers;
-
   transferring_render_frame_host->frame_tree_node()
       ->navigator()
       ->RequestTransferURL(
@@ -471,7 +464,7 @@
           referrer, page_transition, global_request_id,
           should_replace_current_entry,
           transfer_navigation_handle_->IsPost() ? "POST" : "GET",
-          transfer_navigation_handle_->resource_request_body(), extra_headers);
+          transfer_navigation_handle_->resource_request_body());
 
   // If the navigation continued, the NavigationHandle should have been
   // transfered to a RenderFrameHost. In the other cases, it should be cleared.
@@ -661,11 +654,12 @@
   // TODO(carlosk): this code is very similar to what can be found in
   // SwapOutOldFrame and we should see that these are unified at some point.
 
-  // If the SiteInstance for the pending RFH is being used by others don't
-  // delete the RFH. Just swap it out and it can be reused at a later point.
-  // In --site-per-process, RenderFrameHosts are not kept around and are
-  // deleted when not used, replaced by RenderFrameProxyHosts.
+  // If the SiteInstance for the pending RFH is being used by others, ensure
+  // that it is replaced by a RenderFrameProxyHost to allow other frames to
+  // communicate to this frame.
   SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance();
+  RenderViewHostImpl* rvh = render_frame_host->render_view_host();
+  RenderFrameProxyHost* proxy = nullptr;
   if (site_instance->HasSite() && site_instance->active_frame_count() > 1) {
     // Any currently suspended navigations are no longer needed.
     render_frame_host->CancelSuspendedNavigations();
@@ -675,14 +669,30 @@
     // |render_frame_host|, as this method is only called to discard a pending
     // or speculative RenderFrameHost, i.e. one that has never hosted an actual
     // document.
-    RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(site_instance);
-    if (!proxy) {
-      proxy = CreateRenderFrameProxyHost(site_instance,
-                                         render_frame_host->render_view_host());
-    }
+    proxy = GetRenderFrameProxyHost(site_instance);
+    if (!proxy)
+      proxy = CreateRenderFrameProxyHost(site_instance, rvh);
+  }
+
+  // Doing this is important in the case where the replacement proxy is created
+  // above, as the RenderViewHost will continue to exist and should be
+  // considered swapped out if it is ever reused.  When there's no replacement
+  // proxy, this doesn't really matter, as the RenderViewHost will be destroyed
+  // shortly, since |render_frame_host| is its last active frame and will be
+  // deleted below.  See https://crbug.com/627400.
+  if (frame_tree_node_->IsMainFrame()) {
+    rvh->set_main_frame_routing_id(MSG_ROUTING_NONE);
+    rvh->set_is_active(false);
+    rvh->set_is_swapped_out(true);
   }
 
   render_frame_host.reset();
+
+  // If a new RenderFrameProxyHost was created above, or if the old proxy isn't
+  // live, create the RenderFrameProxy in the renderer, so that other frames
+  // can still communicate with this frame.  See https://crbug.com/653746.
+  if (proxy && !proxy->is_render_frame_proxy_live())
+    proxy->InitRenderFrameProxy();
 }
 
 bool RenderFrameHostManager::DeleteFromPendingList(
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc
index 8fe6a7b..23a083b6 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -186,7 +186,7 @@
 
   int view_routing_id = frame_tree_node_->frame_tree()
       ->GetRenderViewHost(site_instance_.get())->GetRoutingID();
-  RenderProcessHostImpl::GetRendererInterface(GetProcess())->CreateFrameProxy(
+  GetProcess()->GetRendererInterface()->CreateFrameProxy(
       routing_id_, view_routing_id, opener_routing_id, parent_routing_id,
       frame_tree_node_->current_replication_state());
 
@@ -258,15 +258,11 @@
 
   // TODO(alexmos, creis): Figure out whether |params.user_gesture| needs to be
   // passed in as well.
-  // TODO(lfg, lukasza): Remove |extra_headers| parameter from
-  // RequestTransferURL method once both RenderFrameProxyHost and
-  // RenderFrameHostImpl call RequestOpenURL from their OnOpenURL handlers.
-  // See also https://crbug.com/647772.
   frame_tree_node_->navigator()->RequestTransferURL(
       current_rfh, validated_url, site_instance_.get(), std::vector<GURL>(),
       params.referrer, ui::PAGE_TRANSITION_LINK, GlobalRequestID(),
       params.should_replace_current_entry, params.uses_post ? "POST" : "GET",
-      params.resource_request_body, params.extra_headers);
+      params.resource_request_body);
 }
 
 void RenderFrameProxyHost::OnRouteMessageEvent(
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index f6af12a..c3e6f3ea 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -28,7 +28,7 @@
 #include "gpu/ipc/common/gpu_messages.h"
 #include "ipc/ipc_channel_handle.h"
 #include "ipc/message_filter.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 
 namespace content {
 
@@ -273,7 +273,7 @@
 
 void BrowserGpuChannelHostFactory::EstablishGpuChannel(
     const gpu::GpuChannelEstablishedCallback& callback) {
-  DCHECK(!shell::ShellIsRemote());
+  DCHECK(!service_manager::ServiceManagerIsRemote());
   if (gpu_channel_.get() && gpu_channel_->IsLost()) {
     DCHECK(!pending_request_.get());
     // Recreate the channel if it has been lost.
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index d444801..d6d52f2 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -62,9 +62,9 @@
 #include "ipc/message_filter.h"
 #include "media/base/media_switches.h"
 #include "mojo/edk/embedder/embedder.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/runner/common/client_util.h"
 #include "ui/base/ui_base_switches.h"
 #include "ui/events/latency_info.h"
 #include "ui/gl/gl_switches.h"
@@ -299,9 +299,9 @@
 
  private:
   // ConnectionFilter:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry,
-                 shell::Connector* connector) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry,
+                 service_manager::Connector* connector) override {
     if (remote_identity.name() != kGpuServiceName)
       return false;
 
@@ -335,7 +335,7 @@
 
 // static
 GpuProcessHost* GpuProcessHost::Get(GpuProcessKind kind, bool force_create) {
-  DCHECK(!shell::ShellIsRemote());
+  DCHECK(!service_manager::ServiceManagerIsRemote());
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
   // Don't grant further access to GPU if it is not allowed.
@@ -415,7 +415,7 @@
   g_gpu_main_thread_factory = create;
 }
 
-shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() {
+service_manager::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() {
   return process_->child_connection()->GetRemoteInterfaces();
 }
 
diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h
index c8e66825..6fe3a94 100644
--- a/content/browser/gpu/gpu_process_host.h
+++ b/content/browser/gpu/gpu_process_host.h
@@ -47,7 +47,7 @@
 struct SyncToken;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -113,7 +113,7 @@
   CONTENT_EXPORT static void RegisterGpuMainThreadFactory(
       GpuMainThreadFactoryFunction create);
 
-  shell::InterfaceProvider* GetRemoteInterfaces();
+  service_manager::InterfaceProvider* GetRemoteInterfaces();
 
   // Get the GPU process host for the GPU process with the given ID. Returns
   // null if the process no longer exists.
diff --git a/content/browser/mojo_sandbox_browsertest.cc b/content/browser/mojo_sandbox_browsertest.cc
index 4a1ef7e..f3eddd9 100644
--- a/content/browser/mojo_sandbox_browsertest.cc
+++ b/content/browser/mojo_sandbox_browsertest.cc
@@ -14,7 +14,7 @@
 #include "content/public/browser/utility_process_host_client.h"
 #include "content/public/test/content_browser_test.h"
 #include "content/public/test/test_service.mojom.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace content {
 namespace {
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 80817ca6..a3f683f 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -302,7 +302,7 @@
       gfx::SwapResult result,
       const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
     RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
-    client_->DidSwapBuffersComplete();
+    client_->DidReceiveSwapBuffersAck();
   }
 
  private:
@@ -349,7 +349,7 @@
   void SwapBuffers(cc::CompositorFrame frame) override {
     surface_->SwapBuffers();
     task_runner_->PostTask(FROM_HERE,
-                           base::Bind(&VulkanOutputSurface::SwapBuffersCallback,
+                           base::Bind(&VulkanOutputSurface::SwapBuffersAck,
                                       weak_ptr_factory_.GetWeakPtr()));
   }
 
@@ -361,9 +361,7 @@
   }
 
  private:
-  void OutputSurface::SwapBuffersCallback() {
-    client_->DidSwapBuffersComplete();
-  }
+  void SwapBuffersAck() { client_->DidReceiveSwapBuffersAck(); }
 
   std::unique_ptr<gpu::VulkanSurface> surface_;
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
index a4d5ba9..a8d3ac2 100644
--- a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
+++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc
@@ -255,7 +255,7 @@
     // first scroll event in a sequence and the original timestamp of that
     // scroll event's underlying touch/wheel event.
     UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY(
-        "Event.Latency." + event_type_name +
+        "Event.Latency.ScrollUpdate." + event_type_name +
             ".TimeToFirstScrollUpdateSwapBegin2",
         original_component, gpu_swap_begin_component);
   } else if (latency.FindLatency(
@@ -266,7 +266,8 @@
     // First scroll events are excluded from this metric.
     if (event_type_name == "Touch") {
       UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY(
-          "Event.Latency." + event_type_name + ".TimeToScrollUpdateSwapBegin2",
+          "Event.Latency.ScrollUpdate." + event_type_name +
+              ".TimeToScrollUpdateSwapBegin2",
           original_component, gpu_swap_begin_component);
     }
   } else {
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
index c3cc587..549945ec 100644
--- a/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
+++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc
@@ -121,8 +121,10 @@
         EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1));
         EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1));
 
-        EXPECT_TRUE(HistogramSizeEq(
-            "Event.Latency.Wheel.TimeToFirstScrollUpdateSwapBegin2", 1));
+        EXPECT_TRUE(
+            HistogramSizeEq("Event.Latency.ScrollUpdate.Wheel."
+                            "TimeToFirstScrollUpdateSwapBegin2",
+                            1));
 
         EXPECT_TRUE(HistogramSizeEq(
             "Event.Latency.ScrollUpdate.Wheel.TimeToHandled2_Main",
@@ -225,10 +227,11 @@
           "Event.Latency.ScrollUpdate.BrowserNotifiedToBeforeGpuSwap", 1));
       EXPECT_TRUE(HistogramSizeEq("Event.Latency.ScrollUpdate.GpuSwap", 1));
       EXPECT_TRUE(HistogramSizeEq(
-          "Event.Latency.Touch.TimeToFirstScrollUpdateSwapBegin2", 1));
+          "Event.Latency.ScrollUpdate.Touch.TimeToFirstScrollUpdateSwapBegin2",
+          1));
 
       EXPECT_TRUE(HistogramSizeEq(
-          "Event.Latency.Touch.TimeToScrollUpdateSwapBegin2", 0));
+          "Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", 0));
 
       EXPECT_TRUE(HistogramSizeEq(
           "Event.Latency.ScrollUpdate.Touch.TimeToHandled2_Main",
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
index 01e0e43..688e2e67 100644
--- a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
+++ b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
@@ -19,7 +19,7 @@
 #include "content/public/browser/resource_context.h"
 #include "content/public/common/media_stream_request.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "url/origin.h"
 
 namespace content {
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc
index 7cd548a..d83a3bf 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -659,8 +659,7 @@
     VideoCaptureControllerEventHandler* client_handler,
     const DoneCB& done_cb) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
-  DVLOG(1) << "VideoCaptureManager::StartCaptureForClient #" << session_id
-           << ", request: "
+  DVLOG(1) << __func__ << ", session_id = " << session_id << ", request: "
            << media::VideoCaptureFormat::ToString(params.requested_format);
 
   DeviceEntry* entry = GetOrCreateDeviceEntry(session_id, params);
@@ -712,21 +711,22 @@
     }
   } else {
     LogVideoCaptureEvent(VIDEO_CAPTURE_STOP_CAPTURE_DUE_TO_ERROR);
-    SessionMap::iterator it;
-    for (it = sessions_.begin(); it != sessions_.end(); ++it) {
-      if (it->second.type == entry->stream_type &&
-          it->second.id == entry->id) {
-        listener_->Aborted(it->second.type, it->first);
+    for (auto it : sessions_) {
+      if (it.second.type == entry->stream_type && it.second.id == entry->id) {
+        listener_->Aborted(it.second.type, it.first);
+        // Aborted() call might synchronously destroy |entry|, recheck.
+        entry = GetDeviceEntryByController(controller);
+        if (!entry)
+          return;
         break;
       }
     }
   }
 
   // Detach client from controller.
-  media::VideoCaptureSessionId session_id =
+  const media::VideoCaptureSessionId session_id =
       controller->RemoveClient(client_id, client_handler);
-  DVLOG(1) << "VideoCaptureManager::StopCaptureForClient, session_id = "
-           << session_id;
+  DVLOG(1) << __func__ << ", session_id = " << session_id;
 
   // If controller has no more clients, delete controller and device.
   DestroyDeviceEntryIfNoClients(entry);
diff --git a/content/browser/renderer_host/render_process_host_browsertest.cc b/content/browser/renderer_host/render_process_host_browsertest.cc
index 01531ec..f1b7ec4 100644
--- a/content/browser/renderer_host/render_process_host_browsertest.cc
+++ b/content/browser/renderer_host/render_process_host_browsertest.cc
@@ -19,8 +19,8 @@
 #include "content/public/test/test_service.mojom.h"
 #include "content/shell/browser/shell.h"
 #include "net/test/embedded_test_server/embedded_test_server.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 #if defined(OS_WIN)
 #include "base/win/windows_version.h"
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 6268885..d9d0883 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -177,10 +177,10 @@
 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "ppapi/shared_impl/ppapi_switches.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/runner/common/switches.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/runner/common/switches.h"
 #include "storage/browser/fileapi/sandbox_file_system_backend.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "ui/base/ui_base_switches.h"
@@ -249,7 +249,6 @@
 namespace content {
 namespace {
 
-const char kRendererInterfaceKeyName[] = "mojom_renderer_interface";
 const char kSiteProcessMapKeyName[] = "content_site_process_map";
 
 #ifdef ENABLE_WEBRTC
@@ -366,21 +365,6 @@
   return map;
 }
 
-// Holds a Mojo associated interface proxy in an RPH's user data.
-template <typename Interface>
-class AssociatedInterfaceHolder : public base::SupportsUserData::Data {
- public:
-  AssociatedInterfaceHolder() {}
-  ~AssociatedInterfaceHolder() override {}
-
-  mojo::AssociatedInterfacePtr<Interface>& proxy() { return proxy_; }
-
- private:
-  mojo::AssociatedInterfacePtr<Interface> proxy_;
-
-  DISALLOW_COPY_AND_ASSIGN(AssociatedInterfaceHolder);
-};
-
 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
 // This static member variable holds the zygote communication information for
 // the renderer.
@@ -518,8 +502,8 @@
 class RenderProcessHostImpl::ConnectionFilterImpl : public ConnectionFilter {
  public:
   ConnectionFilterImpl(
-      const shell::Identity& child_identity,
-      std::unique_ptr<shell::InterfaceRegistry> registry)
+      const service_manager::Identity& child_identity,
+      std::unique_ptr<service_manager::InterfaceRegistry> registry)
       : child_identity_(child_identity),
         registry_(std::move(registry)),
         controller_(new ConnectionFilterController(this)),
@@ -546,9 +530,9 @@
 
  private:
   // ConnectionFilter:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry,
-                 shell::Connector* connector) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry,
+                 service_manager::Connector* connector) override {
     DCHECK(thread_checker_.CalledOnValidThread());
     DCHECK_CURRENTLY_ON(BrowserThread::IO);
     // We only fulfill connections from the renderer we host.
@@ -578,7 +562,7 @@
                     mojo::ScopedMessagePipeHandle handle) {
     DCHECK(thread_checker_.CalledOnValidThread());
     DCHECK_CURRENTLY_ON(BrowserThread::IO);
-    shell::mojom::InterfaceProvider* provider = registry_.get();
+    service_manager::mojom::InterfaceProvider* provider = registry_.get();
 
     base::AutoLock lock(enabled_lock_);
     if (enabled_)
@@ -586,8 +570,8 @@
   }
 
   base::ThreadChecker thread_checker_;
-  shell::Identity child_identity_;
-  std::unique_ptr<shell::InterfaceRegistry> registry_;
+  service_manager::Identity child_identity_;
+  std::unique_ptr<service_manager::InterfaceRegistry> registry_;
   scoped_refptr<ConnectionFilterController> controller_;
 
   // Guards |enabled_|.
@@ -953,7 +937,7 @@
 
   // Acquire a Connector which will route connections to a new instance of the
   // renderer service.
-  shell::Connector* connector =
+  service_manager::Connector* connector =
       BrowserContext::GetConnectorFor(browser_context_);
   if (!connector) {
     // Note that some embedders (e.g. Android WebView) may not initialize a
@@ -964,7 +948,8 @@
       // ServiceManagerConnection prior to this point. This class of test code
       // doesn't care about render processes, so we can initialize a dummy
       // connection.
-      shell::mojom::ServiceRequest request = mojo::GetProxy(&test_service_);
+      service_manager::mojom::ServiceRequest request =
+          mojo::GetProxy(&test_service_);
       ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create(
           std::move(request), io_task_runner));
     }
@@ -1031,11 +1016,7 @@
   // See OnProcessLaunched() for some additional details of this somewhat
   // surprising behavior.
   channel_->GetRemoteAssociatedInterface(&remote_route_provider_);
-
-  std::unique_ptr<AssociatedInterfaceHolder<mojom::Renderer>> holder =
-      base::MakeUnique<AssociatedInterfaceHolder<mojom::Renderer>>();
-  channel_->GetRemoteAssociatedInterface(&holder->proxy());
-  SetUserData(kRendererInterfaceKeyName, holder.release());
+  channel_->GetRemoteAssociatedInterface(&renderer_interface_);
 
   // We start the Channel in a paused state. It will be briefly unpaused again
   // in Init() if applicable, before process launch is initiated.
@@ -1225,8 +1206,8 @@
 }
 
 void RenderProcessHostImpl::RegisterMojoInterfaces() {
-  std::unique_ptr<shell::InterfaceRegistry> registry(
-      new shell::InterfaceRegistry);
+  std::unique_ptr<service_manager::InterfaceRegistry> registry(
+      new service_manager::InterfaceRegistry);
 
   channel_->AddAssociatedInterface(
       base::Bind(&RenderProcessHostImpl::OnRouteProviderRequest,
@@ -1359,7 +1340,8 @@
   widget_helper_->ResumeDeferredNavigation(request_id);
 }
 
-shell::InterfaceProvider* RenderProcessHostImpl::GetRemoteInterfaces() {
+service_manager::InterfaceProvider*
+RenderProcessHostImpl::GetRemoteInterfaces() {
   return child_connection_->GetRemoteInterfaces();
 }
 
@@ -1431,26 +1413,12 @@
   Send(new ChildProcessMsg_PurgeAndSuspend());
 }
 
-mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() {
-  return remote_route_provider_.get();
+mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() {
+  return renderer_interface_.get();
 }
 
-// static
-mojom::Renderer* RenderProcessHostImpl::GetRendererInterface(
-    RenderProcessHost* host) {
-  AssociatedInterfaceHolder<mojom::Renderer>* holder =
-      static_cast<AssociatedInterfaceHolder<mojom::Renderer>*>(
-          host->GetUserData(kRendererInterfaceKeyName));
-  if (!holder) {
-    // In tests, MockRenderProcessHost will not have initialized this key on its
-    // own. We do it with a dead-end endpoint so outgoing requests are silently
-    // dropped.
-    holder = new AssociatedInterfaceHolder<mojom::Renderer>;
-    host->SetUserData(kRendererInterfaceKeyName, holder);
-    mojo::GetDummyProxyForTesting(&holder->proxy());
-  }
-
-  return holder->proxy().get();
+mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() {
+  return remote_route_provider_.get();
 }
 
 void RenderProcessHostImpl::AddRoute(int32_t routing_id,
@@ -2702,7 +2670,7 @@
   // Clear all cached associated interface proxies as well, since these are
   // effectively bound to the lifetime of the Channel.
   remote_route_provider_.reset();
-  RemoveUserData(kRendererInterfaceKeyName);
+  renderer_interface_.reset();
 
   UpdateProcessPriority();
   DCHECK(!is_process_backgrounded_);
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index 5cefd4e..0e34dd6 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -34,8 +34,8 @@
 #include "mojo/public/cpp/bindings/associated_binding.h"
 #include "mojo/public/cpp/bindings/associated_binding_set.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 #include "ui/gfx/gpu_memory_buffer.h"
 #include "ui/gl/gpu_switching_observer.h"
 
@@ -162,7 +162,7 @@
       const WebRtcRtpPacketCallback& packet_callback) override;
 #endif
   void ResumeDeferredNavigation(const GlobalRequestID& request_id) override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
   std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator()
       override;
   const base::TimeTicks& GetInitTimeForNavigationMetrics() const override;
@@ -174,11 +174,10 @@
   void ForceReleaseWorkerRefCounts() override;
   bool IsWorkerRefCountDisabled() override;
   void PurgeAndSuspend() override;
+  mojom::Renderer* GetRendererInterface() override;
 
   mojom::RouteProvider* GetRemoteRouteProvider();
 
-  static mojom::Renderer* GetRendererInterface(RenderProcessHost* host);
-
   // IPC::Sender via RenderProcessHost.
   bool Send(IPC::Message* msg) override;
 
@@ -403,7 +402,7 @@
   // the render process currently hosted by the RPHI. Callbacks added by this
   // method will never run beyond the next invocation of Cleanup().
   template <typename CallbackType>
-  void AddUIThreadInterface(shell::InterfaceRegistry* registry,
+  void AddUIThreadInterface(service_manager::InterfaceRegistry* registry,
                             const CallbackType& callback) {
     registry->AddInterface(
         base::Bind(&InterfaceGetter<CallbackType>::GetInterfaceOnUIThread,
@@ -417,7 +416,7 @@
   int connection_filter_id_ =
       ServiceManagerConnection::kInvalidConnectionFilterId;
   scoped_refptr<ConnectionFilterController> connection_filter_controller_;
-  shell::mojom::ServicePtr test_service_;
+  service_manager::mojom::ServicePtr test_service_;
 
   size_t service_worker_ref_count_;
   size_t shared_worker_ref_count_;
@@ -578,6 +577,7 @@
   scoped_refptr<ResourceMessageFilter> resource_message_filter_;
 
   mojom::RouteProviderAssociatedPtr remote_route_provider_;
+  mojom::RendererAssociatedPtr renderer_interface_;
 
   // A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend
   // WeakPtrs which are invalidated any time the RPHI is recycled.
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index b5a9d85..b8f16e39 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -367,8 +367,7 @@
   GetWidget()->GetResizeParams(&params->initial_size);
   GetWidget()->SetInitialRenderSizeParams(params->initial_size);
 
-  RenderProcessHostImpl::GetRendererInterface(GetProcess())->CreateView(
-      std::move(params));
+  GetProcess()->GetRendererInterface()->CreateView(std::move(params));
 
   // If the RWHV has not yet been set, the surface ID namespace will get
   // passed down by the call to SetView().
diff --git a/content/browser/renderer_host/render_widget_host_view_mus.cc b/content/browser/renderer_host/render_widget_host_view_mus.cc
index b095d70e..e6f006f 100644
--- a/content/browser/renderer_host/render_widget_host_view_mus.cc
+++ b/content/browser/renderer_host/render_widget_host_view_mus.cc
@@ -12,7 +12,7 @@
 #include "content/common/render_widget_window_tree_client_factory.mojom.h"
 #include "content/common/text_input_state.h"
 #include "content/public/common/service_manager_connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "services/ui/public/cpp/window.h"
 #include "services/ui/public/cpp/window_property.h"
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index 6a167b9c..5d2b010f 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -91,8 +91,8 @@
   WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell->web_contents());
   wc->GetFrameTree()->root()->navigator()->RequestOpenURL(
       wc->GetFrameTree()->root()->current_frame_host(), extension_url, false,
-      nullptr, std::string(), nullptr, Referrer(),
-      WindowOpenDisposition::CURRENT_TAB, false, true);
+      nullptr, nullptr, Referrer(), WindowOpenDisposition::CURRENT_TAB, false,
+      true);
 
   // Since the navigation above requires a cross-process swap, there will be a
   // speculative/pending RenderFrameHost. Ensure it exists and is in a different
diff --git a/content/browser/service_manager/service_manager_context.cc b/content/browser/service_manager/service_manager_context.cc
index d35d069..92ff765 100644
--- a/content/browser/service_manager/service_manager_context.cc
+++ b/content/browser/service_manager/service_manager_context.cc
@@ -30,27 +30,28 @@
 #include "services/catalog/manifest_provider.h"
 #include "services/catalog/store.h"
 #include "services/file/public/cpp/constants.h"
-#include "services/shell/connect_params.h"
-#include "services/shell/native_runner.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-#include "services/shell/runner/common/client_util.h"
-#include "services/shell/runner/host/in_process_native_runner.h"
-#include "services/shell/service_manager.h"
+#include "services/service_manager/connect_params.h"
+#include "services/service_manager/native_runner.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
+#include "services/service_manager/runner/common/client_util.h"
+#include "services/service_manager/runner/host/in_process_native_runner.h"
+#include "services/service_manager/service_manager.h"
 
 namespace content {
 
 namespace {
 
-base::LazyInstance<std::unique_ptr<shell::Connector>>::Leaky
+base::LazyInstance<std::unique_ptr<service_manager::Connector>>::Leaky
     g_io_thread_connector = LAZY_INSTANCE_INITIALIZER;
 
 void DestroyConnectorOnIOThread() { g_io_thread_connector.Get().reset(); }
 
-void StartUtilityProcessOnIOThread(shell::mojom::ServiceFactoryRequest request,
-                                   const base::string16& process_name,
-                                   bool use_sandbox) {
+void StartUtilityProcessOnIOThread(
+    service_manager::mojom::ServiceFactoryRequest request,
+    const base::string16& process_name,
+    bool use_sandbox) {
   UtilityProcessHost* process_host =
       UtilityProcessHost::Create(nullptr, nullptr);
   process_host->SetName(process_name);
@@ -60,11 +61,12 @@
   process_host->GetRemoteInterfaces()->GetInterface(std::move(request));
 }
 
-void StartServiceInUtilityProcess(const std::string& service_name,
-                                  const base::string16& process_name,
-                                  bool use_sandbox,
-                                  shell::mojom::ServiceRequest request) {
-  shell::mojom::ServiceFactoryPtr service_factory;
+void StartServiceInUtilityProcess(
+    const std::string& service_name,
+    const base::string16& process_name,
+    bool use_sandbox,
+    service_manager::mojom::ServiceRequest request) {
+  service_manager::mojom::ServiceFactoryPtr service_factory;
   BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
                           base::Bind(&StartUtilityProcessOnIOThread,
                                      base::Passed(GetProxy(&service_factory)),
@@ -74,9 +76,11 @@
 
 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS)
 
-// Request shell::mojom::ServiceFactory from GPU process host. Must be called on
+// Request service_manager::mojom::ServiceFactory from GPU process host. Must be
+// called on
 // IO thread.
-void RequestGpuServiceFactory(shell::mojom::ServiceFactoryRequest request) {
+void RequestGpuServiceFactory(
+    service_manager::mojom::ServiceFactoryRequest request) {
   GpuProcessHost* process_host =
       GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED);
   if (!process_host) {
@@ -92,8 +96,8 @@
 }
 
 void StartServiceInGpuProcess(const std::string& service_name,
-                              shell::mojom::ServiceRequest request) {
-  shell::mojom::ServiceFactoryPtr service_factory;
+                              service_manager::mojom::ServiceRequest request) {
+  service_manager::mojom::ServiceFactoryPtr service_factory;
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
       base::Bind(&RequestGpuServiceFactory,
@@ -137,12 +141,12 @@
  public:
   InProcessServiceManagerContext() {}
 
-  shell::mojom::ServiceRequest Start(
+  service_manager::mojom::ServiceRequest Start(
       std::unique_ptr<BuiltinManifestProvider> manifest_provider) {
-    shell::mojom::ServicePtr embedder_service_proxy;
-    shell::mojom::ServiceRequest embedder_service_request =
+    service_manager::mojom::ServicePtr embedder_service_proxy;
+    service_manager::mojom::ServiceRequest embedder_service_request =
         mojo::GetProxy(&embedder_service_proxy);
-    shell::mojom::ServicePtrInfo embedder_service_proxy_info =
+    service_manager::mojom::ServicePtrInfo embedder_service_proxy_info =
         embedder_service_proxy.PassInterface();
     BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)->PostTask(
         FROM_HERE,
@@ -165,18 +169,18 @@
 
   void StartOnIOThread(
       std::unique_ptr<BuiltinManifestProvider> manifest_provider,
-      shell::mojom::ServicePtrInfo embedder_service_proxy_info) {
+      service_manager::mojom::ServicePtrInfo embedder_service_proxy_info) {
     manifest_provider_ = std::move(manifest_provider);
 
     base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool();
-    std::unique_ptr<shell::NativeRunnerFactory> native_runner_factory(
-        new shell::InProcessNativeRunnerFactory(blocking_pool));
+    std::unique_ptr<service_manager::NativeRunnerFactory> native_runner_factory(
+        new service_manager::InProcessNativeRunnerFactory(blocking_pool));
     catalog_.reset(
         new catalog::Catalog(blocking_pool, nullptr, manifest_provider_.get()));
-    service_manager_.reset(new shell::ServiceManager(
+    service_manager_.reset(new service_manager::ServiceManager(
         std::move(native_runner_factory), catalog_->TakeService()));
 
-    shell::mojom::ServiceRequest request =
+    service_manager::mojom::ServiceRequest request =
         service_manager_->StartEmbedderService(kBrowserServiceName);
     mojo::FuseInterface(
         std::move(request), std::move(embedder_service_proxy_info));
@@ -190,16 +194,16 @@
 
   std::unique_ptr<BuiltinManifestProvider> manifest_provider_;
   std::unique_ptr<catalog::Catalog> catalog_;
-  std::unique_ptr<shell::ServiceManager> service_manager_;
+  std::unique_ptr<service_manager::ServiceManager> service_manager_;
 
   DISALLOW_COPY_AND_ASSIGN(InProcessServiceManagerContext);
 };
 
 ServiceManagerContext::ServiceManagerContext() {
-  shell::mojom::ServiceRequest request;
-  if (shell::ShellIsRemote()) {
+  service_manager::mojom::ServiceRequest request;
+  if (service_manager::ServiceManagerIsRemote()) {
     mojo::edk::SetParentPipeHandleFromCommandLine();
-    request = shell::GetServiceRequestFromCommandLine();
+    request = service_manager::GetServiceRequestFromCommandLine();
   } else {
     std::unique_ptr<BuiltinManifestProvider> manifest_provider =
         base::MakeUnique<BuiltinManifestProvider>();
@@ -301,7 +305,7 @@
 }
 
 // static
-shell::Connector* ServiceManagerContext::GetConnectorForIOThread() {
+service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
   return g_io_thread_connector.Get().get();
 }
diff --git a/content/browser/service_manager/service_manager_context.h b/content/browser/service_manager/service_manager_context.h
index 273ead7..d2c025c 100644
--- a/content/browser/service_manager/service_manager_context.h
+++ b/content/browser/service_manager/service_manager_context.h
@@ -9,7 +9,7 @@
 #include "base/memory/ref_counted.h"
 #include "content/common/content_export.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -23,8 +23,8 @@
   ServiceManagerContext();
   ~ServiceManagerContext();
 
-  // Returns a shell::Connector that can be used on the IO thread.
-  static shell::Connector* GetConnectorForIOThread();
+  // Returns a service_manager::Connector that can be used on the IO thread.
+  static service_manager::Connector* GetConnectorForIOThread();
 
  private:
   class InProcessServiceManagerContext;
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc
index 8e81ee9..ee456fa 100644
--- a/content/browser/service_worker/embedded_worker_instance.cc
+++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -29,8 +29,8 @@
 #include "content/public/common/child_process_host.h"
 #include "content/public/common/content_switches.h"
 #include "ipc/ipc_message.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "url/gurl.h"
 
 namespace content {
@@ -108,8 +108,8 @@
 void SetupMojoOnUIThread(
     int process_id,
     int thread_id,
-    shell::mojom::InterfaceProviderRequest remote_interfaces,
-    shell::mojom::InterfaceProviderPtrInfo exposed_interfaces) {
+    service_manager::mojom::InterfaceProviderRequest remote_interfaces,
+    service_manager::mojom::InterfaceProviderPtrInfo exposed_interfaces) {
   RenderProcessHost* rph = RenderProcessHost::FromID(process_id);
   // |rph| or its InterfaceProvider may be NULL in unit tests.
   if (!rph || !rph->GetRemoteInterfaces())
@@ -450,8 +450,8 @@
   status_ = EmbeddedWorkerStatus::STARTING;
   starting_phase_ = ALLOCATING_PROCESS;
   network_accessed_for_script_ = false;
-  interface_registry_.reset(new shell::InterfaceRegistry);
-  remote_interfaces_.reset(new shell::InterfaceProvider);
+  interface_registry_.reset(new service_manager::InterfaceRegistry);
+  remote_interfaces_.reset(new service_manager::InterfaceProvider);
   FOR_EACH_OBSERVER(Listener, listener_list_, OnStarting());
 
   params->embedded_worker_id = embedded_worker_id_;
@@ -539,14 +539,16 @@
                                     embedded_worker_id_));
 }
 
-shell::InterfaceRegistry* EmbeddedWorkerInstance::GetInterfaceRegistry() {
+service_manager::InterfaceRegistry*
+EmbeddedWorkerInstance::GetInterfaceRegistry() {
   DCHECK(status_ == EmbeddedWorkerStatus::STARTING ||
          status_ == EmbeddedWorkerStatus::RUNNING)
       << static_cast<int>(status_);
   return interface_registry_.get();
 }
 
-shell::InterfaceProvider* EmbeddedWorkerInstance::GetRemoteInterfaces() {
+service_manager::InterfaceProvider*
+EmbeddedWorkerInstance::GetRemoteInterfaces() {
   DCHECK(status_ == EmbeddedWorkerStatus::STARTING ||
          status_ == EmbeddedWorkerStatus::RUNNING)
       << static_cast<int>(status_);
@@ -697,10 +699,10 @@
   thread_id_ = thread_id;
   FOR_EACH_OBSERVER(Listener, listener_list_, OnThreadStarted());
 
-  shell::mojom::InterfaceProviderPtr exposed_interfaces;
+  service_manager::mojom::InterfaceProviderPtr exposed_interfaces;
   interface_registry_->Bind(mojo::GetProxy(&exposed_interfaces));
-  shell::mojom::InterfaceProviderPtr remote_interfaces;
-  shell::mojom::InterfaceProviderRequest request =
+  service_manager::mojom::InterfaceProviderPtr remote_interfaces;
+  service_manager::mojom::InterfaceProviderRequest request =
       mojo::GetProxy(&remote_interfaces);
   remote_interfaces_->Bind(std::move(remote_interfaces));
   BrowserThread::PostTask(
diff --git a/content/browser/service_worker/embedded_worker_instance.h b/content/browser/service_worker/embedded_worker_instance.h
index 705b773..65df846 100644
--- a/content/browser/service_worker/embedded_worker_instance.h
+++ b/content/browser/service_worker/embedded_worker_instance.h
@@ -37,7 +37,7 @@
 class Message;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 class InterfaceRegistry;
 }
@@ -134,11 +134,12 @@
   // Resumes the worker if it paused after download.
   void ResumeAfterDownload();
 
-  // Returns the shell::InterfaceRegistry and shell::InterfaceProvider for this
+  // Returns the service_manager::InterfaceRegistry and
+  // service_manager::InterfaceProvider for this
   // worker. It is invalid to call this when the worker is not in STARTING or
   // RUNNING status.
-  shell::InterfaceRegistry* GetInterfaceRegistry();
-  shell::InterfaceProvider* GetRemoteInterfaces();
+  service_manager::InterfaceRegistry* GetInterfaceRegistry();
+  service_manager::InterfaceProvider* GetRemoteInterfaces();
 
   int embedded_worker_id() const { return embedded_worker_id_; }
   EmbeddedWorkerStatus status() const { return status_; }
@@ -311,8 +312,8 @@
   int thread_id_;
 
   // These are connected to the renderer process after OnThreadStarted.
-  std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
-  std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
+  std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
+  std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
   // |client_| is used to send messages to the renderer process.
   mojom::EmbeddedWorkerInstanceClientPtr client_;
 
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc
index aceb858..f7620af 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.cc
+++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -29,8 +29,8 @@
 #include "content/public/test/test_browser_context.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace content {
@@ -72,8 +72,8 @@
 
   void ExchangeInterfaceProviders(
       int32_t thread_id,
-      shell::mojom::InterfaceProviderRequest request,
-      shell::mojom::InterfaceProviderPtr remote_interfaces) override {
+      service_manager::mojom::InterfaceProviderRequest request,
+      service_manager::mojom::InterfaceProviderPtr remote_interfaces) override {
     if (!helper_)
       return;
     helper_->OnSetupMojoStub(thread_id, std::move(request),
@@ -303,7 +303,7 @@
 
 void EmbeddedWorkerTestHelper::OnSetupMojo(
     int thread_id,
-    shell::InterfaceRegistry* interface_registry) {
+    service_manager::InterfaceRegistry* interface_registry) {
   interface_registry->AddInterface(base::Bind(&MockFetchEventDispatcher::Create,
                                               weak_factory_.GetWeakPtr(),
                                               thread_id));
@@ -516,14 +516,14 @@
 
 void EmbeddedWorkerTestHelper::OnSetupMojoStub(
     int thread_id,
-    shell::mojom::InterfaceProviderRequest request,
-    shell::mojom::InterfaceProviderPtr remote_interfaces) {
-  std::unique_ptr<shell::InterfaceRegistry> local(
-      new shell::InterfaceRegistry);
+    service_manager::mojom::InterfaceProviderRequest request,
+    service_manager::mojom::InterfaceProviderPtr remote_interfaces) {
+  std::unique_ptr<service_manager::InterfaceRegistry> local(
+      new service_manager::InterfaceRegistry);
   local->Bind(std::move(request));
 
-  std::unique_ptr<shell::InterfaceProvider> remote(
-      new shell::InterfaceProvider);
+  std::unique_ptr<service_manager::InterfaceProvider> remote(
+      new service_manager::InterfaceProvider);
   remote->Bind(std::move(remote_interfaces));
 
   OnSetupMojo(thread_id, local.get());
@@ -544,20 +544,20 @@
   return filter.get();
 }
 
-std::unique_ptr<shell::InterfaceRegistry>
+std::unique_ptr<service_manager::InterfaceRegistry>
 EmbeddedWorkerTestHelper::CreateInterfaceRegistry(MockRenderProcessHost* rph) {
-  std::unique_ptr<shell::InterfaceRegistry> registry(
-      new shell::InterfaceRegistry);
+  std::unique_ptr<service_manager::InterfaceRegistry> registry(
+      new service_manager::InterfaceRegistry);
   registry->AddInterface(
       base::Bind(&MockEmbeddedWorkerSetup::Create, AsWeakPtr()));
   registry->AddInterface(
       base::Bind(&MockEmbeddedWorkerInstanceClient::Bind, AsWeakPtr()));
 
-  shell::mojom::InterfaceProviderPtr interfaces;
+  service_manager::mojom::InterfaceProviderPtr interfaces;
   registry->Bind(mojo::GetProxy(&interfaces));
 
-  std::unique_ptr<shell::InterfaceProvider> remote_interfaces(
-      new shell::InterfaceProvider);
+  std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces(
+      new service_manager::InterfaceProvider);
   remote_interfaces->Bind(std::move(interfaces));
   rph->SetRemoteInterfaces(std::move(remote_interfaces));
   return registry;
diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h
index 2ea93ee..8317f92 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.h
+++ b/content/browser/service_worker/embedded_worker_test_helper.h
@@ -22,14 +22,14 @@
 #include "ipc/ipc_listener.h"
 #include "ipc/ipc_test_sink.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
 class GURL;
 struct ServiceWorkerMsg_ExtendableMessageEvent_Params;
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 class InterfaceRegistry;
 }
@@ -167,8 +167,9 @@
 
   // Called to setup mojo for a new embedded worker. Override to register
   // interfaces the worker should expose to the browser.
-  virtual void OnSetupMojo(int thread_id,
-                           shell::InterfaceRegistry* interface_registry);
+  virtual void OnSetupMojo(
+      int thread_id,
+      service_manager::InterfaceRegistry* interface_registry);
 
   // On*Event handlers. Called by the default implementation of
   // OnMessageToWorker when events are sent to the embedded
@@ -200,8 +201,8 @@
 
  private:
   using InterfaceRegistryAndProvider =
-      std::pair<std::unique_ptr<shell::InterfaceRegistry>,
-                std::unique_ptr<shell::InterfaceProvider>>;
+      std::pair<std::unique_ptr<service_manager::InterfaceRegistry>,
+                std::unique_ptr<service_manager::InterfaceProvider>>;
 
   class MockEmbeddedWorkerSetup;
   class MockFetchEventDispatcher;
@@ -222,13 +223,14 @@
                         const ServiceWorkerFetchRequest& request,
                         const FetchCallback& callback);
   void OnPushEventStub(int request_id, const PushEventPayload& payload);
-  void OnSetupMojoStub(int thread_id,
-                       shell::mojom::InterfaceProviderRequest services,
-                       shell::mojom::InterfaceProviderPtr exposed_services);
+  void OnSetupMojoStub(
+      int thread_id,
+      service_manager::mojom::InterfaceProviderRequest services,
+      service_manager::mojom::InterfaceProviderPtr exposed_services);
 
   MessagePortMessageFilter* NewMessagePortMessageFilter();
 
-  std::unique_ptr<shell::InterfaceRegistry> CreateInterfaceRegistry(
+  std::unique_ptr<service_manager::InterfaceRegistry> CreateInterfaceRegistry(
       MockRenderProcessHost* rph);
 
   std::unique_ptr<TestBrowserContext> browser_context_;
@@ -248,8 +250,9 @@
   int mock_render_process_id_;
   int new_mock_render_process_id_;
 
-  std::unique_ptr<shell::InterfaceRegistry> render_process_interface_registry_;
-  std::unique_ptr<shell::InterfaceRegistry>
+  std::unique_ptr<service_manager::InterfaceRegistry>
+      render_process_interface_registry_;
+  std::unique_ptr<service_manager::InterfaceRegistry>
       new_render_process_interface_registry_;
 
   std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_;
diff --git a/content/browser/service_worker/service_worker_client_utils.cc b/content/browser/service_worker/service_worker_client_utils.cc
index 0cd39b27..dbd59d7 100644
--- a/content/browser/service_worker/service_worker_client_utils.cc
+++ b/content/browser/service_worker/service_worker_client_utils.cc
@@ -162,6 +162,13 @@
     return;
   }
 
+  // ContentBrowserClient::OpenURL calls ui::BaseWindow::Show which
+  // makes the destination window the main+key window, but won't make Chrome
+  // the active application (https://crbug.com/470830). Since OpenWindow is
+  // always called from a user gesture (e.g. notification click), we should
+  // explicitly activate the window, which brings Chrome to the front.
+  static_cast<WebContentsImpl*>(web_contents)->Activate();
+
   RenderFrameHostImpl* rfhi =
       static_cast<RenderFrameHostImpl*>(web_contents->GetMainFrame());
   new OpenURLObserver(web_contents,
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
index 39ced7a0..6aef95e3 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -38,7 +38,7 @@
 #include "content/common/service_worker/service_worker_types.h"
 #include "ipc/ipc_message.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerEventResult.h"
 #include "url/gurl.h"
 #include "url/origin.h"
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc
index 49493447..98898f61 100644
--- a/content/browser/service_worker/service_worker_version_unittest.cc
+++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -24,7 +24,7 @@
 #include "content/public/test/test_service.mojom.h"
 #include "content/public/test/test_utils.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 // IPC messages for testing ---------------------------------------------------
@@ -374,7 +374,8 @@
   MessageReceiverMojoTestService() : MessageReceiver() {}
   ~MessageReceiverMojoTestService() override {}
 
-  void OnSetupMojo(int thread_id, shell::InterfaceRegistry* registry) override {
+  void OnSetupMojo(int thread_id,
+                   service_manager::InterfaceRegistry* registry) override {
     registry->AddInterface(base::Bind(&TestServiceImpl::Create));
   }
 
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 5d97b9da..67ff7ca 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -6144,7 +6144,7 @@
   // Send the message to create a proxy for B's new child frame in A.  This
   // used to crash, as parent_routing_id refers to a proxy that doesn't exist
   // anymore.
-  RenderProcessHostImpl::GetRendererInterface(process_a)->CreateFrameProxy(
+  process_a->GetRendererInterface()->CreateFrameProxy(
       new_routing_id, view_routing_id, MSG_ROUTING_NONE, parent_routing_id,
       FrameReplicationState());
 
@@ -6220,8 +6220,7 @@
     params->widget_params->hidden = true;
     params->replication_state.name = "name";
     params->replication_state.unique_name = "name";
-    RenderProcessHostImpl::GetRendererInterface(process)->CreateFrame(
-        std::move(params));
+    process->GetRendererInterface()->CreateFrame(std::move(params));
   }
 
   // The test must wait for the process to exit, but if there is no leak, the
@@ -6286,8 +6285,7 @@
     params->widget_params->hidden = true;
     params->replication_state.name = "name";
     params->replication_state.unique_name = "name";
-    RenderProcessHostImpl::GetRendererInterface(process)->CreateFrame(
-        std::move(params));
+    process->GetRendererInterface()->CreateFrame(std::move(params));
   }
 
   // The test must wait for the process to exit, but if there is no leak, the
@@ -8379,4 +8377,149 @@
   load_observer.Wait();
 }
 
+// Test that when canceling a pending RenderFrameHost in the middle of a
+// redirect, and then killing the corresponding RenderView's renderer process,
+// the RenderViewHost isn't reused in an improper state later.  Previously this
+// led to a crash in CreateRenderView when recreating the RenderView due to a
+// stale main frame routing ID.  See https://crbug.com/627400.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+                       ReuseNonLiveRenderViewHostAfterCancelPending) {
+  GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
+  GURL b_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
+  GURL c_url(embedded_test_server()->GetURL("c.com", "/title3.html"));
+
+  EXPECT_TRUE(NavigateToURL(shell(), a_url));
+
+  // Open a popup and navigate it to b.com.
+  Shell* popup = OpenPopup(shell(), a_url, "popup");
+  EXPECT_TRUE(NavigateToURL(popup, b_url));
+
+  // Open a second popup and navigate it to b.com, which redirects to c.com.
+  // The navigation to b.com will create a pending RenderFrameHost, which will
+  // be canceled during the redirect to c.com.  Note that NavigateToURL will
+  // return false because the committed URL won't match the requested URL due
+  // to the redirect.
+  Shell* popup2 = OpenPopup(shell(), a_url, "popup2");
+  TestNavigationObserver observer(popup2->web_contents());
+  GURL redirect_url(embedded_test_server()->GetURL(
+      "b.com", "/server-redirect?" + c_url.spec()));
+  EXPECT_FALSE(NavigateToURL(popup2, redirect_url));
+  EXPECT_EQ(c_url, observer.last_navigation_url());
+  EXPECT_TRUE(observer.last_navigation_succeeded());
+
+  // Kill the b.com process (which currently hosts a RenderFrameProxy that
+  // replaced the pending RenderFrame in |popup2|, as well as the RenderFrame
+  // for |popup|).
+  RenderProcessHost* b_process =
+      popup->web_contents()->GetMainFrame()->GetProcess();
+  RenderProcessHostWatcher crash_observer(
+      b_process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
+  b_process->Shutdown(0, false);
+  crash_observer.Wait();
+
+  // Navigate the second popup to b.com.  This used to crash when creating the
+  // RenderView, because it reused the RenderViewHost created by the canceled
+  // navigation to b.com, and that RenderViewHost had a stale main frame
+  // routing ID and active state.
+  EXPECT_TRUE(NavigateToURL(popup2, b_url));
+}
+
+// Check that after a pending RFH is canceled and replaced with a proxy (which
+// reuses the canceled RFH's RenderViewHost), navigating to a main frame in the
+// same site as the canceled RFH doesn't lead to a renderer crash.  The steps
+// here are similar to ReuseNonLiveRenderViewHostAfterCancelPending, but don't
+// involve crashing the renderer. See https://crbug.com/651980.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+                       RecreateMainFrameAfterCancelPending) {
+  GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
+  GURL b_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
+  GURL c_url(embedded_test_server()->GetURL("c.com", "/title3.html"));
+
+  EXPECT_TRUE(NavigateToURL(shell(), a_url));
+
+  // Open a popup and navigate it to b.com.
+  Shell* popup = OpenPopup(shell(), a_url, "popup");
+  EXPECT_TRUE(NavigateToURL(popup, b_url));
+
+  // Open a second popup and navigate it to b.com, which redirects to c.com.
+  // The navigation to b.com will create a pending RenderFrameHost, which will
+  // be canceled during the redirect to c.com.  Note that NavigateToURL will
+  // return false because the committed URL won't match the requested URL due
+  // to the redirect.
+  Shell* popup2 = OpenPopup(shell(), a_url, "popup2");
+  TestNavigationObserver observer(popup2->web_contents());
+  GURL redirect_url(embedded_test_server()->GetURL(
+      "b.com", "/server-redirect?" + c_url.spec()));
+  EXPECT_FALSE(NavigateToURL(popup2, redirect_url));
+  EXPECT_EQ(c_url, observer.last_navigation_url());
+  EXPECT_TRUE(observer.last_navigation_succeeded());
+
+  // Navigate the second popup to b.com.  This used to crash the b.com renderer
+  // because it failed to delete the canceled RFH's RenderFrame, so this caused
+  // it to try to create a frame widget which already existed.
+  EXPECT_TRUE(NavigateToURL(popup2, b_url));
+}
+
+// Check that when a pending RFH is canceled and a proxy needs to be created in
+// its place, the proxy is properly initialized on the renderer side.  See
+// https://crbug.com/653746.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+                       CommunicateWithProxyAfterCancelPending) {
+  GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
+  GURL b_url(embedded_test_server()->GetURL("b.com", "/title2.html"));
+  GURL c_url(embedded_test_server()->GetURL("c.com", "/title3.html"));
+
+  EXPECT_TRUE(NavigateToURL(shell(), a_url));
+
+  // Open a popup and navigate it to b.com.
+  Shell* popup = OpenPopup(shell(), a_url, "popup");
+  EXPECT_TRUE(NavigateToURL(popup, b_url));
+
+  // Open a second popup and navigate it to b.com, which redirects to c.com.
+  // The navigation to b.com will create a pending RenderFrameHost, which will
+  // be canceled during the redirect to c.com.  Note that NavigateToURL will
+  // return false because the committed URL won't match the requested URL due
+  // to the redirect.
+  Shell* popup2 = OpenPopup(shell(), a_url, "popup2");
+  TestNavigationObserver observer(popup2->web_contents());
+  GURL redirect_url(embedded_test_server()->GetURL(
+      "b.com", "/server-redirect?" + c_url.spec()));
+  EXPECT_FALSE(NavigateToURL(popup2, redirect_url));
+  EXPECT_EQ(c_url, observer.last_navigation_url());
+  EXPECT_TRUE(observer.last_navigation_succeeded());
+
+  // Because b.com has other active frames (namely, the frame in |popup|),
+  // there should be a proxy created for the canceled RFH, and it should be
+  // live.
+  SiteInstance* b_instance = popup->web_contents()->GetSiteInstance();
+  FrameTreeNode* popup2_root =
+      static_cast<WebContentsImpl*>(popup2->web_contents())
+          ->GetFrameTree()
+          ->root();
+  RenderFrameProxyHost* proxy =
+      popup2_root->render_manager()->GetRenderFrameProxyHost(b_instance);
+  EXPECT_TRUE(proxy);
+  EXPECT_TRUE(proxy->is_render_frame_proxy_live());
+
+  // Add a postMessage listener in |popup2| (currently at a c.com URL).
+  EXPECT_TRUE(
+      ExecuteScript(popup2,
+                    "window.addEventListener('message', function(event) {\n"
+                    "  document.title=event.data;\n"
+                    "});"));
+
+  // Check that a postMessage can be sent via |proxy| above.  This needs to be
+  // done from the b.com process.  |popup| is currently in b.com, but it can't
+  // reach the window reference for |popup2| due to a security restriction in
+  // Blink. So, navigate the main tab to b.com and then send a postMessage to
+  // |popup2|. This is allowed since the main tab is |popup2|'s opener.
+  EXPECT_TRUE(NavigateToURL(shell(), b_url));
+
+  base::string16 expected_title(base::UTF8ToUTF16("foo"));
+  TitleWatcher title_watcher(popup2->web_contents(), expected_title);
+  EXPECT_TRUE(ExecuteScript(
+      shell(), "window.open('','popup2').postMessage('foo', '*');"));
+  EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
+}
+
 }  // namespace content
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc
index 8601a09c..059d3fc 100644
--- a/content/browser/utility_process_host_impl.cc
+++ b/content/browser/utility_process_host_impl.cc
@@ -39,8 +39,8 @@
 #include "content/public/common/service_manager_connection.h"
 #include "content/public/common/service_names.h"
 #include "mojo/edk/embedder/embedder.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "ui/base/ui_base_switches.h"
 
 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
@@ -229,7 +229,8 @@
   return StartProcess();
 }
 
-shell::InterfaceProvider* UtilityProcessHostImpl::GetRemoteInterfaces() {
+service_manager::InterfaceProvider*
+UtilityProcessHostImpl::GetRemoteInterfaces() {
   return process_->child_connection()->GetRemoteInterfaces();
 }
 
diff --git a/content/browser/utility_process_host_impl.h b/content/browser/utility_process_host_impl.h
index 7e915f5..55fa31d 100644
--- a/content/browser/utility_process_host_impl.h
+++ b/content/browser/utility_process_host_impl.h
@@ -57,7 +57,7 @@
   void SetEnv(const base::EnvironmentMap& env) override;
 #endif
   bool Start() override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
   void SetName(const base::string16& name) override;
 
   void set_child_flags(int flags) { child_flags_ = flags; }
diff --git a/content/browser/utility_process_host_impl_browsertest.cc b/content/browser/utility_process_host_impl_browsertest.cc
index 38e81a8..c1f956ee 100644
--- a/content/browser/utility_process_host_impl_browsertest.cc
+++ b/content/browser/utility_process_host_impl_browsertest.cc
@@ -11,8 +11,8 @@
 #include "content/public/test/content_browser_test.h"
 #include "content/public/test/content_browser_test_utils.h"
 #include "content/public/test/test_service.mojom.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace content {
 
diff --git a/content/browser/vibration_browsertest.cc b/content/browser/vibration_browsertest.cc
index 320e129..2f3a83a 100644
--- a/content/browser/vibration_browsertest.cc
+++ b/content/browser/vibration_browsertest.cc
@@ -18,7 +18,7 @@
 #include "content/shell/browser/shell.h"
 #include "device/vibration/vibration_manager.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 // These tests run against a dummy implementation of the VibrationManager
 // service. That is, they verify that the service implementation is correctly
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 2d93f2d..864cb1d1 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -126,7 +126,7 @@
 #include "net/http/http_transaction_factory.h"
 #include "net/url_request/url_request_context.h"
 #include "net/url_request/url_request_context_getter.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/WebSecurityStyle.h"
 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
 #include "third_party/skia/include/core/SkBitmap.h"
@@ -309,6 +309,8 @@
 WebContents* WebContents::FromFrameTreeNodeId(int frame_tree_node_id) {
   FrameTreeNode* frame_tree_node =
       FrameTreeNode::GloballyFindByID(frame_tree_node_id);
+  if (!frame_tree_node)
+    return nullptr;
   return FromRenderFrameHost(frame_tree_node->current_frame_host());
 }
 
@@ -4921,11 +4923,11 @@
       frame_tree_.root()->current_replication_state());
 }
 
-shell::InterfaceProvider* WebContentsImpl::GetJavaInterfaces() {
+service_manager::InterfaceProvider* WebContentsImpl::GetJavaInterfaces() {
   if (!java_interfaces_) {
-    shell::mojom::InterfaceProviderPtr provider;
+    service_manager::mojom::InterfaceProviderPtr provider;
     BindInterfaceRegistryForWebContents(mojo::GetProxy(&provider), this);
-    java_interfaces_.reset(new shell::InterfaceProvider);
+    java_interfaces_.reset(new service_manager::InterfaceProvider);
     java_interfaces_->Bind(std::move(provider));
   }
   return java_interfaces_.get();
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 26a2026..6a99161 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -51,7 +51,7 @@
 
 struct ViewHostMsg_DateTimeDialogValue_Params;
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -423,7 +423,7 @@
   virtual WebContentsAndroid* GetWebContentsAndroid();
   void ActivateNearestFindResult(float x, float y) override;
   void RequestFindMatchRects(int current_version) override;
-  shell::InterfaceProvider* GetJavaInterfaces() override;
+  service_manager::InterfaceProvider* GetJavaInterfaces() override;
 #elif defined(OS_MACOSX)
   void SetAllowOtherViews(bool allow) override;
   bool GetAllowOtherViews() override;
@@ -1428,7 +1428,7 @@
   RenderWidgetHostImpl* mouse_lock_widget_;
 
 #if defined(OS_ANDROID)
-  std::unique_ptr<shell::InterfaceProvider> java_interfaces_;
+  std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_;
 #endif
 
   base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
diff --git a/content/browser/webrtc/webrtc_image_capture_browsertest.cc b/content/browser/webrtc/webrtc_image_capture_browsertest.cc
index 13603b79..2213c5f 100644
--- a/content/browser/webrtc/webrtc_image_capture_browsertest.cc
+++ b/content/browser/webrtc/webrtc_image_capture_browsertest.cc
@@ -18,6 +18,19 @@
 #include "base/android/build_info.h"
 #endif
 
+namespace content {
+
+#if defined(OS_WIN)
+// These tests are flaky on WebRTC Windows bots: https://crbug.com/633242.
+#define MAYBE_CreateAndGetCapabilities DISABLED_CreateAndGetCapabilities
+#define MAYBE_CreateAndTakePhoto DISABLED_CreateAndTakePhoto
+#define MAYBE_CreateAndGrabFrame DISABLED_CreateAndGrabFrame
+#else
+#define MAYBE_CreateAndGetCapabilities CreateAndGetCapabilities
+#define MAYBE_CreateAndTakePhoto CreateAndTakePhoto
+#define MAYBE_CreateAndGrabFrame CreateAndGrabFrame
+#endif
+
 namespace {
 
 static const char kImageCaptureHtmlFile[] = "/media/image_capture_test.html";
@@ -32,8 +45,6 @@
 
 }  // namespace
 
-namespace content {
-
 // This class is the content_browsertests for Image Capture API, which allows
 // for capturing still images out of a MediaStreamTrack. Is a
 // WebRtcWebcamBrowserTest to be able to use a physical camera.
@@ -67,74 +78,56 @@
         switches::kEnableBlinkFeatures, "ImageCapture");
   }
 
+  void SetUp() override {
+    ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
+    WebRtcWebcamBrowserTest::SetUp();
+  }
+
+  // Tries to run a |command| JS test, returning true if the test can be safely
+  // skipped or it works as intended, or false otherwise.
+  bool RunImageCaptureTestCase(const std::string& command) {
+#if defined(OS_ANDROID)
+    // TODO(mcasas): fails on Lollipop devices: https://crbug.com/634811
+    if (base::android::BuildInfo::GetInstance()->sdk_int() <
+        base::android::SDK_VERSION_MARSHMALLOW) {
+      return true;
+    }
+#endif
+
+    GURL url(embedded_test_server()->GetURL(kImageCaptureHtmlFile));
+    NavigateToURL(shell(), url);
+
+    if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
+      DVLOG(1) << "No video device; skipping test...";
+      return true;
+    }
+
+    std::string result;
+    if (!ExecuteScriptAndExtractString(shell(), command, &result))
+      return false;
+    return result == "OK";
+  }
+
  private:
   DISALLOW_COPY_AND_ASSIGN(WebRtcImageCaptureBrowserTest);
 };
 
-#if defined(OS_WIN)
-// This test is flaky on WebRTC Windows bots: https://crbug.com/633242.
-#define MAYBE_CreateAndGetCapabilities DISABLED_CreateAndGetCapabilities
-#else
-#define MAYBE_CreateAndGetCapabilities CreateAndGetCapabilities
-#endif
 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest,
                        MAYBE_CreateAndGetCapabilities) {
-#if defined(OS_ANDROID)
-  // TODO(mcasas): fails on Lollipop devices: https://crbug.com/634811
-  if (base::android::BuildInfo::GetInstance()->sdk_int() <
-      base::android::SDK_VERSION_MARSHMALLOW) {
-    return;
-  }
-#endif
-
-  ASSERT_TRUE(embedded_test_server()->Start());
-  GURL url(embedded_test_server()->GetURL(kImageCaptureHtmlFile));
-  NavigateToURL(shell(), url);
-
-  if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
-    DVLOG(1) << "No video device; skipping test...";
-    return;
-  }
-
-  std::string result;
-  ASSERT_TRUE(ExecuteScriptAndExtractString(
-      shell(), "testCreateAndGetCapabilities()", &result));
-  if (result == "OK")
-    return;
-  FAIL();
+  embedded_test_server()->StartAcceptingConnections();
+  ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGetCapabilities()"));
 }
 
-#if defined(OS_WIN)
-// This test is flaky on WebRTC Windows bots: https://crbug.com/633242.
-#define MAYBE_CreateAndTakePhoto DISABLED_CreateAndTakePhoto
-#else
-#define MAYBE_CreateAndTakePhoto CreateAndTakePhoto
-#endif
 IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest,
                        MAYBE_CreateAndTakePhoto) {
-#if defined(OS_ANDROID)
-  // TODO(mcasas): fails on Lollipop devices: https://crbug.com/634811
-  if (base::android::BuildInfo::GetInstance()->sdk_int() <
-      base::android::SDK_VERSION_MARSHMALLOW) {
-    return;
-  }
-#endif
+  embedded_test_server()->StartAcceptingConnections();
+  ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndTakePhoto()"));
+}
 
-  ASSERT_TRUE(embedded_test_server()->Start());
-  GURL url(embedded_test_server()->GetURL(kImageCaptureHtmlFile));
-  NavigateToURL(shell(), url);
-
-  if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
-    DVLOG(1) << "No video device; skipping test...";
-    return;
-  }
-
-  std::string result;
-  ASSERT_TRUE(ExecuteScriptAndExtractString(shell(), "testCreateAndTakePhoto()",
-                                            &result));
-  if (result == "OK")
-    return;
-  FAIL();
+IN_PROC_BROWSER_TEST_P(WebRtcImageCaptureBrowserTest,
+                       MAYBE_CreateAndGrabFrame) {
+  embedded_test_server()->StartAcceptingConnections();
+  ASSERT_TRUE(RunImageCaptureTestCase("testCreateAndGrabFrame()"));
 }
 
 INSTANTIATE_TEST_CASE_P(,
diff --git a/content/browser/websockets/websocket_manager.cc b/content/browser/websockets/websocket_manager.cc
index 7dfb2948..bd0e372 100644
--- a/content/browser/websockets/websocket_manager.cc
+++ b/content/browser/websockets/websocket_manager.cc
@@ -15,7 +15,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_process_host_observer.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace content {
 
diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc
index 7ed7c43..b2b47c1 100644
--- a/content/browser/webui/web_ui_mojo_browsertest.cc
+++ b/content/browser/webui/web_ui_mojo_browsertest.cc
@@ -32,7 +32,7 @@
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "net/test/embedded_test_server/embedded_test_server.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace content {
 namespace {
diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn
index dd628bf..b1397c6 100644
--- a/content/child/BUILD.gn
+++ b/content/child/BUILD.gn
@@ -238,9 +238,9 @@
     "//mojo/common",
     "//mojo/edk/system",
     "//net",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner/common",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner/common",
     "//skia",
     "//storage/common",
     "//third_party/WebKit/public:blink_headers",
diff --git a/content/child/DEPS b/content/child/DEPS
index 15d826df..ef8ac2b 100644
--- a/content/child/DEPS
+++ b/content/child/DEPS
@@ -9,7 +9,7 @@
 
   "+content/app/strings/grit",  # For generated headers
   "+content/public/child",
-  "+services/shell",
-  "+services/shell",
+  "+services/service_manager",
+  "+services/service_manager",
   "+v8/include/v8.h"
 ]
diff --git a/content/child/background_sync/background_sync_provider.cc b/content/child/background_sync/background_sync_provider.cc
index b10a33c..4527db36 100644
--- a/content/child/background_sync/background_sync_provider.cc
+++ b/content/child/background_sync/background_sync_provider.cc
@@ -16,7 +16,7 @@
 #include "content/child/background_sync/background_sync_type_converters.h"
 #include "content/child/child_thread_impl.h"
 #include "content/child/service_worker/web_service_worker_registration_impl.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncError.h"
 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegistration.h"
 
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 43fb48e0..821d1a7e 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -67,11 +67,11 @@
 #include "mojo/edk/embedder/named_platform_channel_pair.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/edk/embedder/scoped_ipc_support.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/runner/common/client_util.h"
 
 #if defined(OS_POSIX)
 #include "base/posix/global_descriptors.h"
@@ -263,9 +263,9 @@
 
  private:
   // ConnectionFilter:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry,
-                 shell::Connector* connector) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry,
+                 service_manager::Connector* connector) override {
     if (remote_identity.name() != kBrowserServiceName)
       return false;
 
@@ -452,13 +452,13 @@
         mojo::edk::CreateChildMessagePipe(service_request_token);
     DCHECK(handle.is_valid());
     service_manager_connection_ = ServiceManagerConnection::Create(
-        mojo::MakeRequest<shell::mojom::Service>(std::move(handle)),
+        mojo::MakeRequest<service_manager::mojom::Service>(std::move(handle)),
         GetIOTaskRunner());
 
     // When connect_to_browser is true, we obtain interfaces from the browser
     // process by connecting to it, rather than from the incoming interface
     // provider. Exposed interfaces are subject to manifest capability spec.
-    shell::InterfaceProvider* remote_interfaces = nullptr;
+    service_manager::InterfaceProvider* remote_interfaces = nullptr;
     if (options.connect_to_browser) {
       browser_connection_ =
           service_manager_connection_->GetConnector()->Connect(
@@ -655,18 +655,18 @@
   return service_manager_connection_.get();
 }
 
-shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() {
+service_manager::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() {
   if (!interface_registry_.get())
-    interface_registry_.reset(new shell::InterfaceRegistry);
+    interface_registry_.reset(new service_manager::InterfaceRegistry);
   return interface_registry_.get();
 }
 
-shell::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
+service_manager::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
   if (browser_connection_)
     return browser_connection_->GetRemoteInterfaces();
 
   if (!remote_interfaces_.get())
-    remote_interfaces_.reset(new shell::InterfaceProvider);
+    remote_interfaces_.reset(new service_manager::InterfaceProvider);
   return remote_interfaces_.get();
 }
 
diff --git a/content/child/child_thread_impl.h b/content/child/child_thread_impl.h
index ecc984e..a1f2231 100644
--- a/content/child/child_thread_impl.h
+++ b/content/child/child_thread_impl.h
@@ -38,9 +38,9 @@
 class SyncMessageFilter;
 }  // namespace IPC
 
-namespace shell {
+namespace service_manager {
 class Connection;
-}  // namespace shell
+}  // namespace service_manager
 
 namespace mojo {
 namespace edk {
@@ -103,8 +103,8 @@
   void RecordAction(const base::UserMetricsAction& action) override;
   void RecordComputedAction(const std::string& action) override;
   ServiceManagerConnection* GetServiceManagerConnection() override;
-  shell::InterfaceRegistry* GetInterfaceRegistry() override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceRegistry* GetInterfaceRegistry() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
 
   IPC::SyncChannel* channel() { return channel_.get(); }
 
@@ -267,10 +267,10 @@
       mojom::AssociatedInterfaceAssociatedRequest request) override;
 
   std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_;
-  std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
-  std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
+  std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
+  std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
   std::unique_ptr<ServiceManagerConnection> service_manager_connection_;
-  std::unique_ptr<shell::Connection> browser_connection_;
+  std::unique_ptr<service_manager::Connection> browser_connection_;
 
   mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_;
   mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider>
diff --git a/content/child/service_factory.cc b/content/child/service_factory.cc
index 956be49..41be4be 100644
--- a/content/child/service_factory.cc
+++ b/content/child/service_factory.cc
@@ -16,8 +16,9 @@
 ServiceFactory::ServiceFactory() {}
 ServiceFactory::~ServiceFactory() {}
 
-void ServiceFactory::CreateService(shell::mojom::ServiceRequest request,
-                                   const std::string& name) {
+void ServiceFactory::CreateService(
+    service_manager::mojom::ServiceRequest request,
+    const std::string& name) {
   // Only register services on first run.
   if (!has_registered_services_) {
     DCHECK(services_.empty());
diff --git a/content/child/service_factory.h b/content/child/service_factory.h
index 3d906f1..35bb115 100644
--- a/content/child/service_factory.h
+++ b/content/child/service_factory.h
@@ -10,16 +10,16 @@
 
 #include "base/macros.h"
 #include "content/public/common/service_info.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
 
 namespace content {
 
 class EmbeddedServiceRunner;
 
 // Base class for child-process specific implementations of
-// shell::mojom::ServiceFactory.
-class ServiceFactory : public shell::mojom::ServiceFactory {
+// service_manager::mojom::ServiceFactory.
+class ServiceFactory : public service_manager::mojom::ServiceFactory {
  public:
   using ServiceMap = std::map<std::string, ServiceInfo>;
 
@@ -29,8 +29,8 @@
   virtual void RegisterServices(ServiceMap* services) = 0;
   virtual void OnServiceQuit() {}
 
-  // shell::mojom::ServiceFactory:
-  void CreateService(shell::mojom::ServiceRequest request,
+  // service_manager::mojom::ServiceFactory:
+  void CreateService(service_manager::mojom::ServiceRequest request,
                      const std::string& name) override;
 
  private:
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index e19bf5f..dd6425d 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -276,11 +276,17 @@
   const char* cipher;
   const char* mac;
   bool is_aead;
+  bool is_tls13;
   uint16_t cipher_suite =
       net::SSLConnectionStatusToCipherSuite(info.ssl_connection_status);
   net::SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead,
-                               cipher_suite);
-  if (mac == NULL) {
+                               &is_tls13, cipher_suite);
+  if (key_exchange == nullptr) {
+    DCHECK(is_tls13);
+    key_exchange = "";
+  }
+
+  if (mac == nullptr) {
     DCHECK(is_aead);
     mac = "";
   }
diff --git a/content/child/web_url_request_util.cc b/content/child/web_url_request_util.cc
index 51830c38..777e9b7 100644
--- a/content/child/web_url_request_util.cc
+++ b/content/child/web_url_request_util.cc
@@ -233,6 +233,7 @@
   WebHTTPBody http_body;
   http_body.initialize();
   http_body.setIdentifier(input->identifier());
+  http_body.setContainsPasswordData(input->contains_sensitive_info());
   for (const auto& element : *input->elements()) {
     switch (element.type()) {
       case ResourceRequestBodyImpl::Element::TYPE_BYTES:
@@ -328,6 +329,7 @@
     }
   }
   request_body->set_identifier(httpBody.identifier());
+  request_body->set_contains_sensitive_info(httpBody.containsPasswordData());
   return request_body;
 }
 
diff --git a/content/child/worker_thread_registry.cc b/content/child/worker_thread_registry.cc
index cfc9d837..f3d6fc5b 100644
--- a/content/child/worker_thread_registry.cc
+++ b/content/child/worker_thread_registry.cc
@@ -107,8 +107,9 @@
 void WorkerThreadRegistry::WillStopCurrentWorkerThread() {
   WorkerThreadObservers* observers = g_observers_tls.Pointer()->Get();
   DCHECK(observers);
-  FOR_EACH_OBSERVER(WorkerThread::Observer, *observers,
-                    WillStopCurrentWorkerThread());
+  for (auto& observer : *observers)
+    observer.WillStopCurrentWorkerThread();
+
   {
     base::AutoLock locker(task_runner_map_lock_);
     task_runner_map_.erase(WorkerThread::GetCurrentId());
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index d8e7df5..9adaecd7 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -385,10 +385,10 @@
     "//mojo/edk/system",
     "//net",
     "//sandbox",
-    "//services/shell",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner/common",
+    "//services/service_manager",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner/common",
     "//services/ui/public/interfaces",
     "//services/video_capture/public/interfaces",
     "//skia",
@@ -584,7 +584,7 @@
     "//ipc:mojom",
     "//media/mojo/interfaces",
     "//mojo/common:common_custom_types",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
     "//services/ui/public/interfaces",
     "//services/video_capture/public/interfaces",
     "//skia/public/interfaces",
diff --git a/content/common/DEPS b/content/common/DEPS
index 770d161..1831aed 100644
--- a/content/common/DEPS
+++ b/content/common/DEPS
@@ -2,7 +2,7 @@
   "-storage/browser",
 
   "+device/base/synchronization",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+services/video_capture/public/interfaces",
 
   # No inclusion of WebKit from the browser, other than strictly enum/POD,
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index 23c339f..b4cde2c 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -35,7 +35,7 @@
 #include "ipc/ipc_logging.h"
 #include "ipc/message_filter.h"
 #include "mojo/edk/embedder/embedder.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 #if defined(OS_LINUX)
 #include "base/linux_util.h"
@@ -131,7 +131,8 @@
     filter->OnFilterAdded(channel_.get());
 }
 
-shell::InterfaceProvider* ChildProcessHostImpl::GetRemoteInterfaces() {
+service_manager::InterfaceProvider*
+ChildProcessHostImpl::GetRemoteInterfaces() {
   return delegate_->GetRemoteInterfaces();
 }
 
@@ -160,7 +161,7 @@
   DCHECK(channel_id_.empty());
   channel_id_ = "ChannelMojo";
 
-  shell::InterfaceProvider* remote_interfaces = GetRemoteInterfaces();
+  service_manager::InterfaceProvider* remote_interfaces = GetRemoteInterfaces();
   DCHECK(remote_interfaces);
 
   IPC::mojom::ChannelBootstrapPtr bootstrap;
diff --git a/content/common/child_process_host_impl.h b/content/common/child_process_host_impl.h
index f1734f2..99b8843 100644
--- a/content/common/child_process_host_impl.h
+++ b/content/common/child_process_host_impl.h
@@ -82,7 +82,7 @@
   void CreateChannelMojo() override;
   bool IsChannelOpening() override;
   void AddFilter(IPC::MessageFilter* filter) override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
 #if defined(OS_POSIX)
   base::ScopedFD TakeClientFileDescriptor() override;
 #endif
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index 9ec9644..5bde8c3 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -4,16 +4,16 @@
 
 module content.mojom;
 
-import "services/shell/public/interfaces/interface_provider.mojom";
+import "services/service_manager/public/interfaces/interface_provider.mojom";
 
 // Implemented by the frame provider (e.g. renderer processes).
 interface Frame {
-  GetInterfaceProvider(shell.mojom.InterfaceProvider& interfaces);
+  GetInterfaceProvider(service_manager.mojom.InterfaceProvider& interfaces);
 };
 
 // Implemented by the frame server (i.e. the browser process).
 interface FrameHost {
-  GetInterfaceProvider(shell.mojom.InterfaceProvider& interfaces);
+  GetInterfaceProvider(service_manager.mojom.InterfaceProvider& interfaces);
 };
 
 // Implemented by a service that provides implementations of the Frame
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index 3e6ee6a5..62d319a3 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -409,7 +409,6 @@
   IPC_STRUCT_MEMBER(bool, uses_post)
   IPC_STRUCT_MEMBER(scoped_refptr<content::ResourceRequestBodyImpl>,
                     resource_request_body)
-  IPC_STRUCT_MEMBER(std::string, extra_headers)
   IPC_STRUCT_MEMBER(content::Referrer, referrer)
   IPC_STRUCT_MEMBER(WindowOpenDisposition, disposition)
   IPC_STRUCT_MEMBER(bool, should_replace_current_entry)
diff --git a/content/common/page_state_serialization.cc b/content/common/page_state_serialization.cc
index 2d4782e..3e52960 100644
--- a/content/common/page_state_serialization.cc
+++ b/content/common/page_state_serialization.cc
@@ -765,6 +765,10 @@
   scoped_refptr<ResourceRequestBodyImpl> result = new ResourceRequestBodyImpl();
   SerializeObject obj(data, static_cast<int>(size));
   ReadResourceRequestBody(&obj, result);
+  // Please see the EncodeResourceRequestBody() function below for information
+  // about why the contains_sensitive_info() field is being explicitly
+  // deserialized.
+  result->set_contains_sensitive_info(ReadBoolean(&obj));
   return obj.parse_error ? nullptr : result;
 }
 
@@ -773,6 +777,11 @@
   SerializeObject obj;
   obj.version = kCurrentVersion;
   WriteResourceRequestBody(resource_request_body, &obj);
+  // EncodeResourceRequestBody() is different from WriteResourceRequestBody()
+  // because it covers additional data (e.g.|contains_sensitive_info|) which
+  // is marshaled between native code and java. WriteResourceRequestBody()
+  // serializes data which needs to be saved out to disk.
+  WriteBoolean(resource_request_body.contains_sensitive_info(), &obj);
   return obj.GetAsString();
 }
 
diff --git a/content/common/resource_messages.cc b/content/common/resource_messages.cc
index 31330a7..5062ca5 100644
--- a/content/common/resource_messages.cc
+++ b/content/common/resource_messages.cc
@@ -396,6 +396,7 @@
   if (p.get()) {
     GetParamSize(s, *p->elements());
     GetParamSize(s, p->identifier());
+    GetParamSize(s, p->contains_sensitive_info());
   }
 }
 
@@ -406,6 +407,7 @@
   if (p.get()) {
     WriteParam(m, *p->elements());
     WriteParam(m, p->identifier());
+    WriteParam(m, p->contains_sensitive_info());
   }
 }
 
@@ -424,9 +426,13 @@
   int64_t identifier;
   if (!ReadParam(m, iter, &identifier))
     return false;
+  bool contains_sensitive_info;
+  if (!ReadParam(m, iter, &contains_sensitive_info))
+    return false;
   *r = new content::ResourceRequestBodyImpl;
   (*r)->swap_elements(&elements);
   (*r)->set_identifier(identifier);
+  (*r)->set_contains_sensitive_info(contains_sensitive_info);
   return true;
 }
 
diff --git a/content/common/resource_request_body_impl.cc b/content/common/resource_request_body_impl.cc
index 80212bd9..2484aec 100644
--- a/content/common/resource_request_body_impl.cc
+++ b/content/common/resource_request_body_impl.cc
@@ -12,7 +12,9 @@
 
 namespace content {
 
-ResourceRequestBodyImpl::ResourceRequestBodyImpl() : identifier_(0) {}
+ResourceRequestBodyImpl::ResourceRequestBodyImpl()
+    : identifier_(0),
+      contains_sensitive_info_(false) {}
 
 void ResourceRequestBodyImpl::AppendBytes(const char* bytes, int bytes_len) {
   if (bytes_len > 0) {
diff --git a/content/common/resource_request_body_impl.h b/content/common/resource_request_body_impl.h
index 4cc8ad0..bb74d6a8f 100644
--- a/content/common/resource_request_body_impl.h
+++ b/content/common/resource_request_body_impl.h
@@ -58,12 +58,21 @@
   // Returns paths referred to by |elements| of type Element::TYPE_FILE.
   std::vector<base::FilePath> GetReferencedFiles() const;
 
+  // Sets the flag which indicates whether the post data contains sensitive
+  // information like passwords.
+  void set_contains_sensitive_info(bool contains_sensitive_info) {
+    contains_sensitive_info_ = contains_sensitive_info;
+  }
+  bool contains_sensitive_info() const { return contains_sensitive_info_; }
+
  private:
   ~ResourceRequestBodyImpl() override;
 
   std::vector<Element> elements_;
   int64_t identifier_;
 
+  bool contains_sensitive_info_;
+
   DISALLOW_COPY_AND_ASSIGN(ResourceRequestBodyImpl);
 };
 
diff --git a/content/common/service_manager/DEPS b/content/common/service_manager/DEPS
index 4aa4defd..b583263 100644
--- a/content/common/service_manager/DEPS
+++ b/content/common/service_manager/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
   "+mojo/converters/network",
   "+mojo/edk/embedder",
-  "+services/shell",
+  "+services/service_manager",
 ]
diff --git a/content/common/service_manager/child_connection.cc b/content/common/service_manager/child_connection.cc
index f21e9c0..2f73ff0 100644
--- a/content/common/service_manager/child_connection.cc
+++ b/content/common/service_manager/child_connection.cc
@@ -11,17 +11,17 @@
 #include "content/public/common/service_manager_connection.h"
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace content {
 
 namespace {
 
 void CallBinderOnTaskRunner(
-    const shell::InterfaceRegistry::Binder& binder,
+    const service_manager::InterfaceRegistry::Binder& binder,
     scoped_refptr<base::SequencedTaskRunner> task_runner,
     const std::string& interface_name,
     mojo::ScopedMessagePipeHandle request_handle) {
@@ -37,13 +37,13 @@
  public:
   IOThreadContext() {}
 
-  void Initialize(const shell::Identity& child_identity,
-                  shell::Connector* connector,
+  void Initialize(const service_manager::Identity& child_identity,
+                  service_manager::Connector* connector,
                   mojo::ScopedMessagePipeHandle service_pipe,
                   scoped_refptr<base::SequencedTaskRunner> io_task_runner) {
     DCHECK(!io_task_runner_);
     io_task_runner_ = io_task_runner;
-    std::unique_ptr<shell::Connector> io_thread_connector;
+    std::unique_ptr<service_manager::Connector> io_thread_connector;
     if (connector)
       io_thread_connector = connector->Clone();
     io_task_runner_->PostTask(
@@ -85,16 +85,16 @@
   virtual ~IOThreadContext() {}
 
   void InitializeOnIOThread(
-      const shell::Identity& child_identity,
-      std::unique_ptr<shell::Connector> connector,
+      const service_manager::Identity& child_identity,
+      std::unique_ptr<service_manager::Connector> connector,
       mojo::ScopedMessagePipeHandle service_pipe) {
-    shell::mojom::ServicePtr service;
-    service.Bind(mojo::InterfacePtrInfo<shell::mojom::Service>(
+    service_manager::mojom::ServicePtr service;
+    service.Bind(mojo::InterfacePtrInfo<service_manager::mojom::Service>(
         std::move(service_pipe), 0u));
-    shell::mojom::PIDReceiverRequest pid_receiver_request =
+    service_manager::mojom::PIDReceiverRequest pid_receiver_request =
         mojo::GetProxy(&pid_receiver_);
 
-    shell::Connector::ConnectParams params(child_identity);
+    service_manager::Connector::ConnectParams params(child_identity);
     params.set_client_process_connection(std::move(service),
                                          std::move(pid_receiver_request));
 
@@ -115,8 +115,8 @@
   }
 
   scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
-  std::unique_ptr<shell::Connection> connection_;
-  shell::mojom::PIDReceiverPtr pid_receiver_;
+  std::unique_ptr<service_manager::Connection> connection_;
+  service_manager::mojom::PIDReceiverPtr pid_receiver_;
 
   DISALLOW_COPY_AND_ASSIGN(IOThreadContext);
 };
@@ -125,10 +125,12 @@
     const std::string& service_name,
     const std::string& instance_id,
     const std::string& child_token,
-    shell::Connector* connector,
+    service_manager::Connector* connector,
     scoped_refptr<base::SequencedTaskRunner> io_task_runner)
     : context_(new IOThreadContext),
-      child_identity_(service_name, shell::mojom::kInheritUserID, instance_id),
+      child_identity_(service_name,
+                      service_manager::mojom::kInheritUserID,
+                      instance_id),
       service_token_(mojo::edk::GenerateRandomToken()),
       weak_factory_(this) {
   mojo::ScopedMessagePipeHandle service_pipe =
diff --git a/content/common/service_manager/child_connection.h b/content/common/service_manager/child_connection.h
index f7fc946..a6675491 100644
--- a/content/common/service_manager/child_connection.h
+++ b/content/common/service_manager/child_connection.h
@@ -14,11 +14,11 @@
 #include "base/process/process_handle.h"
 #include "base/sequenced_task_runner.h"
 #include "content/common/content_export.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connection;
 class Connector;
 }
@@ -37,15 +37,15 @@
   ChildConnection(const std::string& name,
                   const std::string& instance_id,
                   const std::string& child_token,
-                  shell::Connector* connector,
+                  service_manager::Connector* connector,
                   scoped_refptr<base::SequencedTaskRunner> io_task_runner);
   ~ChildConnection();
 
-  shell::InterfaceProvider* GetRemoteInterfaces() {
+  service_manager::InterfaceProvider* GetRemoteInterfaces() {
     return &remote_interfaces_;
   }
 
-  const shell::Identity& child_identity() const {
+  const service_manager::Identity& child_identity() const {
     return child_identity_;
   }
 
@@ -63,10 +63,10 @@
   class IOThreadContext;
 
   scoped_refptr<IOThreadContext> context_;
-  shell::Identity child_identity_;
+  service_manager::Identity child_identity_;
   const std::string service_token_;
 
-  shell::InterfaceProvider remote_interfaces_;
+  service_manager::InterfaceProvider remote_interfaces_;
 
   base::WeakPtrFactory<ChildConnection> weak_factory_;
 
diff --git a/content/common/service_manager/embedded_service_runner.cc b/content/common/service_manager/embedded_service_runner.cc
index 0a6bbca..f47cee42 100644
--- a/content/common/service_manager/embedded_service_runner.cc
+++ b/content/common/service_manager/embedded_service_runner.cc
@@ -13,7 +13,7 @@
 #include "base/threading/thread.h"
 #include "base/threading/thread_checker.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_context.h"
 
 namespace content {
 
@@ -33,7 +33,7 @@
       task_runner_ = base::ThreadTaskRunnerHandle::Get();
   }
 
-  void BindServiceRequest(shell::mojom::ServiceRequest request) {
+  void BindServiceRequest(service_manager::mojom::ServiceRequest request) {
     DCHECK(runner_thread_checker_.CalledOnValidThread());
 
     if (use_own_thread_ && !thread_) {
@@ -73,7 +73,7 @@
   }
 
   void BindServiceRequestOnApplicationThread(
-      shell::mojom::ServiceRequest request) {
+      service_manager::mojom::ServiceRequest request) {
     DCHECK(task_runner_->BelongsToCurrentThread());
 
     if (!service_) {
@@ -81,15 +81,15 @@
           base::Bind(&Instance::Quit, base::Unretained(this)));
     }
 
-    shell::ServiceContext* new_connection =
-        new shell::ServiceContext(service_.get(), std::move(request));
+    service_manager::ServiceContext* new_connection =
+        new service_manager::ServiceContext(service_.get(), std::move(request));
     shell_connections_.push_back(base::WrapUnique(new_connection));
     new_connection->SetConnectionLostClosure(
         base::Bind(&Instance::OnStop, base::Unretained(this),
                    new_connection));
   }
 
-  void OnStop(shell::ServiceContext* connection) {
+  void OnStop(service_manager::ServiceContext* connection) {
     DCHECK(task_runner_->BelongsToCurrentThread());
 
     for (auto it = shell_connections_.begin(); it != shell_connections_.end();
@@ -140,8 +140,9 @@
   // These fields must only be accessed from the application thread, except in
   // the destructor which may run on either the runner thread or the application
   // thread.
-  std::unique_ptr<shell::Service> service_;
-  std::vector<std::unique_ptr<shell::ServiceContext>> shell_connections_;
+  std::unique_ptr<service_manager::Service> service_;
+  std::vector<std::unique_ptr<service_manager::ServiceContext>>
+      shell_connections_;
 
   DISALLOW_COPY_AND_ASSIGN(Instance);
 };
@@ -159,7 +160,7 @@
 }
 
 void EmbeddedServiceRunner::BindServiceRequest(
-    shell::mojom::ServiceRequest request) {
+    service_manager::mojom::ServiceRequest request) {
   instance_->BindServiceRequest(std::move(request));
 }
 
diff --git a/content/common/service_manager/embedded_service_runner.h b/content/common/service_manager/embedded_service_runner.h
index fda29a3..0d58565 100644
--- a/content/common/service_manager/embedded_service_runner.h
+++ b/content/common/service_manager/embedded_service_runner.h
@@ -14,8 +14,8 @@
 #include "base/single_thread_task_runner.h"
 #include "base/strings/string_piece.h"
 #include "content/public/common/service_info.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace content {
 
@@ -36,7 +36,7 @@
   // Binds an incoming ServiceRequest for this service. If the service isn't
   // already running, it is started. Otherwise the request is bound to the
   // running instance.
-  void BindServiceRequest(shell::mojom::ServiceRequest request);
+  void BindServiceRequest(service_manager::mojom::ServiceRequest request);
 
   // Sets a callback to run after the service loses its last connection and is
   // torn down.
diff --git a/content/common/service_manager/service_manager_connection_impl.cc b/content/common/service_manager/service_manager_connection_impl.cc
index 0bc9ac0e..d1c4474 100644
--- a/content/common/service_manager/service_manager_connection_impl.cc
+++ b/content/common/service_manager/service_manager_connection_impl.cc
@@ -19,10 +19,10 @@
 #include "content/public/common/connection_filter.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/runner/common/client_util.h"
 
 namespace content {
 namespace {
@@ -39,18 +39,22 @@
 // bindings.
 class ServiceManagerConnectionImpl::IOThreadContext
     : public base::RefCountedThreadSafe<IOThreadContext>,
-      public shell::Service,
-      public shell::InterfaceFactory<shell::mojom::ServiceFactory>,
-      public shell::mojom::ServiceFactory {
+      public service_manager::Service,
+      public service_manager::InterfaceFactory<
+          service_manager::mojom::ServiceFactory>,
+      public service_manager::mojom::ServiceFactory {
  public:
-  using InitializeCallback = base::Callback<void(const shell::Identity&)>;
+  using InitializeCallback =
+      base::Callback<void(const service_manager::Identity&)>;
   using ServiceFactoryCallback =
-      base::Callback<void(shell::mojom::ServiceRequest, const std::string&)>;
+      base::Callback<void(service_manager::mojom::ServiceRequest,
+                          const std::string&)>;
 
-  IOThreadContext(shell::mojom::ServiceRequest service_request,
-                  scoped_refptr<base::SequencedTaskRunner> io_task_runner,
-                  std::unique_ptr<shell::Connector> io_thread_connector,
-                  shell::mojom::ConnectorRequest connector_request)
+  IOThreadContext(
+      service_manager::mojom::ServiceRequest service_request,
+      scoped_refptr<base::SequencedTaskRunner> io_task_runner,
+      std::unique_ptr<service_manager::Connector> io_thread_connector,
+      service_manager::mojom::ConnectorRequest connector_request)
       : pending_service_request_(std::move(service_request)),
         io_task_runner_(io_task_runner),
         io_thread_connector_(std::move(io_thread_connector)),
@@ -109,7 +113,7 @@
 
   // Safe to call any time before Start() is called.
   void SetDefaultBinderForBrowserConnection(
-      const shell::InterfaceRegistry::Binder& binder) {
+      const service_manager::InterfaceRegistry::Binder& binder) {
     DCHECK(!started_);
     default_browser_binder_ = base::Bind(
         &IOThreadContext::CallBinderOnTaskRunner,
@@ -160,7 +164,7 @@
   void StartOnIOThread() {
     // Should bind |io_thread_checker_| to the context's thread.
     DCHECK(io_thread_checker_.CalledOnValidThread());
-    service_context_.reset(new shell::ServiceContext(
+    service_context_.reset(new service_manager::ServiceContext(
         this, std::move(pending_service_request_),
         std::move(io_thread_connector_),
         std::move(pending_connector_request_)));
@@ -212,9 +216,9 @@
   }
 
   /////////////////////////////////////////////////////////////////////////////
-  // shell::Service implementation
+  // service_manager::Service implementation
 
-  void OnStart(const shell::Identity& identity) override {
+  void OnStart(const service_manager::Identity& identity) override {
     DCHECK(io_thread_checker_.CalledOnValidThread());
     DCHECK(!initialize_handler_.is_null());
     id_ = identity;
@@ -223,13 +227,13 @@
     callback_task_runner_->PostTask(FROM_HERE, base::Bind(handler, identity));
   }
 
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
     DCHECK(io_thread_checker_.CalledOnValidThread());
     std::string remote_service = remote_identity.name();
     if (remote_service == "service:shell") {
       // Only expose the SCF interface to the shell.
-      registry->AddInterface<shell::mojom::ServiceFactory>(this);
+      registry->AddInterface<service_manager::mojom::ServiceFactory>(this);
       return true;
     }
 
@@ -262,18 +266,19 @@
   }
 
   /////////////////////////////////////////////////////////////////////////////
-  // shell::InterfaceFactory<shell::mojom::ServiceFactory> implementation
+  // service_manager::InterfaceFactory<service_manager::mojom::ServiceFactory>
+  // implementation
 
-  void Create(const shell::Identity& remote_identity,
-              shell::mojom::ServiceFactoryRequest request) override {
+  void Create(const service_manager::Identity& remote_identity,
+              service_manager::mojom::ServiceFactoryRequest request) override {
     DCHECK(io_thread_checker_.CalledOnValidThread());
     factory_bindings_.AddBinding(this, std::move(request));
   }
 
   /////////////////////////////////////////////////////////////////////////////
-  // shell::mojom::ServiceFactory implementation
+  // service_manager::mojom::ServiceFactory implementation
 
-  void CreateService(shell::mojom::ServiceRequest request,
+  void CreateService(service_manager::mojom::ServiceRequest request,
                      const std::string& name) override {
     DCHECK(io_thread_checker_.CalledOnValidThread());
     callback_task_runner_->PostTask(
@@ -283,7 +288,7 @@
 
   static void CallBinderOnTaskRunner(
       scoped_refptr<base::SequencedTaskRunner> task_runner,
-      const shell::InterfaceRegistry::Binder& binder,
+      const service_manager::InterfaceRegistry::Binder& binder,
       const std::string& interface_name,
       mojo::ScopedMessagePipeHandle request_handle) {
     task_runner->PostTask(FROM_HERE, base::Bind(binder, interface_name,
@@ -295,10 +300,10 @@
 
   // Temporary state established on construction and consumed on the IO thread
   // once the connection is started.
-  shell::mojom::ServiceRequest pending_service_request_;
+  service_manager::mojom::ServiceRequest pending_service_request_;
   scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
-  std::unique_ptr<shell::Connector> io_thread_connector_;
-  shell::mojom::ConnectorRequest pending_connector_request_;
+  std::unique_ptr<service_manager::Connector> io_thread_connector_;
+  service_manager::mojom::ConnectorRequest pending_connector_request_;
 
   // TaskRunner on which to run our owner's callbacks, i.e. the ones passed to
   // Start().
@@ -317,17 +322,17 @@
   // default binder (below) has been set up.
   bool has_browser_connection_ = false;
 
-  shell::Identity id_;
+  service_manager::Identity id_;
 
   // Default binder callback used for the browser connection's
   // InterfaceRegistry.
   //
   // TODO(rockot): Remove this once all interfaces exposed to the browser are
   // exposed via a ConnectionFilter.
-  shell::InterfaceRegistry::Binder default_browser_binder_;
+  service_manager::InterfaceRegistry::Binder default_browser_binder_;
 
-  std::unique_ptr<shell::ServiceContext> service_context_;
-  mojo::BindingSet<shell::mojom::ServiceFactory> factory_bindings_;
+  std::unique_ptr<service_manager::ServiceContext> service_context_;
+  mojo::BindingSet<service_manager::mojom::ServiceFactory> factory_bindings_;
   int next_filter_id_ = kInvalidConnectionFilterId;
 
   // Not owned.
@@ -371,7 +376,7 @@
 
 // static
 std::unique_ptr<ServiceManagerConnection> ServiceManagerConnection::Create(
-    shell::mojom::ServiceRequest request,
+    service_manager::mojom::ServiceRequest request,
     scoped_refptr<base::SequencedTaskRunner> io_task_runner) {
   if (service_manager_connection_factory)
     return service_manager_connection_factory->Run();
@@ -385,13 +390,14 @@
 // ServiceManagerConnectionImpl, public:
 
 ServiceManagerConnectionImpl::ServiceManagerConnectionImpl(
-    shell::mojom::ServiceRequest request,
+    service_manager::mojom::ServiceRequest request,
     scoped_refptr<base::SequencedTaskRunner> io_task_runner)
     : weak_factory_(this) {
-  shell::mojom::ConnectorRequest connector_request;
-  connector_ = shell::Connector::Create(&connector_request);
+  service_manager::mojom::ConnectorRequest connector_request;
+  connector_ = service_manager::Connector::Create(&connector_request);
 
-  std::unique_ptr<shell::Connector> io_thread_connector = connector_->Clone();
+  std::unique_ptr<service_manager::Connector> io_thread_connector =
+      connector_->Clone();
   context_ = new IOThreadContext(
       std::move(request), io_task_runner, std::move(io_thread_connector),
       std::move(connector_request));
@@ -420,11 +426,12 @@
   initialize_handler_ = handler;
 }
 
-shell::Connector* ServiceManagerConnectionImpl::GetConnector() {
+service_manager::Connector* ServiceManagerConnectionImpl::GetConnector() {
   return connector_.get();
 }
 
-const shell::Identity& ServiceManagerConnectionImpl::GetIdentity() const {
+const service_manager::Identity& ServiceManagerConnectionImpl::GetIdentity()
+    const {
   return identity_;
 }
 
@@ -434,8 +441,8 @@
 }
 
 void ServiceManagerConnectionImpl::SetupInterfaceRequestProxies(
-    shell::InterfaceRegistry* registry,
-    shell::InterfaceProvider* provider) {
+    service_manager::InterfaceRegistry* registry,
+    service_manager::InterfaceProvider* provider) {
   // It's safe to bind |registry| as a raw pointer because the caller must
   // guarantee that it outlives |this|, and |this| is bound as a weak ptr here.
   context_->SetDefaultBinderForBrowserConnection(
@@ -474,7 +481,7 @@
 }
 
 void ServiceManagerConnectionImpl::CreateService(
-    shell::mojom::ServiceRequest request,
+    service_manager::mojom::ServiceRequest request,
     const std::string& name) {
   auto it = request_handlers_.find(name);
   if (it != request_handlers_.end())
@@ -482,7 +489,7 @@
 }
 
 void ServiceManagerConnectionImpl::OnContextInitialized(
-    const shell::Identity& identity) {
+    const service_manager::Identity& identity) {
   identity_ = identity;
   if (!initialize_handler_.is_null())
     base::ResetAndReturn(&initialize_handler_).Run();
@@ -494,7 +501,7 @@
 }
 
 void ServiceManagerConnectionImpl::GetInterface(
-    shell::mojom::InterfaceProvider* provider,
+    service_manager::mojom::InterfaceProvider* provider,
     const std::string& interface_name,
     mojo::ScopedMessagePipeHandle request_handle) {
   provider->GetInterface(interface_name, std::move(request_handle));
diff --git a/content/common/service_manager/service_manager_connection_impl.h b/content/common/service_manager/service_manager_connection_impl.h
index 4a42331..23c1f85 100644
--- a/content/common/service_manager/service_manager_connection_impl.h
+++ b/content/common/service_manager/service_manager_connection_impl.h
@@ -14,10 +14,10 @@
 #include "content/public/common/service_manager_connection.h"
 #include "mojo/public/cpp/bindings/string.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -28,7 +28,7 @@
 class ServiceManagerConnectionImpl : public ServiceManagerConnection {
  public:
   explicit ServiceManagerConnectionImpl(
-      shell::mojom::ServiceRequest request,
+      service_manager::mojom::ServiceRequest request,
       scoped_refptr<base::SequencedTaskRunner> io_task_runner);
   ~ServiceManagerConnectionImpl() override;
 
@@ -38,12 +38,12 @@
   // ServiceManagerConnection:
   void Start() override;
   void SetInitializeHandler(const base::Closure& handler) override;
-  shell::Connector* GetConnector() override;
-  const shell::Identity& GetIdentity() const override;
+  service_manager::Connector* GetConnector() override;
+  const service_manager::Identity& GetIdentity() const override;
   void SetConnectionLostClosure(const base::Closure& closure) override;
   void SetupInterfaceRequestProxies(
-      shell::InterfaceRegistry* registry,
-      shell::InterfaceProvider* provider) override;
+      service_manager::InterfaceRegistry* registry,
+      service_manager::InterfaceProvider* provider) override;
   int AddConnectionFilter(std::unique_ptr<ConnectionFilter> filter) override;
   void RemoveConnectionFilter(int filter_id) override;
   void AddEmbeddedService(const std::string& name,
@@ -52,17 +52,17 @@
       const std::string& name,
       const ServiceRequestHandler& handler) override;
 
-  void OnContextInitialized(const shell::Identity& identity);
+  void OnContextInitialized(const service_manager::Identity& identity);
   void OnConnectionLost();
-  void CreateService(shell::mojom::ServiceRequest request,
+  void CreateService(service_manager::mojom::ServiceRequest request,
                      const std::string& name);
-  void GetInterface(shell::mojom::InterfaceProvider* provider,
+  void GetInterface(service_manager::mojom::InterfaceProvider* provider,
                     const std::string& interface_name,
                     mojo::ScopedMessagePipeHandle request_handle);
 
-  shell::Identity identity_;
+  service_manager::Identity identity_;
 
-  std::unique_ptr<shell::Connector> connector_;
+  std::unique_ptr<service_manager::Connector> connector_;
   scoped_refptr<IOThreadContext> context_;
 
   base::Closure initialize_handler_;
diff --git a/content/common/service_worker/embedded_worker.mojom b/content/common/service_worker/embedded_worker.mojom
index a839a33..28cff4a 100644
--- a/content/common/service_worker/embedded_worker.mojom
+++ b/content/common/service_worker/embedded_worker.mojom
@@ -4,7 +4,7 @@
 
 module content.mojom;
 
-import "services/shell/public/interfaces/interface_provider.mojom";
+import "services/service_manager/public/interfaces/interface_provider.mojom";
 import "url/mojo/url.mojom";
 
 [Native]
diff --git a/content/common/service_worker/embedded_worker_setup.mojom b/content/common/service_worker/embedded_worker_setup.mojom
index 6b1dfb5..f70830a 100644
--- a/content/common/service_worker/embedded_worker_setup.mojom
+++ b/content/common/service_worker/embedded_worker_setup.mojom
@@ -4,11 +4,11 @@
 
 module content.mojom;
 
-import "services/shell/public/interfaces/interface_provider.mojom";
+import "services/service_manager/public/interfaces/interface_provider.mojom";
 
 interface EmbeddedWorkerSetup {
   ExchangeInterfaceProviders(
       int32 thread_id,
-      shell.mojom.InterfaceProvider& remote_interfaces,
-      shell.mojom.InterfaceProvider local_interfaces);
+      service_manager.mojom.InterfaceProvider& remote_interfaces,
+      service_manager.mojom.InterfaceProvider local_interfaces);
 };
diff --git a/content/gpu/BUILD.gn b/content/gpu/BUILD.gn
index bb98524..a4379e42 100644
--- a/content/gpu/BUILD.gn
+++ b/content/gpu/BUILD.gn
@@ -61,8 +61,8 @@
     "//ipc",
     "//media/gpu",
     "//media/gpu/ipc/service",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//skia",
     "//ui/events/ipc",
     "//ui/gfx/ipc",
diff --git a/content/gpu/DEPS b/content/gpu/DEPS
index c8928c0d..7db30d2 100644
--- a/content/gpu/DEPS
+++ b/content/gpu/DEPS
@@ -4,7 +4,7 @@
   "+content/public/gpu",
   "+libEGL",
   "+libGLESv2",
-  "+services/shell",
+  "+services/service_manager",
   "+sandbox",
   "+skia",
 ]
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index b5157b6..a1076a99 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -37,8 +37,8 @@
 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h"
 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
-#include "media/gpu/ipc/service/media_service.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "media/gpu/ipc/service/media_gpu_channel_manager.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/gl/gl_implementation.h"
 #include "ui/gl/gl_switches.h"
 #include "ui/gl/gpu_switching_manager.h"
@@ -278,7 +278,7 @@
 }
 
 void GpuChildThread::DidDestroyChannel(int client_id) {
-  media_service_->RemoveChannel(client_id);
+  media_gpu_channel_manager_->RemoveChannel(client_id);
   Send(new GpuHostMsg_DestroyChannel(client_id));
 }
 
@@ -356,7 +356,8 @@
       ChildProcess::current()->GetShutDownEvent(), sync_point_manager,
       gpu_memory_buffer_factory_));
 
-  media_service_.reset(new media::MediaService(gpu_channel_manager_.get()));
+  media_gpu_channel_manager_.reset(
+      new media::MediaGpuChannelManager(gpu_channel_manager_.get()));
 
   // Only set once per process instance.
   service_factory_.reset(new GpuServiceFactory);
@@ -480,7 +481,7 @@
   IPC::ChannelHandle channel_handle = gpu_channel_manager_->EstablishChannel(
       params.client_id, params.client_tracing_id, params.preempts,
       params.allow_view_command_buffers, params.allow_real_time_streams);
-  media_service_->AddChannel(params.client_id);
+  media_gpu_channel_manager_->AddChannel(params.client_id);
   Send(new GpuHostMsg_ChannelEstablished(channel_handle));
 }
 
@@ -517,13 +518,13 @@
 void GpuChildThread::OnLoseAllContexts() {
   if (gpu_channel_manager_) {
     gpu_channel_manager_->DestroyAllChannels();
-    media_service_->DestroyAllChannels();
+    media_gpu_channel_manager_->DestroyAllChannels();
   }
 }
 
 void GpuChildThread::BindServiceFactoryRequest(
-    shell::mojom::ServiceFactoryRequest request) {
-  DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest";
+    service_manager::mojom::ServiceFactoryRequest request) {
+  DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
   DCHECK(service_factory_);
   service_factory_bindings_.AddBinding(service_factory_.get(),
                                        std::move(request));
diff --git a/content/gpu/gpu_child_thread.h b/content/gpu/gpu_child_thread.h
index 329a4dd..3882fa526 100644
--- a/content/gpu/gpu_child_thread.h
+++ b/content/gpu/gpu_child_thread.h
@@ -27,7 +27,7 @@
 #include "gpu/ipc/service/gpu_config.h"
 #include "gpu/ipc/service/x_util.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
 #include "ui/gfx/native_widget_types.h"
 
 namespace gpu {
@@ -37,7 +37,7 @@
 }
 
 namespace media {
-class MediaService;
+class MediaGpuChannelManager;
 }
 
 namespace sandbox {
@@ -127,7 +127,8 @@
 #endif
   void OnLoseAllContexts();
 
-  void BindServiceFactoryRequest(shell::mojom::ServiceFactoryRequest request);
+  void BindServiceFactoryRequest(
+      service_manager::mojom::ServiceFactoryRequest request);
 
   // Set this flag to true if a fatal error occurred before we receive the
   // OnInitialize message, in which case we just declare ourselves DOA.
@@ -145,7 +146,7 @@
 
   std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
 
-  std::unique_ptr<media::MediaService> media_service_;
+  std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_;
 
   // Information about the GPU, such as device and vendor ID.
   gpu::GPUInfo gpu_info_;
@@ -159,11 +160,12 @@
   // The gpu::GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers.
   gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_;
 
-  // ServiceFactory for shell::Service hosting.
+  // ServiceFactory for service_manager::Service hosting.
   std::unique_ptr<GpuServiceFactory> service_factory_;
 
-  // Bindings to the shell::mojom::ServiceFactory impl.
-  mojo::BindingSet<shell::mojom::ServiceFactory> service_factory_bindings_;
+  // Bindings to the service_manager::mojom::ServiceFactory impl.
+  mojo::BindingSet<service_manager::mojom::ServiceFactory>
+      service_factory_bindings_;
 
   DISALLOW_COPY_AND_ASSIGN(GpuChildThread);
 };
diff --git a/content/ppapi_plugin/BUILD.gn b/content/ppapi_plugin/BUILD.gn
index 0ddd31b..88a2b280 100644
--- a/content/ppapi_plugin/BUILD.gn
+++ b/content/ppapi_plugin/BUILD.gn
@@ -55,7 +55,7 @@
     "//ppapi/proxy:ipc",
     "//ppapi/shared_impl",
     "//sandbox",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
     "//skia",
     "//third_party/WebKit/public:blink",
     "//third_party/icu",
diff --git a/content/public/DEPS b/content/public/DEPS
index d484923..094c5aea 100644
--- a/content/public/DEPS
+++ b/content/public/DEPS
@@ -1,7 +1,7 @@
 include_rules = [
   "-content",
 
-  "+services/shell/public",
+  "+services/service_manager/public",
 
   # This file does not belong in content/public as it should not be
   # included directly by embedders of content/.  It must however be
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn
index 44dc4c6..b1a7563c 100644
--- a/content/public/android/BUILD.gn
+++ b/content/public/android/BUILD.gn
@@ -47,8 +47,8 @@
     "//mojo/public/java:bindings",
     "//mojo/public/java:system",
     "//net/android:net_java",
-    "//services/shell/public/interfaces:interfaces_java",
-    "//services/shell/public/java:shell_java",
+    "//services/service_manager/public/interfaces:interfaces_java",
+    "//services/service_manager/public/java:service_manager_java",
     "//third_party/WebKit/public:blink_headers_java",
     "//third_party/WebKit/public:new_wrapper_types_mojo_bindings_java",
     "//third_party/android_tools:android_support_annotations_java",
diff --git a/content/public/android/java/src/org/chromium/content/app/ContentApplication.java b/content/public/android/java/src/org/chromium/content/app/ContentApplication.java
index fea54ae..821d223 100644
--- a/content/public/android/java/src/org/chromium/content/app/ContentApplication.java
+++ b/content/public/android/java/src/org/chromium/content/app/ContentApplication.java
@@ -56,18 +56,10 @@
             }
         });
 
-        initializeLibraryDependencies();
         mLibraryDependenciesInitialized = true;
     }
 
     /**
-     * Initialize all the dependencies that need to be setup before library loading can be
-     * kicked off.
-     */
-    protected void initializeLibraryDependencies() {
-    }
-
-    /**
      * @return Whether the library dependencies have been initialized and it is safe to issue
      *         requests to load the native library.
      */
diff --git a/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java b/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java
index cf5d3931..0cc7719 100644
--- a/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java
+++ b/content/public/android/java/src/org/chromium/content/browser/BindingManagerImpl.java
@@ -168,7 +168,8 @@
      * for the same pid).
      */
     private class ManagedConnection {
-        // Set in constructor, cleared in clearConnection().
+        // Set in constructor, cleared in clearConnection() (on a separate thread).
+        // Need to keep a local reference to avoid it being cleared while using it.
         private ChildProcessConnection mConnection;
 
         // True iff there is a strong binding kept on the service because it is working in
@@ -187,9 +188,10 @@
          * @return true if the binding was removed.
          */
         private boolean removeInitialBinding() {
-            if (mConnection == null || !mConnection.isInitialBindingBound()) return false;
+            ChildProcessConnection connection = mConnection;
+            if (connection == null || !connection.isInitialBindingBound()) return false;
 
-            mConnection.removeInitialBinding();
+            connection.removeInitialBinding();
             return true;
         }
 
@@ -251,8 +253,10 @@
 
         /** Removes the moderate service binding. */
         private void removeModerateBinding() {
-            if (mConnection == null || !mConnection.isModerateBindingBound()) return;
-            mConnection.removeModerateBinding();
+            ChildProcessConnection connection = mConnection;
+            if (connection == null || !connection.isModerateBindingBound()) return;
+
+            connection.removeModerateBinding();
         }
 
         /** Adds the moderate service binding. */
@@ -321,16 +325,14 @@
             // When a process crashes, we can be queried about its oom status before or after the
             // connection is cleared. For the latter case, the oom status is stashed in
             // mWasOomProtected.
-            return mConnection != null
-                    ? mConnection.isOomProtectedOrWasWhenDied() : mWasOomProtected;
+            ChildProcessConnection connection = mConnection;
+            return connection != null
+                    ? connection.isOomProtectedOrWasWhenDied() : mWasOomProtected;
         }
 
         void clearConnection() {
             mWasOomProtected = mConnection.isOomProtectedOrWasWhenDied();
-            ModerateBindingPool moderateBindingPool;
-            synchronized (mModerateBindingPoolLock) {
-                moderateBindingPool = mModerateBindingPool;
-            }
+            ModerateBindingPool moderateBindingPool = mModerateBindingPool;
             if (moderateBindingPool != null) moderateBindingPool.removeConnection(this);
             mConnection = null;
         }
diff --git a/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java
index 9728f5e..365fc68 100644
--- a/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java
+++ b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupController.java
@@ -290,7 +290,7 @@
         // Normally Main.java will have kicked this off asynchronously for Chrome. But other
         // ContentView apps like tests also need them so we make sure we've extracted resources
         // here. We can still make it a little async (wait until the library is loaded).
-        ResourceExtractor resourceExtractor = ResourceExtractor.get(mContext);
+        ResourceExtractor resourceExtractor = ResourceExtractor.get();
         resourceExtractor.startExtractingResources();
 
         // This strictmode exception is to cover the case where the browser process is being started
@@ -336,7 +336,7 @@
      * Initialization needed for tests. Mainly used by content browsertests.
      */
     public void initChromiumBrowserProcessForTests() {
-        ResourceExtractor resourceExtractor = ResourceExtractor.get(mContext);
+        ResourceExtractor resourceExtractor = ResourceExtractor.get();
         resourceExtractor.startExtractingResources();
         resourceExtractor.waitForCompletion();
         nativeSetCommandLineFlags(false, null);
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 22a40ef..0a5293b 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -627,15 +627,6 @@
     }
 
     /**
-     * Returns the context used to obtain display density (ratio of physical pixels to DIP).
-     */
-    private Context getDisplayContext(WindowAndroid window) {
-        Context displayContext = null;
-        if (window != null) displayContext = window.getContext().get();
-        return displayContext != null ? displayContext : mContext;
-    }
-
-    /**
      *
      * @param viewDelegate Delegate to add/remove anchor views.
      * @param internalDispatcher Handles dispatching all hidden or super methods to the
@@ -668,7 +659,7 @@
         setContainerViewInternals(internalDispatcher);
 
         mRenderCoordinates.reset();
-        mRenderCoordinates.setDeviceScaleFactor(getDisplayContext(windowAndroid));
+        mRenderCoordinates.updateDeviceScaleFactorFromWindow(windowAndroid);
 
         initPopupZoomer(mContext);
         mImeAdapter = createImeAdapter();
@@ -692,7 +683,6 @@
         mSelectPopup = null;
         mPastePopupMenu = null;
 
-        mRenderCoordinates.setDeviceScaleFactor(getDisplayContext(windowAndroid));
         addDisplayAndroidObserverIfNeeded();
 
         for (WindowAndroidChangedObserver observer : mWindowAndroidChangedObservers) {
@@ -704,6 +694,7 @@
         if (!mAttachedToWindow) return;
         WindowAndroid windowAndroid = getWindowAndroid();
         if (windowAndroid != null) {
+            mRenderCoordinates.updateDeviceScaleFactorFromWindow(windowAndroid);
             windowAndroid.getDisplay().addObserver(this);
             onRotationChanged(windowAndroid.getDisplay().getRotation());
         }
diff --git a/content/public/android/java/src/org/chromium/content/browser/InterfaceRegistrarImpl.java b/content/public/android/java/src/org/chromium/content/browser/InterfaceRegistrarImpl.java
index 17134cc..228afef 100644
--- a/content/public/android/java/src/org/chromium/content/browser/InterfaceRegistrarImpl.java
+++ b/content/public/android/java/src/org/chromium/content/browser/InterfaceRegistrarImpl.java
@@ -18,7 +18,7 @@
 import org.chromium.device.nfc.mojom.Nfc;
 import org.chromium.device.vibration.VibrationManagerImpl;
 import org.chromium.mojo.system.impl.CoreImpl;
-import org.chromium.services.shell.InterfaceRegistry;
+import org.chromium.services.service_manager.InterfaceRegistry;
 
 @JNINamespace("content")
 class InterfaceRegistrarImpl {
diff --git a/content/public/android/java/src/org/chromium/content/browser/NfcFactory.java b/content/public/android/java/src/org/chromium/content/browser/NfcFactory.java
index 7a475f1..35268c1 100644
--- a/content/public/android/java/src/org/chromium/content/browser/NfcFactory.java
+++ b/content/public/android/java/src/org/chromium/content/browser/NfcFactory.java
@@ -9,7 +9,7 @@
 import org.chromium.content_public.browser.WebContents;
 import org.chromium.device.nfc.NfcImpl;
 import org.chromium.device.nfc.mojom.Nfc;
-import org.chromium.services.shell.InterfaceFactory;
+import org.chromium.services.service_manager.InterfaceFactory;
 import org.chromium.ui.base.WindowAndroid;
 
 class NfcFactory implements InterfaceFactory<Nfc> {
diff --git a/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java b/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java
index 2df4f97..5bcebc2 100644
--- a/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java
+++ b/content/public/android/java/src/org/chromium/content/browser/RenderCoordinates.java
@@ -7,9 +7,8 @@
 import android.content.Context;
 import android.util.TypedValue;
 
-import org.chromium.base.CommandLine;
 import org.chromium.base.VisibleForTesting;
-import org.chromium.content.common.ContentSwitches;
+import org.chromium.ui.base.WindowAndroid;
 
 /**
  * Cached copy of all positions and scales (CSS-to-DIP-to-physical pixels)
@@ -62,22 +61,19 @@
         mContentHeightCss = contentHeightCss;
     }
 
-    void setDeviceScaleFactor(Context context) {
-        String forceScaleFactor =
-                CommandLine.getInstance().getSwitchValue(ContentSwitches.FORCE_DEVICE_SCALE_FACTOR);
-        mDeviceScaleFactor = forceScaleFactor != null
-                ? Float.valueOf(forceScaleFactor)
-                : context.getResources().getDisplayMetrics().density;
+    void updateDeviceScaleFactorFromWindow(WindowAndroid windowAndroid) {
+        mDeviceScaleFactor = windowAndroid.getDisplay().getDIPScale();
 
         // The wheel scroll factor depends on the theme in the context.
         // This code assumes that the theme won't change between this call and
-        // getWheelScrollScale().
+        // getWheelScrollFactor().
 
+        Context context = windowAndroid.getContext().get();
         TypedValue outValue = new TypedValue();
         // This is the same attribute used by Android Views to scale wheel
         // event motion into scroll deltas.
-        if (context.getTheme().resolveAttribute(
-                    android.R.attr.listPreferredItemHeight, outValue, true)) {
+        if (context != null && context.getTheme().resolveAttribute(
+                android.R.attr.listPreferredItemHeight, outValue, true)) {
             mWheelScrollFactor = outValue.getDimension(context.getResources().getDisplayMetrics());
         } else {
             // If attribute retrieval fails, just use a sensible default.
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java
index 497481b..d63f7ed 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java
@@ -54,8 +54,7 @@
         }
     }
 
-    ThreadedInputConnectionFactory(
-            InputMethodManagerWrapper inputMethodManagerWrapper) {
+    ThreadedInputConnectionFactory(InputMethodManagerWrapper inputMethodManagerWrapper) {
         mInputMethodManagerWrapper = inputMethodManagerWrapper;
         mHandler = createHandler();
         mInputMethodUma = createInputMethodUma();
@@ -140,10 +139,12 @@
         if (mReentrantTriggering) return;
 
         // We need to check this before creating invalidator.
-        if (!view.hasFocus() || !view.hasWindowFocus()) return;
+        if (!view.hasFocus()) return;
 
         mCheckInvalidator = new CheckInvalidator();
 
+        if (!view.hasWindowFocus()) mCheckInvalidator.invalidate();
+
         if (mProxyView == null) {
             mProxyView = createProxyView(mHandler, view);
         }
@@ -155,8 +156,6 @@
         view.getHandler().post(new Runnable() {
             @Override
             public void run() {
-                if (mCheckInvalidator.isInvalid()) return;
-
                 // This is a hack to make InputMethodManager believe that the proxy view
                 // now has a focus. As a result, InputMethodManager will think that mProxyView
                 // is focused, and will call getHandler() of the view when creating input
@@ -207,13 +206,13 @@
             return;
         }
 
-        if (checkInvalidator.isInvalid()) return;
-
         if (retry > 0) {
             postCheckRegisterResultOnUiThread(view, checkInvalidator, retry - 1);
             return;
         }
 
+        if (checkInvalidator.isInvalid()) return;
+
         onRegisterProxyViewFailure();
     }
 
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionProxyView.java b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionProxyView.java
index 9cf5e29..31c59f6 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionProxyView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionProxyView.java
@@ -107,7 +107,10 @@
     @Override
     public View getRootView() {
         if (DEBUG_LOGS) Log.w(TAG, "getRootView");
-        return mRootView.get();
+        // Returning a null here matches mCurRootView being null value in InputMethodManager,
+        // which represents that the current focused window is not IME target window.
+        // In this case, you are still able to type.
+        return mWindowFocused.get() ? mRootView.get() : null;
     }
 
     @Override
diff --git a/content/public/android/java/src/org/chromium/content/browser/shapedetection/ShapeDetectionFactory.java b/content/public/android/java/src/org/chromium/content/browser/shapedetection/ShapeDetectionFactory.java
index 88c7ac7..ef657a4 100644
--- a/content/public/android/java/src/org/chromium/content/browser/shapedetection/ShapeDetectionFactory.java
+++ b/content/public/android/java/src/org/chromium/content/browser/shapedetection/ShapeDetectionFactory.java
@@ -7,7 +7,7 @@
 import android.content.Context;
 
 import org.chromium.blink.mojom.ShapeDetection;
-import org.chromium.services.shell.InterfaceFactory;
+import org.chromium.services.service_manager.InterfaceFactory;
 
 /**
  * A factory method for registry in InterfaceRegistrarImpl.java.
diff --git a/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java
index 941c5f6..58aa89b 100644
--- a/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java
+++ b/content/public/android/java/src/org/chromium/content/common/ContentSwitches.java
@@ -45,10 +45,6 @@
     // Native switch - chrome_switches::kDisablePopupBlocking
     public static final String DISABLE_POPUP_BLOCKING = "disable-popup-blocking";
 
-    // Native switch - gfx_switches::kForceDeviceScaleFactor
-    public static final String FORCE_DEVICE_SCALE_FACTOR =
-            "force-device-scale-factor";
-
     // Enable mouse hover emulation by holding your finger just over the screen.
     public static final String ENABLE_TOUCH_HOVER = "enable-touch-hover";
 
diff --git a/content/public/android/java/src/org/chromium/content_public/browser/InterfaceRegistrar.java b/content/public/android/java/src/org/chromium/content_public/browser/InterfaceRegistrar.java
index e76061d..03a7bd8 100644
--- a/content/public/android/java/src/org/chromium/content_public/browser/InterfaceRegistrar.java
+++ b/content/public/android/java/src/org/chromium/content_public/browser/InterfaceRegistrar.java
@@ -6,7 +6,7 @@
 
 import android.content.Context;
 
-import org.chromium.services.shell.InterfaceRegistry;
+import org.chromium.services.service_manager.InterfaceRegistry;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java
index 5becba3..037ab3c 100644
--- a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java
+++ b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionFactoryTest.java
@@ -8,9 +8,7 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.when;
 
@@ -21,9 +19,6 @@
 import android.view.inputmethod.InputConnection;
 import android.view.inputmethod.InputMethodManager;
 
-import org.chromium.base.ThreadUtils;
-import org.chromium.base.test.util.Feature;
-import org.chromium.testing.local.LocalRobolectricTestRunner;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -38,6 +33,10 @@
 import org.robolectric.internal.ShadowExtractor;
 import org.robolectric.shadows.ShadowLooper;
 
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.Feature;
+import org.chromium.testing.local.LocalRobolectricTestRunner;
+
 import java.util.concurrent.Callable;
 
 /**
@@ -90,9 +89,16 @@
         public boolean hasFailed() {
             return mFailed;
         }
+
         public boolean hasSucceeded() {
             return mSucceeded;
         }
+
+        @Override
+        public void onWindowFocusChanged(boolean gainFocus) {
+            mHasWindowFocus = gainFocus;
+            super.onWindowFocusChanged(gainFocus);
+        }
     }
 
     @Mock
@@ -113,7 +119,7 @@
     private TestFactory mFactory;
     private InputConnection mInputConnection;
     private InOrder mInOrder;
-    private boolean mWindowFocusChanged;
+    private boolean mHasWindowFocus;
 
     @Before
     public void setUp() throws Exception {
@@ -128,6 +134,7 @@
         mInputMethodManager = Mockito.mock(InputMethodManager.class);
 
         mFactory = new TestFactory(new InputMethodManagerWrapper(mContext));
+        mFactory.onWindowFocusChanged(true);
 
         when(mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
                 .thenReturn(mInputMethodManager);
@@ -140,13 +147,6 @@
         when(mProxyView.getContext()).thenReturn(mContext);
         when(mProxyView.requestFocus()).thenReturn(true);
         when(mProxyView.getHandler()).thenReturn(mImeHandler);
-        doAnswer(new Answer<Void>() {
-            @Override
-            public Void answer(InvocationOnMock invocation) throws Throwable {
-                mWindowFocusChanged = true;
-                return null;
-            }
-        }).when(mProxyView).onWindowFocusChanged(true);
         final Callable<InputConnection> callable = new Callable<InputConnection>() {
             @Override
             public InputConnection call() throws Exception {
@@ -168,17 +168,22 @@
             @Override
             public Boolean answer(InvocationOnMock invocation) throws Throwable {
                 mCount++;
-                if (mCount == 1 && mWindowFocusChanged) {
+                // To simplify IMM's behavior, let's say that it succeeds input method activation
+                // only when the view has a window focus.
+                if (!mHasWindowFocus) return false;
+                if (mCount == 1) {
                     mInputConnection = mProxyView.onCreateInputConnection(mEditorInfo);
                     return false;
-                } else if (mCount == 2) {
-                    return true;
                 }
-                fail();
-                return false;
+                return mHasWindowFocus;
             }
         });
-        when(mInputMethodManager.isActive(mProxyView)).thenReturn(true);
+        when(mInputMethodManager.isActive(mProxyView)).thenAnswer(new Answer<Boolean>() {
+            @Override
+            public Boolean answer(InvocationOnMock invocation) throws Throwable {
+                return mInputConnection != null;
+            }
+        });
 
         mInOrder = inOrder(mImeAdapter, mInputMethodManager, mContainerView, mProxyView);
     }
@@ -239,29 +244,7 @@
 
     @Test
     @Feature({"TextInput"})
-    public void testCreateInputConnection_WindowFocusLostOnFirstLoop() {
-        // Somehow input was activated right after window focus was lost.
-        when(mContainerView.hasWindowFocus()).thenReturn(false);
-
-        // Pause all the loopers.
-        Robolectric.getForegroundThreadScheduler().pause();
-        mImeShadowLooper.pause();
-
-        activateInput();
-
-        // The first onCreateInputConnection().
-        runOneUiTask();
-        mInOrder.verify(mContainerView).hasFocus();
-        mInOrder.verify(mContainerView).hasWindowFocus();
-        mInOrder.verifyNoMoreInteractions();
-        assertNull(mInputConnection);
-        assertFalse(mFactory.hasSucceeded());
-        assertFalse(mFactory.hasFailed());
-    }
-
-    @Test
-    @Feature({"TextInput"})
-    public void testCreateInputConnection_WindowFocusLostOnSecondLoop() {
+    public void testCreateInputConnection_Failure() {
         // Pause all the loopers.
         Robolectric.getForegroundThreadScheduler().pause();
         mImeShadowLooper.pause();
@@ -279,11 +262,30 @@
 
         // Now window focus was lost before the second onCreateInputConnection().
         mFactory.onWindowFocusChanged(false);
-
-        // The second onCreateInputConnection() gets ignored.
-        runOneUiTask();
         mInOrder.verify(mProxyView).onOriginalViewWindowFocusChanged(false);
+
+        // The second onCreateInputConnection().
+        runOneUiTask();
+        mInOrder.verify(mProxyView).onWindowFocusChanged(true);
+        mInOrder.verify(mInputMethodManager).isActive(mContainerView);
         mInOrder.verifyNoMoreInteractions();
+
+        // Window focus is lost and we fail to activate.
+        assertNull(mInputConnection);
+
+        // Verification process.
+        mImeShadowLooper.runOneTask();
+        mInOrder.verify(mContainerView).getHandler();
+        runOneUiTask();
+        mInOrder.verify(mInputMethodManager).isActive(mProxyView);
+
+        // Wait one more UI loop.
+        mInOrder.verify(mContainerView).getHandler();
+        runOneUiTask();
+        mInOrder.verify(mInputMethodManager).isActive(mProxyView);
+
+        mInOrder.verifyNoMoreInteractions();
+        // Failed, but no logging because check has been invalidated.
         assertNull(mInputConnection);
         assertFalse(mFactory.hasSucceeded());
         assertFalse(mFactory.hasFailed());
diff --git a/content/public/app/BUILD.gn b/content/public/app/BUILD.gn
index 557e3d4c..4a7c3a84 100644
--- a/content/public/app/BUILD.gn
+++ b/content/public/app/BUILD.gn
@@ -21,7 +21,7 @@
 #       //content/public/app:both_sources (source set)
 
 import("//build/config/chrome_build.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 
 public_app_shared_sources = [
   "content_jni_onload.h",
diff --git a/content/public/app/mojo/content_browser_manifest.json b/content/public/app/mojo/content_browser_manifest.json
index bec4ded..0d5bf07e 100644
--- a/content/public/app/mojo/content_browser_manifest.json
+++ b/content/public/app/mojo/content_browser_manifest.json
@@ -33,28 +33,22 @@
         "memory_coordinator::mojom::MemoryCoordinatorHandle"
       ],
       "shell:service_factory": [
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ]
     },
     "required": {
-      "*": { "classes": [ "app" ] },
-
+      "*": [ "app" ],
       // In classic ash, the browser supplies ash interfaces to itself.
-      "service:content_browser": { "classes": [ "ash" ] },
-      "service:content_gpu": { "classes": [ "browser" ] },
-      "service:content_plugin": { "classes": [ "browser" ] },
-      "service:content_renderer": { "classes": [ "browser" ] },
-      "service:content_utility": { "classes": [ "browser" ] },
-
-      "service:shell": {
-        "classes": [
-          "shell:client_process",
-          "shell:instance_name",
-          "shell:user_id"
-        ]
-      },
-      "service:file": { "classes": [ "file:filesystem", "file:leveldb" ] },
-      "service:media": { "classes": [ "media:media" ] }
+      "service:content_browser": [ "ash" ],
+      "service:content_gpu": [ "browser" ],
+      "service:content_plugin": [ "browser" ],
+      "service:content_renderer": [ "browser" ],
+      "service:content_utility": [ "browser" ],
+      "service:shell": [ "shell:client_process",
+                         "shell:instance_name",
+                         "shell:user_id" ],
+      "service:file": [ "file:filesystem", "file:leveldb" ],
+      "service:media": [ "media:media" ]
     }
   }
 }
diff --git a/content/public/app/mojo/content_gpu_manifest.json b/content/public/app/mojo/content_gpu_manifest.json
index 638d824..e28bb9be 100644
--- a/content/public/app/mojo/content_gpu_manifest.json
+++ b/content/public/app/mojo/content_gpu_manifest.json
@@ -6,18 +6,14 @@
     "provided": {
       "browser": [
         "IPC::mojom::ChannelBootstrap",
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ],
       "shell:service_factory": [
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ]
     },
     "required": {
-      "service:content_browser": {
-        "classes": [
-          "gpu"
-        ]
-      }
+      "service:content_browser": [ "gpu" ]
     }
   }
 }
diff --git a/content/public/app/mojo/content_plugin_manifest.json b/content/public/app/mojo/content_plugin_manifest.json
index 3a11031..1d4eef9 100644
--- a/content/public/app/mojo/content_plugin_manifest.json
+++ b/content/public/app/mojo/content_plugin_manifest.json
@@ -6,15 +6,11 @@
     "provided": {
       "browser": [ "IPC::mojom::ChannelBootstrap" ],
       "shell:service_factory": [
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ]
     },
     "required": {
-      "service:content_browser": {
-        "classes": [
-          "plugin"
-        ]
-      }
+      "service:content_browser": [ "plugin" ]
     }
   }
 }
diff --git a/content/public/app/mojo/content_renderer_manifest.json b/content/public/app/mojo/content_renderer_manifest.json
index 221c771..c2630cc 100644
--- a/content/public/app/mojo/content_renderer_manifest.json
+++ b/content/public/app/mojo/content_renderer_manifest.json
@@ -15,12 +15,12 @@
         "web_cache::mojom::WebCache"
       ],
       "shell:service_factory": [
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ]
     },
     "required": {
-      "service:content_browser": { "classes":  [ "renderer" ] },
-      "service:ui": { "classes":  [ "ui:gpu_client" ] }
+      "service:content_browser": [ "renderer" ],
+      "service:ui": [ "ui:gpu_client" ]
     }
   }
 }
diff --git a/content/public/app/mojo/content_utility_manifest.json b/content/public/app/mojo/content_utility_manifest.json
index a0790ce..931a263 100644
--- a/content/public/app/mojo/content_utility_manifest.json
+++ b/content/public/app/mojo/content_utility_manifest.json
@@ -6,10 +6,10 @@
     "provided": {
       "browser": [
         "IPC::mojom::ChannelBootstrap",
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ],
       "shell:service_factory": [
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ]
     }
   }
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn
index 60669a87..ddc3ee4 100644
--- a/content/public/browser/BUILD.gn
+++ b/content/public/browser/BUILD.gn
@@ -283,7 +283,7 @@
   public_deps = [
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
 
     # We expose skia headers in the public API.
     "//skia",
diff --git a/content/public/browser/android/content_view_core.h b/content/public/browser/android/content_view_core.h
index 9d0b521..1f9e7b3a 100644
--- a/content/public/browser/android/content_view_core.h
+++ b/content/public/browser/android/content_view_core.h
@@ -44,8 +44,6 @@
   virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() = 0;
   virtual void ShowPastePopup(int x, int y) = 0;
 
-  virtual void PauseOrResumeGeolocation(bool should_pause) = 0;
-
   virtual ui::WindowAndroid* GetWindowAndroid() const = 0;
 
  protected:
diff --git a/content/public/browser/android/java_interfaces.h b/content/public/browser/android/java_interfaces.h
index aa4973d3..6806100 100644
--- a/content/public/browser/android/java_interfaces.h
+++ b/content/public/browser/android/java_interfaces.h
@@ -7,7 +7,7 @@
 
 #include "content/common/content_export.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -17,7 +17,7 @@
 // This provides access to interfaces implemented in Java in the browser process
 // to C++ code in the browser process. This and the returned InterfaceProvider
 // may only be used on the UI thread.
-CONTENT_EXPORT shell::InterfaceProvider* GetGlobalJavaInterfaces();
+CONTENT_EXPORT service_manager::InterfaceProvider* GetGlobalJavaInterfaces();
 
 }  // namespace content
 
diff --git a/content/public/browser/browser_child_process_host.h b/content/public/browser/browser_child_process_host.h
index e8506d8..4b1639b 100644
--- a/content/public/browser/browser_child_process_host.h
+++ b/content/public/browser/browser_child_process_host.h
@@ -25,7 +25,7 @@
 class SharedPersistentMemoryAllocator;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h
index aaa5e23e9f..377eebd4 100644
--- a/content/public/browser/browser_context.h
+++ b/content/public/browser/browser_context.h
@@ -30,7 +30,7 @@
 class Time;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -154,8 +154,8 @@
 
   // Returns a Service User ID associated with this BrowserContext. This ID is
   // not persistent across runs. See
-  // services/shell/public/interfaces/connector.mojom. By default, this user id
-  // is randomly generated when Initialize() is called.
+  // services/service_manager/public/interfaces/connector.mojom. By default,
+  // this user id is randomly generated when Initialize() is called.
   static const std::string& GetServiceUserIdFor(
       BrowserContext* browser_context);
 
@@ -166,7 +166,8 @@
 
   // Returns a Connector associated with this BrowserContext, which can be used
   // to connect to service instances bound as this user.
-  static shell::Connector* GetConnectorFor(BrowserContext* browser_context);
+  static service_manager::Connector* GetConnectorFor(
+      BrowserContext* browser_context);
   static ServiceManagerConnection* GetServiceManagerConnectionFor(
       BrowserContext* browser_context);
 
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index af10e53..970acb7 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -64,7 +64,7 @@
 class CdmFactory;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 class Service;
 }
@@ -649,19 +649,19 @@
   // |registry| will by default be run immediately on the IO thread, unless a
   // task runner is provided.
   virtual void ExposeInterfacesToRenderer(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       RenderProcessHost* render_process_host) {}
 
   // Called when RenderFrameHostImpl connects to the Media service. Expose
   // interfaces to the service using |registry|.
   virtual void ExposeInterfacesToMediaService(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       RenderFrameHost* render_frame_host) {}
 
   // Allows to register browser Mojo interfaces exposed through the
   // RenderFrameHost.
   virtual void RegisterRenderFrameMojoInterfaces(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       RenderFrameHost* render_frame_host) {}
 
   // Allows to register browser Mojo interfaces exposed through the
@@ -669,7 +669,7 @@
   // callbacks added to |registry| will by default be run immediately on the IO
   // thread, unless a task runner is provided.
   virtual void ExposeInterfacesToGpuProcess(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       GpuProcessHost* render_process_host) {}
 
   using StaticServiceMap = std::map<std::string, ServiceInfo>;
diff --git a/content/public/browser/gpu_service_registry.cc b/content/public/browser/gpu_service_registry.cc
index 53b0761..88ffd97 100644
--- a/content/public/browser/gpu_service_registry.cc
+++ b/content/public/browser/gpu_service_registry.cc
@@ -8,7 +8,7 @@
 
 namespace content {
 
-shell::InterfaceProvider* GetGpuRemoteInterfaces() {
+service_manager::InterfaceProvider* GetGpuRemoteInterfaces() {
   GpuProcessHost* host =
       GpuProcessHost::Get(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED);
   return host->GetRemoteInterfaces();
diff --git a/content/public/browser/gpu_service_registry.h b/content/public/browser/gpu_service_registry.h
index 6f04180..e1455f3 100644
--- a/content/public/browser/gpu_service_registry.h
+++ b/content/public/browser/gpu_service_registry.h
@@ -7,16 +7,17 @@
 
 #include "content/common/content_export.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
 namespace content {
 
-// Get shell::InterfaceProvider that can be used to bind interfaces registered
+// Get service_manager::InterfaceProvider that can be used to bind interfaces
+// registered
 // via ContentGpuClient::ExposeInterfacesToBrowser().
 // This must be called on IO thread.
-CONTENT_EXPORT shell::InterfaceProvider* GetGpuRemoteInterfaces();
+CONTENT_EXPORT service_manager::InterfaceProvider* GetGpuRemoteInterfaces();
 
 }  // namespace content
 
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h
index 2d44e2c7..35971e03 100644
--- a/content/public/browser/render_frame_host.h
+++ b/content/public/browser/render_frame_host.h
@@ -24,7 +24,7 @@
 class Value;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 class InterfaceProvider;
 }
@@ -187,11 +187,11 @@
 
   // Returns the InterfaceRegistry that this process uses to expose interfaces
   // to the application running in this frame.
-  virtual shell::InterfaceRegistry* GetInterfaceRegistry() = 0;
+  virtual service_manager::InterfaceRegistry* GetInterfaceRegistry() = 0;
 
   // Returns the InterfaceProvider that this process can use to bind
   // interfaces exposed to it by the application running in this frame.
-  virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0;
+  virtual service_manager::InterfaceProvider* GetRemoteInterfaces() = 0;
 
   // Returns the AssociatedInterfaceProvider that this process can use to access
   // remote frame-specific Channel-associated interfaces for this frame.
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h
index 12160f4..ef58b64 100644
--- a/content/public/browser/render_process_host.h
+++ b/content/public/browser/render_process_host.h
@@ -32,7 +32,7 @@
 class MediaKeys;
 }
 
-namespace shell {
+namespace service_manager {
 class Connection;
 class InterfaceProvider;
 }
@@ -45,6 +45,10 @@
 class StoragePartition;
 struct GlobalRequestID;
 
+namespace mojom {
+class Renderer;
+}
+
 // Interface that represents the browser side of the browser <-> renderer
 // communication channel. There will generally be one RenderProcessHost per
 // renderer process.
@@ -263,9 +267,10 @@
   // transferring it to a new renderer process.
   virtual void ResumeDeferredNavigation(const GlobalRequestID& request_id) = 0;
 
-  // Returns the shell::InterfaceProvider the browser process can use to bind
+  // Returns the service_manager::InterfaceProvider the browser process can use
+  // to bind
   // interfaces exposed to it from the renderer.
-  virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0;
+  virtual service_manager::InterfaceProvider* GetRemoteInterfaces() = 0;
 
   // Extracts any persistent-memory-allocator used for renderer metrics.
   // Ownership is passed to the caller. To support sharing of histogram data
@@ -315,6 +320,11 @@
   // Purges and suspends the renderer process.
   virtual void PurgeAndSuspend() = 0;
 
+  // Acquires the |mojom::Renderer| interface to the render process. This is for
+  // internal use only, and is only exposed here to support
+  // MockRenderProcessHost usage in tests.
+  virtual mojom::Renderer* GetRendererInterface() = 0;
+
   // Returns the current number of active views in this process.  Excludes
   // any RenderViewHosts that are swapped out.
   size_t GetActiveViewCount();
diff --git a/content/public/browser/utility_process_host.h b/content/public/browser/utility_process_host.h
index 2f49727..d131f5b 100644
--- a/content/public/browser/utility_process_host.h
+++ b/content/public/browser/utility_process_host.h
@@ -17,7 +17,7 @@
 class SequencedTaskRunner;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -34,7 +34,7 @@
 // EndBatchMode().
 // If you need to bind Mojo interfaces, use Start() to start the child
 // process and GetRemoteInterfaces() to get the utility process'
-// shell::InterfaceProvider.
+// service_manager::InterfaceProvider.
 //
 // Note: If your class keeps a ptr to an object of this type, grab a weak ptr to
 // avoid a use after free since this object is deleted synchronously but the
@@ -82,9 +82,10 @@
   // Starts the utility process.
   virtual bool Start() = 0;
 
-  // Returns the shell::InterfaceProvider the browser process can use to bind
+  // Returns the service_manager::InterfaceProvider the browser process can use
+  // to bind
   // interfaces exposed to it from the utility process.
-  virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0;
+  virtual service_manager::InterfaceProvider* GetRemoteInterfaces() = 0;
 
   // Set the name of the process to appear in the task manager.
   virtual void SetName(const base::string16& name) = 0;
diff --git a/content/public/browser/utility_process_mojo_client.h b/content/public/browser/utility_process_mojo_client.h
index 09bf76c..e81667b 100644
--- a/content/public/browser/utility_process_mojo_client.h
+++ b/content/public/browser/utility_process_mojo_client.h
@@ -16,7 +16,7 @@
 #include "content/public/browser/utility_process_host.h"
 #include "content/public/browser/utility_process_host_client.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace content {
 
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 3040b9b..697ea3ae 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -46,7 +46,7 @@
 struct LoadStateWithParam;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -741,7 +741,7 @@
   // Returns an InterfaceProvider for Java-implemented interfaces that are
   // scoped to this WebContents. This provides access to interfaces implemented
   // in Java in the browser process to C++ code in the browser process.
-  virtual shell::InterfaceProvider* GetJavaInterfaces() = 0;
+  virtual service_manager::InterfaceProvider* GetJavaInterfaces() = 0;
 #elif defined(OS_MACOSX)
   // Allowing other views disables optimizations which assume that only a single
   // WebContents is present.
diff --git a/content/public/child/child_thread.h b/content/public/child/child_thread.h
index 9d2fa88..e8d9e351 100644
--- a/content/public/child/child_thread.h
+++ b/content/public/child/child_thread.h
@@ -20,7 +20,7 @@
 struct UserMetricsAction;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 class InterfaceRegistry;
 }
@@ -68,16 +68,16 @@
   virtual void RecordComputedAction(const std::string& action) = 0;
 
   // Returns the ServiceManagerConnection for the thread (from which a
-  // shell::Connector can be obtained).
+  // service_manager::Connector can be obtained).
   virtual ServiceManagerConnection* GetServiceManagerConnection() = 0;
 
   // Returns the InterfaceRegistry that this process uses to expose interfaces
   // to the browser.
-  virtual shell::InterfaceRegistry* GetInterfaceRegistry() = 0;
+  virtual service_manager::InterfaceRegistry* GetInterfaceRegistry() = 0;
 
   // Returns the InterfaceProvider that this process can use to bind
   // interfaces exposed to it by the browser.
-  virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0;
+  virtual service_manager::InterfaceProvider* GetRemoteInterfaces() = 0;
 };
 
 }  // namespace content
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn
index 5d9e1f83..efd2e7b2 100644
--- a/content/public/common/BUILD.gn
+++ b/content/public/common/BUILD.gn
@@ -235,8 +235,8 @@
     "//content/common",
     "//content/public/common:interfaces",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//third_party/WebKit/public:blink_headers",
     "//ui/accessibility",
     "//ui/surface",
@@ -251,7 +251,7 @@
     "//mojo/common",
     "//net",
     "//ppapi/c",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//storage/common",
     "//third_party/icu",
diff --git a/content/public/common/associated_interface_provider.h b/content/public/common/associated_interface_provider.h
index 400cdb2f..156f64a 100644
--- a/content/public/common/associated_interface_provider.h
+++ b/content/public/common/associated_interface_provider.h
@@ -19,7 +19,8 @@
 
 // A helper interface for connecting to remote Channel-associated interfaces.
 //
-// This is analogous to shell::InterfaceProvider in that it provides a means of
+// This is analogous to service_manager::InterfaceProvider in that it provides a
+// means of
 // binding proxies to remote interfaces, but this is specifically for interfaces
 // which must be assocaited with an IPC::Channel, i.e. retain FIFO message
 // ordering with respect to legacy IPC messages.
diff --git a/content/public/common/child_process_host.h b/content/public/common/child_process_host.h
index 5d043d00..850138d 100644
--- a/content/public/common/child_process_host.h
+++ b/content/public/common/child_process_host.h
@@ -21,7 +21,7 @@
 class MessageFilter;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -98,9 +98,10 @@
   // Adds an IPC message filter.  A reference will be kept to the filter.
   virtual void AddFilter(IPC::MessageFilter* filter) = 0;
 
-  // Returns the shell::InterfaceProvider the process host can use to bind
+  // Returns the service_manager::InterfaceProvider the process host can use to
+  // bind
   // interfaces exposed to it from the child.
-  virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0;
+  virtual service_manager::InterfaceProvider* GetRemoteInterfaces() = 0;
 
 #if defined(OS_POSIX)
   // See IPC::Channel::TakeClientFileDescriptor.
diff --git a/content/public/common/child_process_host_delegate.cc b/content/public/common/child_process_host_delegate.cc
index 9efd375..5afe0dd 100644
--- a/content/public/common/child_process_host_delegate.cc
+++ b/content/public/common/child_process_host_delegate.cc
@@ -10,7 +10,8 @@
   return true;
 }
 
-shell::InterfaceProvider* ChildProcessHostDelegate::GetRemoteInterfaces() {
+service_manager::InterfaceProvider*
+ChildProcessHostDelegate::GetRemoteInterfaces() {
   return nullptr;
 }
 
diff --git a/content/public/common/child_process_host_delegate.h b/content/public/common/child_process_host_delegate.h
index 2bf3320..62fa80e 100644
--- a/content/public/common/child_process_host_delegate.h
+++ b/content/public/common/child_process_host_delegate.h
@@ -11,7 +11,7 @@
 #include "content/common/content_export.h"
 #include "ipc/ipc_listener.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -36,9 +36,11 @@
   // OnProcessLaunched is called or it will be invalid and may crash.
   virtual const base::Process& GetProcess() const = 0;
 
-  // Returns the shell::InterfaceProvider the process host can use to bind
+  // Returns the service_manager::InterfaceProvider the process host can use to
+  // bind
   // interfaces exposed to it from the child.
-  CONTENT_EXPORT virtual shell::InterfaceProvider* GetRemoteInterfaces();
+  CONTENT_EXPORT virtual service_manager::InterfaceProvider*
+  GetRemoteInterfaces();
 };
 
 };  // namespace content
diff --git a/content/public/common/connection_filter.h b/content/public/common/connection_filter.h
index d8a784cc..dac258d 100644
--- a/content/public/common/connection_filter.h
+++ b/content/public/common/connection_filter.h
@@ -7,7 +7,7 @@
 
 #include "content/common/content_export.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 class Identity;
 class InterfaceRegistry;
@@ -35,9 +35,9 @@
   //
   // NOTE: This ConnectionFilter is NOT guaranteed to outlive |registry|, so you
   // must not attach unsafe references to |this|, e.g., via AddInterface().
-  virtual bool OnConnect(const shell::Identity& remote_identity,
-                         shell::InterfaceRegistry* registry,
-                         shell::Connector* connector) = 0;
+  virtual bool OnConnect(const service_manager::Identity& remote_identity,
+                         service_manager::InterfaceRegistry* registry,
+                         service_manager::Connector* connector) = 0;
 };
 
 }  // namespace content
diff --git a/content/public/common/service_info.cc b/content/public/common/service_info.cc
index ca39f5e..450df6f 100644
--- a/content/public/common/service_info.cc
+++ b/content/public/common/service_info.cc
@@ -5,7 +5,7 @@
 #include "content/public/common/service_info.h"
 
 #include "base/callback.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace content {
 
diff --git a/content/public/common/service_info.h b/content/public/common/service_info.h
index 7acd37a..cf90d5d 100644
--- a/content/public/common/service_info.h
+++ b/content/public/common/service_info.h
@@ -12,7 +12,7 @@
 #include "base/single_thread_task_runner.h"
 #include "content/common/content_export.h"
 
-namespace shell {
+namespace service_manager {
 class Service;
 }
 
@@ -21,8 +21,9 @@
 // ServiceInfo provides details necessary to construct and bind new instances
 // of embedded services.
 struct CONTENT_EXPORT ServiceInfo {
-  using ServiceFactory = base::Callback<std::unique_ptr<shell::Service>(
-      const base::Closure& quit_closure)>;
+  using ServiceFactory =
+      base::Callback<std::unique_ptr<service_manager::Service>(
+          const base::Closure& quit_closure)>;
 
   ServiceInfo();
   ServiceInfo(const ServiceInfo& other);
diff --git a/content/public/common/service_manager_connection.h b/content/public/common/service_manager_connection.h
index f73d371a..23b8f1a6 100644
--- a/content/public/common/service_manager_connection.h
+++ b/content/public/common/service_manager_connection.h
@@ -11,10 +11,10 @@
 #include "base/sequenced_task_runner.h"
 #include "content/common/content_export.h"
 #include "content/public/common/service_info.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connection;
 class Connector;
 class InterfaceProvider;
@@ -25,10 +25,11 @@
 
 class ConnectionFilter;
 
-// Encapsulates a connection to a //services/shell.
+// Encapsulates a connection to a //services/service_manager.
 // Access a global instance on the thread the ServiceContext was bound by
 // calling Holder::Get().
-// Clients can add shell::Service implementations whose exposed interfaces
+// Clients can add service_manager::Service implementations whose exposed
+// interfaces
 // will be exposed to inbound connections to this object's Service.
 // Alternatively clients can define named services that will be constructed when
 // requests for those service names are received.
@@ -37,7 +38,7 @@
 class CONTENT_EXPORT ServiceManagerConnection {
  public:
   using ServiceRequestHandler =
-      base::Callback<void(shell::mojom::ServiceRequest)>;
+      base::Callback<void(service_manager::mojom::ServiceRequest)>;
   using Factory =
       base::Callback<std::unique_ptr<ServiceManagerConnection>(void)>;
 
@@ -65,7 +66,7 @@
   // its interfaces and accept new connections on |io_task_runner| only. Note
   // that no incoming connections are accepted until Start() is called.
   static std::unique_ptr<ServiceManagerConnection> Create(
-      shell::mojom::ServiceRequest request,
+      service_manager::mojom::ServiceRequest request,
       scoped_refptr<base::SequencedTaskRunner> io_task_runner);
 
   // Begins accepting incoming connections. Connection filters MUST be added
@@ -77,14 +78,16 @@
   // request from the shell.
   virtual void SetInitializeHandler(const base::Closure& handler) = 0;
 
-  // Returns the shell::Connector received via this connection's Service
+  // Returns the service_manager::Connector received via this connection's
+  // Service
   // implementation. Use this to initiate connections as this object's Identity.
-  virtual shell::Connector* GetConnector() = 0;
+  virtual service_manager::Connector* GetConnector() = 0;
 
   // Returns this connection's identity with the Service Manager. Connections
-  // initiated via the shell::Connector returned by GetConnector() will use
+  // initiated via the service_manager::Connector returned by GetConnector()
+  // will use
   // this.
-  virtual const shell::Identity& GetIdentity() const = 0;
+  virtual const service_manager::Identity& GetIdentity() const = 0;
 
   // Sets a closure that is called when the connection is lost. Note that
   // connection may already have been closed, in which case |closure| will be
@@ -104,8 +107,8 @@
   // TODO(rockot): Remove this. It's a temporary solution to avoid porting all
   // relevant code to ConnectionFilters at once.
   virtual void SetupInterfaceRequestProxies(
-      shell::InterfaceRegistry* registry,
-      shell::InterfaceProvider* provider) = 0;
+      service_manager::InterfaceRegistry* registry,
+      service_manager::InterfaceProvider* provider) = 0;
 
   static const int kInvalidConnectionFilterId = 0;
 
diff --git a/content/public/gpu/content_gpu_client.h b/content/public/gpu/content_gpu_client.h
index e2d45495..a9467c6 100644
--- a/content/public/gpu/content_gpu_client.h
+++ b/content/public/gpu/content_gpu_client.h
@@ -13,7 +13,7 @@
 struct GpuPreferences;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 class InterfaceRegistry;
 }
@@ -33,12 +33,12 @@
   // Allows the client to expose interfaces from the GPU process to the browser
   // process via |registry|.
   virtual void ExposeInterfacesToBrowser(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       const gpu::GpuPreferences& gpu_preferences) {}
 
   // Allow the client to bind interfaces exposed by the browser process.
   virtual void ConsumeInterfacesFromBrowser(
-      shell::InterfaceProvider* provider) {}
+      service_manager::InterfaceProvider* provider) {}
 
   // Allows client to supply a SyncPointManager instance instead of having
   // content internally create one.
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h
index 14d8550..fc9fba9 100644
--- a/content/public/renderer/content_renderer_client.h
+++ b/content/public/renderer/content_renderer_client.h
@@ -71,7 +71,7 @@
 class RendererFactory;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
@@ -368,7 +368,7 @@
   // Allows the client to expose interfaces from the renderer process to the
   // browser process via |registry|.
   virtual void ExposeInterfacesToBrowser(
-      shell::InterfaceRegistry* interface_registry) {}
+      service_manager::InterfaceRegistry* interface_registry) {}
 
   // Overwrites the given URL to use an HTML5 embed if possible.
   // An empty URL is returned if the URL is not overriden.
diff --git a/content/public/renderer/render_frame.h b/content/public/renderer/render_frame.h
index a49a2c4..4cfe3438 100644
--- a/content/public/renderer/render_frame.h
+++ b/content/public/renderer/render_frame.h
@@ -34,7 +34,7 @@
 class Size;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 class InterfaceProvider;
 }
@@ -151,11 +151,11 @@
 
   // Returns the InterfaceRegistry that this process uses to expose interfaces
   // to the application running in this frame.
-  virtual shell::InterfaceRegistry* GetInterfaceRegistry() = 0;
+  virtual service_manager::InterfaceRegistry* GetInterfaceRegistry() = 0;
 
   // Returns the InterfaceProvider that this process can use to bind
   // interfaces exposed to it by the application running in this frame.
-  virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0;
+  virtual service_manager::InterfaceProvider* GetRemoteInterfaces() = 0;
 
   // Returns the AssociatedInterfaceRegistry this frame can use to expose
   // frame-specific Channel-associated interfaces to the remote RenderFrameHost.
diff --git a/content/public/test/DEPS b/content/public/test/DEPS
index 1169b4e..1ef5490 100644
--- a/content/public/test/DEPS
+++ b/content/public/test/DEPS
@@ -2,7 +2,7 @@
   "-content",
   "+content/public",
   "+device/geolocation/android/geolocation_jni_registrar.h",
-  "+services/shell",
+  "+services/service_manager",
   "+v8/include/v8.h",
 ]
 
diff --git a/content/public/test/mock_download_item.cc b/content/public/test/mock_download_item.cc
index 562972a..7b19c31 100644
--- a/content/public/test/mock_download_item.cc
+++ b/content/public/test/mock_download_item.cc
@@ -9,7 +9,8 @@
 MockDownloadItem::MockDownloadItem() {}
 
 MockDownloadItem::~MockDownloadItem() {
-  FOR_EACH_OBSERVER(Observer, observers_, OnDownloadDestroyed(this));
+  for (auto& observer : observers_)
+    observer.OnDownloadDestroyed(this);
 }
 
 void MockDownloadItem::AddObserver(Observer* observer) {
@@ -21,15 +22,18 @@
 }
 
 void MockDownloadItem::NotifyObserversDownloadOpened() {
-  FOR_EACH_OBSERVER(Observer, observers_, OnDownloadOpened(this));
+  for (auto& observer : observers_)
+    observer.OnDownloadOpened(this);
 }
 
 void MockDownloadItem::NotifyObserversDownloadRemoved() {
-  FOR_EACH_OBSERVER(Observer, observers_, OnDownloadRemoved(this));
+  for (auto& observer : observers_)
+    observer.OnDownloadRemoved(this);
 }
 
 void MockDownloadItem::NotifyObserversDownloadUpdated() {
-  FOR_EACH_OBSERVER(Observer, observers_, OnDownloadUpdated(this));
+  for (auto& observer : observers_)
+    observer.OnDownloadUpdated(this);
 }
 
 }
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc
index b6337d36..d987387 100644
--- a/content/public/test/mock_render_process_host.cc
+++ b/content/public/test/mock_render_process_host.cc
@@ -20,6 +20,7 @@
 #include "content/browser/renderer_host/render_widget_host_impl.h"
 #include "content/common/child_process_host_impl.h"
 #include "content/common/frame_messages.h"
+#include "content/common/renderer.mojom.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/global_request_id.h"
 #include "content/public/browser/notification_details.h"
@@ -28,6 +29,7 @@
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/render_widget_host_iterator.h"
 #include "content/public/browser/storage_partition.h"
+#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
 
 namespace content {
 
@@ -57,9 +59,8 @@
 
   // In unit tests, Cleanup() might not have been called.
   if (!deletion_callback_called_) {
-    FOR_EACH_OBSERVER(RenderProcessHostObserver,
-                      observers_,
-                      RenderProcessHostDestroyed(this));
+    for (auto& observer : observers_)
+      observer.RenderProcessHostDestroyed(this);
     RenderProcessHostImpl::UnregisterHost(GetID());
   }
 }
@@ -72,9 +73,8 @@
       NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this),
       Details<RenderProcessHost::RendererClosedDetails>(&details));
 
-  FOR_EACH_OBSERVER(
-      RenderProcessHostObserver, observers_,
-      RenderProcessExited(this, details.status, details.exit_code));
+  for (auto& observer : observers_)
+    observer.RenderProcessExited(this, details.status, details.exit_code);
 
   // Send every routing ID a FrameHostMsg_RenderProcessGone message. To ensure a
   // predictable order for unittests which may assert against the order, we sort
@@ -97,7 +97,7 @@
 
 bool MockRenderProcessHost::Init() {
   has_connection_ = true;
-  remote_interfaces_.reset(new shell::InterfaceProvider);
+  remote_interfaces_.reset(new service_manager::InterfaceProvider);
   return true;
 }
 
@@ -204,9 +204,8 @@
 
 void MockRenderProcessHost::Cleanup() {
   if (listeners_.IsEmpty()) {
-    FOR_EACH_OBSERVER(RenderProcessHostObserver,
-                      observers_,
-                      RenderProcessHostDestroyed(this));
+    for (auto& observer : observers_)
+      observer.RenderProcessHostDestroyed(this);
     base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
     RenderProcessHostImpl::UnregisterHost(GetID());
     deletion_callback_called_ = true;
@@ -253,7 +252,8 @@
   return base::TimeDelta::FromMilliseconds(0);
 }
 
-shell::InterfaceProvider* MockRenderProcessHost::GetRemoteInterfaces() {
+service_manager::InterfaceProvider*
+MockRenderProcessHost::GetRemoteInterfaces() {
   return remote_interfaces_.get();
 }
 
@@ -298,6 +298,14 @@
 
 void MockRenderProcessHost::PurgeAndSuspend() {}
 
+mojom::Renderer* MockRenderProcessHost::GetRendererInterface() {
+  if (!renderer_interface_) {
+    renderer_interface_.reset(new mojom::RendererAssociatedPtr);
+    mojo::GetDummyProxyForTesting(renderer_interface_.get());
+  }
+  return renderer_interface_->get();
+}
+
 void MockRenderProcessHost::FilterURL(bool empty_allowed, GURL* url) {
   RenderProcessHostImpl::FilterURL(this, empty_allowed, url);
 }
diff --git a/content/public/test/mock_render_process_host.h b/content/public/test/mock_render_process_host.h
index d2fcfe1..bf21d6b 100644
--- a/content/public/test/mock_render_process_host.h
+++ b/content/public/test/mock_render_process_host.h
@@ -17,7 +17,8 @@
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_process_host_factory.h"
 #include "ipc/ipc_test_sink.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 class StoragePartition;
 
@@ -92,7 +93,7 @@
       const WebRtcRtpPacketCallback& packet_callback) override;
 #endif
   void ResumeDeferredNavigation(const GlobalRequestID& request_id) override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
   std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator()
       override;
   const base::TimeTicks& GetInitTimeForNavigationMetrics() const override;
@@ -104,6 +105,7 @@
   void ForceReleaseWorkerRefCounts() override;
   bool IsWorkerRefCountDisabled() override;
   void PurgeAndSuspend() override;
+  mojom::Renderer* GetRendererInterface() override;
 
   // IPC::Sender via RenderProcessHost.
   bool Send(IPC::Message* msg) override;
@@ -136,7 +138,7 @@
   int worker_ref_count() const { return worker_ref_count_; }
 
   void SetRemoteInterfaces(
-      std::unique_ptr<shell::InterfaceProvider> remote_interfaces) {
+      std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces) {
     remote_interfaces_ = std::move(remote_interfaces);
   }
 
@@ -159,7 +161,9 @@
   bool is_process_backgrounded_;
   std::unique_ptr<base::ProcessHandle> process_handle;
   int worker_ref_count_;
-  std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
+  std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
+  std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>>
+      renderer_interface_;
 
   DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost);
 };
diff --git a/content/public/test/mock_render_thread.cc b/content/public/test/mock_render_thread.cc
index e93d645fb..f0cda4f 100644
--- a/content/public/test/mock_render_thread.cc
+++ b/content/public/test/mock_render_thread.cc
@@ -17,8 +17,8 @@
 #include "ipc/ipc_message_utils.h"
 #include "ipc/ipc_sync_message.h"
 #include "ipc/message_filter.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/web/WebScriptController.h"
 
@@ -231,18 +231,18 @@
   return nullptr;
 }
 
-shell::InterfaceRegistry* MockRenderThread::GetInterfaceRegistry() {
+service_manager::InterfaceRegistry* MockRenderThread::GetInterfaceRegistry() {
   if (!interface_registry_)
-    interface_registry_.reset(new shell::InterfaceRegistry);
+    interface_registry_.reset(new service_manager::InterfaceRegistry);
   return interface_registry_.get();
 }
 
-shell::InterfaceProvider* MockRenderThread::GetRemoteInterfaces() {
+service_manager::InterfaceProvider* MockRenderThread::GetRemoteInterfaces() {
   if (!remote_interfaces_) {
-    shell::mojom::InterfaceProviderPtr remote_interface_provider;
+    service_manager::mojom::InterfaceProviderPtr remote_interface_provider;
     pending_remote_interface_provider_request_ =
         GetProxy(&remote_interface_provider);
-    remote_interfaces_.reset(new shell::InterfaceProvider);
+    remote_interfaces_.reset(new service_manager::InterfaceProvider);
     remote_interfaces_->Bind(std::move(remote_interface_provider));
   }
   return remote_interfaces_.get();
diff --git a/content/public/test/mock_render_thread.h b/content/public/test/mock_render_thread.h
index 9da3b97..47a01cf 100644
--- a/content/public/test/mock_render_thread.h
+++ b/content/public/test/mock_render_thread.h
@@ -16,7 +16,7 @@
 #include "content/public/renderer/render_thread.h"
 #include "ipc/ipc_test_sink.h"
 #include "ipc/message_filter.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "third_party/WebKit/public/web/WebPopupType.h"
 
 struct FrameHostMsg_CreateChildFrame_Params;
@@ -86,8 +86,8 @@
   void ReleaseCachedFonts() override;
 #endif
   ServiceManagerConnection* GetServiceManagerConnection() override;
-  shell::InterfaceRegistry* GetInterfaceRegistry() override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceRegistry* GetInterfaceRegistry() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
 
   //////////////////////////////////////////////////////////////////////////
   // The following functions are called by the test itself.
@@ -163,9 +163,9 @@
   base::ObserverList<RenderThreadObserver> observers_;
 
   cc::TestSharedBitmapManager shared_bitmap_manager_;
-  std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
-  std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
-  shell::mojom::InterfaceProviderRequest
+  std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
+  std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
+  service_manager::mojom::InterfaceProviderRequest
       pending_remote_interface_provider_request_;
 
   std::unique_ptr<mojom::RenderMessageFilter> mock_render_message_filter_;
diff --git a/content/public/test/test_service.cc b/content/public/test/test_service.cc
index b46c4b71..11c3bc7c 100644
--- a/content/public/test/test_service.cc
+++ b/content/public/test/test_service.cc
@@ -8,8 +8,8 @@
 
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace content {
 
@@ -21,14 +21,14 @@
 TestService::~TestService() {
 }
 
-bool TestService::OnConnect(const shell::Identity& remote_identity,
-                            shell::InterfaceRegistry* registry) {
+bool TestService::OnConnect(const service_manager::Identity& remote_identity,
+                            service_manager::InterfaceRegistry* registry) {
   requestor_name_ = remote_identity.name();
   registry->AddInterface<mojom::TestService>(this);
   return true;
 }
 
-void TestService::Create(const shell::Identity& remote_identity,
+void TestService::Create(const service_manager::Identity& remote_identity,
                          mojom::TestServiceRequest request) {
   DCHECK(!service_binding_.is_bound());
   service_binding_.Bind(std::move(request));
diff --git a/content/public/test/test_service.h b/content/public/test/test_service.h
index 574931c6..ee276e7 100644
--- a/content/public/test/test_service.h
+++ b/content/public/test/test_service.h
@@ -10,8 +10,8 @@
 #include "base/macros.h"
 #include "content/public/test/test_service.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace content {
 
@@ -19,20 +19,21 @@
 
 // Simple Service which provides a mojom::TestService impl. The service
 // terminates itself after its TestService fulfills a single DoSomething call.
-class TestService : public shell::Service,
-                    public shell::InterfaceFactory<mojom::TestService>,
-                    public mojom::TestService {
+class TestService
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::TestService>,
+      public mojom::TestService {
  public:
   TestService();
   ~TestService() override;
 
  private:
-  // shell::Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
-  // shell::InterfaceFactory<mojom::TestService>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::TestService>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::TestServiceRequest request) override;
 
   // TestService:
diff --git a/content/public/utility/content_utility_client.h b/content/public/utility/content_utility_client.h
index 05f46a57a..7faf52fe 100644
--- a/content/public/utility/content_utility_client.h
+++ b/content/public/utility/content_utility_client.h
@@ -14,7 +14,7 @@
 
 class GURL;
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 class Service;
 }
@@ -36,7 +36,8 @@
 
   // Allows the client to expose interfaces from this utility process to the
   // browser process via |registry|.
-  virtual void ExposeInterfacesToBrowser(shell::InterfaceRegistry* registry) {}
+  virtual void ExposeInterfacesToBrowser(
+      service_manager::InterfaceRegistry* registry) {}
 
   virtual void RegisterServices(StaticServiceMap* services) {}
 };
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
index 7b5eba3..daed8b3 100644
--- a/content/renderer/BUILD.gn
+++ b/content/renderer/BUILD.gn
@@ -442,8 +442,8 @@
     "//net",
     "//ppapi/features",
     "//sandbox",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//skia",
     "//storage/common",
     "//third_party/WebKit/public:blink",
diff --git a/content/renderer/bluetooth/web_bluetooth_impl.cc b/content/renderer/bluetooth/web_bluetooth_impl.cc
index b2f47992..5960a65 100644
--- a/content/renderer/bluetooth/web_bluetooth_impl.cc
+++ b/content/renderer/bluetooth/web_bluetooth_impl.cc
@@ -16,7 +16,7 @@
 #include "content/renderer/bluetooth/bluetooth_type_converters.h"
 #include "ipc/ipc_message.h"
 #include "mojo/public/cpp/bindings/array.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothDevice.h"
 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothDeviceInit.h"
 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic.h"
@@ -36,7 +36,8 @@
 
 }  // namespace
 
-WebBluetoothImpl::WebBluetoothImpl(shell::InterfaceProvider* remote_interfaces)
+WebBluetoothImpl::WebBluetoothImpl(
+    service_manager::InterfaceProvider* remote_interfaces)
     : remote_interfaces_(remote_interfaces), binding_(this) {}
 
 WebBluetoothImpl::~WebBluetoothImpl() {
diff --git a/content/renderer/bluetooth/web_bluetooth_impl.h b/content/renderer/bluetooth/web_bluetooth_impl.h
index 58696d7..2436f55 100644
--- a/content/renderer/bluetooth/web_bluetooth_impl.h
+++ b/content/renderer/bluetooth/web_bluetooth_impl.h
@@ -26,7 +26,7 @@
 class WebBluetoothRemoteGATTCharacteristic;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -41,7 +41,7 @@
     : NON_EXPORTED_BASE(public blink::mojom::WebBluetoothServiceClient),
       NON_EXPORTED_BASE(public blink::WebBluetooth) {
  public:
-  WebBluetoothImpl(shell::InterfaceProvider* remote_interfaces);
+  WebBluetoothImpl(service_manager::InterfaceProvider* remote_interfaces);
   ~WebBluetoothImpl() override;
 
   // blink::WebBluetooth interface:
@@ -130,7 +130,7 @@
       const std::vector<uint8_t>& value);
 
   blink::mojom::WebBluetoothService& GetWebBluetoothService();
-  shell::InterfaceProvider* const remote_interfaces_;
+  service_manager::InterfaceProvider* const remote_interfaces_;
   blink::mojom::WebBluetoothServicePtr web_bluetooth_service_;
 
   // Map of characteristic_instance_ids to
diff --git a/content/renderer/device_sensors/device_sensor_event_pump.h b/content/renderer/device_sensors/device_sensor_event_pump.h
index 6ea5407..9a6e1e6 100644
--- a/content/renderer/device_sensors/device_sensor_event_pump.h
+++ b/content/renderer/device_sensors/device_sensor_event_pump.h
@@ -14,7 +14,7 @@
 #include "content/public/renderer/platform_event_observer.h"
 #include "content/renderer/render_thread_impl.h"
 #include "mojo/public/cpp/system/platform_handle.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace content {
 
diff --git a/content/renderer/media/image_capture_frame_grabber.cc b/content/renderer/media/image_capture_frame_grabber.cc
index 87f2afe..165d3e1b9 100644
--- a/content/renderer/media/image_capture_frame_grabber.cc
+++ b/content/renderer/media/image_capture_frame_grabber.cc
@@ -106,7 +106,8 @@
   callback.Run(surface->makeImageSnapshot());
 }
 
-ImageCaptureFrameGrabber::ImageCaptureFrameGrabber() : weak_factory_(this) {}
+ImageCaptureFrameGrabber::ImageCaptureFrameGrabber()
+    : frame_grab_in_progress_(false), weak_factory_(this) {}
 
 ImageCaptureFrameGrabber::~ImageCaptureFrameGrabber() {
   DCHECK(thread_checker_.CalledOnValidThread());
@@ -121,6 +122,12 @@
   DCHECK(track && !track->isNull() && track->getTrackData());
   DCHECK_EQ(blink::WebMediaStreamSource::TypeVideo, track->source().getType());
 
+  if (frame_grab_in_progress_) {
+    // Reject grabFrame()s too close back to back.
+    callbacks->onError();
+    return;
+  }
+
   ScopedWebCallbacks<WebImageCaptureGrabFrameCallbacks> scoped_callbacks =
       make_scoped_web_callbacks(callbacks, base::Bind(&OnError));
 
@@ -129,6 +136,7 @@
   // SKImages might be sent to resolved |callbacks| while DisconnectFromTrack()
   // is being processed, which might be further held up if UI is busy, see
   // https://crbug.com/623042.
+  frame_grab_in_progress_ = true;
   MediaStreamVideoSink::ConnectToTrack(
       *track, base::Bind(&SingleShotFrameHandler::OnVideoFrameOnIOThread,
                          make_scoped_refptr(new SingleShotFrameHandler),
@@ -145,6 +153,7 @@
   DCHECK(thread_checker_.CalledOnValidThread());
 
   MediaStreamVideoSink::DisconnectFromTrack();
+  frame_grab_in_progress_ = false;
   if (image)
     callbacks.PassCallbacks()->onSuccess(image);
   else
diff --git a/content/renderer/media/image_capture_frame_grabber.h b/content/renderer/media/image_capture_frame_grabber.h
index df33626..5b0fcbf 100644
--- a/content/renderer/media/image_capture_frame_grabber.h
+++ b/content/renderer/media/image_capture_frame_grabber.h
@@ -46,6 +46,9 @@
       ScopedWebCallbacks<blink::WebImageCaptureGrabFrameCallbacks> callbacks,
       sk_sp<SkImage> image);
 
+  // Flag to indicate that there is a frame grabbing in progress.
+  bool frame_grab_in_progress_;
+
   base::ThreadChecker thread_checker_;
   base::WeakPtrFactory<ImageCaptureFrameGrabber> weak_factory_;
 
diff --git a/content/renderer/media/media_interface_provider.cc b/content/renderer/media/media_interface_provider.cc
index e5875308..4a445cdc 100644
--- a/content/renderer/media/media_interface_provider.cc
+++ b/content/renderer/media/media_interface_provider.cc
@@ -10,14 +10,13 @@
 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
 #include "media/mojo/interfaces/renderer.mojom.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace content {
 
 MediaInterfaceProvider::MediaInterfaceProvider(
-    shell::InterfaceProvider* remote_interfaces)
-    : remote_interfaces_(remote_interfaces) {
-}
+    service_manager::InterfaceProvider* remote_interfaces)
+    : remote_interfaces_(remote_interfaces) {}
 
 MediaInterfaceProvider::~MediaInterfaceProvider() {
   DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/content/renderer/media/media_interface_provider.h b/content/renderer/media/media_interface_provider.h
index 271fcf1..4431a9d 100644
--- a/content/renderer/media/media_interface_provider.h
+++ b/content/renderer/media/media_interface_provider.h
@@ -10,10 +10,10 @@
 #include "base/threading/thread_checker.h"
 #include "content/common/content_export.h"
 #include "media/mojo/interfaces/service_factory.mojom.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "url/gurl.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -23,9 +23,10 @@
 // provides media related services and handles disconnection automatically.
 // This class is single threaded.
 class CONTENT_EXPORT MediaInterfaceProvider
-    : public shell::mojom::InterfaceProvider {
+    : public service_manager::mojom::InterfaceProvider {
  public:
-  explicit MediaInterfaceProvider(shell::InterfaceProvider* remote_interfaces);
+  explicit MediaInterfaceProvider(
+      service_manager::InterfaceProvider* remote_interfaces);
   ~MediaInterfaceProvider() final;
 
   // InterfaceProvider implementation.
@@ -37,7 +38,7 @@
   void OnConnectionError();
 
   base::ThreadChecker thread_checker_;
-  shell::InterfaceProvider* remote_interfaces_;
+  service_manager::InterfaceProvider* remote_interfaces_;
   media::mojom::ServiceFactoryPtr media_service_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(MediaInterfaceProvider);
diff --git a/content/renderer/media/user_media_client_impl.h b/content/renderer/media/user_media_client_impl.h
index 111c932..5f33c98f 100644
--- a/content/renderer/media/user_media_client_impl.h
+++ b/content/renderer/media/user_media_client_impl.h
@@ -21,7 +21,7 @@
 #include "content/public/renderer/render_frame_observer.h"
 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
 #include "content/renderer/media/media_stream_source.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/WebMediaStream.h"
 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
 #include "third_party/WebKit/public/platform/WebSourceInfo.h"
diff --git a/content/renderer/mojo/blink_interface_provider_impl.cc b/content/renderer/mojo/blink_interface_provider_impl.cc
index e6df27d..0cce6d83 100644
--- a/content/renderer/mojo/blink_interface_provider_impl.cc
+++ b/content/renderer/mojo/blink_interface_provider_impl.cc
@@ -9,12 +9,12 @@
 #include "base/bind.h"
 #include "base/single_thread_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace content {
 
 BlinkInterfaceProviderImpl::BlinkInterfaceProviderImpl(
-    base::WeakPtr<shell::InterfaceProvider> remote_interfaces)
+    base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces)
     : remote_interfaces_(remote_interfaces),
       main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       weak_ptr_factory_(this) {}
diff --git a/content/renderer/mojo/blink_interface_provider_impl.h b/content/renderer/mojo/blink_interface_provider_impl.h
index 4fd4a66..eb8cd42 100644
--- a/content/renderer/mojo/blink_interface_provider_impl.h
+++ b/content/renderer/mojo/blink_interface_provider_impl.h
@@ -15,18 +15,18 @@
 class SingleThreadTaskRunner;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
 namespace content {
 
 // An implementation of blink::InterfaceProvider that forwards to a
-// shell::InterfaceProvider.
+// service_manager::InterfaceProvider.
 class BlinkInterfaceProviderImpl : public blink::InterfaceProvider {
  public:
   explicit BlinkInterfaceProviderImpl(
-      base::WeakPtr<shell::InterfaceProvider> remote_interfaces);
+      base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces);
   ~BlinkInterfaceProviderImpl();
 
   // blink::InterfaceProvider override.
@@ -34,7 +34,7 @@
                     mojo::ScopedMessagePipeHandle handle) override;
 
  private:
-  const base::WeakPtr<shell::InterfaceProvider> remote_interfaces_;
+  const base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces_;
 
   scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
 
diff --git a/content/renderer/mojo/blink_interface_registry_impl.cc b/content/renderer/mojo/blink_interface_registry_impl.cc
index 00f47b69..563eb00 100644
--- a/content/renderer/mojo/blink_interface_registry_impl.cc
+++ b/content/renderer/mojo/blink_interface_registry_impl.cc
@@ -8,12 +8,12 @@
 
 #include "base/bind.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace content {
 
 BlinkInterfaceRegistryImpl::BlinkInterfaceRegistryImpl(
-    base::WeakPtr<shell::InterfaceRegistry> interface_registry)
+    base::WeakPtr<service_manager::InterfaceRegistry> interface_registry)
     : interface_registry_(interface_registry) {}
 
 BlinkInterfaceRegistryImpl::~BlinkInterfaceRegistryImpl() = default;
diff --git a/content/renderer/mojo/blink_interface_registry_impl.h b/content/renderer/mojo/blink_interface_registry_impl.h
index 86414ba..6dd48250 100644
--- a/content/renderer/mojo/blink_interface_registry_impl.h
+++ b/content/renderer/mojo/blink_interface_registry_impl.h
@@ -9,7 +9,7 @@
 #include "base/memory/weak_ptr.h"
 #include "third_party/WebKit/public/platform/InterfaceRegistry.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
@@ -18,7 +18,7 @@
 class BlinkInterfaceRegistryImpl : public blink::InterfaceRegistry {
  public:
   explicit BlinkInterfaceRegistryImpl(
-      base::WeakPtr<shell::InterfaceRegistry> interface_registry);
+      base::WeakPtr<service_manager::InterfaceRegistry> interface_registry);
   ~BlinkInterfaceRegistryImpl();
 
   // blink::InterfaceRegistry override.
@@ -26,7 +26,7 @@
                     const blink::InterfaceFactory& factory) override;
 
  private:
-  const base::WeakPtr<shell::InterfaceRegistry> interface_registry_;
+  const base::WeakPtr<service_manager::InterfaceRegistry> interface_registry_;
 
   DISALLOW_COPY_AND_ASSIGN(BlinkInterfaceRegistryImpl);
 };
diff --git a/content/renderer/mojo/interface_provider_js_wrapper.cc b/content/renderer/mojo/interface_provider_js_wrapper.cc
index 1194330..50d73d4 100644
--- a/content/renderer/mojo/interface_provider_js_wrapper.cc
+++ b/content/renderer/mojo/interface_provider_js_wrapper.cc
@@ -8,7 +8,7 @@
 #include <utility>
 
 #include "mojo/edk/js/handle.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
 
 namespace content {
@@ -24,11 +24,10 @@
 }
 
 // static
-gin::Handle<InterfaceProviderJsWrapper>
-InterfaceProviderJsWrapper::Create(
+gin::Handle<InterfaceProviderJsWrapper> InterfaceProviderJsWrapper::Create(
     v8::Isolate* isolate,
     v8::Handle<v8::Context> context,
-    shell::InterfaceProvider* remote_interfaces) {
+    service_manager::InterfaceProvider* remote_interfaces) {
   return gin::CreateHandle(
       isolate,
       new InterfaceProviderJsWrapper(
@@ -62,7 +61,8 @@
     const std::string& interface_name,
     v8::Local<v8::Function> service_factory) {
   ScopedJsFactory factory(v8::Isolate::GetCurrent(), service_factory);
-  shell::InterfaceProvider::TestApi test_api(remote_interfaces_.get());
+  service_manager::InterfaceProvider::TestApi test_api(
+      remote_interfaces_.get());
   test_api.SetBinderForName(
       interface_name,
       base::Bind(&InterfaceProviderJsWrapper::CallJsFactory,
@@ -70,14 +70,15 @@
 }
 
 void InterfaceProviderJsWrapper::ClearOverridesForTesting() {
-  shell::InterfaceProvider::TestApi test_api(remote_interfaces_.get());
+  service_manager::InterfaceProvider::TestApi test_api(
+      remote_interfaces_.get());
   test_api.ClearBinders();
 }
 
 InterfaceProviderJsWrapper::InterfaceProviderJsWrapper(
     v8::Isolate* isolate,
     v8::Handle<v8::Context> context,
-    base::WeakPtr<shell::InterfaceProvider> remote_interfaces)
+    base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces)
     : isolate_(isolate),
       context_(isolate, context),
       remote_interfaces_(remote_interfaces),
diff --git a/content/renderer/mojo/interface_provider_js_wrapper.h b/content/renderer/mojo/interface_provider_js_wrapper.h
index 0c5c6eb9..aa0a479 100644
--- a/content/renderer/mojo/interface_provider_js_wrapper.h
+++ b/content/renderer/mojo/interface_provider_js_wrapper.h
@@ -15,13 +15,14 @@
 #include "mojo/public/cpp/system/message_pipe.h"
 #include "v8/include/v8.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
 namespace content {
 
-// A JS wrapper around shell::InterfaceProvider that allows connecting to
+// A JS wrapper around service_manager::InterfaceProvider that allows connecting
+// to
 // remote services.
 class CONTENT_EXPORT InterfaceProviderJsWrapper
     : public gin::Wrappable<InterfaceProviderJsWrapper> {
@@ -30,7 +31,7 @@
   static gin::Handle<InterfaceProviderJsWrapper> Create(
       v8::Isolate* isolate,
       v8::Handle<v8::Context> context,
-      shell::InterfaceProvider* remote_interfaces);
+      service_manager::InterfaceProvider* remote_interfaces);
 
   // gin::Wrappable<InterfaceProviderJsWrapper> overrides.
   gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
@@ -53,7 +54,7 @@
   InterfaceProviderJsWrapper(
       v8::Isolate* isolate,
       v8::Handle<v8::Context> context,
-      base::WeakPtr<shell::InterfaceProvider> remote_interfaces);
+      base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces);
 
   void CallJsFactory(const ScopedJsFactory& factory,
                      mojo::ScopedMessagePipeHandle pipe);
@@ -63,7 +64,7 @@
 
   v8::Isolate* isolate_;
   v8::Global<v8::Context> context_;
-  base::WeakPtr<shell::InterfaceProvider> remote_interfaces_;
+  base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces_;
 
   base::WeakPtrFactory<InterfaceProviderJsWrapper> weak_factory_;
 
diff --git a/content/renderer/mus/BUILD.gn b/content/renderer/mus/BUILD.gn
index bc6508cb..95c77c7 100644
--- a/content/renderer/mus/BUILD.gn
+++ b/content/renderer/mus/BUILD.gn
@@ -24,7 +24,7 @@
     "//content/public/child:child_sources",
     "//content/public/common:common_sources",
     "//mojo/common",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
     "//third_party/WebKit/public:blink",
diff --git a/content/renderer/mus/render_widget_window_tree_client_factory.cc b/content/renderer/mus/render_widget_window_tree_client_factory.cc
index 8486854..f57ba30 100644
--- a/content/renderer/mus/render_widget_window_tree_client_factory.cc
+++ b/content/renderer/mus/render_widget_window_tree_client_factory.cc
@@ -18,8 +18,8 @@
 #include "content/public/common/service_manager_connection.h"
 #include "content/renderer/mus/render_widget_mus_connection.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/ui/public/interfaces/window_tree.mojom.h"
 #include "url/gurl.h"
 
@@ -49,9 +49,9 @@
 
  private:
   // ConnectionFilter implementation:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry,
-                 shell::Connector* connector) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry,
+                 service_manager::Connector* connector) override {
     registry->AddInterface(
         base::Bind(&RenderWidgetWindowTreeClientFactoryImpl::CreateFactory,
                    weak_factory_.GetWeakPtr()));
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
index e0f857e4..1299a45e 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -13,7 +13,7 @@
 #include "content/public/common/presentation_constants.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/renderer/presentation/presentation_connection_client.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/WebURL.h"
 #include "third_party/WebKit/public/platform/WebVector.h"
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 88a5cd0d..8f75c8c8 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -157,8 +157,8 @@
 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
 #include "net/http/http_util.h"
 #include "ppapi/features/features.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "storage/common/data_element.h"
 #include "third_party/WebKit/public/platform/FilePathConversion.h"
 #include "third_party/WebKit/public/platform/URLConversion.h"
@@ -1119,13 +1119,13 @@
       frame_binding_(this),
       has_accessed_initial_document_(false),
       weak_factory_(this) {
-  // We don't have a shell::Connection at this point, so use nullptr.
+  // We don't have a service_manager::Connection at this point, so use nullptr.
   // TODO(beng): We should fix this, so we can apply policy about which
   //             interfaces get exposed.
-  interface_registry_.reset(new shell::InterfaceRegistry);
-  shell::mojom::InterfaceProviderPtr remote_interfaces;
+  interface_registry_.reset(new service_manager::InterfaceRegistry);
+  service_manager::mojom::InterfaceProviderPtr remote_interfaces;
   pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces);
-  remote_interfaces_.reset(new shell::InterfaceProvider);
+  remote_interfaces_.reset(new service_manager::InterfaceProvider);
   remote_interfaces_->Bind(std::move(remote_interfaces));
   blink_interface_provider_.reset(new BlinkInterfaceProviderImpl(
       remote_interfaces_->GetWeakPtr()));
@@ -2483,11 +2483,11 @@
   OnJavaScriptExecuteRequest(javascript, 0, false);
 }
 
-shell::InterfaceRegistry* RenderFrameImpl::GetInterfaceRegistry() {
+service_manager::InterfaceRegistry* RenderFrameImpl::GetInterfaceRegistry() {
   return interface_registry_.get();
 }
 
-shell::InterfaceProvider* RenderFrameImpl::GetRemoteInterfaces() {
+service_manager::InterfaceProvider* RenderFrameImpl::GetRemoteInterfaces() {
   return remote_interfaces_.get();
 }
 
@@ -2631,7 +2631,7 @@
 // mojom::Frame implementation -------------------------------------------------
 
 void RenderFrameImpl::GetInterfaceProvider(
-    shell::mojom::InterfaceProviderRequest request) {
+    service_manager::mojom::InterfaceProviderRequest request) {
   interface_registry_->Bind(std::move(request));
 }
 
@@ -3163,8 +3163,7 @@
                                       suggested_name));
   } else {
     OpenURL(request.url(), IsHttpPost(request),
-            GetRequestBodyForWebURLRequest(request),
-            GetWebURLRequestHeaders(request), referrer, policy,
+            GetRequestBodyForWebURLRequest(request), referrer, policy,
             should_replace_current_entry, false);
   }
 }
@@ -5094,8 +5093,7 @@
       render_view_->renderer_preferences_
           .browser_handles_all_top_level_requests) {
     OpenURL(url, IsHttpPost(info.urlRequest),
-            GetRequestBodyForWebURLRequest(info.urlRequest),
-            GetWebURLRequestHeaders(info.urlRequest), referrer,
+            GetRequestBodyForWebURLRequest(info.urlRequest), referrer,
             info.defaultPolicy, info.replacesCurrentHistoryItem, false);
     return blink::WebNavigationPolicyIgnore;  // Suppress the load here.
   }
@@ -5115,8 +5113,7 @@
     // JavaScript on the page is trying to interrupt the history navigation.
     if (!info.isClientRedirect) {
       OpenURL(url, IsHttpPost(info.urlRequest),
-              GetRequestBodyForWebURLRequest(info.urlRequest),
-              GetWebURLRequestHeaders(info.urlRequest), referrer,
+              GetRequestBodyForWebURLRequest(info.urlRequest), referrer,
               info.defaultPolicy, info.replacesCurrentHistoryItem, true);
       // Suppress the load in Blink but mark the frame as loading.
       return blink::WebNavigationPolicyHandledByClient;
@@ -5177,7 +5174,6 @@
     if (should_fork) {
       OpenURL(url, IsHttpPost(info.urlRequest),
               GetRequestBodyForWebURLRequest(info.urlRequest),
-              GetWebURLRequestHeaders(info.urlRequest),
               send_referrer ? referrer : Referrer(), info.defaultPolicy,
               info.replacesCurrentHistoryItem, false);
       return blink::WebNavigationPolicyIgnore;  // Suppress the load here.
@@ -5219,8 +5215,7 @@
   if (is_fork) {
     // Open the URL via the browser, not via WebKit.
     OpenURL(url, IsHttpPost(info.urlRequest),
-            GetRequestBodyForWebURLRequest(info.urlRequest),
-            GetWebURLRequestHeaders(info.urlRequest), Referrer(),
+            GetRequestBodyForWebURLRequest(info.urlRequest), Referrer(),
             info.defaultPolicy, info.replacesCurrentHistoryItem, false);
     return blink::WebNavigationPolicyIgnore;
   }
@@ -5557,7 +5552,6 @@
     const GURL& url,
     bool uses_post,
     const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
-    const std::string& extra_headers,
     const Referrer& referrer,
     WebNavigationPolicy policy,
     bool should_replace_current_entry,
@@ -5566,7 +5560,6 @@
   params.url = url;
   params.uses_post = uses_post;
   params.resource_request_body = resource_request_body;
-  params.extra_headers = extra_headers;
   params.referrer = referrer;
   params.disposition = RenderViewImpl::NavigationPolicyToDisposition(policy);
 
@@ -6058,7 +6051,8 @@
              REQUEST_CONTEXT_FRAME_TYPE_NESTED);
 
   Send(new FrameHostMsg_BeginNavigation(
-      routing_id_, MakeCommonNavigationParams(info),
+      routing_id_,
+      MakeCommonNavigationParams(info),
       BeginNavigationParams(
           GetWebURLRequestHeaders(info.urlRequest),
           GetLoadFlagsForWebURLRequest(info.urlRequest),
@@ -6326,7 +6320,8 @@
 }
 
 #if defined(ENABLE_MOJO_MEDIA)
-shell::mojom::InterfaceProvider* RenderFrameImpl::GetMediaInterfaceProvider() {
+service_manager::mojom::InterfaceProvider*
+RenderFrameImpl::GetMediaInterfaceProvider() {
   if (!media_interface_provider_) {
     media_interface_provider_.reset(
         new MediaInterfaceProvider(GetRemoteInterfaces()));
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index ad7c55c..62ac504 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -41,8 +41,8 @@
 #include "media/blink/webmediaplayer_params.h"
 #include "media/mojo/interfaces/remoting.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
 #include "third_party/WebKit/public/platform/WebFocusType.h"
 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
@@ -113,7 +113,7 @@
 class WebEncryptedMediaClientImpl;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 class InterfaceProvider;
 }
@@ -421,8 +421,8 @@
   void ExecuteJavaScript(const base::string16& javascript) override;
   bool IsMainFrame() override;
   bool IsHidden() override;
-  shell::InterfaceRegistry* GetInterfaceRegistry() override;
-  shell::InterfaceProvider* GetRemoteInterfaces() override;
+  service_manager::InterfaceRegistry* GetInterfaceRegistry() override;
+  service_manager::InterfaceProvider* GetRemoteInterfaces() override;
   AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
   AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
 #if defined(ENABLE_PLUGINS)
@@ -454,7 +454,7 @@
 
   // mojom::Frame implementation:
   void GetInterfaceProvider(
-      shell::mojom::InterfaceProviderRequest request) override;
+      service_manager::mojom::InterfaceProviderRequest request) override;
 
   // blink::WebFrameClient implementation:
   blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
@@ -894,7 +894,6 @@
       const GURL& url,
       bool uses_post,
       const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
-      const std::string& extra_headers,
       const Referrer& referrer,
       blink::WebNavigationPolicy policy,
       bool should_replace_current_entry,
@@ -1034,7 +1033,7 @@
   bool AreSecureCodecsSupported();
 
 #if defined(ENABLE_MOJO_MEDIA)
-  shell::mojom::InterfaceProvider* GetMediaInterfaceProvider();
+  service_manager::mojom::InterfaceProvider* GetMediaInterfaceProvider();
 #endif
 
 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
@@ -1236,15 +1235,15 @@
   // initialized.
   PresentationDispatcher* presentation_dispatcher_;
 
-  std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
-  std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
+  std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
+  std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
   std::unique_ptr<BlinkInterfaceProviderImpl> blink_interface_provider_;
   std::unique_ptr<BlinkInterfaceRegistryImpl> blink_interface_registry_;
-  shell::mojom::InterfaceProviderRequest
+  service_manager::mojom::InterfaceProviderRequest
       pending_remote_interface_provider_request_;
 
   // The shell proxy used to connect to services.
-  shell::mojom::ConnectorPtr connector_;
+  service_manager::mojom::ConnectorPtr connector_;
 
   // The screen orientation dispatcher attached to the frame, lazily
   // initialized.
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc
index 3fc8a180..1a833e2 100644
--- a/content/renderer/render_frame_proxy.cc
+++ b/content/renderer/render_frame_proxy.cc
@@ -111,6 +111,14 @@
                                               proxy.get(), opener);
     render_view->webview()->setMainFrame(web_frame);
     render_widget = render_view->GetWidget();
+
+    // If the RenderView is reused by this proxy after having been used for a
+    // pending RenderFrame that was discarded, its swapped out state needs to
+    // be updated, as the OnSwapOut flow which normally does this won't happen
+    // in that case.  See https://crbug.com/653746 and
+    // https://crbug.com/651980.
+    if (!render_view->is_swapped_out())
+      render_view->SetSwappedOut(true);
   } else {
     // Create a frame under an existing parent. The parent is always expected
     // to be a RenderFrameProxy, because navigations initiated by local frames
@@ -445,7 +453,6 @@
   params.url = request.url();
   params.uses_post = request.httpMethod().utf8() == "POST";
   params.resource_request_body = GetRequestBodyForWebURLRequest(request);
-  params.extra_headers = GetWebURLRequestHeaders(request);
   params.referrer = Referrer(
       blink::WebStringToGURL(
           request.httpHeaderField(blink::WebString::fromUTF8("Referer"))),
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 9e7bf65..7afa5c8 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -139,8 +139,8 @@
 #include "net/base/port_util.h"
 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
 #include "net/base/url_util.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "skia/ext/event_tracer_impl.h"
 #include "skia/ext/skia_memory_dump_provider.h"
 #include "third_party/WebKit/public/platform/WebImageGenerator.h"
@@ -369,8 +369,8 @@
 }
 
 void SetupEmbeddedWorkerOnWorkerThread(
-    shell::mojom::InterfaceProviderRequest request,
-    shell::mojom::InterfaceProviderPtrInfo remote_interfaces) {
+    service_manager::mojom::InterfaceProviderRequest request,
+    service_manager::mojom::InterfaceProviderPtrInfo remote_interfaces) {
   ServiceWorkerContextClient* client =
       ServiceWorkerContextClient::ThreadSpecificInstance();
   // It is possible for client to be null if for some reason the worker died
@@ -388,8 +388,8 @@
 
   void ExchangeInterfaceProviders(
       int32_t thread_id,
-      shell::mojom::InterfaceProviderRequest request,
-      shell::mojom::InterfaceProviderPtr remote_interfaces) override {
+      service_manager::mojom::InterfaceProviderRequest request,
+      service_manager::mojom::InterfaceProviderPtr remote_interfaces) override {
     WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask(
         FROM_HERE,
         base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request),
@@ -842,6 +842,9 @@
                  base::Unretained(this))));
 
   if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) {
+    // Disable MemoryPressureListener when memory coordinator is enabled.
+    base::MemoryPressureListener::SetNotificationsSuppressed(true);
+
     // TODO(bashi): Revisit how to manage the lifetime of
     // ChildMemoryCoordinatorImpl.
     // https://codereview.chromium.org/2094583002/#msg52
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 060e15d0..bad73417 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -385,6 +385,20 @@
       GetRenderWidgetInputHandlerDelegate(this), this));
 }
 
+void RenderWidget::SetSwappedOut(bool is_swapped_out) {
+  // We should only toggle between states.
+  DCHECK(is_swapped_out_ != is_swapped_out);
+  is_swapped_out_ = is_swapped_out;
+
+  // If we are swapping out, we will call ReleaseProcess, allowing the process
+  // to exit if all of its RenderViews are swapped out.  We wait until the
+  // WasSwappedOut call to do this, to allow the unload handler to finish.
+  // If we are swapping in, we call AddRefProcess to prevent the process from
+  // exiting.
+  if (!is_swapped_out_)
+    RenderProcess::current()->AddRefProcess();
+}
+
 bool RenderWidget::Init(int32_t opener_id) {
   bool success = DoInit(
       opener_id, RenderWidget::CreateWebWidget(this),
@@ -431,20 +445,6 @@
   }
 }
 
-void RenderWidget::SetSwappedOut(bool is_swapped_out) {
-  // We should only toggle between states.
-  DCHECK(is_swapped_out_ != is_swapped_out);
-  is_swapped_out_ = is_swapped_out;
-
-  // If we are swapping out, we will call ReleaseProcess, allowing the process
-  // to exit if all of its RenderViews are swapped out.  We wait until the
-  // WasSwappedOut call to do this, to allow the unload handler to finish.
-  // If we are swapping in, we call AddRefProcess to prevent the process from
-  // exiting.
-  if (!is_swapped_out_)
-    RenderProcess::current()->AddRefProcess();
-}
-
 void RenderWidget::WasSwappedOut() {
   // If we have been swapped out and no one else is using this process,
   // it's safe to exit now.
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 0a9e9d1..7a449da 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -164,7 +164,6 @@
   bool is_hidden() const { return is_hidden_; }
   // Temporary for debugging purposes...
   bool closing() const { return closing_; }
-  bool is_swapped_out() { return is_swapped_out_; }
   bool has_host_context_menu_location() {
     return has_host_context_menu_location_;
   }
@@ -182,6 +181,14 @@
   // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
   ScreenInfo screen_info() const { return screen_info_; }
 
+  // Sets whether this RenderWidget has been swapped out to be displayed by
+  // a RenderWidget in a different process.  If so, no new IPC messages will be
+  // sent (only ACKs) and the process is free to exit when there are no other
+  // active RenderWidgets.
+  void SetSwappedOut(bool is_swapped_out);
+
+  bool is_swapped_out() { return is_swapped_out_; }
+
   // Manage edit commands to be used for the next keyboard event.
   const EditCommands& edit_commands() const { return edit_commands_; }
   void SetEditCommandForNextKeyEvent(const std::string& name,
@@ -439,12 +446,6 @@
               blink::WebWidget* web_widget,
               IPC::SyncMessage* create_widget_message);
 
-  // Sets whether this RenderWidget has been swapped out to be displayed by
-  // a RenderWidget in a different process.  If so, no new IPC messages will be
-  // sent (only ACKs) and the process is free to exit when there are no other
-  // active RenderWidgets.
-  void SetSwappedOut(bool is_swapped_out);
-
   // Allows the process to exit once the unload handler has finished, if there
   // are no other active RenderWidgets.
   void WasSwappedOut();
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index bdfdf825..f281bde 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -81,7 +81,7 @@
 #include "media/blink/webcontentdecryptionmodule_impl.h"
 #include "media/filters/stream_parser_factory.h"
 #include "mojo/common/common_type_converters.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "storage/common/database/database_identifier.h"
 #include "storage/common/quota/quota_types.h"
 #include "third_party/WebKit/public/platform/BlameContext.h"
@@ -252,7 +252,7 @@
 
 RendererBlinkPlatformImpl::RendererBlinkPlatformImpl(
     blink::scheduler::RendererScheduler* renderer_scheduler,
-    base::WeakPtr<shell::InterfaceProvider> remote_interfaces)
+    base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces)
     : BlinkPlatformImpl(renderer_scheduler->DefaultTaskRunner()),
       main_thread_(renderer_scheduler->CreateMainThread()),
       clipboard_delegate_(new RendererClipboardDelegate),
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
index f3f64bc..f99e89a 100644
--- a/content/renderer/renderer_blink_platform_impl.h
+++ b/content/renderer/renderer_blink_platform_impl.h
@@ -49,7 +49,7 @@
 class WebServiceWorkerCacheStorage;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
 }
 
@@ -69,7 +69,7 @@
  public:
   RendererBlinkPlatformImpl(
       blink::scheduler::RendererScheduler* renderer_scheduler,
-      base::WeakPtr<shell::InterfaceProvider> remote_interfaces);
+      base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces);
   ~RendererBlinkPlatformImpl() override;
 
   // Shutdown must be called just prior to shutting down blink.
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
index 6dfc4b1..f3907bd0 100644
--- a/content/renderer/service_worker/service_worker_context_client.cc
+++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -49,8 +49,8 @@
 #include "ipc/ipc_message_macros.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/platform/URLConversion.h"
 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
@@ -215,8 +215,8 @@
   // Pending callbacks for Fetch Events
   FetchEventCallbacksMap fetch_event_callbacks;
 
-  shell::InterfaceRegistry interface_registry;
-  shell::InterfaceProvider remote_interfaces;
+  service_manager::InterfaceRegistry interface_registry;
+  service_manager::InterfaceProvider remote_interfaces;
 
   base::ThreadChecker thread_checker;
   base::WeakPtrFactory<ServiceWorkerContextClient> weak_factory;
@@ -322,8 +322,8 @@
 }
 
 void ServiceWorkerContextClient::BindInterfaceProviders(
-    shell::mojom::InterfaceProviderRequest request,
-    shell::mojom::InterfaceProviderPtr remote_interfaces) {
+    service_manager::mojom::InterfaceProviderRequest request,
+    service_manager::mojom::InterfaceProviderPtr remote_interfaces) {
   context_->interface_registry.Bind(std::move(request));
   context_->remote_interfaces.Bind(std::move(remote_interfaces));
 }
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h
index bb4a55c..5261f91 100644
--- a/content/renderer/service_worker/service_worker_context_client.h
+++ b/content/renderer/service_worker/service_worker_context_client.h
@@ -23,7 +23,7 @@
 #include "content/common/service_worker/service_worker_status_code.h"
 #include "content/common/service_worker/service_worker_types.h"
 #include "ipc/ipc_listener.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h"
@@ -93,8 +93,8 @@
 
   // Called some time after the worker has started.
   void BindInterfaceProviders(
-      shell::mojom::InterfaceProviderRequest request,
-      shell::mojom::InterfaceProviderPtr remote_interfaces);
+      service_manager::mojom::InterfaceProviderRequest request,
+      service_manager::mojom::InterfaceProviderPtr remote_interfaces);
 
   // WebServiceWorkerContextClient overrides.
   blink::WebURL scope() const override;
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn
index 94ff3cb3..eb33daf 100644
--- a/content/shell/BUILD.gn
+++ b/content/shell/BUILD.gn
@@ -244,7 +244,7 @@
     "//net",
     "//net:net_resources",
     "//sandbox",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//storage/browser",
     "//testing/gmock",
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java
index 68f8a087..fe0a813b 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java
+++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellApplication.java
@@ -25,10 +25,6 @@
     protected void attachBaseContext(Context base) {
         super.attachBaseContext(base);
         ContextUtils.initApplicationContext(this);
-    }
-
-    @Override
-    protected void initializeLibraryDependencies() {
         PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
     }
 
diff --git a/content/shell/browser/DEPS b/content/shell/browser/DEPS
index 7b28132..d6be83d 100644
--- a/content/shell/browser/DEPS
+++ b/content/shell/browser/DEPS
@@ -1,7 +1,7 @@
 include_rules = [
   "-content/shell/browser/layout_test",
   "+device/geolocation",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 ]
 
 specific_include_rules = {
diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
index b47276f..a82f526 100644
--- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
+++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
@@ -126,23 +126,23 @@
 // Notifies the adapter's observers for each device id the adapter.
 void NotifyDevicesAdded(MockBluetoothAdapter* adapter) {
   for (BluetoothDevice* device : adapter->GetMockDevices()) {
-    FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
-                      DeviceAdded(adapter, device));
+    for (auto& observer : adapter->GetObservers())
+      observer.DeviceAdded(adapter, device);
   }
 }
 
 // Notifies the adapter's observers that the services have been discovered.
 void NotifyServicesDiscovered(MockBluetoothAdapter* adapter,
                               MockBluetoothDevice* device) {
-  FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
-                    GattServicesDiscovered(adapter, device));
+  for (auto& observer : adapter->GetObservers())
+    observer.GattServicesDiscovered(adapter, device);
 }
 
 // Notifies the adapter's observers that a device has changed.
 void NotifyDeviceChanged(MockBluetoothAdapter* adapter,
                          MockBluetoothDevice* device) {
-  FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
-                    DeviceChanged(adapter, device));
+  for (auto& observer : adapter->GetObservers())
+    observer.DeviceChanged(adapter, device);
 }
 
 }  // namespace
@@ -363,16 +363,16 @@
                       std::unique_ptr<NiceMockBluetoothDevice> new_device) {
   NiceMockBluetoothDevice* new_device_ptr = new_device.get();
   adapter->AddMockDevice(std::move(new_device));
-  FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
-                    DeviceAdded(adapter.get(), new_device_ptr));
+  for (auto& observer : adapter->GetObservers())
+    observer.DeviceAdded(adapter.get(), new_device_ptr);
 }
 
 static void RemoveDevice(scoped_refptr<NiceMockBluetoothAdapter> adapter,
                          const std::string& device_address) {
   std::unique_ptr<MockBluetoothDevice> removed_device =
       adapter->RemoveMockDevice(device_address);
-  FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
-                    DeviceRemoved(adapter.get(), removed_device.get()));
+  for (auto& observer : adapter->GetObservers())
+    observer.DeviceRemoved(adapter.get(), removed_device.get());
 }
 // static
 scoped_refptr<NiceMockBluetoothAdapter>
@@ -736,9 +736,8 @@
           const std::vector<uint8_t>& value, const base::Closure& success,
           const BluetoothRemoteGattCharacteristic::ErrorCallback& error) {
         device_ptr->SetConnected(false);
-        FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
-                          adapter_ptr->GetObservers(),
-                          DeviceChanged(adapter_ptr, device_ptr));
+        for (auto& observer : adapter_ptr->GetObservers())
+          observer.DeviceChanged(adapter_ptr, device_ptr);
         success.Run();
       }));
 
@@ -1209,10 +1208,10 @@
             location[0] = 1;  // Chest
             // Read a characteristic has a side effect of
             // GattCharacteristicValueChanged being called.
-            FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
-                              adapter->GetObservers(),
-                              GattCharacteristicValueChanged(
-                                  adapter, location_chest_ptr, location));
+            for (auto& observer : adapter->GetObservers()) {
+              observer.GattCharacteristicValueChanged(
+                  adapter, location_chest_ptr, location);
+            }
             return location;
           }));
 
@@ -1231,10 +1230,10 @@
             location[0] = 2;  // Wrist
             // Read a characteristic has a side effect of
             // GattCharacteristicValueChanged being called.
-            FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
-                              adapter->GetObservers(),
-                              GattCharacteristicValueChanged(
-                                  adapter, location_wrist_ptr, location));
+            for (auto& observer : adapter->GetObservers()) {
+              observer.GattCharacteristicValueChanged(
+                  adapter, location_wrist_ptr, location);
+            }
             return location;
           }));
 
diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.cc b/content/shell/browser/layout_test/layout_test_content_browser_client.cc
index 3ecacd1..3b25ecd 100644
--- a/content/shell/browser/layout_test/layout_test_content_browser_client.cc
+++ b/content/shell/browser/layout_test/layout_test_content_browser_client.cc
@@ -21,7 +21,7 @@
 #include "content/shell/common/layout_test/layout_test_switches.h"
 #include "content/shell/common/shell_messages.h"
 #include "content/shell/renderer/layout_test/blink_test_helpers.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace content {
 namespace {
@@ -72,7 +72,7 @@
 }
 
 void LayoutTestContentBrowserClient::ExposeInterfacesToRenderer(
-    shell::InterfaceRegistry* registry,
+    service_manager::InterfaceRegistry* registry,
     RenderProcessHost* render_process_host) {
   scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
       content::BrowserThread::GetTaskRunnerForThread(
diff --git a/content/shell/browser/layout_test/layout_test_content_browser_client.h b/content/shell/browser/layout_test/layout_test_content_browser_client.h
index 54ac3c9..e3fe22f 100644
--- a/content/shell/browser/layout_test/layout_test_content_browser_client.h
+++ b/content/shell/browser/layout_test/layout_test_content_browser_client.h
@@ -28,7 +28,7 @@
   // ContentBrowserClient overrides.
   void RenderProcessWillLaunch(RenderProcessHost* host) override;
   void ExposeInterfacesToRenderer(
-      shell::InterfaceRegistry* registry,
+      service_manager::InterfaceRegistry* registry,
       RenderProcessHost* render_process_host) override;
   void OverrideWebkitPrefs(RenderViewHost* render_view_host,
                            WebPreferences* prefs) override;
diff --git a/content/shell/renderer/DEPS b/content/shell/renderer/DEPS
index a2cba18..8807c28 100644
--- a/content/shell/renderer/DEPS
+++ b/content/shell/renderer/DEPS
@@ -4,5 +4,5 @@
   "+components/web_cache/renderer",
   "+components/plugins/renderer",
   "+components/test_runner",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 ]
diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc
index b302b3dc..b2d0a6d 100644
--- a/content/shell/renderer/layout_test/blink_test_runner.cc
+++ b/content/shell/renderer/layout_test/blink_test_runner.cc
@@ -58,7 +58,7 @@
 #include "media/base/video_capturer_source.h"
 #include "net/base/filename_util.h"
 #include "net/base/net_errors.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "skia/ext/platform_canvas.h"
 #include "third_party/WebKit/public/platform/FilePathConversion.h"
 #include "third_party/WebKit/public/platform/Platform.h"
diff --git a/content/shell/renderer/layout_test/interface_registry_js_wrapper.cc b/content/shell/renderer/layout_test/interface_registry_js_wrapper.cc
index 7b268c05..7f2a054 100644
--- a/content/shell/renderer/layout_test/interface_registry_js_wrapper.cc
+++ b/content/shell/renderer/layout_test/interface_registry_js_wrapper.cc
@@ -8,7 +8,7 @@
 #include <utility>
 
 #include "mojo/edk/js/handle.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace content {
 
@@ -25,7 +25,7 @@
 gin::Handle<InterfaceRegistryJsWrapper> InterfaceRegistryJsWrapper::Create(
     v8::Isolate* isolate,
     v8::Handle<v8::Context> context,
-    shell::InterfaceRegistry* interface_registry) {
+    service_manager::InterfaceRegistry* interface_registry) {
   return gin::CreateHandle(
       isolate, new InterfaceRegistryJsWrapper(
                    isolate, context, interface_registry->GetWeakPtr()));
@@ -43,7 +43,8 @@
     const std::string& interface_name) {
   mojo::MessagePipe pipe;
   if (interface_registry_) {
-    shell::InterfaceRegistry::TestApi test_api(interface_registry_.get());
+    service_manager::InterfaceRegistry::TestApi test_api(
+        interface_registry_.get());
     test_api.GetLocalInterface(interface_name, std::move(pipe.handle0));
   }
   return pipe.handle1.release();
@@ -52,7 +53,7 @@
 InterfaceRegistryJsWrapper::InterfaceRegistryJsWrapper(
     v8::Isolate* isolate,
     v8::Handle<v8::Context> context,
-    base::WeakPtr<shell::InterfaceRegistry> interface_registry)
+    base::WeakPtr<service_manager::InterfaceRegistry> interface_registry)
     : isolate_(isolate),
       context_(isolate, context),
       interface_registry_(interface_registry),
diff --git a/content/shell/renderer/layout_test/interface_registry_js_wrapper.h b/content/shell/renderer/layout_test/interface_registry_js_wrapper.h
index 57498a6..1330d56 100644
--- a/content/shell/renderer/layout_test/interface_registry_js_wrapper.h
+++ b/content/shell/renderer/layout_test/interface_registry_js_wrapper.h
@@ -14,13 +14,14 @@
 #include "mojo/public/cpp/system/message_pipe.h"
 #include "v8/include/v8.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
 namespace content {
 
-// A JS wrapper around shell::InterfaceRegistry that allows connecting to
+// A JS wrapper around service_manager::InterfaceRegistry that allows connecting
+// to
 // interfaces exposed by the renderer for testing.
 class InterfaceRegistryJsWrapper
     : public gin::Wrappable<InterfaceRegistryJsWrapper> {
@@ -28,7 +29,7 @@
   static gin::Handle<InterfaceRegistryJsWrapper> Create(
       v8::Isolate* isolate,
       v8::Handle<v8::Context> context,
-      shell::InterfaceRegistry* interface_registry);
+      service_manager::InterfaceRegistry* interface_registry);
 
   // gin::Wrappable<InterfaceRegistryJsWrapper> overrides.
   gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
@@ -48,7 +49,7 @@
   InterfaceRegistryJsWrapper(
       v8::Isolate* isolate,
       v8::Handle<v8::Context> context,
-      base::WeakPtr<shell::InterfaceRegistry> interface_registry);
+      base::WeakPtr<service_manager::InterfaceRegistry> interface_registry);
   ~InterfaceRegistryJsWrapper() override;
 
   void CallJsFactory(const ScopedJsFactory& factory,
@@ -59,7 +60,7 @@
 
   v8::Isolate* isolate_;
   v8::Global<v8::Context> context_;
-  base::WeakPtr<shell::InterfaceRegistry> interface_registry_;
+  base::WeakPtr<service_manager::InterfaceRegistry> interface_registry_;
 
   base::WeakPtrFactory<InterfaceRegistryJsWrapper> weak_factory_;
 
diff --git a/content/shell/renderer/shell_content_renderer_client.cc b/content/shell/renderer/shell_content_renderer_client.cc
index e5c8b9f..b6baad6 100644
--- a/content/shell/renderer/shell_content_renderer_client.cc
+++ b/content/shell/renderer/shell_content_renderer_client.cc
@@ -17,7 +17,7 @@
 #include "content/shell/renderer/shell_render_view_observer.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/web/WebTestingSupport.h"
 #include "third_party/WebKit/public/web/WebView.h"
 #include "v8/include/v8.h"
@@ -135,7 +135,7 @@
 }
 
 void ShellContentRendererClient::ExposeInterfacesToBrowser(
-    shell::InterfaceRegistry* interface_registry) {
+    service_manager::InterfaceRegistry* interface_registry) {
   interface_registry->AddInterface<mojom::TestService>(
       base::Bind(&CreateTestService));
 }
diff --git a/content/shell/renderer/shell_content_renderer_client.h b/content/shell/renderer/shell_content_renderer_client.h
index 7ad6971..d406cca0 100644
--- a/content/shell/renderer/shell_content_renderer_client.h
+++ b/content/shell/renderer/shell_content_renderer_client.h
@@ -35,7 +35,7 @@
       v8::Local<v8::Context> context) override;
 
   void ExposeInterfacesToBrowser(
-      shell::InterfaceRegistry* interface_registry) override;
+      service_manager::InterfaceRegistry* interface_registry) override;
 
 #if defined(OS_ANDROID)
   void AddSupportedKeySystems(
diff --git a/content/shell/utility/DEPS b/content/shell/utility/DEPS
index 8d1f46a..c610d2e 100644
--- a/content/shell/utility/DEPS
+++ b/content/shell/utility/DEPS
@@ -1,3 +1,3 @@
 include_rules = [
-  "+services/shell",
+  "+services/service_manager",
 ]
diff --git a/content/shell/utility/shell_content_utility_client.cc b/content/shell/utility/shell_content_utility_client.cc
index 1d7d5a3a..faa732b 100644
--- a/content/shell/utility/shell_content_utility_client.cc
+++ b/content/shell/utility/shell_content_utility_client.cc
@@ -14,7 +14,7 @@
 #include "content/public/test/test_service.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/public/cpp/system/buffer.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace content {
 
@@ -66,9 +66,9 @@
   DISALLOW_COPY_AND_ASSIGN(TestServiceImpl);
 };
 
-std::unique_ptr<shell::Service> CreateTestService(
+std::unique_ptr<service_manager::Service> CreateTestService(
     const base::Closure& quit_closure) {
-  return std::unique_ptr<shell::Service>(new TestService);
+  return std::unique_ptr<service_manager::Service>(new TestService);
 }
 
 }  // namespace
@@ -83,7 +83,7 @@
 }
 
 void ShellContentUtilityClient::ExposeInterfacesToBrowser(
-    shell::InterfaceRegistry* registry) {
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface(base::Bind(&TestServiceImpl::Create));
 }
 
diff --git a/content/shell/utility/shell_content_utility_client.h b/content/shell/utility/shell_content_utility_client.h
index a147619f..e057705 100644
--- a/content/shell/utility/shell_content_utility_client.h
+++ b/content/shell/utility/shell_content_utility_client.h
@@ -15,7 +15,8 @@
 
   // ContentUtilityClient:
   void RegisterServices(StaticServiceMap* services) override;
-  void ExposeInterfacesToBrowser(shell::InterfaceRegistry* registry) override;
+  void ExposeInterfacesToBrowser(
+      service_manager::InterfaceRegistry* registry) override;
 };
 
 }  // namespace content
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index 5f13e1c..685d1557 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -236,7 +236,7 @@
     "//mojo/edk/system",
     "//mojo/edk/test:test_support",
     "//net:test_support",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//storage/browser",
     "//storage/common",
@@ -723,7 +723,7 @@
     "//mojo/public/cpp/bindings",
     "//mojo/public/js",
     "//net:test_support",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//storage/browser",
     "//testing/gmock",
     "//testing/gtest",
diff --git a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html
index 3ae0e56c..e881731b 100644
--- a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html
+++ b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_main.html
@@ -23,14 +23,56 @@
   waitForFinish();
 }
 
+function drawTriangle(canvas)
+{
+  var gl = canvas.getContext("webgl");
+  gl.clearColor(0, 1, 0, 1);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  var prog = gl.createProgram();
+  var vs = gl.createShader(gl.VERTEX_SHADER);
+  gl.shaderSource(vs, ['attribute vec2 pos;',
+      'void main() {',
+      '  gl_Position = vec4(pos, 0., 1.);',
+      '}'].join('\n'));
+  gl.compileShader(vs);
+  if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) {
+      throw 'failed to compiled shader';
+  }
+  gl.attachShader(prog, vs);
+
+  var fs = gl.createShader(gl.FRAGMENT_SHADER);
+  gl.shaderSource(fs, ['void main() {',
+      '  gl_FragColor = vec4(1.);',
+      '}'].join('\n'));
+  gl.compileShader(fs);
+  if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) {
+      throw 'failed to compiled shader';
+  }
+  gl.attachShader(prog, fs);
+
+  gl.linkProgram(prog);
+  if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) {
+      throw "Could not link the shader program!";
+  }
+  gl.useProgram(prog);
+
+  gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
+  gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-.5,0, 0,.5, .5,0]), gl.STATIC_DRAW);
+  var attr = gl.getAttribLocation(prog, 'pos');
+  gl.enableVertexAttribArray(attr);
+  gl.vertexAttribPointer(attr, 2, gl.FLOAT, false, 0, 0);
+
+  gl.drawArrays(gl.TRIANGLE_STRIP, 0, 3);
+
+  gl.commit();
+}
+
 function draw()
 {
   var canvas = document.getElementById("c");
   var offscreenCanvas = canvas.transferControlToOffscreen();
-  var gl = offscreenCanvas.getContext("webgl");
-  gl.clearColor(0.0, 1.0, 0.0, 1.0);
-  gl.clear(gl.COLOR_BUFFER_BIT);
-  gl.commit();
+  drawTriangle(offscreenCanvas);
 }
 
 function waitForFinish()
@@ -47,10 +89,10 @@
 </script>
 </head>
 <body onload="main()">
-<div style="position:relative; width:200px; height:200px; background-color:white">
+<div style="position:relative; width:300px; height:300px; background-color:white">
 </div>
 <div id="container" style="position:absolute; top:0px; left:0px">
-<canvas id="c" width="200" height="200" class="nomargin"></canvas>
+<canvas id="c" width="300" height="300" class="nomargin"></canvas>
 </div>
 </body>
 </html>
diff --git a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
index 2af35761..292500e 100644
--- a/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
+++ b/content/test/data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html
@@ -15,12 +15,54 @@
 }
 </style>
 <script id="myWorker" type="text/worker">
+function drawTriangle(canvas)
+{
+  var gl = canvas.getContext("webgl");
+  gl.clearColor(0, 1, 0, 1);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  var prog = gl.createProgram();
+  var vs = gl.createShader(gl.VERTEX_SHADER);
+  gl.shaderSource(vs, ['attribute vec2 pos;',
+      'void main() {',
+      '  gl_Position = vec4(pos, 0., 1.);',
+      '}'].join('\n'));
+  gl.compileShader(vs);
+  if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) {
+      throw 'failed to compiled shader';
+  }
+  gl.attachShader(prog, vs);
+
+  var fs = gl.createShader(gl.FRAGMENT_SHADER);
+  gl.shaderSource(fs, ['void main() {',
+      '  gl_FragColor = vec4(1.);',
+      '}'].join('\n'));
+  gl.compileShader(fs);
+  if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) {
+      throw 'failed to compiled shader';
+  }
+  gl.attachShader(prog, fs);
+
+  gl.linkProgram(prog);
+  if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) {
+      throw "Could not link the shader program!";
+  }
+  gl.useProgram(prog);
+
+  gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
+  gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-.5,0, 0,.5, .5,0]), gl.STATIC_DRAW);
+  var attr = gl.getAttribLocation(prog, 'pos');
+  gl.enableVertexAttribArray(attr);
+  gl.vertexAttribPointer(attr, 2, gl.FLOAT, false, 0, 0);
+
+  gl.drawArrays(gl.TRIANGLE_STRIP, 0, 3);
+
+  gl.commit();
+}
+
 self.onmessage = function(e) {
   var transferredOffscreenCanvas = e.data;
-  var gl = transferredOffscreenCanvas.getContext("webgl");
-  gl.clearColor(1.0, 0.0, 0.0, 1.0);
-  gl.clear(gl.COLOR_BUFFER_BIT);
-  gl.commit();
+  drawTriangle(transferredOffscreenCanvas);
   self.postMessage("");
 };
 </script>
@@ -62,10 +104,10 @@
 </script>
 </head>
 <body onload="main()">
-<div style="position:relative; width:200px; height:200px; background-color:white">
+<div style="position:relative; width:300px; height:300px; background-color:white">
 </div>
 <div id="container" style="position:absolute; top:0px; left:0px">
-<canvas id="c" width="200" height="200" class="nomargin"></canvas>
+<canvas id="c" width="300" height="300" class="nomargin"></canvas>
 </div>
 </body>
 </html>
diff --git a/content/test/data/media/image_capture_test.html b/content/test/data/media/image_capture_test.html
index 2ed7449..0dbd39b 100644
--- a/content/test/data/media/image_capture_test.html
+++ b/content/test/data/media/image_capture_test.html
@@ -6,10 +6,12 @@
 <body>
 <script type="text/javascript" src="webrtc_test_utilities.js"></script>
 <script>
+const HEIGHT = 180;
+const WIDTH = 320;
 
 // Runs an ImageCapture.getPhotoCapabilities().
 function testCreateAndGetCapabilities() {
-  const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
+  const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
   navigator.mediaDevices.getUserMedia({"video" : constraints})
       .then(stream => {
         assertEquals('video', stream.getVideoTracks()[0].kind);
@@ -38,7 +40,7 @@
 
 // Runs an ImageCapture.takePhoto().
 function testCreateAndTakePhoto() {
-  const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
+  const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
   navigator.mediaDevices.getUserMedia({"video" : constraints})
       .then(stream => {
         assertEquals('video', stream.getVideoTracks()[0].kind);
@@ -58,6 +60,28 @@
       });
 }
 
+// Runs an ImageCapture.grabFrame().
+function testCreateAndGrabFrame() {
+  const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
+  navigator.mediaDevices.getUserMedia({"video" : constraints})
+      .then(stream => {
+        assertEquals('video', stream.getVideoTracks()[0].kind);
+        return new ImageCapture(stream.getVideoTracks()[0]);
+      })
+      .then(capturer => {
+        return capturer.grabFrame();
+      })
+      .then(imageBitmap => {
+        assertEquals(WIDTH, imageBitmap.width);
+        assertEquals(HEIGHT, imageBitmap.height);
+
+        reportTestSuccess();
+      })
+      .catch(err => {
+        return failTest(err.toString());
+      });
+}
+
 </script>
 </body>
 </html>
diff --git a/content/test/gpu/gpu_tests/pixel_test_pages.py b/content/test/gpu/gpu_tests/pixel_test_pages.py
index caf9417..40074192 100644
--- a/content/test/gpu/gpu_tests/pixel_test_pages.py
+++ b/content/test/gpu/gpu_tests/pixel_test_pages.py
@@ -154,30 +154,30 @@
 
     PixelTestPage(
       'pixel_offscreenCanvas_webgl_commit_main.html',
-      base_name + '_OffscreenCanvasWebGLGreenBox',
-      test_rect=[0, 0, 300, 300],
-      revision=2,
+      base_name + '_OffscreenCanvasWebGLDefault',
+      test_rect=[0, 0, 350, 350],
+      revision=1,
       browser_args=browser_args),
 
     PixelTestPage(
       'pixel_offscreenCanvas_webgl_commit_worker.html',
-      base_name + '_OffscreenCanvasWebGLRedBoxWorker',
-      test_rect=[0, 0, 300, 300],
-      revision=3,
+      base_name + '_OffscreenCanvasWebGLDefaultWorker',
+      test_rect=[0, 0, 350, 350],
+      revision=1,
       browser_args=browser_args),
 
     PixelTestPage(
       'pixel_offscreenCanvas_webgl_commit_main.html',
       base_name + '_OffscreenCanvasWebGLSoftwareCompositing',
-      test_rect=[0, 0, 300, 300],
-      revision=1,
+      test_rect=[0, 0, 350, 350],
+      revision=2,
       browser_args=browser_args + ['--disable-gpu-compositing']),
 
     PixelTestPage(
       'pixel_offscreenCanvas_webgl_commit_worker.html',
       base_name + '_OffscreenCanvasWebGLSoftwareCompositingWorker',
-      test_rect=[0, 0, 300, 300],
-      revision=1,
+      test_rect=[0, 0, 350, 350],
+      revision=2,
       browser_args=browser_args + ['--disable-gpu-compositing']),
 
     PixelTestPage(
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
index a94e6e0..1853e179 100644
--- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -56,10 +56,34 @@
 
     # All platforms.
     self.Flaky('conformance2/query/occlusion-query.html', bug=603168)
+    self.Fail('conformance/buffers/buffer-uninitialized.html',
+        bug=654201)
+    self.Fail('conformance2/transform_feedback/transform_feedback.html',
+        bug=654201)
+    self.Fail('conformance2/context/constants-and-properties-2.html',
+        bug=655836)
+    self.Fail('conformance/extensions/webgl-compressed-texture-etc.html',
+        bug=655836)
+    self.Fail('conformance/extensions/webgl-compressed-texture-pvrtc.html',
+        bug=655836)
+    self.Fail('conformance/extensions/webgl-compressed-texture-atc.html',
+        bug=655836)
+    self.Fail('conformance/extensions/webgl-compressed-texture-s3tc.html',
+        bug=655836)
+    self.Fail('conformance/extensions/webgl-compressed-texture-s3tc-srgb.html',
+        bug=655836)
+    self.Fail('conformance2/textures/misc/tex-storage-compressed-formats.html',
+        bug=655836)
+    self.Fail('deqp/functional/gles3/integerstatequery.html', bug=655836)
+    self.Fail('deqp/functional/gles3/negativetextureapi.html',
+        ['win', 'mac'], bug=655836)
+    self.Fail('deqp/functional/gles3/textureformat/*', bug=655836)
+    self.Fail('deqp/functional/gles3/texturewrap/*', bug=655836)
+    self.Fail('deqp/functional/gles3/texturewrap.html', bug=655836)
 
     # Windows only.
     # We are awesome!
-    self.Fail('conformance2/buffers/getBufferSubData.html',
+    self.Fail('conformance2/buffers/get-buffer-sub-data.html',
         ['win'], bug=654201)
 
     # Win / NVidia
@@ -504,7 +528,7 @@
         ['mac', 'intel'], bug=483282)
 
     # Linux only.
-    self.Fail('conformance2/buffers/getBufferSubData.html',
+    self.Fail('conformance2/buffers/get-buffer-sub-data.html',
         ['linux'], bug=654201)
 
     self.Flaky('conformance/textures/video/' +
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
index bc1abdd..6c677f7 100644
--- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -112,6 +112,9 @@
     # ========================
     # Fails on all platforms
 
+    self.Fail('conformance/buffers/buffer-uninitialized.html',
+        bug=654201)
+
     # We need to add WebGL 1 check in command buffer that format/type from
     # TexSubImage2D have to match the current texture's.
     self.Fail('conformance/textures/misc/tex-sub-image-2d-bad-args.html',
diff --git a/content/utility/BUILD.gn b/content/utility/BUILD.gn
index 26fbcf1..76c7ac7a 100644
--- a/content/utility/BUILD.gn
+++ b/content/utility/BUILD.gn
@@ -35,9 +35,9 @@
     "//mojo/common",
     "//mojo/public/cpp/bindings",
     "//sandbox",
-    "//services/shell",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//third_party/WebKit/public:blink_headers",
     "//third_party/WebKit/public:mojo_bindings",
     "//url",
diff --git a/content/utility/DEPS b/content/utility/DEPS
index 2d8ce23..1069d6a 100644
--- a/content/utility/DEPS
+++ b/content/utility/DEPS
@@ -2,7 +2,7 @@
   "+components/scheduler/child",
   "+content/child",
   "+content/public/utility",
-  "+services/shell",
-  "+services/shell",
+  "+services/service_manager",
+  "+services/service_manager",
   "+sandbox/win/src",
 ]
diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc
index 4d498548..8684758a 100644
--- a/content/utility/utility_thread_impl.cc
+++ b/content/utility/utility_thread_impl.cc
@@ -18,7 +18,7 @@
 #include "content/utility/utility_blink_platform_impl.h"
 #include "content/utility/utility_service_factory.h"
 #include "ipc/ipc_sync_channel.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/web/WebKit.h"
 
 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS)
@@ -122,7 +122,7 @@
 }
 
 void UtilityThreadImpl::BindServiceFactoryRequest(
-    shell::mojom::ServiceFactoryRequest request) {
+    service_manager::mojom::ServiceFactoryRequest request) {
   DCHECK(service_factory_);
   service_factory_bindings_.AddBinding(service_factory_.get(),
                                        std::move(request));
diff --git a/content/utility/utility_thread_impl.h b/content/utility/utility_thread_impl.h
index c7e88381..487a748 100644
--- a/content/utility/utility_thread_impl.h
+++ b/content/utility/utility_thread_impl.h
@@ -16,7 +16,7 @@
 #include "content/common/content_export.h"
 #include "content/public/utility/utility_thread.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
 
 namespace base {
 class FilePath;
@@ -56,18 +56,21 @@
   void OnBatchModeStarted();
   void OnBatchModeFinished();
 
-  void BindServiceFactoryRequest(shell::mojom::ServiceFactoryRequest request);
+  void BindServiceFactoryRequest(
+      service_manager::mojom::ServiceFactoryRequest request);
 
   // True when we're running in batch mode.
   bool batch_mode_;
 
   std::unique_ptr<UtilityBlinkPlatformImpl> blink_platform_impl_;
 
-  // shell::mojom::ServiceFactory for shell::Service hosting.
+  // service_manager::mojom::ServiceFactory for service_manager::Service
+  // hosting.
   std::unique_ptr<UtilityServiceFactory> service_factory_;
 
-  // Bindings to the shell::mojom::ServiceFactory impl.
-  mojo::BindingSet<shell::mojom::ServiceFactory> service_factory_bindings_;
+  // Bindings to the service_manager::mojom::ServiceFactory impl.
+  mojo::BindingSet<service_manager::mojom::ServiceFactory>
+      service_factory_bindings_;
 
   DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl);
 };
diff --git a/device/DEPS b/device/DEPS
index af749b9..09bd94e 100644
--- a/device/DEPS
+++ b/device/DEPS
@@ -2,6 +2,6 @@
   "+chromeos",
   "+components/device_event_log",
   "+mojo/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+third_party/ocmock",
 ]
diff --git a/device/battery/android/BUILD.gn b/device/battery/android/BUILD.gn
index 3399783..ff0d201 100644
--- a/device/battery/android/BUILD.gn
+++ b/device/battery/android/BUILD.gn
@@ -17,7 +17,7 @@
     "//device/battery:mojo_bindings_java",
     "//mojo/public/java:bindings",
     "//mojo/public/java:system",
-    "//services/shell/public/java:shell_java",
+    "//services/service_manager/public/java:service_manager_java",
     "//third_party/jsr-305:jsr_305_javalib",
   ]
 }
diff --git a/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java b/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java
index 34109564..d17e2869 100644
--- a/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java
+++ b/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java
@@ -11,7 +11,7 @@
 import org.chromium.device.BatteryMonitor;
 import org.chromium.device.BatteryStatus;
 import org.chromium.device.battery.BatteryStatusManager.BatteryStatusCallback;
-import org.chromium.services.shell.InterfaceFactory;
+import org.chromium.services.service_manager.InterfaceFactory;
 
 import java.util.HashSet;
 
diff --git a/device/geolocation/geolocation_service_context.cc b/device/geolocation/geolocation_service_context.cc
index 2f0e011..148b77b 100644
--- a/device/geolocation/geolocation_service_context.cc
+++ b/device/geolocation/geolocation_service_context.cc
@@ -10,7 +10,7 @@
 
 namespace device {
 
-GeolocationServiceContext::GeolocationServiceContext() : paused_(false) {}
+GeolocationServiceContext::GeolocationServiceContext() {}
 
 GeolocationServiceContext::~GeolocationServiceContext() {}
 
@@ -33,20 +33,6 @@
   services_.erase(it);
 }
 
-void GeolocationServiceContext::PauseUpdates() {
-  paused_ = true;
-  for (auto* service : services_) {
-    service->PauseUpdates();
-  }
-}
-
-void GeolocationServiceContext::ResumeUpdates() {
-  paused_ = false;
-  for (auto* service : services_) {
-    service->ResumeUpdates();
-  }
-}
-
 void GeolocationServiceContext::SetOverride(
     std::unique_ptr<Geoposition> geoposition) {
   geoposition_override_.swap(geoposition);
diff --git a/device/geolocation/geolocation_service_context.h b/device/geolocation/geolocation_service_context.h
index e320d5c2..b462dc2 100644
--- a/device/geolocation/geolocation_service_context.h
+++ b/device/geolocation/geolocation_service_context.h
@@ -33,15 +33,6 @@
   // longer safe to access |service|.
   void ServiceHadConnectionError(GeolocationServiceImpl* service);
 
-  // Pauses and resumes geolocation. Resuming when nothing is paused is a
-  // no-op. If a service is added while geolocation is paused, that service
-  // will not get geolocation updates until geolocation is resumed.
-  void PauseUpdates();
-  void ResumeUpdates();
-
-  // Returns whether geolocation updates are currently paused.
-  bool paused() { return paused_; }
-
   // Enables geolocation override. This method can be used to trigger possible
   // location-specific behavior in a particular context.
   void SetOverride(std::unique_ptr<Geoposition> geoposition);
@@ -51,7 +42,6 @@
 
  private:
   ScopedVector<GeolocationServiceImpl> services_;
-  bool paused_;
 
   std::unique_ptr<Geoposition> geoposition_override_;
 
diff --git a/device/geolocation/geolocation_service_impl.cc b/device/geolocation/geolocation_service_impl.cc
index 1df0c03..ee9ae3a 100644
--- a/device/geolocation/geolocation_service_impl.cc
+++ b/device/geolocation/geolocation_service_impl.cc
@@ -160,9 +160,6 @@
   RecordGeopositionErrorCode(position.error_code);
   DCHECK(context_);
 
-  if (context_->paused())
-    return;
-
   update_callback_.Run();
 
   current_position_.valid = position.Validate();
diff --git a/device/vibration/android/BUILD.gn b/device/vibration/android/BUILD.gn
index 2ae3869e..99f46462 100644
--- a/device/vibration/android/BUILD.gn
+++ b/device/vibration/android/BUILD.gn
@@ -14,6 +14,6 @@
     "//device/vibration:mojo_bindings_java",
     "//mojo/public/java:bindings",
     "//mojo/public/java:system",
-    "//services/shell/public/java:shell_java",
+    "//services/service_manager/public/java:service_manager_java",
   ]
 }
diff --git a/device/vibration/android/java/src/org/chromium/device/vibration/VibrationManagerImpl.java b/device/vibration/android/java/src/org/chromium/device/vibration/VibrationManagerImpl.java
index ed186f1..31a619e 100644
--- a/device/vibration/android/java/src/org/chromium/device/vibration/VibrationManagerImpl.java
+++ b/device/vibration/android/java/src/org/chromium/device/vibration/VibrationManagerImpl.java
@@ -13,7 +13,7 @@
 import org.chromium.base.VisibleForTesting;
 import org.chromium.device.VibrationManager;
 import org.chromium.mojo.system.MojoException;
-import org.chromium.services.shell.InterfaceFactory;
+import org.chromium.services.service_manager.InterfaceFactory;
 
 /**
  * Android implementation of the vibration manager service defined in
diff --git a/docs/chromoting_android_hacking.md b/docs/chromoting_android_hacking.md
index ba708b5..14f6bb222 100644
--- a/docs/chromoting_android_hacking.md
+++ b/docs/chromoting_android_hacking.md
@@ -72,8 +72,6 @@
 <classpathentry kind="src" path="mojo/public/java/src"/>
 <classpathentry kind="src" path="mojo/android/system/src"/>
 <classpathentry kind="src" path="mojo/android/javatests/src"/>
-<classpathentry kind="src" path="services/shell/android/apk/src"/>
-<classpathentry kind="src" path="mojo/services/native_viewport/android/src"/>
 <classpathentry kind="src" path="testing/android/java/src"/>
 <classpathentry kind="src" path="printing/android/java/src"/>
 <classpathentry kind="src" path="tools/binary_size/java/src"/>
diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS
index db2b2f8..6a045e55 100644
--- a/extensions/browser/DEPS
+++ b/extensions/browser/DEPS
@@ -20,7 +20,7 @@
   "+google_apis/gaia",
   "+grit/extensions_strings.h",
   "+net",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+skia/ext/image_operations.h",
   "+storage/browser/fileapi",
   "+third_party/leveldatabase",
diff --git a/extensions/browser/api/cast_channel/cast_auth_util.cc b/extensions/browser/api/cast_channel/cast_auth_util.cc
index 0e5c388..c6067bdf 100644
--- a/extensions/browser/api/cast_channel/cast_auth_util.cc
+++ b/extensions/browser/api/cast_channel/cast_auth_util.cc
@@ -21,7 +21,7 @@
 namespace cast_channel {
 namespace {
 
-const char* const kParseErrorPrefix = "Failed to parse auth message: ";
+const char kParseErrorPrefix[] = "Failed to parse auth message: ";
 
 // The maximum number of days a cert can live for.
 const int kMaxSelfSignedCertLifetimeInDays = 4;
diff --git a/extensions/browser/api/cast_channel/logger.cc b/extensions/browser/api/cast_channel/logger.cc
index a0d92f3..46cd102 100644
--- a/extensions/browser/api/cast_channel/logger.cc
+++ b/extensions/browser/api/cast_channel/logger.cc
@@ -29,7 +29,7 @@
 
 namespace {
 
-const char* kInternalNamespacePrefix = "com.google.cast";
+const char kInternalNamespacePrefix[] = "com.google.cast";
 
 proto::ChallengeReplyErrorType ChallegeReplyErrorToProto(
     AuthResult::ErrorType error_type) {
diff --git a/extensions/browser/api/hid/hid_apitest.cc b/extensions/browser/api/hid/hid_apitest.cc
index e583f5f..f4e6eb417 100644
--- a/extensions/browser/api/hid/hid_apitest.cc
+++ b/extensions/browser/api/hid/hid_apitest.cc
@@ -34,7 +34,7 @@
 #if defined(OS_MACOSX)
 const uint64_t kTestDeviceIds[] = {1, 2, 3, 4, 5};
 #else
-const char* kTestDeviceIds[] = {"A", "B", "C", "D", "E"};
+const char* const kTestDeviceIds[] = {"A", "B", "C", "D", "E"};
 #endif
 
 // These report descriptors define two devices with 8-byte input, output and
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index 5995ad1a..04216934 100644
--- a/extensions/browser/extension_function.cc
+++ b/extensions/browser/extension_function.cc
@@ -171,7 +171,7 @@
   UserGestureForTests();
   friend struct base::DefaultSingletonTraits<UserGestureForTests>;
 
-  base::Lock lock_; // for protecting access to count_
+  base::Lock lock_;  // for protecting access to |count_|
   int count_;
 };
 
@@ -220,7 +220,7 @@
 bool ExtensionFunction::ignore_all_did_respond_for_testing_do_not_use = false;
 
 // static
-const char* ExtensionFunction::kUnknownErrorDoNotUse = "Unknown error.";
+const char ExtensionFunction::kUnknownErrorDoNotUse[] = "Unknown error.";
 
 // static
 void ExtensionFunctionDeleteTraits::Destruct(const ExtensionFunction* x) {
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h
index dee9a4fe1..a547b0e 100644
--- a/extensions/browser/extension_function.h
+++ b/extensions/browser/extension_function.h
@@ -179,7 +179,7 @@
   // aren't already set.
   // TODO(devlin): Remove this if/when all functions are updated to return real
   // errors.
-  static const char* kUnknownErrorDoNotUse;
+  static const char kUnknownErrorDoNotUse[];
 
   // Called before Run() in order to perform a common verification check so that
   // APIs subclassing this don't have to roll their own RunSafe() variants.
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc
index 14be1c7..f281e21 100644
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc
@@ -232,6 +232,17 @@
 void MimeHandlerStreamManager::EmbedderObserver::RenderFrameHostChanged(
     content::RenderFrameHost* old_host,
     content::RenderFrameHost* new_host) {
+  // If the old_host is null, then it means that a subframe is being created.
+  // Don't treat this like a host change.
+  if (!old_host)
+    return;
+
+  // If this is an unrelated host, ignore.
+  if ((old_host->GetRoutingID() != render_frame_id_) ||
+      (old_host->GetProcess()->GetID() != render_process_id_)) {
+    return;
+  }
+
   new_host_ = new_host;
   // Update the RFID, RPIDs to those of the new RFH. This ensures
   // that if the new RFH gets deleted before loading the stream, we will
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc
index 7819c4c5..70147008 100644
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_browsertest.cc
@@ -34,7 +34,7 @@
 using guest_view::TestGuestViewManagerFactory;
 
 // The test extension id is set by the key value in the manifest.
-const char* kExtensionId = "oickdpebdnfbgkcaoklfcdhjniefkcji";
+const char kExtensionId[] = "oickdpebdnfbgkcaoklfcdhjniefkcji";
 
 // Counts the number of URL requests made for a given URL.
 class URLRequestCounter {
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
index dcf7527..8da2fac 100644
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -28,7 +28,7 @@
 #include "extensions/strings/grit/extensions_strings.h"
 #include "ipc/ipc_message_macros.h"
 #include "net/base/url_util.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 
 using content::WebContents;
diff --git a/extensions/browser/mojo/BUILD.gn b/extensions/browser/mojo/BUILD.gn
index a45a190..2902310 100644
--- a/extensions/browser/mojo/BUILD.gn
+++ b/extensions/browser/mojo/BUILD.gn
@@ -12,6 +12,6 @@
 
   deps = [
     "//extensions/common:mojo",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 }
diff --git a/extensions/browser/mojo/DEPS b/extensions/browser/mojo/DEPS
index df73043..771dfe3 100644
--- a/extensions/browser/mojo/DEPS
+++ b/extensions/browser/mojo/DEPS
@@ -1,3 +1,3 @@
 include_rules = [
-  "+services/shell/public/interfaces",
+  "+services/service_manager/public/interfaces",
 ]
diff --git a/extensions/browser/mojo/service_registration.cc b/extensions/browser/mojo/service_registration.cc
index 7d36864..eca9156 100644
--- a/extensions/browser/mojo/service_registration.cc
+++ b/extensions/browser/mojo/service_registration.cc
@@ -18,7 +18,7 @@
 #include "extensions/common/constants.h"
 #include "extensions/common/extension_api.h"
 #include "extensions/common/switches.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 #if defined(ENABLE_WIFI_DISPLAY)
 #include "extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h"
@@ -48,7 +48,7 @@
                               const Extension* extension) {
   DCHECK(extension);
 
-  shell::InterfaceRegistry* registry =
+  service_manager::InterfaceRegistry* registry =
       render_frame_host->GetInterfaceRegistry();
   registry->AddInterface(base::Bind(
       KeepAliveImpl::Create,
diff --git a/extensions/browser/script_executor.cc b/extensions/browser/script_executor.cc
index 84fc2c3..105889c 100644
--- a/extensions/browser/script_executor.cc
+++ b/extensions/browser/script_executor.cc
@@ -28,8 +28,8 @@
 
 namespace {
 
-const char* kRendererDestroyed = "The tab was closed.";
-const char* kFrameRemoved = "The frame was removed.";
+const char kRendererDestroyed[] = "The tab was closed.";
+const char kFrameRemoved[] = "The frame was removed.";
 
 // A handler for a single injection request. On creation this will send the
 // injection request to the renderer, and it will be destroyed after either the
diff --git a/extensions/browser/warning_service_unittest.cc b/extensions/browser/warning_service_unittest.cc
index abe7851..83a3ea0 100644
--- a/extensions/browser/warning_service_unittest.cc
+++ b/extensions/browser/warning_service_unittest.cc
@@ -35,8 +35,8 @@
 
 typedef ExtensionsTest WarningServiceTest;
 
-const char* ext1_id = "extension1";
-const char* ext2_id = "extension2";
+const char ext1_id[] = "extension1";
+const char ext2_id[] = "extension2";
 const Warning::WarningType warning_1 = Warning::kNetworkDelay;
 const Warning::WarningType warning_2 = Warning::kNetworkConflict;
 
diff --git a/extensions/common/extension_api.cc b/extensions/common/extension_api.cc
index 9a0801e..e420c5f 100644
--- a/extensions/common/extension_api.cc
+++ b/extensions/common/extension_api.cc
@@ -33,10 +33,7 @@
 
 namespace {
 
-const char* kChildKinds[] = {
-  "functions",
-  "events"
-};
+const char* const kChildKinds[] = {"functions", "events"};
 
 std::unique_ptr<base::DictionaryValue> LoadSchemaDictionary(
     const std::string& name,
diff --git a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
index 63ff88e3..8138ee15 100644
--- a/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
+++ b/extensions/common/manifest_handlers/shared_module_manifest_unittest.cc
@@ -11,14 +11,14 @@
 
 namespace {
 
-const char* kValidImportPath =
+const char kValidImportPath[] =
     "_modules/abcdefghijklmnopabcdefghijklmnop/foo/bar.html";
-const char* kValidImportPathID = "abcdefghijklmnopabcdefghijklmnop";
-const char* kValidImportPathRelative = "foo/bar.html";
-const char* kInvalidImportPath = "_modules/abc/foo.html";
-const char* kImportId1 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
-const char* kImportId2 = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
-const char* kNoImport = "cccccccccccccccccccccccccccccccc";
+const char kValidImportPathID[] = "abcdefghijklmnopabcdefghijklmnop";
+const char kValidImportPathRelative[] = "foo/bar.html";
+const char kInvalidImportPath[] = "_modules/abc/foo.html";
+const char kImportId1[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+const char kImportId2[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
+const char kNoImport[] = "cccccccccccccccccccccccccccccccc";
 
 }  // namespace
 
diff --git a/extensions/common/permissions/usb_device_permission_data.cc b/extensions/common/permissions/usb_device_permission_data.cc
index eef44a6..c23b0b21 100644
--- a/extensions/common/permissions/usb_device_permission_data.cc
+++ b/extensions/common/permissions/usb_device_permission_data.cc
@@ -18,9 +18,9 @@
 
 namespace {
 
-const char* kProductIdKey = "productId";
-const char* kVendorIdKey = "vendorId";
-const char* kInterfaceIdKey = "interfaceId";
+const char kProductIdKey[] = "productId";
+const char kVendorIdKey[] = "vendorId";
+const char kInterfaceIdKey[] = "interfaceId";
 
 }  // namespace
 
diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc
index a74c864..7313e12 100644
--- a/extensions/common/url_pattern.cc
+++ b/extensions/common/url_pattern.cc
@@ -27,13 +27,10 @@
 
 // TODO(aa): What about more obscure schemes like data: and javascript: ?
 // Note: keep this array in sync with kValidSchemeMasks.
-const char* kValidSchemes[] = {
-    url::kHttpScheme,
-    url::kHttpsScheme,
-    url::kFileScheme,
-    url::kFtpScheme,
-    content::kChromeUIScheme,
-    extensions::kExtensionScheme,
+const char* const kValidSchemes[] = {
+    url::kHttpScheme,         url::kHttpsScheme,
+    url::kFileScheme,         url::kFtpScheme,
+    content::kChromeUIScheme, extensions::kExtensionScheme,
     url::kFileSystemScheme,
 };
 
diff --git a/extensions/renderer/api/display_source/wifi_display/DEPS b/extensions/renderer/api/display_source/wifi_display/DEPS
index 6dd95bf..c9b9f41f 100644
--- a/extensions/renderer/api/display_source/wifi_display/DEPS
+++ b/extensions/renderer/api/display_source/wifi_display/DEPS
@@ -2,7 +2,7 @@
   # TODO(Mikhail): Consider removing when https://crbug.com/432381 is fixed.
   "+media/base",
   "+media/video",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+third_party/openh264/src/codec/api",
   "+third_party/wds/src/libwds/public",
 ]
diff --git a/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.cc b/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.cc
index 02bf1381..55a9d75 100644
--- a/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.cc
+++ b/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.cc
@@ -15,7 +15,7 @@
 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_elementary_stream_info.h"
 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media_pipeline.h"
 #include "media/base/bind_to_current_loop.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace extensions {
 
@@ -86,7 +86,7 @@
     const blink::WebMediaStreamTrack& video_track,
     const blink::WebMediaStreamTrack& audio_track,
     const std::string& sink_ip_address,
-    shell::InterfaceProvider* interface_provider,
+    service_manager::InterfaceProvider* interface_provider,
     const ErrorCallback& error_callback)
     : video_track_(video_track),
       audio_track_(audio_track),
diff --git a/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.h b/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.h
index 9f69f2c..efa8dfc 100644
--- a/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.h
+++ b/extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.h
@@ -18,9 +18,9 @@
 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
 #include "third_party/wds/src/libwds/public/media_manager.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceProvider;
-}  // namespace shell
+}
 
 namespace extensions {
 class WiFiDisplayAudioSink;
@@ -36,7 +36,7 @@
       const blink::WebMediaStreamTrack& video_track,
       const blink::WebMediaStreamTrack& audio_track,
       const std::string& sink_ip_address,
-      shell::InterfaceProvider* interface_provider,
+      service_manager::InterfaceProvider* interface_provider,
       const ErrorCallback& error_callback);
 
   ~WiFiDisplayMediaManager() override;
@@ -79,7 +79,7 @@
   std::unique_ptr<WiFiDisplayAudioSink> audio_sink_;
   std::unique_ptr<WiFiDisplayVideoSink> video_sink_;
 
-  shell::InterfaceProvider* interface_provider_;
+  service_manager::InterfaceProvider* interface_provider_;
   std::string sink_ip_address_;
   std::pair<int, int> sink_rtp_ports_;
   wds::H264VideoFormat optimal_video_format_;
diff --git a/extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc b/extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc
index eefbb1a..e9392633 100644
--- a/extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc
+++ b/extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc
@@ -10,7 +10,7 @@
 #include "base/timer/timer.h"
 #include "content/public/renderer/render_frame.h"
 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_media_manager.h"
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/wds/src/libwds/public/logging.h"
 #include "third_party/wds/src/libwds/public/media_manager.h"
 
diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc
index d53dbac6..6e2ab49 100644
--- a/extensions/renderer/api_binding.cc
+++ b/extensions/renderer/api_binding.cc
@@ -48,10 +48,12 @@
 // returned.
 // If the argument does not match and it is not optional, returns null and
 // populates error.
-std::unique_ptr<base::Value> ParseArgument(const ArgumentSpec& spec,
-                                           v8::Local<v8::Context> context,
-                                           gin::Arguments* arguments,
-                                           std::string* error) {
+std::unique_ptr<base::Value> ParseArgument(
+    const ArgumentSpec& spec,
+    v8::Local<v8::Context> context,
+    gin::Arguments* arguments,
+    const ArgumentSpec::RefMap& type_refs,
+    std::string* error) {
   v8::Local<v8::Value> value = arguments->PeekNext();
   if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) {
     if (!spec.optional()) {
@@ -65,7 +67,7 @@
   }
 
   std::unique_ptr<base::Value> result =
-      spec.ConvertArgument(context, value, error);
+      spec.ConvertArgument(context, value, type_refs, error);
   if (!result) {
     if (!spec.optional()) {
       *error = "Missing required argument: " + spec.name();
@@ -79,16 +81,18 @@
 }
 
 // Parses |args| against |signature| and populates error with any errors.
-std::unique_ptr<base::ListValue> ParseArguments(const APISignature* signature,
-                                                gin::Arguments* arguments,
-                                                std::string* error) {
+std::unique_ptr<base::ListValue> ParseArguments(
+    const APISignature* signature,
+    gin::Arguments* arguments,
+    const ArgumentSpec::RefMap& type_refs,
+    std::string* error) {
   auto results = base::MakeUnique<base::ListValue>();
 
   v8::Local<v8::Context> context = arguments->isolate()->GetCurrentContext();
 
   for (const auto& argument_spec : *signature) {
     std::unique_ptr<base::Value> parsed =
-        ParseArgument(*argument_spec, context, arguments, error);
+        ParseArgument(*argument_spec, context, arguments, type_refs, error);
     if (!parsed)
       return nullptr;
     results->Append(std::move(parsed));
@@ -115,8 +119,10 @@
 
 APIBinding::APIBinding(const std::string& name,
                        const base::ListValue& function_definitions,
-                       const APIMethodCallback& callback)
-    : method_callback_(callback), weak_factory_(this) {
+                       const base::ListValue& type_definitions,
+                       const APIMethodCallback& callback,
+                       ArgumentSpec::RefMap* type_refs)
+    : method_callback_(callback), type_refs_(type_refs), weak_factory_(this) {
   DCHECK(!method_callback_.is_null());
   for (const auto& func : function_definitions) {
     const base::DictionaryValue* func_dict = nullptr;
@@ -126,6 +132,16 @@
     std::unique_ptr<APISignature> spec = GetAPISignature(*func_dict);
     signatures_[name] = std::move(spec);
   }
+  for (const auto& type : type_definitions) {
+    const base::DictionaryValue* type_dict = nullptr;
+    CHECK(type->GetAsDictionary(&type_dict));
+    std::string id;
+    CHECK(type_dict->GetString("id", &id));
+    DCHECK(type_refs->find(id) == type_refs->end());
+    // TODO(devlin): refs are sometimes preceeded by the API namespace; we might
+    // need to take that into account.
+    (*type_refs)[id] = base::MakeUnique<ArgumentSpec>(*type_dict);
+  }
 }
 
 APIBinding::~APIBinding() {}
@@ -174,7 +190,8 @@
   std::unique_ptr<base::ListValue> parsed_arguments;
   {
     v8::TryCatch try_catch(arguments->isolate());
-    parsed_arguments = ParseArguments(signature, arguments, &error);
+    parsed_arguments = ParseArguments(signature, arguments,
+                                      *type_refs_, &error);
     if (try_catch.HasCaught()) {
       DCHECK(!parsed_arguments);
       try_catch.ReThrow();
diff --git a/extensions/renderer/api_binding.h b/extensions/renderer/api_binding.h
index 99f4b7e..19b58ef 100644
--- a/extensions/renderer/api_binding.h
+++ b/extensions/renderer/api_binding.h
@@ -13,6 +13,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "base/supports_user_data.h"
+#include "extensions/renderer/argument_spec.h"
 #include "v8/include/v8.h"
 
 namespace base {
@@ -25,8 +26,6 @@
 
 namespace extensions {
 
-class ArgumentSpec;
-
 // A class that vends v8::Objects for extension APIs. These APIs have function
 // interceptors for all exposed methods, which call back into the APIBinding.
 // The APIBinding then matches the calling arguments against an expected method
@@ -44,9 +43,12 @@
                           std::unique_ptr<base::ListValue>)>;
   using HandlerCallback = base::Callback<void(gin::Arguments*)>;
 
+  // The ArgumentSpec::RefMap is required to outlive this object.
   APIBinding(const std::string& name,
              const base::ListValue& function_definitions,
-             const APIMethodCallback& callback);
+             const base::ListValue& type_definitions,
+             const APIMethodCallback& callback,
+             ArgumentSpec::RefMap* type_refs);
   ~APIBinding();
 
   // Returns a new v8::Object for the API this APIBinding represents.
@@ -78,6 +80,9 @@
   // The callback to use when an API is invoked with valid arguments.
   APIMethodCallback method_callback_;
 
+  // The reference map for all known types; required to outlive this object.
+  const ArgumentSpec::RefMap* type_refs_;
+
   base::WeakPtrFactory<APIBinding> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(APIBinding);
diff --git a/extensions/renderer/api_binding_unittest.cc b/extensions/renderer/api_binding_unittest.cc
index 103b443..cadee14 100644
--- a/extensions/renderer/api_binding_unittest.cc
+++ b/extensions/renderer/api_binding_unittest.cc
@@ -6,6 +6,7 @@
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
 #include "base/memory/ptr_util.h"
+#include "base/stl_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/values.h"
@@ -64,13 +65,15 @@
     "  }]"
     "}]";
 
-// Helper to convert kFunctions into a ListValue of functions after replacing
-// single quotes with double quotes.
-std::unique_ptr<base::ListValue> GetFunctions() {
-  std::string functions_str;
-  base::ReplaceChars(kFunctions, "'", "\"", &functions_str);
-  std::unique_ptr<base::Value> value = base::JSONReader::Read(functions_str);
-  EXPECT_TRUE(value);
+const char kError[] = "Uncaught TypeError: Invalid invocation";
+
+// Helper to convert |source| into a ListValue after replacing single quotes
+// with double quotes.
+std::unique_ptr<base::ListValue> GetListValue(const char* source) {
+  std::string str;
+  base::ReplaceChars(source, "'", "\"", &str);
+  std::unique_ptr<base::Value> value = base::JSONReader::Read(str);
+  EXPECT_TRUE(value) << source;
   return base::ListValue::From(std::move(value));
 }
 
@@ -153,7 +156,7 @@
   if (should_pass) {
     EXPECT_FALSE(try_catch.HasCaught())
         << gin::V8ToString(try_catch.Message()->Get());
-    EXPECT_TRUE(arguments_);
+    ASSERT_TRUE(arguments_) << script_source;
     std::string actual_json;
     EXPECT_TRUE(base::JSONWriter::Write(*arguments_, &actual_json));
     EXPECT_EQ(expected_json_arguments, actual_json);
@@ -167,11 +170,14 @@
 }
 
 TEST_F(APIBindingTest, Test) {
-  std::unique_ptr<base::ListValue> functions = GetFunctions();
+  std::unique_ptr<base::ListValue> functions = GetListValue(kFunctions);
   ASSERT_TRUE(functions);
+  ArgumentSpec::RefMap refs;
   APIBinding binding(
-      "test", *functions,
-      base::Bind(&APIBindingTest::OnFunctionCall, base::Unretained(this)));
+      "test", *functions, base::ListValue(),
+      base::Bind(&APIBindingTest::OnFunctionCall, base::Unretained(this)),
+      &refs);
+  EXPECT_TRUE(refs.empty());
 
   v8::Isolate* isolate = instance_->isolate();
 
@@ -182,29 +188,28 @@
   v8::Local<v8::Object> binding_object =
       binding.CreateInstance(context, isolate);
 
-  std::string error = "Uncaught TypeError: Invalid invocation";
   ExpectPass(binding_object, "obj.oneString('foo');", "['foo']");
   ExpectPass(binding_object, "obj.oneString('');", "['']");
-  ExpectFailure(binding_object, "obj.oneString(1);", error);
-  ExpectFailure(binding_object, "obj.oneString();", error);
-  ExpectFailure(binding_object, "obj.oneString({});", error);
-  ExpectFailure(binding_object, "obj.oneString('foo', 'bar');", error);
+  ExpectFailure(binding_object, "obj.oneString(1);", kError);
+  ExpectFailure(binding_object, "obj.oneString();", kError);
+  ExpectFailure(binding_object, "obj.oneString({});", kError);
+  ExpectFailure(binding_object, "obj.oneString('foo', 'bar');", kError);
 
   ExpectPass(binding_object, "obj.stringAndInt('foo', 42);", "['foo',42]");
   ExpectPass(binding_object, "obj.stringAndInt('foo', -1);", "['foo',-1]");
-  ExpectFailure(binding_object, "obj.stringAndInt(1);", error);
-  ExpectFailure(binding_object, "obj.stringAndInt('foo');", error);
-  ExpectFailure(binding_object, "obj.stringAndInt(1, 'foo');", error);
-  ExpectFailure(binding_object, "obj.stringAndInt('foo', 'foo');", error);
-  ExpectFailure(binding_object, "obj.stringAndInt('foo', '1');", error);
-  ExpectFailure(binding_object, "obj.stringAndInt('foo', 2.3);", error);
+  ExpectFailure(binding_object, "obj.stringAndInt(1);", kError);
+  ExpectFailure(binding_object, "obj.stringAndInt('foo');", kError);
+  ExpectFailure(binding_object, "obj.stringAndInt(1, 'foo');", kError);
+  ExpectFailure(binding_object, "obj.stringAndInt('foo', 'foo');", kError);
+  ExpectFailure(binding_object, "obj.stringAndInt('foo', '1');", kError);
+  ExpectFailure(binding_object, "obj.stringAndInt('foo', 2.3);", kError);
 
   ExpectPass(binding_object, "obj.stringOptionalIntAndBool('foo', 42, true);",
              "['foo',42,true]");
   ExpectPass(binding_object, "obj.stringOptionalIntAndBool('foo', true);",
              "['foo',null,true]");
   ExpectFailure(binding_object,
-                "obj.stringOptionalIntAndBool('foo', 'bar', true);", error);
+                "obj.stringOptionalIntAndBool('foo', 'bar', true);", kError);
 
   ExpectPass(binding_object,
              "obj.oneObject({prop1: 'foo'});", "[{'prop1':'foo'}]");
@@ -214,4 +219,66 @@
       "Uncaught Error: Badness");
 }
 
+TEST_F(APIBindingTest, TypeRefsTest) {
+  const char kTypes[] =
+      "[{"
+      "  'id': 'refObj',"
+      "  'type': 'object',"
+      "  'properties': {"
+      "    'prop1': {'type': 'string'},"
+      "    'prop2': {'type': 'integer', 'optional': true}"
+      "  }"
+      "}, {"
+      "  'id': 'refEnum',"
+      "  'type': 'string',"
+      "  'enum': ['alpha', 'beta']"
+      "}]";
+  const char kRefFunctions[] =
+      "[{"
+      "  'name': 'takesRefObj',"
+      "  'parameters': [{"
+      "    'name': 'o',"
+      "    '$ref': 'refObj'"
+      "  }]"
+      "}, {"
+      "  'name': 'takesRefEnum',"
+      "  'parameters': [{"
+      "    'name': 'e',"
+      "    '$ref': 'refEnum'"
+      "   }]"
+      "}]";
+
+  std::unique_ptr<base::ListValue> functions = GetListValue(kRefFunctions);
+  ASSERT_TRUE(functions);
+  std::unique_ptr<base::ListValue> types = GetListValue(kTypes);
+  ASSERT_TRUE(types);
+  ArgumentSpec::RefMap refs;
+  APIBinding binding(
+      "test", *functions, *types,
+      base::Bind(&APIBindingTest::OnFunctionCall, base::Unretained(this)),
+      &refs);
+  EXPECT_EQ(2u, refs.size());
+  EXPECT_TRUE(base::ContainsKey(refs, "refObj"));
+  EXPECT_TRUE(base::ContainsKey(refs, "refEnum"));
+
+  v8::Isolate* isolate = instance_->isolate();
+
+  v8::HandleScope handle_scope(isolate);
+  v8::Local<v8::Context> context =
+      v8::Local<v8::Context>::New(isolate, context_);
+
+  v8::Local<v8::Object> binding_object =
+      binding.CreateInstance(context, isolate);
+
+  ExpectPass(binding_object, "obj.takesRefObj({prop1: 'foo'})",
+             "[{'prop1':'foo'}]");
+  ExpectPass(binding_object, "obj.takesRefObj({prop1: 'foo', prop2: 2})",
+             "[{'prop1':'foo','prop2':2}]");
+  ExpectFailure(binding_object, "obj.takesRefObj({prop1: 'foo', prop2: 'a'})",
+                kError);
+  ExpectPass(binding_object, "obj.takesRefEnum('alpha')", "['alpha']");
+  ExpectPass(binding_object, "obj.takesRefEnum('beta')", "['beta']");
+  ExpectFailure(binding_object, "obj.takesRefEnum('gamma')", kError);
+}
+
 }  // namespace extensions
diff --git a/extensions/renderer/argument_spec.cc b/extensions/renderer/argument_spec.cc
index abd2f96b..623f1358 100644
--- a/extensions/renderer/argument_spec.cc
+++ b/extensions/renderer/argument_spec.cc
@@ -33,6 +33,20 @@
     : type_(ArgumentType::INTEGER), optional_(false) {
   const base::DictionaryValue* dict = nullptr;
   CHECK(value.GetAsDictionary(&dict));
+  dict->GetBoolean("optional", &optional_);
+  dict->GetString("name", &name_);
+
+  InitializeType(dict);
+}
+
+void ArgumentSpec::InitializeType(const base::DictionaryValue* dict) {
+  std::string ref_string;
+  if (dict->GetString("$ref", &ref_string)) {
+    ref_ = std::move(ref_string);
+    type_ = ArgumentType::REF;
+    return;
+  }
+
   std::string type_string;
   CHECK(dict->GetString("type", &type_string));
   if (type_string == "integer")
@@ -54,9 +68,6 @@
   else
     NOTREACHED();
 
-  dict->GetBoolean("optional", &optional_);
-  dict->GetString("name", &name_);
-
   int min = 0;
   if (dict->GetInteger("minimum", &min))
     minimum_ = min;
@@ -72,6 +83,20 @@
     const base::DictionaryValue* item_value = nullptr;
     CHECK(dict->GetDictionary("items", &item_value));
     list_element_type_ = base::MakeUnique<ArgumentSpec>(*item_value);
+  } else if (type_ == ArgumentType::STRING) {
+    // Technically, there's no reason enums couldn't be other objects (e.g.
+    // numbers), but right now they seem to be exclusively strings. We could
+    // always update this if need be.
+    const base::ListValue* enums = nullptr;
+    if (dict->GetList("enum", &enums)) {
+      size_t size = enums->GetSize();
+      CHECK_GT(size, 0u);
+      for (size_t i = 0; i < size; ++i) {
+        std::string enum_value;
+        CHECK(enums->GetString(i, &enum_value));
+        enum_values_.insert(std::move(enum_value));
+      }
+    }
   }
 }
 
@@ -80,9 +105,17 @@
 std::unique_ptr<base::Value> ArgumentSpec::ConvertArgument(
     v8::Local<v8::Context> context,
     v8::Local<v8::Value> value,
+    const RefMap& refs,
     std::string* error) const {
   // TODO(devlin): Support functions?
   DCHECK_NE(type_, ArgumentType::FUNCTION);
+  if (type_ == ArgumentType::REF) {
+    DCHECK(ref_);
+    auto iter = refs.find(ref_.value());
+    DCHECK(iter != refs.end()) << ref_.value();
+    return iter->second->ConvertArgument(context, value, refs, error);
+  }
+
   if (IsFundamentalType())
     return ConvertArgumentToFundamental(context, value, error);
   if (type_ == ArgumentType::OBJECT) {
@@ -93,7 +126,7 @@
       return nullptr;
     }
     v8::Local<v8::Object> object = value.As<v8::Object>();
-    return ConvertArgumentToObject(context, object, error);
+    return ConvertArgumentToObject(context, object, refs, error);
   }
   if (type_ == ArgumentType::LIST) {
     if (!value->IsArray()) {
@@ -101,7 +134,7 @@
       return nullptr;
     }
     v8::Local<v8::Array> array = value.As<v8::Array>();
-    return ConvertArgumentToArray(context, array, error);
+    return ConvertArgumentToArray(context, array, refs, error);
   }
   if (type_ == ArgumentType::ANY)
     return ConvertArgumentToAny(context, value, error);
@@ -130,9 +163,12 @@
       std::string s;
       // TODO(devlin): If base::StringValue ever takes a std::string&&, we could
       // use std::move to construct.
-      if (gin::Converter<std::string>::FromV8(context->GetIsolate(), value, &s))
-        return base::MakeUnique<base::StringValue>(s);
-      return nullptr;
+      if (!gin::Converter<std::string>::FromV8(context->GetIsolate(),
+                                               value, &s) ||
+          (!enum_values_.empty() && enum_values_.count(s) == 0)) {
+        return nullptr;
+      }
+      return base::MakeUnique<base::StringValue>(s);
     }
     case ArgumentType::BOOLEAN: {
       bool b = false;
@@ -151,6 +187,7 @@
 std::unique_ptr<base::Value> ArgumentSpec::ConvertArgumentToObject(
     v8::Local<v8::Context> context,
     v8::Local<v8::Object> object,
+    const RefMap& refs,
     std::string* error) const {
   DCHECK_EQ(ArgumentType::OBJECT, type_);
   auto result = base::MakeUnique<base::DictionaryValue>();
@@ -176,7 +213,7 @@
       continue;
     }
     std::unique_ptr<base::Value> property =
-        kv.second->ConvertArgument(context, subvalue, error);
+        kv.second->ConvertArgument(context, subvalue, refs, error);
     if (!property)
       return nullptr;
     result->Set(kv.first, std::move(property));
@@ -187,6 +224,7 @@
 std::unique_ptr<base::Value> ArgumentSpec::ConvertArgumentToArray(
     v8::Local<v8::Context> context,
     v8::Local<v8::Array> value,
+    const RefMap& refs,
     std::string* error) const {
   DCHECK_EQ(ArgumentType::LIST, type_);
   auto result = base::MakeUnique<base::ListValue>();
@@ -204,7 +242,7 @@
     if (!maybe_subvalue.ToLocal(&subvalue))
       return nullptr;
     std::unique_ptr<base::Value> item =
-        list_element_type_->ConvertArgument(context, subvalue, error);
+        list_element_type_->ConvertArgument(context, subvalue, refs, error);
     if (!item)
       return nullptr;
     result->Append(std::move(item));
diff --git a/extensions/renderer/argument_spec.h b/extensions/renderer/argument_spec.h
index 1ca0ff8..27dee4b 100644
--- a/extensions/renderer/argument_spec.h
+++ b/extensions/renderer/argument_spec.h
@@ -7,6 +7,7 @@
 
 #include <map>
 #include <memory>
+#include <set>
 #include <string>
 #include <vector>
 
@@ -15,6 +16,7 @@
 #include "v8/include/v8.h"
 
 namespace base {
+class DictionaryValue;
 class Value;
 }
 
@@ -29,11 +31,16 @@
   LIST,
   FUNCTION,
   ANY,
+  REF,
 };
 
 // A description of a given Argument to an Extension.
 class ArgumentSpec {
  public:
+  // A map from name -> definition for type definitions. This is used when an
+  // argument is declared to be a reference to a type defined elsewhere.
+  using RefMap = std::map<std::string, std::unique_ptr<ArgumentSpec>>;
+
   // Reads the description from |value| and sets associated fields.
   // TODO(devlin): We should strongly think about generating these instead of
   // populating them at runtime.
@@ -41,15 +48,20 @@
   ~ArgumentSpec();
 
   // Returns the converted base::Value or null if the |value| didn't match.
-  std::unique_ptr<base::Value> ConvertArgument(v8::Local<v8::Context> context,
-                                               v8::Local<v8::Value> value,
-                                               std::string* error) const;
+  std::unique_ptr<base::Value> ConvertArgument(
+      v8::Local<v8::Context> context,
+      v8::Local<v8::Value> value,
+      const RefMap& refs,
+      std::string* error) const;
 
   const std::string& name() const { return name_; }
   bool optional() const { return optional_; }
   ArgumentType type() const { return type_; }
 
  private:
+  // Initializes this object according to |type_string| and |dict|.
+  void InitializeType(const base::DictionaryValue* dict);
+
   // Returns true if this argument refers to a fundamental type.
   bool IsFundamentalType() const;
 
@@ -62,10 +74,12 @@
   std::unique_ptr<base::Value> ConvertArgumentToObject(
       v8::Local<v8::Context> context,
       v8::Local<v8::Object> object,
+      const RefMap& refs,
       std::string* error) const;
   std::unique_ptr<base::Value> ConvertArgumentToArray(
       v8::Local<v8::Context> context,
       v8::Local<v8::Array> value,
+      const RefMap& refs,
       std::string* error) const;
   std::unique_ptr<base::Value> ConvertArgumentToAny(
       v8::Local<v8::Context> context,
@@ -81,6 +95,10 @@
   // Whether or not the argument is required.
   bool optional_;
 
+  // The reference the argument points to, if any. Note that if this is set,
+  // none of the following fields describing the argument will be.
+  base::Optional<std::string> ref_;
+
   // A minimum, if any.
   base::Optional<int> minimum_;
 
@@ -91,6 +109,9 @@
   // The type of item that should be in the list; present only for lists.
   std::unique_ptr<ArgumentSpec> list_element_type_;
 
+  // The possible enum values, if defined for this argument.
+  std::set<std::string> enum_values_;
+
   DISALLOW_COPY_AND_ASSIGN(ArgumentSpec);
 };
 
diff --git a/extensions/renderer/argument_spec_unittest.cc b/extensions/renderer/argument_spec_unittest.cc
index 832e1b8..336f3f80 100644
--- a/extensions/renderer/argument_spec_unittest.cc
+++ b/extensions/renderer/argument_spec_unittest.cc
@@ -4,6 +4,7 @@
 
 #include "base/json/json_reader.h"
 #include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "base/values.h"
 #include "extensions/renderer/argument_spec.h"
@@ -23,7 +24,7 @@
   std::string updated;
   base::ReplaceChars(str.c_str(), "'", "\"", &updated);
   std::unique_ptr<base::Value> value = base::JSONReader::Read(updated);
-  CHECK(value);
+  CHECK(value) << str;
   return value;
 }
 
@@ -56,6 +57,10 @@
             expected_thrown_message);
   }
 
+  void AddTypeRef(const std::string& id, std::unique_ptr<ArgumentSpec> spec) {
+    type_refs_[id] = std::move(spec);
+  }
+
  private:
   enum class TestResult { PASS, FAIL, THROW, };
 
@@ -65,6 +70,8 @@
                const std::string& expected_json,
                const std::string& expected_thrown_message);
 
+  ArgumentSpec::RefMap type_refs_;
+
   DISALLOW_COPY_AND_ASSIGN(ArgumentSpecUnitTest);
 };
 
@@ -88,7 +95,7 @@
 
   std::string error;
   std::unique_ptr<base::Value> out_value =
-      spec.ConvertArgument(context, val, &error);
+      spec.ConvertArgument(context, val, type_refs_, &error);
   bool should_succeed = expected_result == TestResult::PASS;
   ASSERT_EQ(should_succeed, !!out_value) << script_source << ", " << error;
   bool should_throw = expected_result == TestResult::THROW;
@@ -136,6 +143,17 @@
   }
 
   {
+    ArgumentSpec spec(*GetValue("{'type': 'string', 'enum': ['foo', 'bar']}"));
+    ExpectSuccess(spec, "'foo'", "'foo'");
+    ExpectSuccess(spec, "'bar'", "'bar'");
+    ExpectFailure(spec, "['foo']");
+    ExpectFailure(spec, "'fo'");
+    ExpectFailure(spec, "'foobar'");
+    ExpectFailure(spec, "'baz'");
+    ExpectFailure(spec, "''");
+  }
+
+  {
     ArgumentSpec spec(*GetValue("{'type': 'boolean'}"));
     ExpectSuccess(spec, "true", "true");
     ExpectSuccess(spec, "false", "false");
@@ -210,4 +228,63 @@
   }
 }
 
+TEST_F(ArgumentSpecUnitTest, TypeRefsTest) {
+  const char kObjectType[] =
+      "{"
+      "  'id': 'refObj',"
+      "  'type': 'object',"
+      "  'properties': {"
+      "    'prop1': {'type': 'string'},"
+      "    'prop2': {'type': 'integer', 'optional': true}"
+      "  }"
+      "}";
+  const char kEnumType[] =
+      "{'id': 'refEnum', 'type': 'string', 'enum': ['alpha', 'beta']}";
+  AddTypeRef("refObj", base::MakeUnique<ArgumentSpec>(*GetValue(kObjectType)));
+  AddTypeRef("refEnum", base::MakeUnique<ArgumentSpec>(*GetValue(kEnumType)));
+
+  {
+    const char kObjectWithRefEnumSpec[] =
+        "{"
+        "  'name': 'objWithRefEnum',"
+        "  'type': 'object',"
+        "  'properties': {"
+        "    'e': {'$ref': 'refEnum'},"
+        "    'sub': {'type': 'integer'}"
+        "  }"
+        "}";
+    ArgumentSpec spec(*GetValue(kObjectWithRefEnumSpec));
+    ExpectSuccess(spec, "({e: 'alpha', sub: 1})", "{'e':'alpha','sub':1}");
+    ExpectSuccess(spec, "({e: 'beta', sub: 1})", "{'e':'beta','sub':1}");
+    ExpectFailure(spec, "({e: 'gamma', sub: 1})");
+    ExpectFailure(spec, "({e: 'alpha'})");
+  }
+
+  {
+    const char kObjectWithRefObjectSpec[] =
+        "{"
+        "  'name': 'objWithRefObject',"
+        "  'type': 'object',"
+        "  'properties': {"
+        "    'o': {'$ref': 'refObj'}"
+        "  }"
+        "}";
+    ArgumentSpec spec(*GetValue(kObjectWithRefObjectSpec));
+    ExpectSuccess(spec, "({o: {prop1: 'foo'}})", "{'o':{'prop1':'foo'}}");
+    ExpectSuccess(spec, "({o: {prop1: 'foo', prop2: 2}})",
+                  "{'o':{'prop1':'foo','prop2':2}}");
+    ExpectFailure(spec, "({o: {prop1: 1}})");
+  }
+
+  {
+    const char kRefEnumListSpec[] =
+        "{'type': 'array', 'items': {'$ref': 'refEnum'}}";
+    ArgumentSpec spec(*GetValue(kRefEnumListSpec));
+    ExpectSuccess(spec, "['alpha']", "['alpha']");
+    ExpectSuccess(spec, "['alpha', 'alpha']", "['alpha','alpha']");
+    ExpectSuccess(spec, "['alpha', 'beta']", "['alpha','beta']");
+    ExpectFailure(spec, "['alpha', 'beta', 'gamma']");
+  }
+}
+
 }  // namespace extensions
diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc
index 55c7bab..b814350e 100644
--- a/extensions/renderer/module_system.cc
+++ b/extensions/renderer/module_system.cc
@@ -31,10 +31,10 @@
 
 namespace {
 
-const char* kModuleSystem = "module_system";
-const char* kModuleName = "module_name";
-const char* kModuleField = "module_field";
-const char* kModulesField = "modules";
+const char kModuleSystem[] = "module_system";
+const char kModuleName[] = "module_name";
+const char kModuleField[] = "module_field";
+const char kModulesField[] = "modules";
 
 // Logs an error for the calling context in preparation for potentially
 // crashing the renderer, with some added metadata about the context:
diff --git a/extensions/renderer/object_backed_native_handler.cc b/extensions/renderer/object_backed_native_handler.cc
index e1aa9405..7346e39 100644
--- a/extensions/renderer/object_backed_native_handler.cc
+++ b/extensions/renderer/object_backed_native_handler.cc
@@ -21,8 +21,8 @@
 
 namespace {
 // Key for the base::Bound routed function.
-const char* kHandlerFunction = "handler_function";
-const char* kFeatureName = "feature_name";
+const char kHandlerFunction[] = "handler_function";
+const char kFeatureName[] = "feature_name";
 }  // namespace
 
 ObjectBackedNativeHandler::ObjectBackedNativeHandler(ScriptContext* context)
diff --git a/headless/BUILD.gn b/headless/BUILD.gn
index 7bb59619..cfe2ce0 100644
--- a/headless/BUILD.gn
+++ b/headless/BUILD.gn
@@ -238,7 +238,7 @@
     "//content/public/renderer",
     "//content/public/utility",
     "//net",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//third_party/mesa:osmesa",
     "//ui/aura",
     "//ui/base",
diff --git a/headless/DEPS b/headless/DEPS
index cc93e6b..500e022 100644
--- a/headless/DEPS
+++ b/headless/DEPS
@@ -9,5 +9,5 @@
   "+ui/gfx/geometry",
   "+ui/gl",
   "+ui/ozone/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
 ]
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc
index 20865a3d..2418c29 100644
--- a/headless/lib/browser/headless_web_contents_impl.cc
+++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -28,7 +28,7 @@
 #include "headless/lib/browser/headless_browser_impl.h"
 #include "headless/lib/browser/headless_browser_main_parts.h"
 #include "headless/lib/browser/headless_devtools_client_impl.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/aura/window.h"
 
 namespace headless {
@@ -154,7 +154,7 @@
         content::BINDINGS_POLICY_HEADLESS);
   }
 
-  shell::InterfaceRegistry* interface_registry =
+  service_manager::InterfaceRegistry* interface_registry =
       render_frame_host->GetInterfaceRegistry();
 
   for (const MojoService& service : mojo_services_) {
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
index be10790..e5c8969 100644
--- a/infra/config/recipes.cfg
+++ b/infra/config/recipes.cfg
@@ -5,7 +5,7 @@
   project_id: "build"
   url: "https://chromium.googlesource.com/chromium/tools/build.git"
   branch: "master"
-  revision: "c18191a7a410694a5069feda6171d4a97f27d7c8"
+  revision: "6484849c469e34f3a15f3c45c2147e5b67071a61"
 }
 deps {
   project_id: "depot_tools"
diff --git a/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_fail.json b/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_fail.json
index 9163b3d..84fc62b 100644
--- a/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_fail.json
+++ b/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_fail.json
@@ -193,6 +193,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac/src",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json",
       "GYP_CHROMIUM_NO_ACTION": "1",
       "GYP_DEFINES": "clang=1 component=static_library gomadir='[CACHE]/cipd/goma' target_arch=x64 use_goma=1",
@@ -218,6 +219,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac/src",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "generate_build_files (with patch)"
@@ -235,6 +237,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "clang_revision",
@@ -284,6 +287,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "compile (with patch)",
@@ -485,6 +489,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac/src",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "generate_build_files (without patch)"
@@ -502,6 +507,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "clang_revision (2)",
@@ -551,6 +557,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "compile (without patch)",
diff --git a/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_pass.json b/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_pass.json
index a926879..5263f223 100644
--- a/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_pass.json
+++ b/infra/recipes/blink_downstream.expected/full_client_v8_fyi_V8_Blink_Mac_pass.json
@@ -193,6 +193,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac/src",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json",
       "GYP_CHROMIUM_NO_ACTION": "1",
       "GYP_DEFINES": "clang=1 component=static_library gomadir='[CACHE]/cipd/goma' target_arch=x64 use_goma=1",
@@ -218,6 +219,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac/src",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "generate_build_files (with patch)"
@@ -235,6 +237,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "clang_revision",
@@ -284,6 +287,7 @@
     ],
     "cwd": "[BUILDER_CACHE]/V8_Blink_Mac",
     "env": {
+      "FORCE_MAC_TOOLCHAIN": "1",
       "GOMA_SERVICE_ACCOUNT_JSON_FILE": "/creds/service_accounts/service-account-goma-client.json"
     },
     "name": "compile (with patch)",
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn
index c9def995..26cfb533 100644
--- a/ios/chrome/browser/BUILD.gn
+++ b/ios/chrome/browser/BUILD.gn
@@ -684,7 +684,7 @@
     "//ios/web/public/app",
     "//net",
     "//net:extras",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//skia",
     "//third_party/brotli",
     "//third_party/google_toolbox_for_mac",
diff --git a/ios/chrome/browser/ui/webui/DEPS b/ios/chrome/browser/ui/webui/DEPS
index b48515a..7f957bc 100644
--- a/ios/chrome/browser/ui/webui/DEPS
+++ b/ios/chrome/browser/ui/webui/DEPS
@@ -1,4 +1,4 @@
 include_rules = [
   "+mojo/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
 ]
diff --git a/ios/chrome/browser/ui/webui/mojo_web_ui_ios_controller.h b/ios/chrome/browser/ui/webui/mojo_web_ui_ios_controller.h
index c5e87e53..a9c9807 100644
--- a/ios/chrome/browser/ui/webui/mojo_web_ui_ios_controller.h
+++ b/ios/chrome/browser/ui/webui/mojo_web_ui_ios_controller.h
@@ -8,8 +8,8 @@
 #import "ios/web/public/web_state/web_state.h"
 #include "ios/web/public/webui/web_ui_ios.h"
 #include "ios/web/public/webui/web_ui_ios_controller.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 // This class is intended for web ui pages that use mojo. It is expected that
 // subclasses will do two things:
@@ -20,8 +20,9 @@
 // . Override BindUIHandler() to create and bind the implementation of the
 //   bindings.
 template <typename Interface>
-class MojoWebUIIOSController : public web::WebUIIOSController,
-                               public shell::InterfaceFactory<Interface> {
+class MojoWebUIIOSController
+    : public web::WebUIIOSController,
+      public service_manager::InterfaceFactory<Interface> {
  public:
   explicit MojoWebUIIOSController(web::WebUIIOS* web_ui)
       : web::WebUIIOSController(web_ui) {
@@ -33,8 +34,8 @@
   virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0;
 
  private:
-  // shell::InterfaceFactory overrides:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory overrides:
+  void Create(const service_manager::Identity& remote_identity,
               mojo::InterfaceRequest<Interface> request) override {
     BindUIHandler(std::move(request));
   }
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn
index 4011076..1ec4b29 100644
--- a/ios/web/BUILD.gn
+++ b/ios/web/BUILD.gn
@@ -20,7 +20,7 @@
     "//mojo/public/cpp/system",
     "//mojo/public/js",
     "//net",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/base",
     "//ui/gfx",
     "//ui/gfx/geometry:geometry",
@@ -239,7 +239,7 @@
     "//mojo/public/cpp/system",
     "//mojo/public/js",
     "//net",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/base",
     "//ui/gfx",
     "//ui/gfx/geometry:geometry",
@@ -472,7 +472,7 @@
     "//ios/testing:ocmock_support",
     "//ios/web/test:mojo_bindings",
     "//net:test_support",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//testing/gmock",
     "//testing/gtest",
     "//third_party/ocmock",
@@ -549,7 +549,7 @@
     "//ios/web/test:resources",
     "//mojo/edk/system",
     "//net:test_support",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//testing/gtest",
     "//ui/base:test_support",
   ]
diff --git a/ios/web/DEPS b/ios/web/DEPS
index 1572b65..ad710e6 100644
--- a/ios/web/DEPS
+++ b/ios/web/DEPS
@@ -5,7 +5,7 @@
   "+ios/net",
   "+ios/web",
   "+net",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+ui",
 
   # For tests.
diff --git a/ios/web/js_compile.gni b/ios/web/js_compile.gni
index d712a61..eff5274 100644
--- a/ios/web/js_compile.gni
+++ b/ios/web/js_compile.gni
@@ -119,7 +119,6 @@
       #   --jscomp_error=checkVars
       #   --jscomp_error=missingProperties
       #   --jscomp_error=undefinedVars
-
       args = [
         "--compilation_level",
         "SIMPLE_OPTIMIZATIONS",
@@ -137,10 +136,26 @@
         "--jscomp_error=unknownDefines",
         "--jscomp_error=uselessCode",
         "--jscomp_error=visibility",
+        "--module_output_path_prefix",
+        rebase_path(target_gen_dir, root_build_dir) + "/",
+        "--js",
+        rebase_path("//ios/web/web_state/js/resources/base.js", root_build_dir),
+        "--module",
+        "base_module:1",
+        "--js",
+        rebase_path("//ios/web/web_state/js/resources/common.js",
+                    root_build_dir),
+        "--module",
+        "common_module:1:base_module",
+        "--js",
+        rebase_path("//ios/web/web_state/js/resources/message.js",
+                    root_build_dir),
+        "--module",
+        "message_module:1:common_module",
         "--js",
         "{{source}}",
-        "--js_output_file",
-        rebase_path("$target_gen_dir/{{source_file_part}}", root_build_dir),
+        "--module",
+        "{{source_name_part}}:1:common_module:message_module",
       ]
     }
 
diff --git a/ios/web/public/test/test_web_state.h b/ios/web/public/test/test_web_state.h
index 9635024..3d312ca7 100644
--- a/ios/web/public/test/test_web_state.h
+++ b/ios/web/public/test/test_web_state.h
@@ -65,7 +65,7 @@
                     uint32_t max_bitmap_size,
                     bool bypass_cache,
                     const ImageDownloadCallback& callback) override;
-  shell::InterfaceRegistry* GetMojoInterfaceRegistry() override;
+  service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() override;
   base::WeakPtr<WebState> AsWeakPtr() override;
 
   // Setters for test data.
diff --git a/ios/web/public/test/test_web_state.mm b/ios/web/public/test/test_web_state.mm
index 255acaa..3906434 100644
--- a/ios/web/public/test/test_web_state.mm
+++ b/ios/web/public/test/test_web_state.mm
@@ -142,7 +142,7 @@
   return 0;
 }
 
-shell::InterfaceRegistry* TestWebState::GetMojoInterfaceRegistry() {
+service_manager::InterfaceRegistry* TestWebState::GetMojoInterfaceRegistry() {
   return nullptr;
 }
 
diff --git a/ios/web/public/web_state/web_state.h b/ios/web/public/web_state/web_state.h
index c6d362d..2f140f9 100644
--- a/ios/web/public/web_state/web_state.h
+++ b/ios/web/public/web_state/web_state.h
@@ -35,7 +35,7 @@
 class Value;
 }
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
@@ -238,7 +238,7 @@
                             const ImageDownloadCallback& callback) = 0;
 
   // Returns Mojo interface registry for this WebState.
-  virtual shell::InterfaceRegistry* GetMojoInterfaceRegistry() = 0;
+  virtual service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() = 0;
 
  protected:
   friend class WebStateObserver;
diff --git a/ios/web/web_state/js/resources/common.js b/ios/web/web_state/js/resources/common.js
index 41c7485..9e13a41d 100644
--- a/ios/web/web_state/js/resources/common.js
+++ b/ios/web/web_state/js/resources/common.js
@@ -561,7 +561,8 @@
    */
   __gCrWeb.common.createAndDispatchHTMLEvent = function(
       element, type, bubbles, cancelable) {
-    var changeEvent = element.ownerDocument.createEvent('HTMLEvents');
+    var changeEvent =
+        /** @type {!Event} */(element.ownerDocument.createEvent('HTMLEvents'));
     changeEvent.initEvent(type, bubbles, cancelable);
 
     // A timer is used to avoid reentering JavaScript evaluation.
@@ -578,7 +579,7 @@
   __gCrWeb.common.getFavicons = function() {
     var favicons = [];
     var hasFavicon = false;
-    favicons.toJSON = null;  // Never inherit Array.prototype.toJSON.
+    delete favicons.toJSON;  // Never inherit Array.prototype.toJSON.
     var links = document.getElementsByTagName('link');
     var linkCount = links.length;
     for (var i = 0; i < linkCount; ++i) {
@@ -641,15 +642,15 @@
   /**
    * Returns a list of plugin elements in the document that have no fallback
    * content. For nested plugins, only the innermost plugin element is returned.
-   * @return {Array} A list of plugin elements.
+   * @return {!Array<!HTMLElement>} A list of plugin elements.
    * @private
    */
   var findPluginNodesWithoutFallback_ = function() {
-    var pluginNodes = [];
+    var i, pluginNodes = [];
     var objects = document.getElementsByTagName('object');
     var objectCount = objects.length;
-    for (var i = 0; i < objectCount; i++) {
-      var object = objects[i];
+    for (i = 0; i < objectCount; i++) {
+      var object = /** @type {!HTMLElement} */(objects[i]);
       if (objectNodeIsPlugin_(object) &&
           !pluginHasFallbackContent_(object)) {
         pluginNodes.push(object);
@@ -657,8 +658,8 @@
     }
     var applets = document.getElementsByTagName('applet');
     var appletsCount = applets.length;
-    for (var i = 0; i < appletsCount; i++) {
-      var applet = applets[i];
+    for (i = 0; i < appletsCount; i++) {
+      var applet = /** @type {!HTMLElement} */(applets[i]);
       if (!pluginHasFallbackContent_(applet)) {
         pluginNodes.push(applet);
       }
diff --git a/ios/web/web_state/js/resources/message.js b/ios/web/web_state/js/resources/message.js
index 509ad24..1649a64 100644
--- a/ios/web/web_state/js/resources/message.js
+++ b/ios/web/web_state/js/resources/message.js
@@ -27,7 +27,7 @@
       messageQueue_.queue = [];
       // Since the array will be JSON serialized, protect against non-standard
       // custom versions of Array.prototype.toJSON.
-      messageQueue_.queue.toJSON = null
+      delete messageQueue_.queue.toJSON;
     }
   };
   messageQueue_.reset();
@@ -80,7 +80,7 @@
         // object ensures that original and working implementation of
         // window.webkit is restored.
         var oldWebkit = window.webkit;
-        delete window.webkit;
+        delete window['webkit'];
         window.webkit.messageHandlers[queueObject.scheme].postMessage(
             stringifiedMessage);
         window.webkit = oldWebkit;
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 526961a..11e59039 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -102,7 +102,7 @@
 #import "ios/web/webui/mojo_facade.h"
 #import "net/base/mac/url_conversions.h"
 #include "net/base/net_errors.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/base/page_transition_types.h"
 #include "url/gurl.h"
 #include "url/url_constants.h"
@@ -2426,7 +2426,7 @@
 
 - (web::MojoFacade*)mojoFacade {
   if (!_mojoFacade) {
-    shell::mojom::InterfaceProvider* interfaceProvider =
+    service_manager::mojom::InterfaceProvider* interfaceProvider =
         _webStateImpl->GetMojoInterfaceRegistry();
     _mojoFacade.reset(new web::MojoFacade(interfaceProvider, self));
   }
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h
index 01ad3d7c..3bb1e736 100644
--- a/ios/web/web_state/web_state_impl.h
+++ b/ios/web/web_state/web_state_impl.h
@@ -251,7 +251,7 @@
                     uint32_t max_bitmap_size,
                     bool bypass_cache,
                     const ImageDownloadCallback& callback) override;
-  shell::InterfaceRegistry* GetMojoInterfaceRegistry() override;
+  service_manager::InterfaceRegistry* GetMojoInterfaceRegistry() override;
   base::WeakPtr<WebState> AsWeakPtr() override;
 
   // Adds |interstitial|'s view to the web controller's content view.
@@ -366,7 +366,7 @@
   base::WeakPtrFactory<WebState> weak_factory_;
 
   // Mojo interface registry for this WebState.
-  std::unique_ptr<shell::InterfaceRegistry> mojo_interface_registry_;
+  std::unique_ptr<service_manager::InterfaceRegistry> mojo_interface_registry_;
 
   DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
 };
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
index 1830c3c..f43b3595 100644
--- a/ios/web/web_state/web_state_impl.mm
+++ b/ios/web/web_state/web_state_impl.mm
@@ -32,7 +32,7 @@
 #import "ios/web/webui/web_ui_ios_controller_factory_registry.h"
 #import "ios/web/webui/web_ui_ios_impl.h"
 #include "net/http/http_response_headers.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace web {
 
@@ -475,20 +475,16 @@
 }
 
 bool WebStateImpl::ShouldAllowRequest(NSURLRequest* request) {
-  base::ObserverListBase<WebStatePolicyDecider>::Iterator it(&policy_deciders_);
-  WebStatePolicyDecider* policy_decider = nullptr;
-  while ((policy_decider = it.GetNext()) != nullptr) {
-    if (!policy_decider->ShouldAllowRequest(request))
+  for (auto& policy_decider : policy_deciders_) {
+    if (!policy_decider.ShouldAllowRequest(request))
       return false;
   }
   return true;
 }
 
 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) {
-  base::ObserverListBase<WebStatePolicyDecider>::Iterator it(&policy_deciders_);
-  WebStatePolicyDecider* policy_decider = nullptr;
-  while ((policy_decider = it.GetNext()) != nullptr) {
-    if (!policy_decider->ShouldAllowResponse(response))
+  for (auto& policy_decider : policy_deciders_) {
+    if (!policy_decider.ShouldAllowResponse(response))
       return false;
   }
   return true;
@@ -536,9 +532,9 @@
                                               callback:callback];
 }
 
-shell::InterfaceRegistry* WebStateImpl::GetMojoInterfaceRegistry() {
+service_manager::InterfaceRegistry* WebStateImpl::GetMojoInterfaceRegistry() {
   if (!mojo_interface_registry_) {
-    mojo_interface_registry_.reset(new shell::InterfaceRegistry);
+    mojo_interface_registry_.reset(new service_manager::InterfaceRegistry);
   }
   return mojo_interface_registry_.get();
 }
diff --git a/ios/web/webui/DEPS b/ios/web/webui/DEPS
index ea8a0f4..c1663263 100644
--- a/ios/web/webui/DEPS
+++ b/ios/web/webui/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
   "+mojo/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+ui/resources/grit",
 ]
diff --git a/ios/web/webui/mojo_facade.h b/ios/web/webui/mojo_facade.h
index 600d4a61..ce9ed754 100644
--- a/ios/web/webui/mojo_facade.h
+++ b/ios/web/webui/mojo_facade.h
@@ -18,11 +18,11 @@
 class Value;
 }  // base
 
-namespace shell {
+namespace service_manager {
 namespace mojom {
 class InterfaceProvider;
 }  // mojom
-}  // shell
+}  // service_manager
 
 namespace web {
 
@@ -33,7 +33,7 @@
  public:
   // Constructs MojoFacade. The calling code must retain the ownership of
   // |interface_provider| and |script_evaluator|, both can not be null.
-  MojoFacade(shell::mojom::InterfaceProvider* interface_provider,
+  MojoFacade(service_manager::mojom::InterfaceProvider* interface_provider,
              id<CRWJSInjectionEvaluator> script_evaluator);
   ~MojoFacade();
 
@@ -126,7 +126,7 @@
       const base::DictionaryValue* args);
 
   // Provides interfaces.
-  shell::mojom::InterfaceProvider* interface_provider_;
+  service_manager::mojom::InterfaceProvider* interface_provider_;
   // Runs JavaScript on WebUI page.
   base::WeakNSProtocol<id<CRWJSInjectionEvaluator>> script_evaluator_;
   // Id of the last created watch.
diff --git a/ios/web/webui/mojo_facade.mm b/ios/web/webui/mojo_facade.mm
index dc8eb24c..dd912ee 100644
--- a/ios/web/webui/mojo_facade.mm
+++ b/ios/web/webui/mojo_facade.mm
@@ -15,7 +15,7 @@
 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h"
 #include "ios/web/public/web_thread.h"
 #include "mojo/public/cpp/system/core.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
@@ -34,8 +34,9 @@
 
 }  // namespace
 
-MojoFacade::MojoFacade(shell::mojom::InterfaceProvider* interface_provider,
-                       id<CRWJSInjectionEvaluator> script_evaluator)
+MojoFacade::MojoFacade(
+    service_manager::mojom::InterfaceProvider* interface_provider,
+    id<CRWJSInjectionEvaluator> script_evaluator)
     : interface_provider_(interface_provider),
       script_evaluator_(script_evaluator) {
   DCHECK_CURRENTLY_ON(WebThread::UI);
diff --git a/ios/web/webui/mojo_facade_unittest.mm b/ios/web/webui/mojo_facade_unittest.mm
index fb0d28b..bf839ab 100644
--- a/ios/web/webui/mojo_facade_unittest.mm
+++ b/ios/web/webui/mojo_facade_unittest.mm
@@ -14,9 +14,9 @@
 #import "ios/web/public/web_state/js/crw_js_injection_evaluator.h"
 #include "ios/web/test/mojo_test.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #import "testing/gtest_mac.h"
 #import "third_party/ocmock/OCMock/OCMock.h"
 
@@ -44,13 +44,14 @@
 }
 
 // Test mojo handler factory.
-class TestUIHandlerFactory : public shell::InterfaceFactory<TestUIHandlerMojo> {
+class TestUIHandlerFactory
+    : public service_manager::InterfaceFactory<TestUIHandlerMojo> {
  public:
   ~TestUIHandlerFactory() override {}
 
  private:
-  // shell::InterfaceFactory overrides.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory overrides.
+  void Create(const service_manager::Identity& remote_identity,
               mojo::InterfaceRequest<TestUIHandlerMojo> request) override {}
 };
 
@@ -60,7 +61,7 @@
 class MojoFacadeTest : public WebTest {
  protected:
   MojoFacadeTest() {
-    interface_registry_.reset(new shell::InterfaceRegistry);
+    interface_registry_.reset(new service_manager::InterfaceRegistry);
     interface_registry_->AddInterface(&ui_handler_factory_);
     evaluator_.reset([[OCMockObject
         mockForProtocol:@protocol(CRWJSInjectionEvaluator)] retain]);
@@ -74,7 +75,7 @@
 
  private:
   TestUIHandlerFactory ui_handler_factory_;
-  std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
+  std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
   base::scoped_nsobject<OCMockObject> evaluator_;
   std::unique_ptr<MojoFacade> facade_;
 };
diff --git a/ios/web/webui/resources/interface_provider.js b/ios/web/webui/resources/interface_provider.js
index bd1372d..75b0c9eb 100644
--- a/ios/web/webui/resources/interface_provider.js
+++ b/ios/web/webui/resources/interface_provider.js
@@ -5,7 +5,7 @@
 // Module "content/public/renderer/frame_interfaces"
 //
 // This module provides the JavaScript bindings for
-// services/shell/public/cpp/connection.h.
+// services/service_manager/public/cpp/connection.h.
 // Refer to that file for more detailed documentation for equivalent methods.
 
 define("content/public/renderer/frame_interfaces", [
diff --git a/ios/web/webui/web_ui_mojo_inttest.mm b/ios/web/webui/web_ui_mojo_inttest.mm
index c0be7633..da7c3cf 100644
--- a/ios/web/webui/web_ui_mojo_inttest.mm
+++ b/ios/web/webui/web_ui_mojo_inttest.mm
@@ -17,8 +17,8 @@
 #import "ios/web/web_state/ui/crw_web_controller.h"
 #import "ios/web/web_state/web_state_impl.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "url/gurl.h"
 #include "url/scheme_host_port.h"
 
@@ -37,8 +37,9 @@
 // Once "fin" is received |IsFinReceived()| call will return true, indicating
 // that communication was successful. See test WebUI page code here:
 // ios/web/test/data/mojo_test.js
-class TestUIHandler : public TestUIHandlerMojo,
-                      public shell::InterfaceFactory<TestUIHandlerMojo> {
+class TestUIHandler
+    : public TestUIHandlerMojo,
+      public service_manager::InterfaceFactory<TestUIHandlerMojo> {
  public:
   TestUIHandler() {}
   ~TestUIHandler() override {}
@@ -68,8 +69,8 @@
   }
 
  private:
-  // shell::InterfaceFactory overrides.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory overrides.
+  void Create(const service_manager::Identity& remote_identity,
               mojo::InterfaceRequest<TestUIHandlerMojo> request) override {
     bindings_.AddBinding(this, std::move(request));
   }
diff --git a/mash/BUILD.gn b/mash/BUILD.gn
index d0750466..c21cdbdb 100644
--- a/mash/BUILD.gn
+++ b/mash/BUILD.gn
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 # Target that builders build.
@@ -49,7 +49,7 @@
     "//ash/mus:unittests",
     "//base",
     "//base/test:test_support",
-    "//services/shell/background:main",
+    "//services/service_manager/background:main",
     "//ui/aura",
     "//ui/base",
     "//ui/compositor:test_support",
diff --git a/mash/DEPS b/mash/DEPS
index 97359eb3..1c4becfb 100644
--- a/mash/DEPS
+++ b/mash/DEPS
@@ -5,7 +5,7 @@
   "+mojo/converters",
   "+mojo/public",
   "+services/catalog/public",
-  "+services/shell",
+  "+services/service_manager",
   "+services/tracing/public",
   "+services/ui/common",
   "+services/ui/public",
diff --git a/mash/app_driver/BUILD.gn b/mash/app_driver/BUILD.gn
index 6615f053..6bb0165 100644
--- a/mash/app_driver/BUILD.gn
+++ b/mash/app_driver/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -22,7 +22,7 @@
   public_deps = [
     "//base",
     "//services/catalog/public/interfaces",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:sources",
     "//services/ui/public/interfaces",
   ]
 
@@ -40,8 +40,8 @@
     ":lib",
     "//base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
   ]
 
   data_deps = [
diff --git a/mash/app_driver/app_driver.cc b/mash/app_driver/app_driver.cc
index ed8976d..85747014 100644
--- a/mash/app_driver/app_driver.cc
+++ b/mash/app_driver/app_driver.cc
@@ -9,8 +9,8 @@
 #include "base/bind.h"
 #include "base/message_loop/message_loop.h"
 #include "mash/public/interfaces/launchable.mojom.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/common/event_matcher_util.h"
 
 using mash::mojom::LaunchablePtr;
@@ -86,12 +86,12 @@
   }
 }
 
-void AppDriver::OnStart(const shell::Identity& identity) {
+void AppDriver::OnStart(const service_manager::Identity& identity) {
   AddAccelerators();
 }
 
-bool AppDriver::OnConnect(const shell::Identity& remote_identity,
-                          shell::InterfaceRegistry* registry) {
+bool AppDriver::OnConnect(const service_manager::Identity& remote_identity,
+                          service_manager::InterfaceRegistry* registry) {
   return true;
 }
 
diff --git a/mash/app_driver/app_driver.h b/mash/app_driver/app_driver.h
index ef70ca5..593e9467 100644
--- a/mash/app_driver/app_driver.h
+++ b/mash/app_driver/app_driver.h
@@ -14,13 +14,13 @@
 #include "base/memory/weak_ptr.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "services/catalog/public/interfaces/catalog.mojom.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/ui/public/interfaces/accelerator_registrar.mojom.h"
 
 namespace mash {
 namespace app_driver {
 
-class AppDriver : public shell::Service,
+class AppDriver : public service_manager::Service,
                   public ui::mojom::AcceleratorHandler {
  public:
   AppDriver();
@@ -29,10 +29,10 @@
  private:
   void OnAvailableCatalogEntries(std::vector<catalog::mojom::EntryPtr> entries);
 
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
   bool OnStop() override;
 
   // ui::mojom::AcceleratorHandler:
diff --git a/mash/app_driver/main.cc b/mash/app_driver/main.cc
index f2aebef..7645d4cb 100644
--- a/mash/app_driver/main.cc
+++ b/mash/app_driver/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/app_driver/app_driver.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::app_driver::AppDriver);
+  service_manager::ServiceRunner runner(new mash::app_driver::AppDriver);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/app_driver/manifest.json b/mash/app_driver/manifest.json
index b0fcc36..549cf0e 100644
--- a/mash/app_driver/manifest.json
+++ b/mash/app_driver/manifest.json
@@ -4,10 +4,8 @@
   "display_name": "App Driver",
   "capabilities": {
     "required": {
-      "*": {
-        "classes": [ "mash:launchable", "mus:window_manager" ]
-      },
-      "service:catalog": { "classes": [ "catalog:catalog" ] }
+      "*": [ "mash:launchable", "mus:window_manager" ],
+      "service:catalog": [ "catalog:catalog" ]
     }
   }
 }
diff --git a/mash/browser/BUILD.gn b/mash/browser/BUILD.gn
index 7ee849a..771516d 100644
--- a/mash/browser/BUILD.gn
+++ b/mash/browser/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -24,8 +24,8 @@
     "//services/catalog/public/interfaces",
     "//services/navigation/public/cpp",
     "//services/navigation/public/interfaces",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//services/ui/public/cpp",
     "//ui/gfx/geometry/mojo",
@@ -48,7 +48,7 @@
 
   deps = [
     ":lib",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/views/mus:for_mojo_application",
   ]
 
diff --git a/mash/browser/browser.cc b/mash/browser/browser.cc
index 9df2cf6..892970e 100644
--- a/mash/browser/browser.cc
+++ b/mash/browser/browser.cc
@@ -19,10 +19,10 @@
 #include "services/navigation/public/cpp/view_delegate.h"
 #include "services/navigation/public/cpp/view_observer.h"
 #include "services/navigation/public/interfaces/view.mojom.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/ui/public/cpp/window.h"
 #include "services/ui/public/cpp/window_tree_client.h"
@@ -205,7 +205,8 @@
     AddObserver(tab);
     tabs_.push_back(tab);
     tab_container_->AddChildView(tab);
-    FOR_EACH_OBSERVER(TabStripObserver, observers_, OnTabAdded(tab));
+    for (auto& observer : observers_)
+      observer.OnTabAdded(tab);
     SelectTab(tab);
   }
 
@@ -236,7 +237,8 @@
         SelectTab(tabs_[next_selected_index]);
     }
     Layout();
-    FOR_EACH_OBSERVER(TabStripObserver, observers_, OnTabRemoved(tab));
+    for (auto& observer : observers_)
+      observer.OnTabRemoved(tab);
     delete tab;
   }
 
@@ -246,7 +248,8 @@
     auto it = std::find(tabs_.begin(), tabs_.end(), tab);
     DCHECK(it != tabs_.end());
     selected_index_ = it - tabs_.begin();
-    FOR_EACH_OBSERVER(TabStripObserver, observers_, OnTabSelected(tab));
+    for (auto& observer : observers_)
+      observer.OnTabSelected(tab);
   }
   Tab* selected_tab() {
     return selected_index_ != -1 ? tabs_[selected_index_] : nullptr;
@@ -864,7 +867,7 @@
   return base::MakeUnique<navigation::View>(std::move(factory));
 }
 
-void Browser::OnStart(const shell::Identity& identity) {
+void Browser::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 
   aura_init_.reset(
@@ -873,8 +876,8 @@
       views::WindowManagerConnection::Create(connector(), identity);
 }
 
-bool Browser::OnConnect(const shell::Identity& remote_identity,
-                        shell::InterfaceRegistry* registry) {
+bool Browser::OnConnect(const service_manager::Identity& remote_identity,
+                        service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Launchable>(this);
   return true;
 }
@@ -895,7 +898,7 @@
   AddWindow(window);
 }
 
-void Browser::Create(const shell::Identity& remote_identity,
+void Browser::Create(const service_manager::Identity& remote_identity,
                      mojom::LaunchableRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
diff --git a/mash/browser/browser.h b/mash/browser/browser.h
index a0b945d9..00fd1e5 100644
--- a/mash/browser/browser.h
+++ b/mash/browser/browser.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace navigation {
@@ -26,9 +26,9 @@
 namespace mash {
 namespace browser {
 
-class Browser : public shell::Service,
+class Browser : public service_manager::Service,
                 public mojom::Launchable,
-                public shell::InterfaceFactory<mojom::Launchable> {
+                public service_manager::InterfaceFactory<mojom::Launchable> {
  public:
   Browser();
   ~Browser() override;
@@ -42,16 +42,16 @@
   std::unique_ptr<navigation::View> CreateView();
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Launchable:
   void Launch(uint32_t what, mojom::LaunchMode how) override;
 
-  // shell::InterfaceFactory<mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::LaunchableRequest request) override;
 
   mojo::BindingSet<mojom::Launchable> bindings_;
diff --git a/mash/browser/main.cc b/mash/browser/main.cc
index c2b86c3..45a31dbb 100644
--- a/mash/browser/main.cc
+++ b/mash/browser/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/browser/browser.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::browser::Browser);
+  service_manager::ServiceRunner runner(new mash::browser::Browser);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/browser/manifest.json b/mash/browser/manifest.json
index 99916b7..558e6999 100644
--- a/mash/browser/manifest.json
+++ b/mash/browser/manifest.json
@@ -5,7 +5,7 @@
   "capabilities": {
     "provided": { "mash:launchable": [ "mash::mojom::Launchable" ] },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/mash/catalog_viewer/BUILD.gn b/mash/catalog_viewer/BUILD.gn
index f6c3738..d7250b6 100644
--- a/mash/catalog_viewer/BUILD.gn
+++ b/mash/catalog_viewer/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 
 source_set("lib") {
@@ -18,9 +18,9 @@
     "//mash/public/interfaces",
     "//mojo/public/cpp/bindings",
     "//services/catalog/public/interfaces",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//ui/resources",
     "//ui/views",
@@ -41,9 +41,9 @@
     ":lib",
     "//base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
     "//ui/views/mus:for_mojo_application",
   ]
 
diff --git a/mash/catalog_viewer/catalog_viewer.cc b/mash/catalog_viewer/catalog_viewer.cc
index 860dae6..45718a30 100644
--- a/mash/catalog_viewer/catalog_viewer.cc
+++ b/mash/catalog_viewer/catalog_viewer.cc
@@ -14,8 +14,8 @@
 #include "base/strings/utf_string_conversions.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "services/catalog/public/interfaces/catalog.mojom.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/base/models/table_model.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/resources/grit/ui_resources.h"
@@ -165,7 +165,7 @@
     base::MessageLoop::current()->QuitWhenIdle();
 }
 
-void CatalogViewer::OnStart(const shell::Identity& identity) {
+void CatalogViewer::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 
   aura_init_.reset(
@@ -174,8 +174,8 @@
       views::WindowManagerConnection::Create(connector(), identity);
 }
 
-bool CatalogViewer::OnConnect(const shell::Identity& remote_identity,
-                              shell::InterfaceRegistry* registry) {
+bool CatalogViewer::OnConnect(const service_manager::Identity& remote_identity,
+                              service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Launchable>(this);
   return true;
 }
@@ -197,7 +197,7 @@
   windows_.push_back(window);
 }
 
-void CatalogViewer::Create(const shell::Identity& remote_identity,
+void CatalogViewer::Create(const service_manager::Identity& remote_identity,
                            mojom::LaunchableRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
diff --git a/mash/catalog_viewer/catalog_viewer.h b/mash/catalog_viewer/catalog_viewer.h
index 8d66a269..b120c7e 100644
--- a/mash/catalog_viewer/catalog_viewer.h
+++ b/mash/catalog_viewer/catalog_viewer.h
@@ -12,7 +12,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace views {
@@ -24,9 +24,10 @@
 namespace mash {
 namespace catalog_viewer {
 
-class CatalogViewer : public shell::Service,
-                      public mojom::Launchable,
-                      public shell::InterfaceFactory<mojom::Launchable> {
+class CatalogViewer
+    : public service_manager::Service,
+      public mojom::Launchable,
+      public service_manager::InterfaceFactory<mojom::Launchable> {
  public:
   CatalogViewer();
   ~CatalogViewer() override;
@@ -34,16 +35,16 @@
   void RemoveWindow(views::Widget* window);
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Launchable:
   void Launch(uint32_t what, mojom::LaunchMode how) override;
 
-  // shell::InterfaceFactory<mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::LaunchableRequest request) override;
 
   mojo::BindingSet<mojom::Launchable> bindings_;
diff --git a/mash/catalog_viewer/main.cc b/mash/catalog_viewer/main.cc
index f4202e6..620af24 100644
--- a/mash/catalog_viewer/main.cc
+++ b/mash/catalog_viewer/main.cc
@@ -3,10 +3,11 @@
 // found in the LICENSE file.
 
 #include "mash/catalog_viewer/catalog_viewer.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::catalog_viewer::CatalogViewer);
+  service_manager::ServiceRunner runner(
+      new mash::catalog_viewer::CatalogViewer);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/catalog_viewer/manifest.json b/mash/catalog_viewer/manifest.json
index a9df77c..87f85da 100644
--- a/mash/catalog_viewer/manifest.json
+++ b/mash/catalog_viewer/manifest.json
@@ -5,8 +5,8 @@
   "capabilities": {
     "provided": { "mash:launchable": [ "mash::mojom::Launchable" ] },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:catalog": { "classes": [ "catalog:catalog" ] }
+      "*": [ "app" ],
+      "service:catalog": [ "catalog:catalog" ]
     }
   }
 }
diff --git a/mash/example/BUILD.gn b/mash/example/BUILD.gn
index ba59dbf..e46baab 100644
--- a/mash/example/BUILD.gn
+++ b/mash/example/BUILD.gn
@@ -11,6 +11,6 @@
     "//ash/mus",
     "//mash/example/views_examples",
     "//mash/example/window_type_launcher",
-    "//services/shell/standalone",
+    "//services/service_manager/standalone",
   ]
 }
diff --git a/mash/example/common/mus_views_init.h b/mash/example/common/mus_views_init.h
index a37d7b86..0e5cb74 100644
--- a/mash/example/common/mus_views_init.h
+++ b/mash/example/common/mus_views_init.h
@@ -13,7 +13,7 @@
 #include "ui/views/mus/aura_init.h"
 #include "ui/views/views_delegate.h"
 
-namespace shell {
+namespace service_manager {
 class ServiceContext;
 }
 
@@ -25,7 +25,7 @@
 class MUSViewsInit : public views::ViewsDelegate,
                      public ui::WindowTreeClientDelegate {
  public:
-  explicit MUSViewsInit(shell::ServiceContext* app);
+  explicit MUSViewsInit(service_manager::ServiceContext* app);
   ~MUSViewsInit() override;
 
  private:
@@ -45,7 +45,7 @@
   HICON GetSmallWindowIcon() const override;
 #endif
 
-  shell::ServiceContext* app_;
+  service_manager::ServiceContext* app_;
   std::unique_ptr<views::AuraInit> aura_init_;
   ui::mojom::WindowManagerPtr window_manager_;
 
diff --git a/mash/example/views_examples/BUILD.gn b/mash/example/views_examples/BUILD.gn
index 5f59bc5..49e7d3a6 100644
--- a/mash/example/views_examples/BUILD.gn
+++ b/mash/example/views_examples/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -19,8 +19,8 @@
     "//base",
     "//mash/public/interfaces",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
     "//services/tracing/public/cpp",
     "//services/ui/public/interfaces",
     "//skia",
diff --git a/mash/example/views_examples/manifest.json b/mash/example/views_examples/manifest.json
index 9f2c82d..052ebec 100644
--- a/mash/example/views_examples/manifest.json
+++ b/mash/example/views_examples/manifest.json
@@ -4,6 +4,6 @@
   "display_name": "Views Examples",
   "capabilities": {
     "provided": { "mash:launchable": [ "mash::mojom::Launchable" ] },
-    "required": { "*": { "classes": [ "app" ] } }
+    "required": { "*": [ "app" ] }
   }
 }
diff --git a/mash/example/views_examples/views_examples.cc b/mash/example/views_examples/views_examples.cc
index 9585f723..716235c 100644
--- a/mash/example/views_examples/views_examples.cc
+++ b/mash/example/views_examples/views_examples.cc
@@ -7,11 +7,11 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "ui/views/examples/example_base.h"
 #include "ui/views/examples/examples_window.h"
@@ -24,24 +24,24 @@
 }
 
 class ViewsExamples
-    : public shell::Service,
+    : public service_manager::Service,
       public mash::mojom::Launchable,
-      public shell::InterfaceFactory<mash::mojom::Launchable> {
+      public service_manager::InterfaceFactory<mash::mojom::Launchable> {
  public:
   ViewsExamples() {}
   ~ViewsExamples() override {}
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override {
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override {
     tracing_.Initialize(connector(), identity.name());
     aura_init_.reset(
         new views::AuraInit(connector(), "views_mus_resources.pak"));
     window_manager_connection_ =
         views::WindowManagerConnection::Create(connector(), identity);
   }
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
     registry->AddInterface<mash::mojom::Launchable>(this);
     return true;
   }
@@ -52,8 +52,8 @@
                                         nullptr, nullptr);
   }
 
-  // shell::InterfaceFactory<mash::mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mash::mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mash::mojom::LaunchableRequest request) override {
     bindings_.AddBinding(this, std::move(request));
   }
@@ -68,5 +68,6 @@
 };
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  return shell::ServiceRunner(new ViewsExamples).Run(service_request_handle);
+  return service_manager::ServiceRunner(new ViewsExamples)
+      .Run(service_request_handle);
 }
diff --git a/mash/example/window_type_launcher/BUILD.gn b/mash/example/window_type_launcher/BUILD.gn
index 7c5c49a3..e1ffdba 100644
--- a/mash/example/window_type_launcher/BUILD.gn
+++ b/mash/example/window_type_launcher/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -21,8 +21,8 @@
     "//mash/public/interfaces",
     "//mash/session/public/interfaces",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
diff --git a/mash/example/window_type_launcher/manifest.json b/mash/example/window_type_launcher/manifest.json
index 35a8ece5..a985376b 100644
--- a/mash/example/window_type_launcher/manifest.json
+++ b/mash/example/window_type_launcher/manifest.json
@@ -5,8 +5,8 @@
   "capabilities": {
     "provided": { "mash:launchable": [ "mash::mojom::Launchable" ] },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:mash_session": { "classes": [ "mash_session:session" ] }
+      "*": [ "app" ],
+      "service:mash_session": [ "mash_session:session" ]
     }
   }
 }
diff --git a/mash/example/window_type_launcher/window_type_launcher.cc b/mash/example/window_type_launcher/window_type_launcher.cc
index 07254bf7..ade3674 100644
--- a/mash/example/window_type_launcher/window_type_launcher.cc
+++ b/mash/example/window_type_launcher/window_type_launcher.cc
@@ -12,11 +12,11 @@
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/platform_thread.h"
 #include "mash/session/public/interfaces/session.mojom.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
@@ -225,7 +225,7 @@
                                public views::ContextMenuController {
  public:
   explicit WindowTypeLauncherView(WindowTypeLauncher* window_type_launcher,
-                                  shell::Connector* connector)
+                                  service_manager::Connector* connector)
       : window_type_launcher_(window_type_launcher),
         connector_(connector),
         create_button_(
@@ -432,7 +432,7 @@
   }
 
   WindowTypeLauncher* window_type_launcher_;
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
   views::Button* create_button_;
   views::Button* always_on_top_button_;
   views::Button* panel_button_;
@@ -469,15 +469,16 @@
     base::MessageLoop::current()->QuitWhenIdle();
 }
 
-void WindowTypeLauncher::OnStart(const shell::Identity& identity) {
+void WindowTypeLauncher::OnStart(const service_manager::Identity& identity) {
   aura_init_.reset(
       new views::AuraInit(connector(), "views_mus_resources.pak"));
   window_manager_connection_ =
       views::WindowManagerConnection::Create(connector(), identity);
 }
 
-bool WindowTypeLauncher::OnConnect(const shell::Identity& remote_identity,
-                                   shell::InterfaceRegistry* registry) {
+bool WindowTypeLauncher::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mash::mojom::Launchable>(this);
   return true;
 }
@@ -497,12 +498,13 @@
   windows_.push_back(window);
 }
 
-void WindowTypeLauncher::Create(const shell::Identity& remote_identity,
-                                mash::mojom::LaunchableRequest request) {
+void WindowTypeLauncher::Create(
+    const service_manager::Identity& remote_identity,
+    mash::mojom::LaunchableRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  return shell::ServiceRunner(new WindowTypeLauncher)
+  return service_manager::ServiceRunner(new WindowTypeLauncher)
       .Run(service_request_handle);
 }
diff --git a/mash/example/window_type_launcher/window_type_launcher.h b/mash/example/window_type_launcher/window_type_launcher.h
index 53f13d1..f176bd2 100644
--- a/mash/example/window_type_launcher/window_type_launcher.h
+++ b/mash/example/window_type_launcher/window_type_launcher.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace views {
 class AuraInit;
@@ -19,9 +19,9 @@
 }
 
 class WindowTypeLauncher
-    : public shell::Service,
+    : public service_manager::Service,
       public mash::mojom::Launchable,
-      public shell::InterfaceFactory<mash::mojom::Launchable> {
+      public service_manager::InterfaceFactory<mash::mojom::Launchable> {
  public:
   WindowTypeLauncher();
   ~WindowTypeLauncher() override;
@@ -29,16 +29,16 @@
   void RemoveWindow(views::Widget* window);
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mash::mojom::Launchable:
   void Launch(uint32_t what, mash::mojom::LaunchMode how) override;
 
-  // shell::InterfaceFactory<mash::mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mash::mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mash::mojom::LaunchableRequest request) override;
 
   mojo::BindingSet<mash::mojom::Launchable> bindings_;
diff --git a/mash/init/BUILD.gn b/mash/init/BUILD.gn
index 1dd835a..c40fc19 100644
--- a/mash/init/BUILD.gn
+++ b/mash/init/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -21,7 +21,7 @@
     "//mash/init/public/interfaces",
     "//mash/login/public/interfaces",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
diff --git a/mash/init/init.cc b/mash/init/init.cc
index fceaf391..c1d5985 100644
--- a/mash/init/init.cc
+++ b/mash/init/init.cc
@@ -8,8 +8,8 @@
 #include "base/command_line.h"
 #include "base/guid.h"
 #include "mash/login/public/interfaces/login.mojom.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace mash {
 namespace init {
@@ -17,14 +17,14 @@
 Init::Init() {}
 Init::~Init() {}
 
-void Init::OnStart(const shell::Identity& identity) {
+void Init::OnStart(const service_manager::Identity& identity) {
   connector()->Connect("service:ui");
   StartTracing();
   StartLogin();
 }
 
-bool Init::OnConnect(const shell::Identity& remote_identity,
-                     shell::InterfaceRegistry* registry) {
+bool Init::OnConnect(const service_manager::Identity& remote_identity,
+                     service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Init>(this);
   return true;
 }
@@ -32,8 +32,9 @@
 void Init::StartService(const mojo::String& name,
                         const mojo::String& user_id) {
   if (user_services_.find(user_id) == user_services_.end()) {
-    shell::Connector::ConnectParams params(shell::Identity(name, user_id));
-    std::unique_ptr<shell::Connection> connection =
+    service_manager::Connector::ConnectParams params(
+        service_manager::Identity(name, user_id));
+    std::unique_ptr<service_manager::Connection> connection =
         connector()->Connect(&params);
     connection->SetConnectionLostClosure(
         base::Bind(&Init::UserServiceQuit, base::Unretained(this), user_id));
@@ -47,7 +48,7 @@
     user_services_.erase(it);
 }
 
-void Init::Create(const shell::Identity& remote_identity,
+void Init::Create(const service_manager::Identity& remote_identity,
                   mojom::InitRequest request) {
   init_bindings_.AddBinding(this, std::move(request));
 }
diff --git a/mash/init/init.h b/mash/init/init.h
index 7350a557..8395dd1 100644
--- a/mash/init/init.h
+++ b/mash/init/init.h
@@ -12,8 +12,8 @@
 #include "base/macros.h"
 #include "mash/init/public/interfaces/init.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace mojo {
 class Connection;
@@ -22,21 +22,21 @@
 namespace mash {
 namespace init {
 
-class Init : public shell::Service,
-             public shell::InterfaceFactory<mojom::Init>,
+class Init : public service_manager::Service,
+             public service_manager::InterfaceFactory<mojom::Init>,
              public mojom::Init {
  public:
   Init();
   ~Init() override;
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
-  // shell::InterfaceFactory<mojom::Login>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Login>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::InitRequest request) override;
 
   // mojom::Init:
@@ -49,9 +49,10 @@
   void StartTracing();
   void StartLogin();
 
-  std::unique_ptr<shell::Connection> login_connection_;
+  std::unique_ptr<service_manager::Connection> login_connection_;
   mojo::BindingSet<mojom::Init> init_bindings_;
-  std::map<std::string, std::unique_ptr<shell::Connection>> user_services_;
+  std::map<std::string, std::unique_ptr<service_manager::Connection>>
+      user_services_;
 
   DISALLOW_COPY_AND_ASSIGN(Init);
 };
diff --git a/mash/init/main.cc b/mash/init/main.cc
index c1b3107d..a47054c 100644
--- a/mash/init/main.cc
+++ b/mash/init/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/init/init.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::init::Init);
+  service_manager::ServiceRunner runner(new mash::init::Init);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/init/manifest.json b/mash/init/manifest.json
index 34688bfd..a76edbd 100644
--- a/mash/init/manifest.json
+++ b/mash/init/manifest.json
@@ -7,9 +7,9 @@
       "mash_init:init": [ "mash::init::mojom::Init" ]
     },
     "required": {
-      "*": { },
-      "service:login": { "classes": [ "login:login" ] },
-      "service:shell": { "classes": [ "shell:user_id", "shell:all_users" ] }
+      "*": [],
+      "service:login": [ "login:login" ],
+      "service:shell": [ "shell:user_id", "shell:all_users" ]
     }
   }
 }
diff --git a/mash/login/BUILD.gn b/mash/login/BUILD.gn
index 7467c54..f0e3cc0 100644
--- a/mash/login/BUILD.gn
+++ b/mash/login/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -21,7 +21,7 @@
     "//mash/init/public/interfaces",
     "//mash/login/public/interfaces",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
diff --git a/mash/login/login.cc b/mash/login/login.cc
index ea87801..1f773e7 100644
--- a/mash/login/login.cc
+++ b/mash/login/login.cc
@@ -15,8 +15,8 @@
 #include "mash/init/public/interfaces/init.mojom.h"
 #include "mash/login/public/interfaces/login.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "services/ui/public/interfaces/user_access_manager.mojom.h"
@@ -36,8 +36,8 @@
 class UI : public views::WidgetDelegateView,
            public views::ButtonListener {
  public:
-  static void Show(shell::Connector* connector,
-                   const shell::Identity& identity,
+  static void Show(service_manager::Connector* connector,
+                   const service_manager::Identity& identity,
                    Login* login) {
     UI* ui = new UI(login, connector);
     ui->StartWindowManager(identity);
@@ -60,7 +60,7 @@
   }
 
  private:
-  UI(Login* login, shell::Connector* connector)
+  UI(Login* login, service_manager::Connector* connector)
       : login_(login),
         connector_(connector),
         user_id_1_("00000000-0000-4000-8000-000000000000"),
@@ -109,7 +109,7 @@
   // Overridden from views::ButtonListener:
   void ButtonPressed(views::Button* sender, const ui::Event& event) override;
 
-  void StartWindowManager(const shell::Identity& identity) {
+  void StartWindowManager(const service_manager::Identity& identity) {
     mash_wm_connection_ = connector_->Connect("service:ash");
     mash_wm_connection_->SetConnectionLostClosure(
         base::Bind(&UI::StartWindowManager, base::Unretained(this), identity));
@@ -118,19 +118,19 @@
   }
 
   Login* login_;
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
   const std::string user_id_1_;
   const std::string user_id_2_;
   views::MdTextButton* login_button_1_;
   views::MdTextButton* login_button_2_;
-  std::unique_ptr<shell::Connection> mash_wm_connection_;
+  std::unique_ptr<service_manager::Connection> mash_wm_connection_;
   std::unique_ptr<views::WindowManagerConnection> window_manager_connection_;
 
   DISALLOW_COPY_AND_ASSIGN(UI);
 };
 
-class Login : public shell::Service,
-              public shell::InterfaceFactory<mojom::Login>,
+class Login : public service_manager::Service,
+              public service_manager::InterfaceFactory<mojom::Login>,
               public mojom::Login {
  public:
    Login() {}
@@ -144,8 +144,8 @@
   }
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override {
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override {
     identity_ = identity;
     tracing_.Initialize(connector(), identity.name());
 
@@ -155,14 +155,14 @@
     connector()->ConnectToInterface("service:ui", &user_access_manager_);
     user_access_manager_->SetActiveUser(identity.user_id());
   }
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
     registry->AddInterface<mojom::Login>(this);
     return true;
   }
 
-  // shell::InterfaceFactory<mojom::Login>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Login>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::LoginRequest request) override {
     bindings_.AddBinding(this, std::move(request));
   }
@@ -177,7 +177,7 @@
 
   void StartWindowManager();
 
-  shell::Identity identity_;
+  service_manager::Identity identity_;
   tracing::Provider tracing_;
   std::unique_ptr<views::AuraInit> aura_init_;
   mojo::BindingSet<mojom::Login> bindings_;
@@ -200,7 +200,7 @@
 
 }  // namespace
 
-shell::Service* CreateLogin() {
+service_manager::Service* CreateLogin() {
   return new Login;
 }
 
diff --git a/mash/login/login.h b/mash/login/login.h
index 5e0ff68e9..9fd5ca3 100644
--- a/mash/login/login.h
+++ b/mash/login/login.h
@@ -5,14 +5,14 @@
 #ifndef MASH_LOGIN_LOGIN_H_
 #define MASH_LOGIN_LOGIN_H_
 
-namespace shell {
+namespace service_manager {
 class Service;
 }
 
 namespace mash {
 namespace login {
 
-shell::Service* CreateLogin();
+service_manager::Service* CreateLogin();
 
 }  // namespace login
 }  // namespace mash
diff --git a/mash/login/main.cc b/mash/login/main.cc
index d439e030..e9fbf79 100644
--- a/mash/login/main.cc
+++ b/mash/login/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/login/login.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(mash::login::CreateLogin());
+  service_manager::ServiceRunner runner(mash::login::CreateLogin());
   return runner.Run(service_request_handle);
 }
diff --git a/mash/login/manifest.json b/mash/login/manifest.json
index 3b28e10..50a03f9 100644
--- a/mash/login/manifest.json
+++ b/mash/login/manifest.json
@@ -7,10 +7,10 @@
       "login:login": [ "mash::login::mojom::Login" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:mash_init": { "classes": [ "mash_init:init" ] },
-      "service:ui": { "classes": [ "ui:user_access_manager" ] },
-      "service:shell": { "classes": [ "shell:all_users" ] }
+      "*": [ "app" ],
+      "service:mash_init": [ "mash_init:init" ],
+      "service:ui": [ "ui:user_access_manager" ],
+      "service:shell": [ "shell:all_users" ]
     }
   }
 }
diff --git a/mash/package/BUILD.gn b/mash/package/BUILD.gn
index 38395d21..7df33c6 100644
--- a/mash/package/BUILD.gn
+++ b/mash/package/BUILD.gn
@@ -17,8 +17,8 @@
     "//mash/quick_launch:lib",
     "//mash/session:lib",
     "//mash/task_viewer:lib",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/ui:lib",
     "//services/ui/ime/test_ime_driver:lib",
   ]
diff --git a/mash/package/mash_packaged_service.cc b/mash/package/mash_packaged_service.cc
index bf843cc25..f6e1887 100644
--- a/mash/package/mash_packaged_service.cc
+++ b/mash/package/mash_packaged_service.cc
@@ -11,7 +11,7 @@
 #include "mash/quick_launch/quick_launch.h"
 #include "mash/session/session.h"
 #include "mash/task_viewer/task_viewer.h"
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_context.h"
 #include "services/ui/ime/test_ime_driver/test_ime_application.h"
 #include "services/ui/service.h"
 
@@ -25,27 +25,29 @@
 
 MashPackagedService::~MashPackagedService() {}
 
-bool MashPackagedService::OnConnect(const shell::Identity& remote_identity,
-                                    shell::InterfaceRegistry* registry) {
+bool MashPackagedService::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<ServiceFactory>(this);
   return true;
 }
 
 void MashPackagedService::Create(
-    const shell::Identity& remote_identity,
+    const service_manager::Identity& remote_identity,
     mojo::InterfaceRequest<ServiceFactory> request) {
   service_factory_bindings_.AddBinding(this, std::move(request));
 }
 
-void MashPackagedService::CreateService(shell::mojom::ServiceRequest request,
-                                        const std::string& mojo_name) {
+void MashPackagedService::CreateService(
+    service_manager::mojom::ServiceRequest request,
+    const std::string& mojo_name) {
   if (service_) {
     LOG(ERROR) << "request to create additional service " << mojo_name;
     return;
   }
   service_ = CreateService(mojo_name);
   if (service_) {
-    service_->set_context(base::MakeUnique<shell::ServiceContext>(
+    service_->set_context(base::MakeUnique<service_manager::ServiceContext>(
         service_.get(), std::move(request)));
     return;
   }
@@ -54,7 +56,7 @@
 }
 
 // Please see header file for details on adding new services.
-std::unique_ptr<shell::Service> MashPackagedService::CreateService(
+std::unique_ptr<service_manager::Service> MashPackagedService::CreateService(
     const std::string& name) {
   if (name == "service:ash")
     return base::WrapUnique(new ash::mus::WindowManagerApplication);
diff --git a/mash/package/mash_packaged_service.h b/mash/package/mash_packaged_service.h
index 627c1355..e4e7a66 100644
--- a/mash/package/mash_packaged_service.h
+++ b/mash/package/mash_packaged_service.h
@@ -8,9 +8,9 @@
 #include <memory>
 
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
 
 namespace mash {
 
@@ -28,31 +28,32 @@
 //   - Add the new service to mash_browser_tests's deps section and
 //     packaged_services section.
 //   - Add an entry for the new service in MashPackagedService::CreateService().
-class MashPackagedService
-    : public shell::Service,
-      public shell::mojom::ServiceFactory,
-      public shell::InterfaceFactory<shell::mojom::ServiceFactory> {
+class MashPackagedService : public service_manager::Service,
+                            public service_manager::mojom::ServiceFactory,
+                            public service_manager::InterfaceFactory<
+                                service_manager::mojom::ServiceFactory> {
  public:
   MashPackagedService();
   ~MashPackagedService() override;
 
-  // shell::Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
-  // shell::InterfaceFactory<ServiceFactory>
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<ServiceFactory>
+  void Create(const service_manager::Identity& remote_identity,
               mojo::InterfaceRequest<ServiceFactory> request) override;
 
   // ServiceFactory:
-  void CreateService(shell::mojom::ServiceRequest request,
+  void CreateService(service_manager::mojom::ServiceRequest request,
                      const std::string& mojo_name) override;
 
  private:
-  std::unique_ptr<shell::Service> CreateService(const std::string& name);
+  std::unique_ptr<service_manager::Service> CreateService(
+      const std::string& name);
 
   mojo::BindingSet<ServiceFactory> service_factory_bindings_;
-  std::unique_ptr<shell::Service> service_;
+  std::unique_ptr<service_manager::Service> service_;
 
   DISALLOW_COPY_AND_ASSIGN(MashPackagedService);
 };
diff --git a/mash/quick_launch/BUILD.gn b/mash/quick_launch/BUILD.gn
index a58eed1..9a1882ee 100644
--- a/mash/quick_launch/BUILD.gn
+++ b/mash/quick_launch/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -19,8 +19,8 @@
     "//mash/public/interfaces",
     "//mojo/public/cpp/bindings",
     "//services/catalog/public/interfaces",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//ui/views",
     "//ui/views/mus:for_mojo_application",
@@ -35,7 +35,7 @@
 
   deps = [
     ":lib",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/views/mus:for_mojo_application",
   ]
 
diff --git a/mash/quick_launch/main.cc b/mash/quick_launch/main.cc
index d686780..2b9b3703 100644
--- a/mash/quick_launch/main.cc
+++ b/mash/quick_launch/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/quick_launch/quick_launch.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::quick_launch::QuickLaunch);
+  service_manager::ServiceRunner runner(new mash::quick_launch::QuickLaunch);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/quick_launch/manifest.json b/mash/quick_launch/manifest.json
index c7a1849..f119cc1c 100644
--- a/mash/quick_launch/manifest.json
+++ b/mash/quick_launch/manifest.json
@@ -5,8 +5,8 @@
   "capabilities": {
     "provided": { "mash:launchable": [ "mash::mojom::Launchable" ] },
     "required": {
-      "*": { "classes": [ "app", "mash:launchable" ] },
-      "service:catalog": { "classes": [ "catalog:catalog" ] }
+      "*": [ "app", "mash:launchable" ],
+      "service:catalog": [ "catalog:catalog" ]
     }
   }
 }
diff --git a/mash/quick_launch/quick_launch.cc b/mash/quick_launch/quick_launch.cc
index 982149d..a0b9c25 100644
--- a/mash/quick_launch/quick_launch.cc
+++ b/mash/quick_launch/quick_launch.cc
@@ -11,10 +11,10 @@
 #include "base/strings/utf_string_conversions.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "services/catalog/public/interfaces/catalog.mojom.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "ui/views/background.h"
 #include "ui/views/controls/textfield/textfield.h"
@@ -35,10 +35,10 @@
                       public views::TextfieldController {
  public:
   QuickLaunchUI(QuickLaunch* quick_launch,
-                shell::Connector* connector,
+                service_manager::Connector* connector,
                 catalog::mojom::CatalogPtr catalog)
       : quick_launch_(quick_launch),
-    connector_(connector),
+        connector_(connector),
         prompt_(new views::Textfield),
         catalog_(std::move(catalog)) {
     set_background(views::Background::CreateStandardPanelBackground());
@@ -131,7 +131,8 @@
   }
 
   void Launch(const std::string& name, bool new_window) {
-    std::unique_ptr<shell::Connection> connection = connector_->Connect(name);
+    std::unique_ptr<service_manager::Connection> connection =
+        connector_->Connect(name);
     mojom::LaunchablePtr launchable;
     connection->GetInterface(&launchable);
     connections_.push_back(std::move(connection));
@@ -141,9 +142,9 @@
   }
 
   QuickLaunch* quick_launch_;
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
   views::Textfield* prompt_;
-  std::vector<std::unique_ptr<shell::Connection>> connections_;
+  std::vector<std::unique_ptr<service_manager::Connection>> connections_;
   catalog::mojom::CatalogPtr catalog_;
   std::set<base::string16> app_names_;
   bool suggestion_rejected_ = false;
@@ -162,7 +163,7 @@
     base::MessageLoop::current()->QuitWhenIdle();
 }
 
-void QuickLaunch::OnStart(const shell::Identity& identity) {
+void QuickLaunch::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 
   aura_init_.reset(
@@ -173,8 +174,8 @@
   Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW);
 }
 
-bool QuickLaunch::OnConnect(const shell::Identity& remote_identity,
-                            shell::InterfaceRegistry* registry) {
+bool QuickLaunch::OnConnect(const service_manager::Identity& remote_identity,
+                            service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Launchable>(this);
   return true;
 }
@@ -196,7 +197,7 @@
   windows_.push_back(window);
 }
 
-void QuickLaunch::Create(const shell::Identity& remote_identity,
+void QuickLaunch::Create(const service_manager::Identity& remote_identity,
                          mojom::LaunchableRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
diff --git a/mash/quick_launch/quick_launch.h b/mash/quick_launch/quick_launch.h
index dc6b495..9be6bd4 100644
--- a/mash/quick_launch/quick_launch.h
+++ b/mash/quick_launch/quick_launch.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace views {
@@ -22,9 +22,10 @@
 namespace mash {
 namespace quick_launch {
 
-class QuickLaunch : public shell::Service,
-                    public mojom::Launchable,
-                    public shell::InterfaceFactory<mojom::Launchable> {
+class QuickLaunch
+    : public service_manager::Service,
+      public mojom::Launchable,
+      public service_manager::InterfaceFactory<mojom::Launchable> {
  public:
   QuickLaunch();
   ~QuickLaunch() override;
@@ -32,16 +33,16 @@
   void RemoveWindow(views::Widget* window);
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Launchable:
   void Launch(uint32_t what, mojom::LaunchMode how) override;
 
-  // shell::InterfaceFactory<mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::LaunchableRequest request) override;
 
   mojo::BindingSet<mojom::Launchable> bindings_;
diff --git a/mash/screenlock/BUILD.gn b/mash/screenlock/BUILD.gn
index a82ba927..1a1af5a7 100644
--- a/mash/screenlock/BUILD.gn
+++ b/mash/screenlock/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -21,8 +21,8 @@
     "//mash/session/public/interfaces",
     "//mojo/common",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
     "//services/tracing/public/cpp",
     "//services/ui/public/cpp",
     "//ui/views",
diff --git a/mash/screenlock/main.cc b/mash/screenlock/main.cc
index 54a3354..2e5392a4 100644
--- a/mash/screenlock/main.cc
+++ b/mash/screenlock/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/screenlock/screenlock.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::screenlock::Screenlock);
+  service_manager::ServiceRunner runner(new mash::screenlock::Screenlock);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/screenlock/manifest.json b/mash/screenlock/manifest.json
index d1ba2659..8909eb4 100644
--- a/mash/screenlock/manifest.json
+++ b/mash/screenlock/manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Screen Lock",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/mash/screenlock/screenlock.cc b/mash/screenlock/screenlock.cc
index fd4a368..0e28342 100644
--- a/mash/screenlock/screenlock.cc
+++ b/mash/screenlock/screenlock.cc
@@ -9,7 +9,7 @@
 #include "base/strings/utf_string_conversions.h"
 #include "mash/session/public/interfaces/session.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "ui/views/background.h"
 #include "ui/views/controls/button/md_text_button.h"
@@ -25,7 +25,7 @@
 class ScreenlockView : public views::WidgetDelegateView,
                        public views::ButtonListener {
  public:
-  explicit ScreenlockView(shell::Connector* connector)
+  explicit ScreenlockView(service_manager::Connector* connector)
       : connector_(connector),
         unlock_button_(
             views::MdTextButton::Create(this, base::ASCIIToUTF16("Unlock"))) {
@@ -62,7 +62,7 @@
     session->UnlockScreen();
   }
 
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
   views::MdTextButton* unlock_button_;
 
   DISALLOW_COPY_AND_ASSIGN(ScreenlockView);
@@ -73,7 +73,7 @@
 Screenlock::Screenlock() {}
 Screenlock::~Screenlock() {}
 
-void Screenlock::OnStart(const shell::Identity& identity) {
+void Screenlock::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 
   mash::session::mojom::SessionPtr session;
diff --git a/mash/screenlock/screenlock.h b/mash/screenlock/screenlock.h
index a5340a4..1537c0c 100644
--- a/mash/screenlock/screenlock.h
+++ b/mash/screenlock/screenlock.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "mash/session/public/interfaces/session.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace views {
@@ -22,15 +22,15 @@
 namespace mash {
 namespace screenlock {
 
-class Screenlock : public shell::Service,
+class Screenlock : public service_manager::Service,
                    public session::mojom::ScreenlockStateListener {
  public:
   Screenlock();
   ~Screenlock() override;
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
 
   // session::mojom::ScreenlockStateListener:
   void ScreenlockStateChanged(bool locked) override;
diff --git a/mash/session/BUILD.gn b/mash/session/BUILD.gn
index f250359..b07c42e 100644
--- a/mash/session/BUILD.gn
+++ b/mash/session/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -20,8 +20,8 @@
     "//mash/session/public/interfaces",
     "//mojo/common",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
   ]
 
   data_deps = [
@@ -44,8 +44,8 @@
     "//mash/session/public/interfaces",
     "//mojo/common",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
   ]
 
   data_deps = [
diff --git a/mash/session/main.cc b/mash/session/main.cc
index 7a45791..b6c8fdb 100644
--- a/mash/session/main.cc
+++ b/mash/session/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/session/session.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::session::Session);
+  service_manager::ServiceRunner runner(new mash::session::Session);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/session/manifest.json b/mash/session/manifest.json
index 697591b..3c6cfdaf 100644
--- a/mash/session/manifest.json
+++ b/mash/session/manifest.json
@@ -6,6 +6,6 @@
     "provided": {
       "mash_session:session": [ "mash::session::mojom::Session" ]
     },
-    "required": { "*": { "classes": [ "app" ] } }
+    "required": { "*": [ "app" ] }
   }
 }
diff --git a/mash/session/session.cc b/mash/session/session.cc
index adf69c7..395a59a3 100644
--- a/mash/session/session.cc
+++ b/mash/session/session.cc
@@ -8,8 +8,8 @@
 #include "base/command_line.h"
 #include "base/message_loop/message_loop.h"
 #include "mash/login/public/interfaces/login.mojom.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace {
 
@@ -27,7 +27,7 @@
 Session::Session() : screen_locked_(false) {}
 Session::~Session() {}
 
-void Session::OnStart(const shell::Identity& identity) {
+void Session::OnStart(const service_manager::Identity& identity) {
   StartAppDriver();
   StartWindowManager();
   StartQuickLaunch();
@@ -35,8 +35,8 @@
   connector()->Connect("service:content_browser");
 }
 
-bool Session::OnConnect(const shell::Identity& remote_identity,
-                        shell::InterfaceRegistry* registry) {
+bool Session::OnConnect(const service_manager::Identity& remote_identity,
+                        service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Session>(this);
   return true;
 }
@@ -84,7 +84,7 @@
   StopScreenlock();
 }
 
-void Session::Create(const shell::Identity& remote_identity,
+void Session::Create(const service_manager::Identity& remote_identity,
                      mojom::SessionRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
@@ -127,7 +127,7 @@
     const base::Closure& restart_callback) {
   // TODO(beng): This would be the place to insert logic that counted restarts
   //             to avoid infinite crash-restart loops.
-  std::unique_ptr<shell::Connection> connection =
+  std::unique_ptr<service_manager::Connection> connection =
       connector()->Connect(url);
   // Note: |connection| may be null if we've lost our connection to the shell.
   if (connection) {
diff --git a/mash/session/session.h b/mash/session/session.h
index c644214..e653ef01 100644
--- a/mash/session/session.h
+++ b/mash/session/session.h
@@ -13,8 +13,8 @@
 #include "mash/session/public/interfaces/session.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace mojo {
 class Connection;
@@ -23,18 +23,18 @@
 namespace mash {
 namespace session {
 
-class Session : public shell::Service,
+class Session : public service_manager::Service,
                 public mojom::Session,
-                public shell::InterfaceFactory<mojom::Session> {
+                public service_manager::InterfaceFactory<mojom::Session> {
  public:
   Session();
   ~Session() override;
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Session:
   void Logout() override;
@@ -44,8 +44,8 @@
   void LockScreen() override;
   void UnlockScreen() override;
 
-  // shell::InterfaceFactory<mojom::Session>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Session>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::SessionRequest request) override;
 
   void StartWindowManager();
@@ -60,7 +60,8 @@
   void StartRestartableService(const std::string& url,
                                const base::Closure& restart_callback);
 
-  std::map<std::string, std::unique_ptr<shell::Connection>> connections_;
+  std::map<std::string, std::unique_ptr<service_manager::Connection>>
+      connections_;
   bool screen_locked_;
   mojo::BindingSet<mojom::Session> bindings_;
   mojo::InterfacePtrSet<mojom::ScreenlockStateListener> screenlock_listeners_;
diff --git a/mash/task_viewer/BUILD.gn b/mash/task_viewer/BUILD.gn
index e4192565..864bc73 100644
--- a/mash/task_viewer/BUILD.gn
+++ b/mash/task_viewer/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 
 source_set("lib") {
@@ -18,9 +18,9 @@
     "//mash/public/interfaces",
     "//mojo/public/cpp/bindings",
     "//services/catalog/public/interfaces",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//ui/resources",
     "//ui/views",
@@ -41,9 +41,9 @@
     ":lib",
     "//base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
     "//ui/views/mus:for_mojo_application",
   ]
 
diff --git a/mash/task_viewer/main.cc b/mash/task_viewer/main.cc
index 38991329..5ec9e95 100644
--- a/mash/task_viewer/main.cc
+++ b/mash/task_viewer/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/task_viewer/task_viewer.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::task_viewer::TaskViewer);
+  service_manager::ServiceRunner runner(new mash::task_viewer::TaskViewer);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/task_viewer/manifest.json b/mash/task_viewer/manifest.json
index a743c82..4c33798 100644
--- a/mash/task_viewer/manifest.json
+++ b/mash/task_viewer/manifest.json
@@ -5,9 +5,9 @@
   "capabilities": {
     "provided": { "mash:launchable": ["mash::mojom::Launchable"] },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:catalog": { "classes": [ "catalog:catalog" ] },
-      "service:shell": { "classes": [ "shell:service_manager" ] }
+      "*": [ "app" ],
+      "service:catalog": [ "catalog:catalog" ],
+      "service:shell": [ "shell:service_manager" ]
     }
   }
 }
diff --git a/mash/task_viewer/task_viewer.cc b/mash/task_viewer/task_viewer.cc
index b2fe33c..229fd91 100644
--- a/mash/task_viewer/task_viewer.cc
+++ b/mash/task_viewer/task_viewer.cc
@@ -16,9 +16,9 @@
 #include "base/strings/utf_string_conversions.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "services/catalog/public/interfaces/catalog.mojom.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
 #include "ui/base/models/table_model.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/resources/grit/ui_resources.h"
@@ -34,16 +34,18 @@
 namespace task_viewer {
 namespace {
 
-using shell::mojom::ServiceInfoPtr;
+using service_manager::mojom::ServiceInfoPtr;
 
-class TaskViewerContents : public views::WidgetDelegateView,
-                           public ui::TableModel,
-                           public views::ButtonListener,
-                           public shell::mojom::ServiceManagerListener {
+class TaskViewerContents
+    : public views::WidgetDelegateView,
+      public ui::TableModel,
+      public views::ButtonListener,
+      public service_manager::mojom::ServiceManagerListener {
  public:
-  TaskViewerContents(TaskViewer* task_viewer,
-                     shell::mojom::ServiceManagerListenerRequest request,
-                     catalog::mojom::CatalogPtr catalog)
+  TaskViewerContents(
+      TaskViewer* task_viewer,
+      service_manager::mojom::ServiceManagerListenerRequest request,
+      catalog::mojom::CatalogPtr catalog)
       : task_viewer_(task_viewer),
         binding_(this, std::move(request)),
         catalog_(std::move(catalog)),
@@ -74,9 +76,9 @@
 
  private:
   struct InstanceInfo {
-    InstanceInfo(const shell::Identity& identity, base::ProcessId pid)
+    InstanceInfo(const service_manager::Identity& identity, base::ProcessId pid)
         : identity(identity), pid(pid) {}
-    shell::Identity identity;
+    service_manager::Identity identity;
     uint32_t pid;
     std::string display_name;
   };
@@ -147,14 +149,14 @@
     process.Terminate(9, true);
   }
 
-  // Overridden from shell::mojom::ServiceManagerListener:
+  // Overridden from service_manager::mojom::ServiceManagerListener:
   void OnInit(std::vector<ServiceInfoPtr> instances) override {
     // This callback should only be called with an empty model.
     DCHECK(instances_.empty());
     std::vector<std::string> names;
     names.reserve(instances.size());
     for (size_t i = 0; i < instances.size(); ++i) {
-      const shell::Identity& identity = instances[i]->identity;
+      const service_manager::Identity& identity = instances[i]->identity;
       InsertInstance(identity, instances[i]->pid);
       names.push_back(identity.name());
     }
@@ -163,7 +165,7 @@
                                     weak_ptr_factory_.GetWeakPtr()));
   }
   void OnServiceCreated(ServiceInfoPtr instance) override {
-    shell::Identity identity = instance->identity;
+    service_manager::Identity identity = instance->identity;
     DCHECK(!ContainsIdentity(identity));
     InsertInstance(identity, instance->pid);
     observer_->OnItemsAdded(static_cast<int>(instances_.size()), 1);
@@ -173,7 +175,7 @@
                          base::Bind(&TaskViewerContents::OnGotCatalogEntries,
                                     weak_ptr_factory_.GetWeakPtr()));
   }
-  void OnServiceStarted(const shell::Identity& identity,
+  void OnServiceStarted(const service_manager::Identity& identity,
                         uint32_t pid) override {
     for (auto it = instances_.begin(); it != instances_.end(); ++it) {
       if ((*it)->identity == identity) {
@@ -184,7 +186,7 @@
       }
     }
   }
-  void OnServiceStopped(const shell::Identity& identity) override {
+  void OnServiceStopped(const service_manager::Identity& identity) override {
     for (auto it = instances_.begin(); it != instances_.end(); ++it) {
       if ((*it)->identity == identity) {
         observer_->OnItemsRemoved(
@@ -196,7 +198,7 @@
     NOTREACHED();
   }
 
-  bool ContainsIdentity(const shell::Identity& identity) const {
+  bool ContainsIdentity(const service_manager::Identity& identity) const {
     for (auto& it : instances_) {
       if (it->identity == identity)
         return true;
@@ -204,7 +206,7 @@
     return false;
   }
 
-  void InsertInstance(const shell::Identity& identity, uint32_t pid) {
+  void InsertInstance(const service_manager::Identity& identity, uint32_t pid) {
     instances_.push_back(base::MakeUnique<InstanceInfo>(identity, pid));
   }
 
@@ -254,7 +256,7 @@
   }
 
   TaskViewer* task_viewer_;
-  mojo::Binding<shell::mojom::ServiceManagerListener> binding_;
+  mojo::Binding<service_manager::mojom::ServiceManagerListener> binding_;
   catalog::mojom::CatalogPtr catalog_;
 
   views::TableView* table_view_;
@@ -282,7 +284,7 @@
     base::MessageLoop::current()->QuitWhenIdle();
 }
 
-void TaskViewer::OnStart(const shell::Identity& identity) {
+void TaskViewer::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 
   aura_init_.reset(
@@ -291,8 +293,8 @@
       views::WindowManagerConnection::Create(connector(), identity);
 }
 
-bool TaskViewer::OnConnect(const shell::Identity& remote_identity,
-                           shell::InterfaceRegistry* registry) {
+bool TaskViewer::OnConnect(const service_manager::Identity& remote_identity,
+                           service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Launchable>(this);
   return true;
 }
@@ -305,11 +307,12 @@
     return;
   }
 
-  shell::mojom::ServiceManagerPtr service_manager;
+  service_manager::mojom::ServiceManagerPtr service_manager;
   connector()->ConnectToInterface("service:shell", &service_manager);
 
-  shell::mojom::ServiceManagerListenerPtr listener;
-  shell::mojom::ServiceManagerListenerRequest request = GetProxy(&listener);
+  service_manager::mojom::ServiceManagerListenerPtr listener;
+  service_manager::mojom::ServiceManagerListenerRequest request =
+      GetProxy(&listener);
   service_manager->AddListener(std::move(listener));
 
   catalog::mojom::CatalogPtr catalog;
@@ -323,7 +326,7 @@
   windows_.push_back(window);
 }
 
-void TaskViewer::Create(const shell::Identity& remote_identity,
+void TaskViewer::Create(const service_manager::Identity& remote_identity,
                         mojom::LaunchableRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
diff --git a/mash/task_viewer/task_viewer.h b/mash/task_viewer/task_viewer.h
index 8e9866f7..21b440f 100644
--- a/mash/task_viewer/task_viewer.h
+++ b/mash/task_viewer/task_viewer.h
@@ -12,7 +12,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace views {
@@ -24,9 +24,9 @@
 namespace mash {
 namespace task_viewer {
 
-class TaskViewer : public shell::Service,
+class TaskViewer : public service_manager::Service,
                    public mojom::Launchable,
-                   public shell::InterfaceFactory<mojom::Launchable> {
+                   public service_manager::InterfaceFactory<mojom::Launchable> {
  public:
   TaskViewer();
   ~TaskViewer() override;
@@ -34,16 +34,16 @@
   void RemoveWindow(views::Widget* widget);
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Launchable:
   void Launch(uint32_t what, mojom::LaunchMode how) override;
 
-  // shell::InterfaceFactory<mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::LaunchableRequest request) override;
 
   mojo::BindingSet<mojom::Launchable> bindings_;
diff --git a/mash/unittests_manifest.json b/mash/unittests_manifest.json
index 316576d2..00014c8b 100644
--- a/mash/unittests_manifest.json
+++ b/mash/unittests_manifest.json
@@ -4,8 +4,8 @@
   "display_name": "Mash Unittests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app", "test" ] },
-      "service:ash": { "classes": [ "mus:window_manager" ] }
+      "*": [ "app", "test" ],
+      "service:ash": [ "mus:window_manager" ]
     }
   }
 }
diff --git a/mash/webtest/BUILD.gn b/mash/webtest/BUILD.gn
index f78065b..02aeb14 100644
--- a/mash/webtest/BUILD.gn
+++ b/mash/webtest/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//tools/grit/repack.gni")
 
@@ -20,8 +20,8 @@
     "//mash/public/interfaces",
     "//mojo/public/cpp/bindings",
     "//services/navigation/public/interfaces",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//services/ui/public/cpp",
     "//ui/gfx/geometry/mojo",
@@ -44,7 +44,7 @@
 
   deps = [
     ":lib",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/views/mus:for_mojo_application",
   ]
 
diff --git a/mash/webtest/main.cc b/mash/webtest/main.cc
index 0595195..470d238 100644
--- a/mash/webtest/main.cc
+++ b/mash/webtest/main.cc
@@ -3,10 +3,10 @@
 // found in the LICENSE file.
 
 #include "mash/webtest/webtest.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new mash::webtest::Webtest);
+  service_manager::ServiceRunner runner(new mash::webtest::Webtest);
   return runner.Run(service_request_handle);
 }
diff --git a/mash/webtest/manifest.json b/mash/webtest/manifest.json
index a58b810..0a799ff8 100644
--- a/mash/webtest/manifest.json
+++ b/mash/webtest/manifest.json
@@ -5,7 +5,7 @@
   "capabilities": {
     "provided": { "mash:launchable": [ "mash::mojom::Launchable" ] },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/mash/webtest/webtest.cc b/mash/webtest/webtest.cc
index b09fa8f..934e0312 100644
--- a/mash/webtest/webtest.cc
+++ b/mash/webtest/webtest.cc
@@ -13,10 +13,10 @@
 #include "base/timer/timer.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "services/navigation/public/interfaces/view.mojom.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/ui/public/cpp/window.h"
 #include "services/ui/public/cpp/window_tree_client.h"
@@ -156,7 +156,7 @@
     base::MessageLoop::current()->QuitWhenIdle();
 }
 
-void Webtest::OnStart(const shell::Identity& identity) {
+void Webtest::OnStart(const service_manager::Identity& identity) {
   tracing_.Initialize(connector(), identity.name());
 
   aura_init_.reset(
@@ -165,8 +165,8 @@
       views::WindowManagerConnection::Create(connector(), identity);
 }
 
-bool Webtest::OnConnect(const shell::Identity& remote_identity,
-                        shell::InterfaceRegistry* registry) {
+bool Webtest::OnConnect(const service_manager::Identity& remote_identity,
+                        service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Launchable>(this);
   return true;
 }
@@ -194,7 +194,7 @@
   AddWindow(window);
 }
 
-void Webtest::Create(const shell::Identity& remote_identity,
+void Webtest::Create(const service_manager::Identity& remote_identity,
                      mojom::LaunchableRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
diff --git a/mash/webtest/webtest.h b/mash/webtest/webtest.h
index afd8d8d..c1a40db4 100644
--- a/mash/webtest/webtest.h
+++ b/mash/webtest/webtest.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "mash/public/interfaces/launchable.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/public/cpp/provider.h"
 
 namespace views {
@@ -22,10 +22,9 @@
 namespace mash {
 namespace webtest {
 
-class Webtest
-    : public shell::Service,
-      public mojom::Launchable,
-      public shell::InterfaceFactory<mojom::Launchable> {
+class Webtest : public service_manager::Service,
+                public mojom::Launchable,
+                public service_manager::InterfaceFactory<mojom::Launchable> {
  public:
   Webtest();
   ~Webtest() override;
@@ -34,16 +33,16 @@
   void RemoveWindow(views::Widget* window);
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // mojom::Launchable:
   void Launch(uint32_t what, mojom::LaunchMode how) override;
 
-  // shell::InterfaceFactory<mojom::Launchable>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Launchable>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::LaunchableRequest request) override;
 
   mojo::BindingSet<mojom::Launchable> bindings_;
diff --git a/media/base/android/media_codec_util.cc b/media/base/android/media_codec_util.cc
index 46bca0a3..568131e 100644
--- a/media/base/android/media_codec_util.cc
+++ b/media/base/android/media_codec_util.cc
@@ -93,10 +93,12 @@
   // http://crbug.com/365494, http://crbug.com/615872
   // Blacklist Lenovo A6600 / A6800 on KitKat, which tends to crash a lot.
   // See crbug.com/628059 .  We include < K since they don't exist.
+  // GT-S5282 and GT-I8552 are for crbug.com/634920 .
   if (base::android::BuildInfo::GetInstance()->sdk_int() <= 19) {
     std::string model(base::android::BuildInfo::GetInstance()->model());
     return model != "GT-I9100" && model != "GT-I9300" && model != "GT-N7000" &&
-           model != "GT-N7100" && model != "A6600" && model != "A6800";
+           model != "GT-N7100" && model != "A6600" && model != "A6800" &&
+           model != "GT-S5282" && model != "GT-I8552";
   }
 
   return true;
diff --git a/media/base/decryptor.h b/media/base/decryptor.h
index 9c7f64d..58c92e6a 100644
--- a/media/base/decryptor.h
+++ b/media/base/decryptor.h
@@ -28,20 +28,16 @@
 // asynchronously.
 class MEDIA_EXPORT Decryptor {
  public:
-  // TODO(xhwang): Replace kError with kDecryptError and kDecodeError.
-  // TODO(xhwang): Replace kNeedMoreData with kNotEnoughData.
   enum Status {
     kSuccess,  // Decryption successfully completed. Decrypted buffer ready.
-    kNoKey,  // No key is available to decrypt.
+    kNoKey,    // No key is available to decrypt.
     kNeedMoreData,  // Decoder needs more data to produce a frame.
-    kError  // Key is available but an error occurred during decryption.
+    kError,         // Key is available but an error occurred during decryption.
+    kStatusMax = kError
   };
 
   // TODO(xhwang): Unify this with DemuxerStream::Type.
-  enum StreamType {
-    kAudio,
-    kVideo
-  };
+  enum StreamType { kAudio, kVideo, kStreamTypeMax = kVideo };
 
   Decryptor();
   virtual ~Decryptor();
diff --git a/media/base/demuxer_stream.h b/media/base/demuxer_stream.h
index c90de79..82d5d048 100644
--- a/media/base/demuxer_stream.h
+++ b/media/base/demuxer_stream.h
@@ -24,13 +24,14 @@
     AUDIO,
     VIDEO,
     TEXT,
-    NUM_TYPES,  // Always keep this entry as the last one!
+    TYPE_MAX = TEXT,
   };
 
   enum Liveness {
     LIVENESS_UNKNOWN,
     LIVENESS_RECORDED,
     LIVENESS_LIVE,
+    LIVENESS_MAX = LIVENESS_LIVE,
   };
 
   // Status returned in the Read() callback.
@@ -54,6 +55,7 @@
     kOk,
     kAborted,
     kConfigChanged,
+    kStatusMax = kConfigChanged,
   };
 
   // Request a buffer to returned via the provided callback.
diff --git a/media/base/ipc/media_param_traits_macros.h b/media/base/ipc/media_param_traits_macros.h
index 6b949bc..806d009 100644
--- a/media/base/ipc/media_param_traits_macros.h
+++ b/media/base/ipc/media_param_traits_macros.h
@@ -11,6 +11,8 @@
 #include "media/base/buffering_state.h"
 #include "media/base/channel_layout.h"
 #include "media/base/decode_status.h"
+#include "media/base/decryptor.h"
+#include "media/base/demuxer_stream.h"
 #include "media/base/sample_format.h"
 #include "media/base/subsample_entry.h"
 #include "media/base/video_capture_types.h"
@@ -35,6 +37,18 @@
 IPC_ENUM_TRAITS_MAX_VALUE(media::DecodeStatus,
                           media::DecodeStatus::DECODE_STATUS_MAX)
 
+IPC_ENUM_TRAITS_MAX_VALUE(media::Decryptor::Status,
+                          media::Decryptor::Status::kStatusMax)
+
+IPC_ENUM_TRAITS_MAX_VALUE(media::Decryptor::StreamType,
+                          media::Decryptor::StreamType::kStreamTypeMax)
+
+IPC_ENUM_TRAITS_MAX_VALUE(media::DemuxerStream::Status,
+                          media::DemuxerStream::kStatusMax)
+
+IPC_ENUM_TRAITS_MAX_VALUE(media::DemuxerStream::Type,
+                          media::DemuxerStream::TYPE_MAX)
+
 IPC_ENUM_TRAITS_MAX_VALUE(media::SampleFormat, media::kSampleFormatMax)
 
 IPC_ENUM_TRAITS_MAX_VALUE(media::VideoCodec, media::kVideoCodecMax)
diff --git a/media/base/stream_parser_buffer.cc b/media/base/stream_parser_buffer.cc
index e06b566c..469a4a8 100644
--- a/media/base/stream_parser_buffer.cc
+++ b/media/base/stream_parser_buffer.cc
@@ -135,9 +135,6 @@
       return "text";
     case DemuxerStream::UNKNOWN:
       return "unknown";
-    case DemuxerStream::NUM_TYPES:
-      // Fall-through to NOTREACHED().
-      break;
   }
   NOTREACHED();
   return "";
diff --git a/media/base/stream_parser_unittest.cc b/media/base/stream_parser_unittest.cc
index 21e3715d..5f9b16f 100644
--- a/media/base/stream_parser_unittest.cc
+++ b/media/base/stream_parser_unittest.cc
@@ -50,7 +50,7 @@
   DCHECK(decode_timestamps);
   DCHECK(queue);
   DCHECK_NE(type, DemuxerStream::UNKNOWN);
-  DCHECK_LT(type, DemuxerStream::NUM_TYPES);
+  DCHECK_LE(type, DemuxerStream::TYPE_MAX);
   for (int i = 0; decode_timestamps[i] != kEnd; ++i) {
     scoped_refptr<StreamParserBuffer> buffer =
         StreamParserBuffer::CopyFrom(kFakeData, sizeof(kFakeData),
diff --git a/media/blink/video_frame_compositor.cc b/media/blink/video_frame_compositor.cc
index 544f7098..96192f5 100644
--- a/media/blink/video_frame_compositor.cc
+++ b/media/blink/video_frame_compositor.cc
@@ -7,6 +7,7 @@
 #include "base/bind.h"
 #include "base/message_loop/message_loop.h"
 #include "base/time/default_tick_clock.h"
+#include "base/trace_event/auto_open_close_event.h"
 #include "base/trace_event/trace_event.h"
 #include "media/base/video_frame.h"
 
@@ -52,6 +53,18 @@
   DCHECK_NE(rendering_, new_state);
   rendering_ = new_state;
 
+  if (!auto_open_close_) {
+    auto_open_close_.reset(new base::trace_event::AutoOpenCloseEvent(
+        base::trace_event::AutoOpenCloseEvent::Type::ASYNC, "media,rail",
+        "VideoPlayback"));
+  }
+
+  if (rendering_) {
+    auto_open_close_->Begin();
+  } else {
+    auto_open_close_->End();
+  }
+
   if (rendering_) {
     // Always start playback in background rendering mode, if |client_| kicks
     // in right away it's okay.
@@ -105,9 +118,6 @@
 }
 
 void VideoFrameCompositor::Start(RenderCallback* callback) {
-  TRACE_EVENT_ASYNC_BEGIN0("media,rail", "VideoPlayback",
-                           static_cast<const void*>(this));
-
   // Called from the media thread, so acquire the callback under lock before
   // returning in case a Stop() call comes in before the PostTask is processed.
   base::AutoLock lock(callback_lock_);
@@ -119,9 +129,6 @@
 }
 
 void VideoFrameCompositor::Stop() {
-  TRACE_EVENT_ASYNC_END0("media,rail", "VideoPlayback",
-                         static_cast<const void*>(this));
-
   // Called from the media thread, so release the callback under lock before
   // returning to avoid a pending UpdateCurrentFrame() call occurring before
   // the PostTask is processed.
diff --git a/media/blink/video_frame_compositor.h b/media/blink/video_frame_compositor.h
index 9bb79fd..31857c9e 100644
--- a/media/blink/video_frame_compositor.h
+++ b/media/blink/video_frame_compositor.h
@@ -19,6 +19,12 @@
 #include "media/blink/media_blink_export.h"
 #include "ui/gfx/geometry/size.h"
 
+namespace base {
+namespace trace_event {
+class AutoOpenCloseEvent;
+}
+}
+
 namespace media {
 class VideoFrame;
 
@@ -160,6 +166,9 @@
   base::Lock callback_lock_;
   VideoRendererSink::RenderCallback* callback_;
 
+  // AutoOpenCloseEvent for begin/end events.
+  std::unique_ptr<base::trace_event::AutoOpenCloseEvent> auto_open_close_;
+
   DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor);
 };
 
diff --git a/media/capture/video/android/java/src/org/chromium/media/PhotoCapabilities.java b/media/capture/video/android/java/src/org/chromium/media/PhotoCapabilities.java
index 157c5cf..7539ee3 100644
--- a/media/capture/video/android/java/src/org/chromium/media/PhotoCapabilities.java
+++ b/media/capture/video/android/java/src/org/chromium/media/PhotoCapabilities.java
@@ -15,57 +15,70 @@
     public final int maxIso;
     public final int minIso;
     public final int currentIso;
+    public final int stepIso;
     public final int maxHeight;
     public final int minHeight;
     public final int currentHeight;
+    public final int stepHeight;
     public final int maxWidth;
     public final int minWidth;
     public final int currentWidth;
+    public final int stepWidth;
     public final int maxZoom;
     public final int minZoom;
     public final int currentZoom;
+    public final int stepZoom;
     public final int focusMode;
     public final int exposureMode;
     public final int maxExposureCompensation;
     public final int minExposureCompensation;
     public final int currentExposureCompensation;
+    public final int stepExposureCompensation;
     public final int whiteBalanceMode;
     public final int fillLightMode;
     public final boolean redEyeReduction;
     public final int maxColorTemperature;
     public final int minColorTemperature;
     public final int currentColorTemperature;
+    public final int stepColorTemperature;
 
-    PhotoCapabilities(int maxIso, int minIso, int currentIso, int maxHeight, int minHeight,
-            int currentHeight, int maxWidth, int minWidth, int currentWidth, int maxZoom,
-            int minZoom, int currentZoom, int focusMode, int exposureMode,
-            int maxExposureCompensation, int minExposureCompensation,
-            int currentExposureCompensation, int whiteBalanceMode, int fillLightMode,
+    PhotoCapabilities(int maxIso, int minIso, int currentIso, int stepIso, int maxHeight,
+            int minHeight, int currentHeight, int stepHeight, int maxWidth, int minWidth,
+            int currentWidth, int stepWidth, int maxZoom, int minZoom, int currentZoom,
+            int stepZoom, int focusMode, int exposureMode, int maxExposureCompensation,
+            int minExposureCompensation, int currentExposureCompensation,
+            int stepExposureCompensation, int whiteBalanceMode, int fillLightMode,
             boolean redEyeReduction, int maxColorTemperature, int minColorTemperature,
-            int currentColorTemperature) {
+            int currentColorTemperature, int stepColorTemperature) {
         this.maxIso = maxIso;
         this.minIso = minIso;
         this.currentIso = currentIso;
+        this.stepIso = stepIso;
         this.maxHeight = maxHeight;
         this.minHeight = minHeight;
         this.currentHeight = currentHeight;
+        this.stepHeight = stepHeight;
         this.maxWidth = maxWidth;
         this.minWidth = minWidth;
         this.currentWidth = currentWidth;
+        this.stepWidth = stepWidth;
         this.maxZoom = maxZoom;
         this.minZoom = minZoom;
         this.currentZoom = currentZoom;
+        this.stepZoom = stepZoom;
         this.focusMode = focusMode;
         this.exposureMode = exposureMode;
         this.maxExposureCompensation = maxExposureCompensation;
         this.minExposureCompensation = minExposureCompensation;
         this.currentExposureCompensation = currentExposureCompensation;
+        this.stepExposureCompensation = stepExposureCompensation;
         this.whiteBalanceMode = whiteBalanceMode;
         this.fillLightMode = fillLightMode;
         this.redEyeReduction = redEyeReduction;
         this.maxColorTemperature = maxColorTemperature;
         this.minColorTemperature = minColorTemperature;
         this.currentColorTemperature = currentColorTemperature;
+        this.stepColorTemperature = stepColorTemperature;
     }
 
     @CalledByNative
@@ -84,6 +97,11 @@
     }
 
     @CalledByNative
+    public int getStepIso() {
+        return stepIso;
+    }
+
+    @CalledByNative
     public int getMinHeight() {
         return minHeight;
     }
@@ -99,6 +117,11 @@
     }
 
     @CalledByNative
+    public int getStepHeight() {
+        return stepHeight;
+    }
+
+    @CalledByNative
     public int getMinWidth() {
         return minWidth;
     }
@@ -114,6 +137,11 @@
     }
 
     @CalledByNative
+    public int getStepWidth() {
+        return stepWidth;
+    }
+
+    @CalledByNative
     public int getMinZoom() {
         return minZoom;
     }
@@ -129,6 +157,11 @@
     }
 
     @CalledByNative
+    public int getStepZoom() {
+        return stepZoom;
+    }
+
+    @CalledByNative
     public int getFocusMode() {
         return focusMode;
     }
@@ -154,6 +187,11 @@
     }
 
     @CalledByNative
+    public int getStepExposureCompensation() {
+        return stepExposureCompensation;
+    }
+
+    @CalledByNative
     public int getWhiteBalanceMode() {
         return whiteBalanceMode;
     }
@@ -183,30 +221,41 @@
         return currentColorTemperature;
     }
 
+    @CalledByNative
+    public int getStepColorTemperature() {
+        return stepColorTemperature;
+    }
+
     public static class Builder {
         public int maxIso;
         public int minIso;
         public int currentIso;
+        public int stepIso;
         public int maxHeight;
         public int minHeight;
         public int currentHeight;
+        public int stepHeight;
         public int maxWidth;
         public int minWidth;
         public int currentWidth;
+        public int stepWidth;
         public int maxZoom;
         public int minZoom;
         public int currentZoom;
+        public int stepZoom;
         public int focusMode;
         public int exposureMode;
         public int maxExposureCompensation;
         public int minExposureCompensation;
         public int currentExposureCompensation;
+        public int stepExposureCompensation;
         public int whiteBalanceMode;
         public int fillLightMode;
         public boolean redEyeReduction;
         public int maxColorTemperature;
         public int minColorTemperature;
         public int currentColorTemperature;
+        public int stepColorTemperature;
 
         public Builder() {}
 
@@ -225,6 +274,11 @@
             return this;
         }
 
+        public Builder setStepIso(int stepIso) {
+            this.stepIso = stepIso;
+            return this;
+        }
+
         public Builder setMaxHeight(int maxHeight) {
             this.maxHeight = maxHeight;
             return this;
@@ -240,6 +294,11 @@
             return this;
         }
 
+        public Builder setStepHeight(int stepHeight) {
+            this.stepHeight = stepHeight;
+            return this;
+        }
+
         public Builder setMaxWidth(int maxWidth) {
             this.maxWidth = maxWidth;
             return this;
@@ -255,6 +314,11 @@
             return this;
         }
 
+        public Builder setStepWidth(int stepWidth) {
+            this.stepWidth = stepWidth;
+            return this;
+        }
+
         public Builder setMaxZoom(int maxZoom) {
             this.maxZoom = maxZoom;
             return this;
@@ -270,6 +334,11 @@
             return this;
         }
 
+        public Builder setStepZoom(int stepZoom) {
+            this.stepZoom = stepZoom;
+            return this;
+        }
+
         public Builder setFocusMode(int focusMode) {
             this.focusMode = focusMode;
             return this;
@@ -295,6 +364,11 @@
             return this;
         }
 
+        public Builder setStepExposureCompensation(int stepExposureCompensation) {
+            this.stepExposureCompensation = stepExposureCompensation;
+            return this;
+        }
+
         public Builder setWhiteBalanceMode(int whiteBalanceMode) {
             this.whiteBalanceMode = whiteBalanceMode;
             return this;
@@ -325,12 +399,19 @@
             return this;
         }
 
+        public Builder setStepColorTemperature(int stepColorTemperature) {
+            this.stepColorTemperature = stepColorTemperature;
+            return this;
+        }
+
         public PhotoCapabilities build() {
-            return new PhotoCapabilities(maxIso, minIso, currentIso, maxHeight, minHeight,
-                    currentHeight, maxWidth, minWidth, currentWidth, maxZoom, minZoom, currentZoom,
-                    focusMode, exposureMode, maxExposureCompensation, minExposureCompensation,
-                    currentExposureCompensation, whiteBalanceMode, fillLightMode, redEyeReduction,
-                    maxColorTemperature, minColorTemperature, currentColorTemperature);
+            return new PhotoCapabilities(maxIso, minIso, currentIso, stepIso, maxHeight, minHeight,
+                    currentHeight, stepHeight, maxWidth, minWidth, currentWidth, stepWidth, maxZoom,
+                    minZoom, currentZoom, stepZoom, focusMode, exposureMode,
+                    maxExposureCompensation, minExposureCompensation, currentExposureCompensation,
+                    stepExposureCompensation, whiteBalanceMode, fillLightMode, redEyeReduction,
+                    maxColorTemperature, minColorTemperature, currentColorTemperature,
+                    stepColorTemperature);
         }
     }
 }
diff --git a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
index 52aaeb86..ce5785e 100644
--- a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
+++ b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera.java
@@ -342,7 +342,7 @@
         // Before the Camera2 API there was no official way to retrieve the supported, if any, ISO
         // values from |parameters|; some platforms had "iso-values", others "iso-mode-values" etc.
         // Ignore them.
-        builder.setMinIso(0).setMaxIso(0).setCurrentIso(0);
+        builder.setMinIso(0).setMaxIso(0).setCurrentIso(0).setStepIso(0);
 
         List<android.hardware.Camera.Size> supportedSizes = parameters.getSupportedPictureSizes();
         int minWidth = Integer.MAX_VALUE;
@@ -355,22 +355,26 @@
             if (size.width > maxWidth) maxWidth = size.width;
             if (size.height > maxHeight) maxHeight = size.height;
         }
-        builder.setMinHeight(minHeight).setMaxHeight(maxHeight);
-        builder.setMinWidth(minWidth).setMaxWidth(maxWidth);
+        builder.setMinHeight(minHeight).setMaxHeight(maxHeight).setStepHeight(1);
+        builder.setMinWidth(minWidth).setMaxWidth(maxWidth).setStepWidth(1);
         final android.hardware.Camera.Size currentSize = parameters.getPreviewSize();
-        builder.setCurrentHeight(currentSize.height);
-        builder.setCurrentWidth(currentSize.width);
+        builder.setCurrentHeight(currentSize.height).setCurrentWidth(currentSize.width);
 
         int maxZoom = 0;
         int currentZoom = 0;
         int minZoom = 0;
+        int stepZoom = 0;
         if (parameters.isZoomSupported()) {
             // The Max zoom is returned as x100 by the API to avoid using floating point.
             maxZoom = parameters.getZoomRatios().get(parameters.getMaxZoom());
             currentZoom = 100 + 100 * parameters.getZoom();
             minZoom = parameters.getZoomRatios().get(0);
+            if (parameters.getZoomRatios().size() > 1) {
+                stepZoom = parameters.getZoomRatios().get(1) - parameters.getZoomRatios().get(0);
+            }
         }
-        builder.setMinZoom(minZoom).setMaxZoom(maxZoom).setCurrentZoom(currentZoom);
+        builder.setMinZoom(minZoom).setMaxZoom(maxZoom);
+        builder.setCurrentZoom(currentZoom).setStepZoom(stepZoom);
 
         Log.d(TAG, "parameters.getFocusMode(): %s", parameters.getFocusMode());
         final String focusMode = parameters.getFocusMode();
@@ -409,6 +413,7 @@
                 Math.round(parameters.getMaxExposureCompensation() * step * 100));
         builder.setCurrentExposureCompensation(
                 Math.round(parameters.getExposureCompensation() * step * 100));
+        builder.setStepExposureCompensation(Math.round(step * 100));
 
         int jniWhiteBalanceMode = AndroidMeteringMode.NONE;
         if (parameters.isAutoWhiteBalanceLockSupported()
diff --git a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java
index 81a02d0..beb4bd1 100644
--- a/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java
+++ b/media/capture/video/android/java/src/org/chromium/media/VideoCaptureCamera2.java
@@ -688,7 +688,7 @@
             minIso = iso_range.getLower();
             maxIso = iso_range.getUpper();
         }
-        builder.setMinIso(minIso).setMaxIso(maxIso);
+        builder.setMinIso(minIso).setMaxIso(maxIso).setStepIso(1);
         builder.setCurrentIso(mPreviewRequest.get(CaptureRequest.SENSOR_SENSITIVITY));
 
         final StreamConfigurationMap streamMap =
@@ -704,8 +704,8 @@
             if (size.getWidth() > maxWidth) maxWidth = size.getWidth();
             if (size.getHeight() > maxHeight) maxHeight = size.getHeight();
         }
-        builder.setMinHeight(minHeight).setMaxHeight(maxHeight);
-        builder.setMinWidth(minWidth).setMaxWidth(maxWidth);
+        builder.setMinHeight(minHeight).setMaxHeight(maxHeight).setStepHeight(1);
+        builder.setMinWidth(minWidth).setMaxWidth(maxWidth).setStepWidth(1);
         builder.setCurrentHeight((mPhotoHeight > 0) ? mPhotoHeight : mCaptureFormat.getHeight());
         builder.setCurrentWidth((mPhotoWidth > 0) ? mPhotoWidth : mCaptureFormat.getWidth());
 
@@ -718,7 +718,8 @@
                 * cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE)
                           .width()
                 / mPreviewRequest.get(CaptureRequest.SCALER_CROP_REGION).width();
-        builder.setMinZoom(minZoom).setMaxZoom(maxZoom).setCurrentZoom(currentZoom);
+        builder.setMinZoom(minZoom).setMaxZoom(maxZoom);
+        builder.setCurrentZoom(currentZoom).setStepZoom(100);
 
         final int focusMode = mPreviewRequest.get(CaptureRequest.CONTROL_AF_MODE);
         // Classify the Focus capabilities. In CONTINUOUS and SINGLE_SHOT, we can call
@@ -758,6 +759,7 @@
                 Math.round(exposureCompensationRange.getUpper() * step * 100));
         builder.setCurrentExposureCompensation(Math.round(
                 mPreviewRequest.get(CaptureRequest.CONTROL_AE_EXPOSURE_COMPENSATION) * step * 100));
+        builder.setStepExposureCompensation(Math.round(step * 100));
 
         final int whiteBalanceMode = mPreviewRequest.get(CaptureRequest.CONTROL_AWB_MODE);
         if (whiteBalanceMode == CameraMetadata.CONTROL_AWB_MODE_OFF) {
@@ -774,6 +776,7 @@
         if (index >= 0) {
             builder.setCurrentColorTemperature(COLOR_TEMPERATURES_MAP.keyAt(index));
         }
+        builder.setStepColorTemperature(1);
 
         if (!cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE)) {
             builder.setFillLightMode(AndroidFillLightMode.NONE);
diff --git a/media/capture/video/android/photo_capabilities.cc b/media/capture/video/android/photo_capabilities.cc
index 0f5dc1e..29a3f19 100644
--- a/media/capture/video/android/photo_capabilities.cc
+++ b/media/capture/video/android/photo_capabilities.cc
@@ -34,6 +34,11 @@
   return Java_PhotoCapabilities_getCurrentIso(AttachCurrentThread(), object_);
 }
 
+int PhotoCapabilities::getStepIso() const {
+  DCHECK(!object_.is_null());
+  return Java_PhotoCapabilities_getStepIso(AttachCurrentThread(), object_);
+}
+
 int PhotoCapabilities::getMinHeight() const {
   DCHECK(!object_.is_null());
   return Java_PhotoCapabilities_getMinHeight(AttachCurrentThread(), object_);
@@ -50,6 +55,11 @@
                                                  object_);
 }
 
+int PhotoCapabilities::getStepHeight() const {
+  DCHECK(!object_.is_null());
+  return Java_PhotoCapabilities_getStepHeight(AttachCurrentThread(), object_);
+}
+
 int PhotoCapabilities::getMinWidth() const {
   DCHECK(!object_.is_null());
   return Java_PhotoCapabilities_getMinWidth(AttachCurrentThread(), object_);
@@ -65,6 +75,11 @@
   return Java_PhotoCapabilities_getCurrentWidth(AttachCurrentThread(), object_);
 }
 
+int PhotoCapabilities::getStepWidth() const {
+  DCHECK(!object_.is_null());
+  return Java_PhotoCapabilities_getStepWidth(AttachCurrentThread(), object_);
+}
+
 int PhotoCapabilities::getMinZoom() const {
   DCHECK(!object_.is_null());
   return Java_PhotoCapabilities_getMinZoom(AttachCurrentThread(), object_);
@@ -80,6 +95,11 @@
   return Java_PhotoCapabilities_getCurrentZoom(AttachCurrentThread(), object_);
 }
 
+int PhotoCapabilities::getStepZoom() const {
+  DCHECK(!object_.is_null());
+  return Java_PhotoCapabilities_getStepZoom(AttachCurrentThread(), object_);
+}
+
 PhotoCapabilities::AndroidMeteringMode PhotoCapabilities::getFocusMode() const {
   DCHECK(!object_.is_null());
   return static_cast<AndroidMeteringMode>(
@@ -111,6 +131,12 @@
       AttachCurrentThread(), object_);
 }
 
+int PhotoCapabilities::getStepExposureCompensation() const {
+  DCHECK(!object_.is_null());
+  return Java_PhotoCapabilities_getStepExposureCompensation(
+      AttachCurrentThread(), object_);
+}
+
 PhotoCapabilities::AndroidMeteringMode PhotoCapabilities::getWhiteBalanceMode()
     const {
   DCHECK(!object_.is_null());
@@ -150,4 +176,10 @@
       AttachCurrentThread(), object_);
 }
 
+int PhotoCapabilities::getStepColorTemperature() const {
+  DCHECK(!object_.is_null());
+  return Java_PhotoCapabilities_getStepColorTemperature(AttachCurrentThread(),
+                                                        object_);
+}
+
 }  // namespace media
diff --git a/media/capture/video/android/photo_capabilities.h b/media/capture/video/android/photo_capabilities.h
index a39887bf..53861fa 100644
--- a/media/capture/video/android/photo_capabilities.h
+++ b/media/capture/video/android/photo_capabilities.h
@@ -45,26 +45,32 @@
   int getMinIso() const;
   int getMaxIso() const;
   int getCurrentIso() const;
+  int getStepIso() const;
   int getMinHeight() const;
   int getMaxHeight() const;
   int getCurrentHeight() const;
+  int getStepHeight() const;
   int getMinWidth() const;
   int getMaxWidth() const;
   int getCurrentWidth() const;
+  int getStepWidth() const;
   int getMinZoom() const;
   int getMaxZoom() const;
   int getCurrentZoom() const;
+  int getStepZoom() const;
   AndroidMeteringMode getFocusMode() const;
   AndroidMeteringMode getExposureMode() const;
   int getMinExposureCompensation() const;
   int getMaxExposureCompensation() const;
   int getCurrentExposureCompensation() const;
+  int getStepExposureCompensation() const;
   AndroidMeteringMode getWhiteBalanceMode() const;
   AndroidFillLightMode getFillLightMode() const;
   bool getRedEyeReduction() const;
   int getMinColorTemperature() const;
   int getMaxColorTemperature() const;
   int getCurrentColorTemperature() const;
+  int getStepColorTemperature() const;
 
  private:
   const base::android::ScopedJavaLocalRef<jobject> object_;
diff --git a/media/capture/video/android/video_capture_device_android.cc b/media/capture/video/android/video_capture_device_android.cc
index 9769b15..d8ff2b7 100644
--- a/media/capture/video/android/video_capture_device_android.cc
+++ b/media/capture/video/android/video_capture_device_android.cc
@@ -508,18 +508,22 @@
   photo_capabilities->iso->current = caps.getCurrentIso();
   photo_capabilities->iso->max = caps.getMaxIso();
   photo_capabilities->iso->min = caps.getMinIso();
+  photo_capabilities->iso->step = caps.getStepIso();
   photo_capabilities->height = mojom::Range::New();
   photo_capabilities->height->current = caps.getCurrentHeight();
   photo_capabilities->height->max = caps.getMaxHeight();
   photo_capabilities->height->min = caps.getMinHeight();
+  photo_capabilities->height->step = caps.getStepHeight();
   photo_capabilities->width = mojom::Range::New();
   photo_capabilities->width->current = caps.getCurrentWidth();
   photo_capabilities->width->max = caps.getMaxWidth();
   photo_capabilities->width->min = caps.getMinWidth();
+  photo_capabilities->width->step = caps.getStepWidth();
   photo_capabilities->zoom = mojom::Range::New();
   photo_capabilities->zoom->current = caps.getCurrentZoom();
   photo_capabilities->zoom->max = caps.getMaxZoom();
   photo_capabilities->zoom->min = caps.getMinZoom();
+  photo_capabilities->zoom->step = caps.getStepZoom();
   photo_capabilities->focus_mode = ToMojomMeteringMode(caps.getFocusMode());
   photo_capabilities->exposure_mode =
       ToMojomMeteringMode(caps.getExposureMode());
@@ -530,6 +534,8 @@
       caps.getMaxExposureCompensation();
   photo_capabilities->exposure_compensation->min =
       caps.getMinExposureCompensation();
+  photo_capabilities->exposure_compensation->step =
+      caps.getStepExposureCompensation();
   photo_capabilities->white_balance_mode =
       ToMojomMeteringMode(caps.getWhiteBalanceMode());
   photo_capabilities->fill_light_mode =
@@ -540,6 +546,7 @@
       caps.getCurrentColorTemperature();
   photo_capabilities->color_temperature->max = caps.getMaxColorTemperature();
   photo_capabilities->color_temperature->min = caps.getMinColorTemperature();
+  photo_capabilities->color_temperature->step = caps.getStepColorTemperature();
   photo_capabilities->brightness = media::mojom::Range::New();
   photo_capabilities->contrast = media::mojom::Range::New();
   photo_capabilities->saturation = media::mojom::Range::New();
diff --git a/media/capture/video/fake_video_capture_device.cc b/media/capture/video/fake_video_capture_device.cc
index 417cbd0..333bca7 100644
--- a/media/capture/video/fake_video_capture_device.cc
+++ b/media/capture/video/fake_video_capture_device.cc
@@ -31,6 +31,7 @@
 
 static const uint32_t kMinZoom = 100;
 static const uint32_t kMaxZoom = 400;
+static const uint32_t kZoomStep = 1;
 
 void DrawPacman(bool use_argb,
                 uint8_t* const data,
@@ -186,18 +187,22 @@
   photo_capabilities->iso->current = 100;
   photo_capabilities->iso->max = 100;
   photo_capabilities->iso->min = 100;
+  photo_capabilities->iso->step = 0;
   photo_capabilities->height = mojom::Range::New();
   photo_capabilities->height->current = capture_format_.frame_size.height();
   photo_capabilities->height->max = 1080;
   photo_capabilities->height->min = 240;
+  photo_capabilities->height->step = 1;
   photo_capabilities->width = mojom::Range::New();
   photo_capabilities->width->current = capture_format_.frame_size.width();
   photo_capabilities->width->max = 1920;
   photo_capabilities->width->min = 320;
+  photo_capabilities->width->step = 1;
   photo_capabilities->zoom = mojom::Range::New();
   photo_capabilities->zoom->current = current_zoom_;
   photo_capabilities->zoom->max = kMaxZoom;
   photo_capabilities->zoom->min = kMinZoom;
+  photo_capabilities->zoom->step = kZoomStep;
   photo_capabilities->focus_mode = mojom::MeteringMode::NONE;
   photo_capabilities->exposure_mode = mojom::MeteringMode::NONE;
   photo_capabilities->exposure_compensation = mojom::Range::New();
diff --git a/media/capture/video/fake_video_capture_device_unittest.cc b/media/capture/video/fake_video_capture_device_unittest.cc
index 04e7c79..c3e28762 100644
--- a/media/capture/video/fake_video_capture_device_unittest.cc
+++ b/media/capture/video/fake_video_capture_device_unittest.cc
@@ -321,16 +321,20 @@
   EXPECT_EQ(100, capabilities->iso->min);
   EXPECT_EQ(100, capabilities->iso->max);
   EXPECT_EQ(100, capabilities->iso->current);
+  EXPECT_EQ(0, capabilities->iso->step);
   EXPECT_EQ(capture_params.requested_format.frame_size.height(),
             capabilities->height->current);
   EXPECT_EQ(240, capabilities->height->min);
   EXPECT_EQ(1080, capabilities->height->max);
+  EXPECT_EQ(1, capabilities->height->step);
   EXPECT_EQ(capture_params.requested_format.frame_size.width(),
             capabilities->width->current);
   EXPECT_EQ(320, capabilities->width->min);
   EXPECT_EQ(1920, capabilities->width->max);
+  EXPECT_EQ(1, capabilities->width->step);
   EXPECT_EQ(100, capabilities->zoom->min);
   EXPECT_EQ(400, capabilities->zoom->max);
+  EXPECT_EQ(1, capabilities->zoom->step);
   EXPECT_GE(capabilities->zoom->current, capabilities->zoom->min);
   EXPECT_GE(capabilities->zoom->max, capabilities->zoom->current);
   EXPECT_EQ(mojom::MeteringMode::NONE, capabilities->focus_mode);
@@ -338,24 +342,30 @@
   EXPECT_EQ(0, capabilities->exposure_compensation->min);
   EXPECT_EQ(0, capabilities->exposure_compensation->max);
   EXPECT_EQ(0, capabilities->exposure_compensation->current);
+  EXPECT_EQ(0, capabilities->exposure_compensation->step);
   EXPECT_EQ(mojom::MeteringMode::NONE, capabilities->white_balance_mode);
   EXPECT_EQ(mojom::FillLightMode::NONE, capabilities->fill_light_mode);
   EXPECT_FALSE(capabilities->red_eye_reduction);
   EXPECT_EQ(0, capabilities->color_temperature->min);
   EXPECT_EQ(0, capabilities->color_temperature->max);
   EXPECT_EQ(0, capabilities->color_temperature->current);
+  EXPECT_EQ(0, capabilities->color_temperature->step);
   EXPECT_EQ(0, capabilities->brightness->min);
   EXPECT_EQ(0, capabilities->brightness->max);
   EXPECT_EQ(0, capabilities->brightness->current);
+  EXPECT_EQ(0, capabilities->brightness->step);
   EXPECT_EQ(0, capabilities->contrast->min);
   EXPECT_EQ(0, capabilities->contrast->max);
   EXPECT_EQ(0, capabilities->contrast->current);
+  EXPECT_EQ(0, capabilities->contrast->step);
   EXPECT_EQ(0, capabilities->saturation->min);
   EXPECT_EQ(0, capabilities->saturation->max);
   EXPECT_EQ(0, capabilities->saturation->current);
+  EXPECT_EQ(0, capabilities->saturation->step);
   EXPECT_EQ(0, capabilities->sharpness->min);
   EXPECT_EQ(0, capabilities->sharpness->max);
   EXPECT_EQ(0, capabilities->sharpness->current);
+  EXPECT_EQ(0, capabilities->sharpness->step);
 
   // Set options: zoom to the maximum value.
   const int max_zoom_value = capabilities->zoom->max;
diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc
index aecebcc..de0e35b7 100644
--- a/media/capture/video/linux/v4l2_capture_delegate.cc
+++ b/media/capture/video/linux/v4l2_capture_delegate.cc
@@ -110,6 +110,7 @@
     return mojom::Range::New();
   capability->max = range.maximum;
   capability->min = range.minimum;
+  capability->step = range.step;
 
   v4l2_control current = {};
   current.id = control_id;
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index a5b17e1..c5b904a 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -1191,7 +1191,6 @@
       break;
 
     case DemuxerStream::UNKNOWN:
-    case DemuxerStream::NUM_TYPES:
       NOTREACHED();
       return nullptr;
   }
diff --git a/media/filters/decoder_selector.cc b/media/filters/decoder_selector.cc
index 2ad94645..966a7b6 100644
--- a/media/filters/decoder_selector.cc
+++ b/media/filters/decoder_selector.cc
@@ -33,9 +33,8 @@
       return stream->audio_decoder_config().IsValidConfig();
     case DemuxerStream::VIDEO:
       return stream->video_decoder_config().IsValidConfig();
-    case DemuxerStream::UNKNOWN:
     case DemuxerStream::TEXT:
-    case DemuxerStream::NUM_TYPES:
+    case DemuxerStream::UNKNOWN:
       NOTREACHED();
   }
   return false;
@@ -47,9 +46,8 @@
       return stream->audio_decoder_config().is_encrypted();
     case DemuxerStream::VIDEO:
       return stream->video_decoder_config().is_encrypted();
-    case DemuxerStream::UNKNOWN:
     case DemuxerStream::TEXT:
-    case DemuxerStream::NUM_TYPES:
+    case DemuxerStream::UNKNOWN:
       NOTREACHED();
   }
   return false;
diff --git a/media/filters/frame_processor_unittest.cc b/media/filters/frame_processor_unittest.cc
index a3d42faa..2919a06 100644
--- a/media/filters/frame_processor_unittest.cc
+++ b/media/filters/frame_processor_unittest.cc
@@ -319,8 +319,7 @@
       }
       // TODO(wolenetz): Test text coded frame processing.
       case DemuxerStream::TEXT:
-      case DemuxerStream::UNKNOWN:
-      case DemuxerStream::NUM_TYPES: {
+      case DemuxerStream::UNKNOWN: {
         ASSERT_FALSE(true);
       }
     }
diff --git a/media/filters/source_buffer_state.cc b/media/filters/source_buffer_state.cc
index 254dfa7..6f588a87 100644
--- a/media/filters/source_buffer_state.cc
+++ b/media/filters/source_buffer_state.cc
@@ -488,7 +488,6 @@
       }
       break;
     case DemuxerStream::UNKNOWN:
-    case DemuxerStream::NUM_TYPES:
       NOTREACHED();
       break;
   }
diff --git a/media/gpu/ipc/service/BUILD.gn b/media/gpu/ipc/service/BUILD.gn
index 94c27a2f..1c3fef0 100644
--- a/media/gpu/ipc/service/BUILD.gn
+++ b/media/gpu/ipc/service/BUILD.gn
@@ -22,10 +22,10 @@
     "gpu_video_decode_accelerator.h",
     "gpu_video_encode_accelerator.cc",
     "gpu_video_encode_accelerator.h",
-    "media_channel.cc",
-    "media_channel.h",
-    "media_service.cc",
-    "media_service.h",
+    "media_gpu_channel.cc",
+    "media_gpu_channel.h",
+    "media_gpu_channel_manager.cc",
+    "media_gpu_channel_manager.h",
   ]
 
   include_dirs = [ "//third_party/mesa/src/include" ]
diff --git a/media/gpu/ipc/service/media_channel.cc b/media/gpu/ipc/service/media_gpu_channel.cc
similarity index 77%
rename from media/gpu/ipc/service/media_channel.cc
rename to media/gpu/ipc/service/media_gpu_channel.cc
index 28d5823..a1aa806 100644
--- a/media/gpu/ipc/service/media_channel.cc
+++ b/media/gpu/ipc/service/media_gpu_channel.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "media/gpu/ipc/service/media_channel.h"
+#include "media/gpu/ipc/service/media_gpu_channel.h"
 
 #include "base/unguessable_token.h"
 #include "gpu/ipc/service/gpu_channel.h"
@@ -32,9 +32,9 @@
 
 }  // namespace
 
-class MediaChannelDispatchHelper {
+class MediaGpuChannelDispatchHelper {
  public:
-  MediaChannelDispatchHelper(MediaChannel* channel, int32_t routing_id)
+  MediaGpuChannelDispatchHelper(MediaGpuChannel* channel, int32_t routing_id)
       : channel_(channel), routing_id_(routing_id) {}
 
   bool Send(IPC::Message* msg) { return channel_->Send(msg); }
@@ -52,15 +52,15 @@
   }
 
  private:
-  MediaChannel* const channel_;
+  MediaGpuChannel* const channel_;
   const int32_t routing_id_;
-  DISALLOW_COPY_AND_ASSIGN(MediaChannelDispatchHelper);
+  DISALLOW_COPY_AND_ASSIGN(MediaGpuChannelDispatchHelper);
 };
 
 // Filter to respond to GetChannelToken on the IO thread.
-class MediaChannelFilter : public IPC::MessageFilter {
+class MediaGpuChannelFilter : public IPC::MessageFilter {
  public:
-  explicit MediaChannelFilter(const base::UnguessableToken& channel_token)
+  explicit MediaGpuChannelFilter(const base::UnguessableToken& channel_token)
       : channel_token_(channel_token) {}
 
   void OnFilterAdded(IPC::Channel* channel) override { channel_ = channel; }
@@ -68,7 +68,7 @@
 
   bool OnMessageReceived(const IPC::Message& msg) override {
     bool handled = true;
-    IPC_BEGIN_MESSAGE_MAP(MediaChannelFilter, msg)
+    IPC_BEGIN_MESSAGE_MAP(MediaGpuChannelFilter, msg)
       IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetChannelToken,
                                       OnGetChannelToken)
       IPC_MESSAGE_UNHANDLED(handled = false)
@@ -83,32 +83,33 @@
   }
 
  private:
-  ~MediaChannelFilter() override {}
+  ~MediaGpuChannelFilter() override {}
 
   IPC::Channel* channel_;
   base::UnguessableToken channel_token_;
 };
 
-MediaChannel::MediaChannel(gpu::GpuChannel* channel) : channel_(channel) {
-  channel_->AddFilter(new MediaChannelFilter(base::UnguessableToken::Create()));
+MediaGpuChannel::MediaGpuChannel(gpu::GpuChannel* channel) : channel_(channel) {
+  channel_->AddFilter(
+      new MediaGpuChannelFilter(base::UnguessableToken::Create()));
 }
 
-MediaChannel::~MediaChannel() {}
+MediaGpuChannel::~MediaGpuChannel() {}
 
-bool MediaChannel::Send(IPC::Message* msg) {
+bool MediaGpuChannel::Send(IPC::Message* msg) {
   return channel_->Send(msg);
 }
 
-bool MediaChannel::OnMessageReceived(const IPC::Message& message) {
-  MediaChannelDispatchHelper helper(this, message.routing_id());
+bool MediaGpuChannel::OnMessageReceived(const IPC::Message& message) {
+  MediaGpuChannelDispatchHelper helper(this, message.routing_id());
   bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(MediaChannel, message)
+  IPC_BEGIN_MESSAGE_MAP(MediaGpuChannel, message)
     IPC_MESSAGE_FORWARD_DELAY_REPLY(
         GpuCommandBufferMsg_CreateVideoDecoder, &helper,
-        MediaChannelDispatchHelper::OnCreateVideoDecoder)
+        MediaGpuChannelDispatchHelper::OnCreateVideoDecoder)
     IPC_MESSAGE_FORWARD_DELAY_REPLY(
         GpuCommandBufferMsg_CreateVideoEncoder, &helper,
-        MediaChannelDispatchHelper::OnCreateVideoEncoder)
+        MediaGpuChannelDispatchHelper::OnCreateVideoEncoder)
     IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateJpegDecoder,
                                     OnCreateJpegDecoder)
     IPC_MESSAGE_UNHANDLED(handled = false)
@@ -116,8 +117,8 @@
   return handled;
 }
 
-void MediaChannel::OnCreateJpegDecoder(int32_t route_id,
-                                       IPC::Message* reply_msg) {
+void MediaGpuChannel::OnCreateJpegDecoder(int32_t route_id,
+                                          IPC::Message* reply_msg) {
   std::unique_ptr<IPC::Message> msg(reply_msg);
   if (!jpeg_decoder_) {
     jpeg_decoder_.reset(
@@ -129,12 +130,12 @@
                            make_scoped_refptr(channel_->filter())));
 }
 
-void MediaChannel::OnCreateVideoDecoder(
+void MediaGpuChannel::OnCreateVideoDecoder(
     int32_t command_buffer_route_id,
     const VideoDecodeAccelerator::Config& config,
     int32_t decoder_route_id,
     IPC::Message* reply_message) {
-  TRACE_EVENT0("gpu", "MediaChannel::OnCreateVideoDecoder");
+  TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoDecoder");
   gpu::GpuCommandBufferStub* stub =
       channel_->LookupCommandBuffer(command_buffer_route_id);
   if (!stub) {
@@ -153,10 +154,11 @@
   // self-delete during destruction of this stub.
 }
 
-void MediaChannel::OnCreateVideoEncoder(int32_t command_buffer_route_id,
-                                        const CreateVideoEncoderParams& params,
-                                        IPC::Message* reply_message) {
-  TRACE_EVENT0("gpu", "MediaChannel::OnCreateVideoEncoder");
+void MediaGpuChannel::OnCreateVideoEncoder(
+    int32_t command_buffer_route_id,
+    const CreateVideoEncoderParams& params,
+    IPC::Message* reply_message) {
+  TRACE_EVENT0("gpu", "MediaGpuChannel::OnCreateVideoEncoder");
   gpu::GpuCommandBufferStub* stub =
       channel_->LookupCommandBuffer(command_buffer_route_id);
   if (!stub) {
diff --git a/media/gpu/ipc/service/media_channel.h b/media/gpu/ipc/service/media_gpu_channel.h
similarity index 75%
rename from media/gpu/ipc/service/media_channel.h
rename to media/gpu/ipc/service/media_gpu_channel.h
index 6e7c74c..5108d60e 100644
--- a/media/gpu/ipc/service/media_channel.h
+++ b/media/gpu/ipc/service/media_gpu_channel.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MEDIA_GPU_IPC_SERVICE_MEDIA_CHANNEL_H_
-#define MEDIA_GPU_IPC_SERVICE_MEDIA_CHANNEL_H_
+#ifndef MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_H_
+#define MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_H_
 
 #include <memory>
 
@@ -23,18 +23,18 @@
 
 namespace media {
 
-class MediaChannelDispatchHelper;
+class MediaGpuChannelDispatchHelper;
 
-class MediaChannel : public IPC::Listener, public IPC::Sender {
+class MediaGpuChannel : public IPC::Listener, public IPC::Sender {
  public:
-  explicit MediaChannel(gpu::GpuChannel* channel);
-  ~MediaChannel() override;
+  explicit MediaGpuChannel(gpu::GpuChannel* channel);
+  ~MediaGpuChannel() override;
 
   // IPC::Sender implementation:
   bool Send(IPC::Message* msg) override;
 
  private:
-  friend class MediaChannelDispatchHelper;
+  friend class MediaGpuChannelDispatchHelper;
 
   // IPC::Listener implementation:
   bool OnMessageReceived(const IPC::Message& message) override;
@@ -51,9 +51,9 @@
 
   gpu::GpuChannel* const channel_;
   std::unique_ptr<GpuJpegDecodeAccelerator> jpeg_decoder_;
-  DISALLOW_COPY_AND_ASSIGN(MediaChannel);
+  DISALLOW_COPY_AND_ASSIGN(MediaGpuChannel);
 };
 
 }  // namespace media
 
-#endif  // MEDIA_GPU_IPC_SERVICE_MEDIA_CHANNEL_H_
+#endif  // MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_H_
diff --git a/media/gpu/ipc/service/media_gpu_channel_manager.cc b/media/gpu/ipc/service/media_gpu_channel_manager.cc
new file mode 100644
index 0000000..568723a
--- /dev/null
+++ b/media/gpu/ipc/service/media_gpu_channel_manager.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/gpu/ipc/service/media_gpu_channel_manager.h"
+
+#include <memory>
+#include <utility>
+
+#include "gpu/ipc/service/gpu_channel.h"
+#include "gpu/ipc/service/gpu_channel_manager.h"
+#include "ipc/ipc_message_macros.h"
+#include "ipc/param_traits_macros.h"
+#include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
+#include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
+#include "media/gpu/ipc/service/media_gpu_channel.h"
+
+namespace media {
+
+MediaGpuChannelManager::MediaGpuChannelManager(
+    gpu::GpuChannelManager* channel_manager)
+    : channel_manager_(channel_manager) {}
+
+MediaGpuChannelManager::~MediaGpuChannelManager() {}
+
+void MediaGpuChannelManager::AddChannel(int32_t client_id) {
+  gpu::GpuChannel* gpu_channel = channel_manager_->LookupChannel(client_id);
+  DCHECK(gpu_channel);
+  std::unique_ptr<MediaGpuChannel> media_gpu_channel(
+      new MediaGpuChannel(gpu_channel));
+  gpu_channel->SetUnhandledMessageListener(media_gpu_channel.get());
+  media_gpu_channels_.set(client_id, std::move(media_gpu_channel));
+}
+
+void MediaGpuChannelManager::RemoveChannel(int32_t client_id) {
+  media_gpu_channels_.erase(client_id);
+}
+
+void MediaGpuChannelManager::DestroyAllChannels() {
+  media_gpu_channels_.clear();
+}
+
+}  // namespace media
diff --git a/media/gpu/ipc/service/media_gpu_channel_manager.h b/media/gpu/ipc/service/media_gpu_channel_manager.h
new file mode 100644
index 0000000..718b8b8f
--- /dev/null
+++ b/media/gpu/ipc/service/media_gpu_channel_manager.h
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_
+#define MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/containers/scoped_ptr_hash_map.h"
+#include "base/macros.h"
+#include "ipc/ipc_listener.h"
+#include "ipc/ipc_sender.h"
+#include "media/video/video_decode_accelerator.h"
+
+namespace gpu {
+class GpuChannel;
+class GpuChannelManager;
+}
+
+namespace media {
+
+class MediaGpuChannel;
+
+class MediaGpuChannelManager {
+ public:
+  explicit MediaGpuChannelManager(gpu::GpuChannelManager* channel_manager);
+  ~MediaGpuChannelManager();
+
+  void AddChannel(int32_t client_id);
+  void RemoveChannel(int32_t client_id);
+  void DestroyAllChannels();
+
+ private:
+  gpu::GpuChannelManager* const channel_manager_;
+  base::ScopedPtrHashMap<int32_t, std::unique_ptr<MediaGpuChannel>>
+      media_gpu_channels_;
+  DISALLOW_COPY_AND_ASSIGN(MediaGpuChannelManager);
+};
+
+}  // namespace media
+
+#endif  // MEDIA_GPU_IPC_SERVICE_MEDIA_GPU_CHANNEL_MANAGER_H_
diff --git a/media/gpu/ipc/service/media_service.cc b/media/gpu/ipc/service/media_service.cc
deleted file mode 100644
index a5e6d219..0000000
--- a/media/gpu/ipc/service/media_service.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/gpu/ipc/service/media_service.h"
-
-#include <memory>
-#include <utility>
-
-#include "gpu/ipc/service/gpu_channel.h"
-#include "gpu/ipc/service/gpu_channel_manager.h"
-#include "ipc/ipc_message_macros.h"
-#include "ipc/param_traits_macros.h"
-#include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
-#include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
-#include "media/gpu/ipc/service/media_channel.h"
-
-namespace media {
-
-MediaService::MediaService(gpu::GpuChannelManager* channel_manager)
-    : channel_manager_(channel_manager) {}
-
-MediaService::~MediaService() {}
-
-void MediaService::AddChannel(int32_t client_id) {
-  gpu::GpuChannel* gpu_channel = channel_manager_->LookupChannel(client_id);
-  DCHECK(gpu_channel);
-  std::unique_ptr<MediaChannel> media_channel(new MediaChannel(gpu_channel));
-  gpu_channel->SetUnhandledMessageListener(media_channel.get());
-  media_channels_.set(client_id, std::move(media_channel));
-}
-
-void MediaService::RemoveChannel(int32_t client_id) {
-  media_channels_.erase(client_id);
-}
-
-void MediaService::DestroyAllChannels() {
-  media_channels_.clear();
-}
-
-}  // namespace media
diff --git a/media/gpu/ipc/service/media_service.h b/media/gpu/ipc/service/media_service.h
deleted file mode 100644
index 3ebc283..0000000
--- a/media/gpu/ipc/service/media_service.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_GPU_IPC_SERVICE_MEDIA_SERVICE_H_
-#define MEDIA_GPU_IPC_SERVICE_MEDIA_SERVICE_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/containers/scoped_ptr_hash_map.h"
-#include "base/macros.h"
-#include "ipc/ipc_listener.h"
-#include "ipc/ipc_sender.h"
-#include "media/video/video_decode_accelerator.h"
-
-namespace gpu {
-class GpuChannel;
-class GpuChannelManager;
-}
-
-namespace media {
-
-class MediaChannel;
-
-class MediaService {
- public:
-  MediaService(gpu::GpuChannelManager* channel_manager);
-  ~MediaService();
-
-  void AddChannel(int32_t client_id);
-  void RemoveChannel(int32_t client_id);
-  void DestroyAllChannels();
-
- private:
-  gpu::GpuChannelManager* const channel_manager_;
-  base::ScopedPtrHashMap<int32_t, std::unique_ptr<MediaChannel>>
-      media_channels_;
-  DISALLOW_COPY_AND_ASSIGN(MediaService);
-};
-
-}  // namespace media
-
-#endif  // MEDIA_GPU_IPC_SERVICE_MEDIA_SERVICE_H_
diff --git a/media/gpu/v4l2_jpeg_decode_accelerator.cc b/media/gpu/v4l2_jpeg_decode_accelerator.cc
index e38ad1d2..ab39a53 100644
--- a/media/gpu/v4l2_jpeg_decode_accelerator.cc
+++ b/media/gpu/v4l2_jpeg_decode_accelerator.cc
@@ -449,7 +449,6 @@
 
 void V4L2JpegDecodeAccelerator::DestroyInputBuffers() {
   DCHECK(decoder_task_runner_->BelongsToCurrentThread());
-  DCHECK(!input_streamon_);
 
   free_input_buffers_.clear();
 
@@ -479,7 +478,6 @@
 
 void V4L2JpegDecodeAccelerator::DestroyOutputBuffers() {
   DCHECK(decoder_task_runner_->BelongsToCurrentThread());
-  DCHECK(!output_streamon_);
 
   free_output_buffers_.clear();
 
diff --git a/media/mojo/DEPS b/media/mojo/DEPS
index bcc5f1c..08eab978 100644
--- a/media/mojo/DEPS
+++ b/media/mojo/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
-  "+services/shell",
+  "+services/service_manager",
   "+mojo/common",
   "+mojo/converters",
   "+mojo/logging",
diff --git a/media/mojo/clients/BUILD.gn b/media/mojo/clients/BUILD.gn
index 5d280ae..98d2bcd 100644
--- a/media/mojo/clients/BUILD.gn
+++ b/media/mojo/clients/BUILD.gn
@@ -46,12 +46,12 @@
     "//media/mojo/interfaces",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
   ]
 
   deps = [
     "//media/mojo/common",
     "//mojo/common",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 }
diff --git a/media/mojo/clients/mojo_cdm.cc b/media/mojo/clients/mojo_cdm.cc
index 3d1f227e..805cbcb 100644
--- a/media/mojo/clients/mojo_cdm.cc
+++ b/media/mojo/clients/mojo_cdm.cc
@@ -19,8 +19,8 @@
 #include "media/mojo/clients/mojo_decryptor.h"
 #include "media/mojo/common/media_type_converters.h"
 #include "media/mojo/interfaces/decryptor.mojom.h"
-#include "services/shell/public/cpp/connect.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/cpp/connect.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "url/gurl.h"
 
 namespace media {
diff --git a/media/mojo/clients/mojo_cdm_factory.cc b/media/mojo/clients/mojo_cdm_factory.cc
index e45ff09..3837b0f5 100644
--- a/media/mojo/clients/mojo_cdm_factory.cc
+++ b/media/mojo/clients/mojo_cdm_factory.cc
@@ -11,13 +11,13 @@
 #include "media/base/key_systems.h"
 #include "media/cdm/aes_decryptor.h"
 #include "media/mojo/clients/mojo_cdm.h"
-#include "services/shell/public/cpp/connect.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/cpp/connect.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
 namespace media {
 
 MojoCdmFactory::MojoCdmFactory(
-    shell::mojom::InterfaceProvider* interface_provider)
+    service_manager::mojom::InterfaceProvider* interface_provider)
     : interface_provider_(interface_provider) {
   DCHECK(interface_provider_);
 }
@@ -51,8 +51,8 @@
   }
 
   mojom::ContentDecryptionModulePtr cdm_ptr;
-  shell::GetInterface<mojom::ContentDecryptionModule>(interface_provider_,
-                                                      &cdm_ptr);
+  service_manager::GetInterface<mojom::ContentDecryptionModule>(
+      interface_provider_, &cdm_ptr);
 
   MojoCdm::Create(key_system, security_origin, cdm_config, std::move(cdm_ptr),
                   session_message_cb, session_closed_cb, session_keys_change_cb,
diff --git a/media/mojo/clients/mojo_cdm_factory.h b/media/mojo/clients/mojo_cdm_factory.h
index ebfc043..41561623 100644
--- a/media/mojo/clients/mojo_cdm_factory.h
+++ b/media/mojo/clients/mojo_cdm_factory.h
@@ -8,7 +8,7 @@
 #include "base/macros.h"
 #include "media/base/cdm_factory.h"
 
-namespace shell {
+namespace service_manager {
 namespace mojom {
 class InterfaceProvider;
 }
@@ -18,7 +18,8 @@
 
 class MojoCdmFactory : public CdmFactory {
  public:
-  explicit MojoCdmFactory(shell::mojom::InterfaceProvider* interface_provider);
+  explicit MojoCdmFactory(
+      service_manager::mojom::InterfaceProvider* interface_provider);
   ~MojoCdmFactory() final;
 
   // CdmFactory implementation.
@@ -32,7 +33,7 @@
               const CdmCreatedCB& cdm_created_cb) final;
 
  private:
-  shell::mojom::InterfaceProvider* interface_provider_;
+  service_manager::mojom::InterfaceProvider* interface_provider_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoCdmFactory);
 };
diff --git a/media/mojo/clients/mojo_decoder_factory.cc b/media/mojo/clients/mojo_decoder_factory.cc
index 21835f0a..baf3857 100644
--- a/media/mojo/clients/mojo_decoder_factory.cc
+++ b/media/mojo/clients/mojo_decoder_factory.cc
@@ -8,12 +8,12 @@
 #include "media/mojo/clients/mojo_audio_decoder.h"
 #include "media/mojo/clients/mojo_video_decoder.h"
 #include "media/mojo/interfaces/audio_decoder.mojom.h"
-#include "services/shell/public/cpp/connect.h"
+#include "services/service_manager/public/cpp/connect.h"
 
 namespace media {
 
 MojoDecoderFactory::MojoDecoderFactory(
-    shell::mojom::InterfaceProvider* interface_provider)
+    service_manager::mojom::InterfaceProvider* interface_provider)
     : interface_provider_(interface_provider) {
   DCHECK(interface_provider_);
 }
@@ -25,8 +25,8 @@
     ScopedVector<AudioDecoder>* audio_decoders) {
 #if defined(ENABLE_MOJO_AUDIO_DECODER)
   mojom::AudioDecoderPtr audio_decoder_ptr;
-  shell::GetInterface<mojom::AudioDecoder>(interface_provider_,
-                                           &audio_decoder_ptr);
+  service_manager::GetInterface<mojom::AudioDecoder>(interface_provider_,
+                                                     &audio_decoder_ptr);
 
   audio_decoders->push_back(
       new MojoAudioDecoder(task_runner, std::move(audio_decoder_ptr)));
@@ -39,8 +39,8 @@
     ScopedVector<VideoDecoder>* video_decoders) {
 #if defined(ENABLE_MOJO_VIDEO_DECODER)
   mojom::VideoDecoderPtr remote_decoder;
-  shell::GetInterface<mojom::VideoDecoder>(interface_provider_,
-                                           &remote_decoder);
+  service_manager::GetInterface<mojom::VideoDecoder>(interface_provider_,
+                                                     &remote_decoder);
   video_decoders->push_back(new MojoVideoDecoder(task_runner, gpu_factories,
                                                  std::move(remote_decoder)));
 #endif
diff --git a/media/mojo/clients/mojo_decoder_factory.h b/media/mojo/clients/mojo_decoder_factory.h
index 9483fcf..c808dbc4 100644
--- a/media/mojo/clients/mojo_decoder_factory.h
+++ b/media/mojo/clients/mojo_decoder_factory.h
@@ -7,14 +7,14 @@
 
 #include "base/macros.h"
 #include "media/base/decoder_factory.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
 namespace media {
 
 class MojoDecoderFactory : public DecoderFactory {
  public:
   explicit MojoDecoderFactory(
-      shell::mojom::InterfaceProvider* interface_provider);
+      service_manager::mojom::InterfaceProvider* interface_provider);
   ~MojoDecoderFactory() final;
 
   void CreateAudioDecoders(
@@ -27,7 +27,7 @@
       ScopedVector<VideoDecoder>* video_decoders) final;
 
  private:
-  shell::mojom::InterfaceProvider* interface_provider_;
+  service_manager::mojom::InterfaceProvider* interface_provider_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoDecoderFactory);
 };
diff --git a/media/mojo/clients/mojo_decryptor.cc b/media/mojo/clients/mojo_decryptor.cc
index f9a437c..74ce2d2 100644
--- a/media/mojo/clients/mojo_decryptor.cc
+++ b/media/mojo/clients/mojo_decryptor.cc
@@ -18,7 +18,7 @@
 #include "media/mojo/common/mojo_decoder_buffer_converter.h"
 #include "media/mojo/common/mojo_shared_buffer_video_frame.h"
 #include "media/mojo/interfaces/decryptor.mojom.h"
-#include "services/shell/public/cpp/connect.h"
+#include "services/service_manager/public/cpp/connect.h"
 
 namespace media {
 
@@ -75,8 +75,7 @@
   }
 
   remote_decryptor_->Decrypt(
-      static_cast<mojom::DemuxerStream::Type>(stream_type),
-      std::move(mojo_buffer),
+      stream_type, std::move(mojo_buffer),
       base::Bind(&MojoDecryptor::OnBufferDecrypted, weak_factory_.GetWeakPtr(),
                  decrypt_cb));
 }
@@ -85,8 +84,7 @@
   DVLOG(1) << __FUNCTION__;
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  remote_decryptor_->CancelDecrypt(
-      static_cast<mojom::DemuxerStream::Type>(stream_type));
+  remote_decryptor_->CancelDecrypt(stream_type);
 }
 
 void MojoDecryptor::InitializeAudioDecoder(const AudioDecoderConfig& config,
@@ -149,16 +147,14 @@
   DVLOG(1) << __FUNCTION__;
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  remote_decryptor_->ResetDecoder(
-      static_cast<mojom::DemuxerStream::Type>(stream_type));
+  remote_decryptor_->ResetDecoder(stream_type);
 }
 
 void MojoDecryptor::DeinitializeDecoder(StreamType stream_type) {
   DVLOG(1) << __FUNCTION__;
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  remote_decryptor_->DeinitializeDecoder(
-      static_cast<mojom::DemuxerStream::Type>(stream_type));
+  remote_decryptor_->DeinitializeDecoder(stream_type);
 }
 
 void MojoDecryptor::OnKeyAdded() {
@@ -173,11 +169,10 @@
 }
 
 void MojoDecryptor::OnBufferDecrypted(const DecryptCB& decrypt_cb,
-                                      mojom::Decryptor::Status status,
+                                      Status status,
                                       mojom::DecoderBufferPtr buffer) {
-  DVLOG_IF(1, status != mojom::Decryptor::Status::SUCCESS)
-      << __FUNCTION__ << "(" << status << ")";
-  DVLOG_IF(3, status == mojom::Decryptor::Status::SUCCESS) << __FUNCTION__;
+  DVLOG_IF(1, status != kSuccess) << __FUNCTION__ << "(" << status << ")";
+  DVLOG_IF(3, status == kSuccess) << __FUNCTION__;
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (buffer.is_null()) {
@@ -197,11 +192,10 @@
 
 void MojoDecryptor::OnAudioDecoded(
     const AudioDecodeCB& audio_decode_cb,
-    mojom::Decryptor::Status status,
+    Status status,
     std::vector<mojom::AudioBufferPtr> audio_buffers) {
-  DVLOG_IF(1, status != mojom::Decryptor::Status::SUCCESS)
-      << __FUNCTION__ << "(" << status << ")";
-  DVLOG_IF(3, status == mojom::Decryptor::Status::SUCCESS) << __FUNCTION__;
+  DVLOG_IF(1, status != kSuccess) << __FUNCTION__ << "(" << status << ")";
+  DVLOG_IF(3, status == kSuccess) << __FUNCTION__;
   DCHECK(thread_checker_.CalledOnValidThread());
 
   Decryptor::AudioFrames audio_frames;
@@ -212,11 +206,10 @@
 }
 
 void MojoDecryptor::OnVideoDecoded(const VideoDecodeCB& video_decode_cb,
-                                   mojom::Decryptor::Status status,
+                                   Status status,
                                    mojom::VideoFramePtr video_frame) {
-  DVLOG_IF(1, status != mojom::Decryptor::Status::SUCCESS)
-      << __FUNCTION__ << "(" << status << ")";
-  DVLOG_IF(3, status == mojom::Decryptor::Status::SUCCESS) << __FUNCTION__;
+  DVLOG_IF(1, status != kSuccess) << __FUNCTION__ << "(" << status << ")";
+  DVLOG_IF(3, status == kSuccess) << __FUNCTION__;
   DCHECK(thread_checker_.CalledOnValidThread());
 
   if (video_frame.is_null()) {
diff --git a/media/mojo/clients/mojo_decryptor.h b/media/mojo/clients/mojo_decryptor.h
index 6e289c8f..656b9fc 100644
--- a/media/mojo/clients/mojo_decryptor.h
+++ b/media/mojo/clients/mojo_decryptor.h
@@ -50,13 +50,13 @@
  private:
   // Called when a buffer is decrypted.
   void OnBufferDecrypted(const DecryptCB& decrypt_cb,
-                         mojom::Decryptor::Status status,
+                         Status status,
                          mojom::DecoderBufferPtr buffer);
   void OnAudioDecoded(const AudioDecodeCB& audio_decode_cb,
-                      mojom::Decryptor::Status status,
+                      Status status,
                       std::vector<mojom::AudioBufferPtr> audio_buffers);
   void OnVideoDecoded(const VideoDecodeCB& video_decode_cb,
-                      mojom::Decryptor::Status status,
+                      Status status,
                       mojom::VideoFramePtr video_frame);
 
   // Called when done with a VideoFrame in order to reuse the shared memory.
diff --git a/media/mojo/clients/mojo_demuxer_stream_impl.cc b/media/mojo/clients/mojo_demuxer_stream_impl.cc
index dea19dc4..e952e43 100644
--- a/media/mojo/clients/mojo_demuxer_stream_impl.cc
+++ b/media/mojo/clients/mojo_demuxer_stream_impl.cc
@@ -35,10 +35,10 @@
   // Prepare the initial config.
   mojom::AudioDecoderConfigPtr audio_config;
   mojom::VideoDecoderConfigPtr video_config;
-  if (stream_->type() == media::DemuxerStream::AUDIO) {
+  if (stream_->type() == Type::AUDIO) {
     audio_config =
         mojom::AudioDecoderConfig::From(stream_->audio_decoder_config());
-  } else if (stream_->type() == media::DemuxerStream::VIDEO) {
+  } else if (stream_->type() == Type::VIDEO) {
     video_config =
         mojom::VideoDecoderConfig::From(stream_->video_decoder_config());
   } else {
@@ -50,9 +50,8 @@
   mojo_decoder_buffer_writer_ =
       MojoDecoderBufferWriter::Create(stream_->type(), &remote_consumer_handle);
 
-  callback.Run(static_cast<mojom::DemuxerStream::Type>(stream_->type()),
-               std::move(remote_consumer_handle), std::move(audio_config),
-               std::move(video_config));
+  callback.Run(stream_->type(), std::move(remote_consumer_handle),
+               std::move(audio_config), std::move(video_config));
 }
 
 void MojoDemuxerStreamImpl::Read(const ReadCallback& callback) {
@@ -66,19 +65,19 @@
 
 void MojoDemuxerStreamImpl::OnBufferReady(
     const ReadCallback& callback,
-    media::DemuxerStream::Status status,
+    Status status,
     const scoped_refptr<media::DecoderBuffer>& buffer) {
   mojom::AudioDecoderConfigPtr audio_config;
   mojom::VideoDecoderConfigPtr video_config;
 
-  if (status == media::DemuxerStream::kConfigChanged) {
+  if (status == Status::kConfigChanged) {
     DVLOG(2) << __FUNCTION__ << ": ConfigChange!";
     // Send the config change so our client can read it once it parses the
     // Status obtained via Run() below.
-    if (stream_->type() == media::DemuxerStream::AUDIO) {
+    if (stream_->type() == Type::AUDIO) {
       audio_config =
           mojom::AudioDecoderConfig::From(stream_->audio_decoder_config());
-    } else if (stream_->type() == media::DemuxerStream::VIDEO) {
+    } else if (stream_->type() == Type::VIDEO) {
       video_config =
           mojom::VideoDecoderConfig::From(stream_->video_decoder_config());
     } else {
@@ -86,35 +85,31 @@
                    << stream_->type();
     }
 
-    callback.Run(mojom::DemuxerStream::Status::CONFIG_CHANGED,
-                 mojom::DecoderBufferPtr(), std::move(audio_config),
-                 std::move(video_config));
+    callback.Run(Status::kConfigChanged, mojom::DecoderBufferPtr(),
+                 std::move(audio_config), std::move(video_config));
     return;
   }
 
-  if (status == media::DemuxerStream::kAborted) {
-    callback.Run(mojom::DemuxerStream::Status::ABORTED,
-                 mojom::DecoderBufferPtr(), std::move(audio_config),
-                 std::move(video_config));
+  if (status == Status::kAborted) {
+    callback.Run(Status::kAborted, mojom::DecoderBufferPtr(),
+                 std::move(audio_config), std::move(video_config));
     return;
   }
 
-  DCHECK_EQ(status, media::DemuxerStream::kOk);
+  DCHECK_EQ(status, Status::kOk);
 
   mojom::DecoderBufferPtr mojo_buffer =
       mojo_decoder_buffer_writer_->WriteDecoderBuffer(buffer);
   if (!mojo_buffer) {
-    callback.Run(mojom::DemuxerStream::Status::ABORTED,
-                 mojom::DecoderBufferPtr(), std::move(audio_config),
-                 std::move(video_config));
+    callback.Run(Status::kAborted, mojom::DecoderBufferPtr(),
+                 std::move(audio_config), std::move(video_config));
     return;
   }
 
   // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via
   // the producer handle and then read more to keep the pipe full.  Waiting for
   // space can be accomplished using an AsyncWaiter.
-  callback.Run(static_cast<mojom::DemuxerStream::Status>(status),
-               std::move(mojo_buffer), std::move(audio_config),
+  callback.Run(status, std::move(mojo_buffer), std::move(audio_config),
                std::move(video_config));
 }
 
diff --git a/media/mojo/clients/mojo_demuxer_stream_impl.h b/media/mojo/clients/mojo_demuxer_stream_impl.h
index 5c284f4..684c262 100644
--- a/media/mojo/clients/mojo_demuxer_stream_impl.h
+++ b/media/mojo/clients/mojo_demuxer_stream_impl.h
@@ -43,8 +43,11 @@
   }
 
  private:
+  using Type = media::DemuxerStream::Type;
+  using Status = media::DemuxerStream::Status;
+
   void OnBufferReady(const ReadCallback& callback,
-                     media::DemuxerStream::Status status,
+                     Status status,
                      const scoped_refptr<media::DecoderBuffer>& buffer);
 
   mojo::Binding<mojom::DemuxerStream> binding_;
diff --git a/media/mojo/clients/mojo_renderer_factory.cc b/media/mojo/clients/mojo_renderer_factory.cc
index 31ba267..a1fdd74 100644
--- a/media/mojo/clients/mojo_renderer_factory.cc
+++ b/media/mojo/clients/mojo_renderer_factory.cc
@@ -7,14 +7,14 @@
 #include "base/single_thread_task_runner.h"
 #include "media/mojo/clients/mojo_renderer.h"
 #include "media/renderers/video_overlay_factory.h"
-#include "services/shell/public/cpp/connect.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/cpp/connect.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
 namespace media {
 
 MojoRendererFactory::MojoRendererFactory(
     const GetGpuFactoriesCB& get_gpu_factories_cb,
-    shell::mojom::InterfaceProvider* interface_provider)
+    service_manager::mojom::InterfaceProvider* interface_provider)
     : get_gpu_factories_cb_(get_gpu_factories_cb),
       interface_provider_(interface_provider) {
   DCHECK(interface_provider_);
@@ -38,7 +38,8 @@
   }
 
   mojom::RendererPtr renderer_ptr;
-  shell::GetInterface<mojom::Renderer>(interface_provider_, &renderer_ptr);
+  service_manager::GetInterface<mojom::Renderer>(interface_provider_,
+                                                 &renderer_ptr);
 
   return std::unique_ptr<Renderer>(
       new MojoRenderer(media_task_runner, std::move(overlay_factory),
diff --git a/media/mojo/clients/mojo_renderer_factory.h b/media/mojo/clients/mojo_renderer_factory.h
index 2a1ae30..66f74b2e 100644
--- a/media/mojo/clients/mojo_renderer_factory.h
+++ b/media/mojo/clients/mojo_renderer_factory.h
@@ -11,7 +11,7 @@
 #include "media/base/renderer_factory.h"
 #include "media/mojo/interfaces/renderer.mojom.h"
 
-namespace shell {
+namespace service_manager {
 namespace mojom {
 class InterfaceProvider;
 }
@@ -26,8 +26,9 @@
  public:
   using GetGpuFactoriesCB = base::Callback<GpuVideoAcceleratorFactories*()>;
 
-  MojoRendererFactory(const GetGpuFactoriesCB& get_gpu_factories_cb,
-                      shell::mojom::InterfaceProvider* interface_provider);
+  MojoRendererFactory(
+      const GetGpuFactoriesCB& get_gpu_factories_cb,
+      service_manager::mojom::InterfaceProvider* interface_provider);
   ~MojoRendererFactory() final;
 
   std::unique_ptr<Renderer> CreateRenderer(
@@ -39,7 +40,7 @@
 
  private:
   GetGpuFactoriesCB get_gpu_factories_cb_;
-  shell::mojom::InterfaceProvider* interface_provider_;
+  service_manager::mojom::InterfaceProvider* interface_provider_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoRendererFactory);
 };
diff --git a/media/mojo/common/media_type_converters.cc b/media/mojo/common/media_type_converters.cc
index 2d3f300f..e07e0dc 100644
--- a/media/mojo/common/media_type_converters.cc
+++ b/media/mojo/common/media_type_converters.cc
@@ -15,15 +15,12 @@
 #include "media/base/cdm_key_information.h"
 #include "media/base/decoder_buffer.h"
 #include "media/base/decrypt_config.h"
-#include "media/base/decryptor.h"
-#include "media/base/demuxer_stream.h"
 #include "media/base/encryption_scheme.h"
 #include "media/base/media_keys.h"
 #include "media/base/subsample_entry.h"
 #include "media/base/video_decoder_config.h"
 #include "media/base/video_frame.h"
 #include "media/mojo/common/mojo_shared_buffer_video_frame.h"
-#include "media/mojo/interfaces/demuxer_stream.mojom.h"
 #include "mojo/public/cpp/system/buffer.h"
 
 namespace mojo {
@@ -40,34 +37,6 @@
                                                media::mojom::mojo_enum_value), \
                 "Mismatched enum: " #media_enum_value " != " #mojo_enum_value)
 
-// DemuxerStream Type.  Note: Mojo DemuxerStream's don't have the TEXT type.
-ASSERT_ENUM_EQ_RAW(DemuxerStream::Type,
-                   DemuxerStream::UNKNOWN,
-                   DemuxerStream::Type::UNKNOWN);
-ASSERT_ENUM_EQ_RAW(DemuxerStream::Type,
-                   DemuxerStream::AUDIO,
-                   DemuxerStream::Type::AUDIO);
-ASSERT_ENUM_EQ_RAW(DemuxerStream::Type,
-                   DemuxerStream::VIDEO,
-                   DemuxerStream::Type::VIDEO);
-static_assert(
-    media::DemuxerStream::NUM_TYPES ==
-        static_cast<media::DemuxerStream::Type>(
-            static_cast<int>(media::mojom::DemuxerStream::Type::LAST_TYPE) + 2),
-    "Mismatched enum: media::DemuxerStream::NUM_TYPES != "
-    "media::mojom::DemuxerStream::Type::LAST_TYPE + 2");
-
-// DemuxerStream Status.
-ASSERT_ENUM_EQ_RAW(DemuxerStream::Status,
-                   DemuxerStream::kOk,
-                   DemuxerStream::Status::OK);
-ASSERT_ENUM_EQ_RAW(DemuxerStream::Status,
-                   DemuxerStream::kAborted,
-                   DemuxerStream::Status::ABORTED);
-ASSERT_ENUM_EQ_RAW(DemuxerStream::Status,
-                   DemuxerStream::kConfigChanged,
-                   DemuxerStream::Status::CONFIG_CHANGED);
-
 // CipherMode
 ASSERT_ENUM_EQ_RAW(EncryptionScheme::CipherMode,
                    EncryptionScheme::CipherMode::CIPHER_MODE_UNENCRYPTED,
@@ -82,20 +51,6 @@
                    EncryptionScheme::CipherMode::CIPHER_MODE_MAX,
                    CipherMode::MAX);
 
-// Decryptor Status
-ASSERT_ENUM_EQ_RAW(Decryptor::Status,
-                   Decryptor::kSuccess,
-                   Decryptor::Status::SUCCESS);
-ASSERT_ENUM_EQ_RAW(Decryptor::Status,
-                   Decryptor::kNoKey,
-                   Decryptor::Status::NO_KEY);
-ASSERT_ENUM_EQ_RAW(Decryptor::Status,
-                   Decryptor::kNeedMoreData,
-                   Decryptor::Status::NEED_MORE_DATA);
-ASSERT_ENUM_EQ_RAW(Decryptor::Status,
-                   Decryptor::kError,
-                   Decryptor::Status::DECRYPTION_ERROR);
-
 // CdmException
 #define ASSERT_CDM_EXCEPTION(value)                                        \
   static_assert(                                                           \
diff --git a/media/mojo/interfaces/BUILD.gn b/media/mojo/interfaces/BUILD.gn
index 2b17f8a..47390929 100644
--- a/media/mojo/interfaces/BUILD.gn
+++ b/media/mojo/interfaces/BUILD.gn
@@ -30,7 +30,7 @@
 
   public_deps = [
     "//mojo/common:common_custom_types",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
     "//ui/gfx/geometry/mojo",
     "//url/mojo:url_mojom_gurl",
   ]
diff --git a/media/mojo/interfaces/decryptor.mojom b/media/mojo/interfaces/decryptor.mojom
index 0a79bec4..d4581cd 100644
--- a/media/mojo/interfaces/decryptor.mojom
+++ b/media/mojo/interfaces/decryptor.mojom
@@ -4,21 +4,19 @@
 
 module media.mojom;
 
-import "media/mojo/interfaces/demuxer_stream.mojom";
 import "media/mojo/interfaces/media_types.mojom";
 
 // Interface for decrypting (and decoding) encrypted streams.
 // See media/base/decryptor.h for details.
 interface Decryptor {
-  // Status of a decrypt or decrypt-and-decode operation. The returned
-  // buffer/frame of such an operation is NOT null iff the status is SUCCESS.
-  enum Status {
-    SUCCESS,  // Successfully completed. Decrypted buffer ready.
-    NO_KEY,  // No key is available to decrypt.
-    NEED_MORE_DATA,  // Decoder needs more data to produce an output.
-    // Key is available but an error occurred during decryption.
-    DECRYPTION_ERROR
-  };
+  // Status of a decrypt or decrypt-and-decode operation. See decryptor.h for
+  // descriptions.
+  [Native]
+  enum Status;
+
+  // Stream type (audio/video). See decryptor.h for descriptions.
+  [Native]
+  enum StreamType;
 
   // Pass the two data pipes used to transfer DecoderBuffer contents to and
   // from the Decryptor. |receive_pipe| will be used to receive DecoderBuffer
@@ -32,11 +30,11 @@
   // Decrypts the |encrypted| buffer and returns the decrypt |status| and
   // decrypted |buffer|.
   // At most one decrypt call is allowed at any time for a |stream_type|.
-  Decrypt(DemuxerStream.Type stream_type, DecoderBuffer encrypted)
+  Decrypt(StreamType stream_type, DecoderBuffer encrypted)
       => (Status status, DecoderBuffer? buffer);
 
   // Cancels any pending decrypt for |stream_type| with SUCCESS.
-  CancelDecrypt(DemuxerStream.Type stream_type);
+  CancelDecrypt(StreamType stream_type);
 
   // Initializes a decoder with the given |config|. Returns whether the
   // initialization succeeded.
@@ -62,7 +60,7 @@
   // cancels any pending decrypt-and-decode operations immediately with ERROR.
   // This method can only be called after the corresponding decoder has been
   // successfully initialized.
-  ResetDecoder(DemuxerStream.Type stream_type);
+  ResetDecoder(StreamType stream_type);
 
   // Releases decoder resources, deinitializes the decoder, aborts any pending
   // initialization (with false) or decrypt-and-decode (with ERROR) for
@@ -71,7 +69,7 @@
   // has been called (with the correct stream type).
   // After this operation, the decoder is set to an uninitialized state.
   // The decoder can be reinitialized after it is deinitialized.
-  DeinitializeDecoder(DemuxerStream.Type stream_type);
+  DeinitializeDecoder(StreamType stream_type);
 
   // Releases the shared memory.
   ReleaseSharedBuffer(handle<shared_buffer> buffer, uint64 buffer_size);
diff --git a/media/mojo/interfaces/decryptor.typemap b/media/mojo/interfaces/decryptor.typemap
new file mode 100644
index 0000000..0d2977f
--- /dev/null
+++ b/media/mojo/interfaces/decryptor.typemap
@@ -0,0 +1,19 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+mojom = "//media/mojo/interfaces/decryptor.mojom"
+
+public_headers = [ "//media/base/decryptor.h" ]
+
+traits_headers = [ "//media/base/ipc/media_param_traits_macros.h" ]
+
+deps = [
+  "//media",
+  "//media/base/ipc",
+]
+
+type_mappings = [
+  "media.mojom.Decryptor.Status=media::Decryptor::Status",
+  "media.mojom.Decryptor.StreamType=media::Decryptor::StreamType",
+]
diff --git a/media/mojo/interfaces/demuxer_stream.mojom b/media/mojo/interfaces/demuxer_stream.mojom
index 98f3dc7..3433ab3 100644
--- a/media/mojo/interfaces/demuxer_stream.mojom
+++ b/media/mojo/interfaces/demuxer_stream.mojom
@@ -11,19 +11,12 @@
 // different applications.
 interface DemuxerStream {
   // See media::DemuxerStream for descriptions.
-  enum Type {
-    UNKNOWN,
-    AUDIO,
-    VIDEO,
-    LAST_TYPE = VIDEO,
-  };
+  [Native]
+  enum Type;
 
   // See media::DemuxerStream for descriptions.
-  enum Status {
-    OK = 0,
-    ABORTED,
-    CONFIG_CHANGED,
-  };
+  [Native]
+  enum Status;
 
   // Initializes the DemuxerStream. Read() can only be called after the callback
   // is received. The returned |pipe| will be used to fill out the data section
diff --git a/media/mojo/interfaces/demuxer_stream.typemap b/media/mojo/interfaces/demuxer_stream.typemap
new file mode 100644
index 0000000..10cc17d
--- /dev/null
+++ b/media/mojo/interfaces/demuxer_stream.typemap
@@ -0,0 +1,19 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+mojom = "//media/mojo/interfaces/demuxer_stream.mojom"
+
+public_headers = [ "//media/base/demuxer_stream.h" ]
+
+traits_headers = [ "//media/base/ipc/media_param_traits_macros.h" ]
+
+deps = [
+  "//media",
+  "//media/base/ipc",
+]
+
+type_mappings = [
+  "media.mojom.DemuxerStream.Status=media::DemuxerStream::Status",
+  "media.mojom.DemuxerStream.Type=media::DemuxerStream::Type",
+]
diff --git a/media/mojo/interfaces/image_capture.mojom b/media/mojo/interfaces/image_capture.mojom
index 995cd20..b57f98e 100644
--- a/media/mojo/interfaces/image_capture.mojom
+++ b/media/mojo/interfaces/image_capture.mojom
@@ -11,6 +11,7 @@
   int32 max;
   int32 min;
   int32 current;
+  int32 step;
 };
 
 // https://www.w3.org/TR/image-capture/#MeteringMode
diff --git a/media/mojo/interfaces/media_service.mojom b/media/mojo/interfaces/media_service.mojom
index 44b13a5..c66e7df 100644
--- a/media/mojo/interfaces/media_service.mojom
+++ b/media/mojo/interfaces/media_service.mojom
@@ -5,9 +5,9 @@
 module media.mojom;
 
 import "media/mojo/interfaces/service_factory.mojom";
-import "services/shell/public/interfaces/interface_provider.mojom";
+import "services/service_manager/public/interfaces/interface_provider.mojom";
 
 interface MediaService {
   CreateServiceFactory(ServiceFactory& factory,
-                       shell.mojom.InterfaceProvider frame_interfaces);
+                       service_manager.mojom.InterfaceProvider frame_interfaces);
 };
diff --git a/media/mojo/interfaces/typemaps.gni b/media/mojo/interfaces/typemaps.gni
index b7f358da..737a5657 100644
--- a/media/mojo/interfaces/typemaps.gni
+++ b/media/mojo/interfaces/typemaps.gni
@@ -4,6 +4,8 @@
 
 typemaps = [
   "//media/mojo/interfaces/audio_parameters.typemap",
+  "//media/mojo/interfaces/decryptor.typemap",
+  "//media/mojo/interfaces/demuxer_stream.typemap",
   "//media/mojo/interfaces/media_types.typemap",
   "//media/mojo/interfaces/pipeline_statistics.typemap",
 ]
diff --git a/media/mojo/services/BUILD.gn b/media/mojo/services/BUILD.gn
index 48f0d37..3ed6a2c 100644
--- a/media/mojo/services/BUILD.gn
+++ b/media/mojo/services/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//media/media_options.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 config("mojo_media_config") {
@@ -88,7 +88,7 @@
     "//media/mojo/interfaces",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//url",
   ]
 
@@ -97,7 +97,7 @@
     "//media:shared_memory_support",
     "//media/mojo/common",
     "//mojo/common",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
   ]
 
   if (is_android) {
@@ -130,7 +130,7 @@
 
   deps = [
     "//mojo/public/c/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 }
 
@@ -147,8 +147,8 @@
     "//media/mojo/clients",
     "//media/mojo/common",
     "//media/mojo/interfaces",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
     "//testing/gmock",
     "//testing/gtest",
   ]
@@ -175,7 +175,7 @@
 
   deps = [
     "//media/test:mojo_pipeline_integration_tests",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
   ]
 
   data_deps = [
diff --git a/media/mojo/services/android_mojo_media_client.cc b/media/mojo/services/android_mojo_media_client.cc
index 62fa5e9d..3184299 100644
--- a/media/mojo/services/android_mojo_media_client.cc
+++ b/media/mojo/services/android_mojo_media_client.cc
@@ -11,16 +11,16 @@
 #include "media/filters/android/media_codec_audio_decoder.h"
 #include "media/mojo/interfaces/provision_fetcher.mojom.h"
 #include "media/mojo/services/mojo_provision_fetcher.h"
-#include "services/shell/public/cpp/connect.h"
+#include "services/service_manager/public/cpp/connect.h"
 
 namespace media {
 
 namespace {
 
 std::unique_ptr<ProvisionFetcher> CreateProvisionFetcher(
-    shell::mojom::InterfaceProvider* interface_provider) {
+    service_manager::mojom::InterfaceProvider* interface_provider) {
   mojom::ProvisionFetcherPtr provision_fetcher_ptr;
-  shell::GetInterface(interface_provider, &provision_fetcher_ptr);
+  service_manager::GetInterface(interface_provider, &provision_fetcher_ptr);
   return base::MakeUnique<MojoProvisionFetcher>(
       std::move(provision_fetcher_ptr));
 }
@@ -39,7 +39,7 @@
 }
 
 std::unique_ptr<CdmFactory> AndroidMojoMediaClient::CreateCdmFactory(
-    shell::mojom::InterfaceProvider* interface_provider) {
+    service_manager::mojom::InterfaceProvider* interface_provider) {
   return base::MakeUnique<AndroidCdmFactory>(
       base::Bind(&CreateProvisionFetcher, interface_provider));
 }
diff --git a/media/mojo/services/android_mojo_media_client.h b/media/mojo/services/android_mojo_media_client.h
index 3ab07d8..0fab26a 100644
--- a/media/mojo/services/android_mojo_media_client.h
+++ b/media/mojo/services/android_mojo_media_client.h
@@ -22,7 +22,7 @@
       scoped_refptr<base::SingleThreadTaskRunner> task_runner) final;
 
   std::unique_ptr<CdmFactory> CreateCdmFactory(
-      shell::mojom::InterfaceProvider* interface_provider) final;
+      service_manager::mojom::InterfaceProvider* interface_provider) final;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(AndroidMojoMediaClient);
diff --git a/media/mojo/services/apptest_manifest.json b/media/mojo/services/apptest_manifest.json
index e287bba0..eec2b50 100644
--- a/media/mojo/services/apptest_manifest.json
+++ b/media/mojo/services/apptest_manifest.json
@@ -4,8 +4,8 @@
   "display_name": "Media Apptests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:media": { "classes": [ "media:service_factory" ] }
+      "*": [ "app" ],
+      "service:media": [ "media:service_factory" ]
     }
   }
 }
diff --git a/media/mojo/services/default_mojo_media_client.cc b/media/mojo/services/default_mojo_media_client.cc
index 059b7c2..9fa1a78 100644
--- a/media/mojo/services/default_mojo_media_client.cc
+++ b/media/mojo/services/default_mojo_media_client.cc
@@ -70,7 +70,7 @@
 }
 
 std::unique_ptr<CdmFactory> DefaultMojoMediaClient::CreateCdmFactory(
-    shell::mojom::InterfaceProvider* /* interface_provider */) {
+    service_manager::mojom::InterfaceProvider* /* interface_provider */) {
   DVLOG(1) << __FUNCTION__;
   return base::MakeUnique<DefaultCdmFactory>();
 }
diff --git a/media/mojo/services/default_mojo_media_client.h b/media/mojo/services/default_mojo_media_client.h
index 1c26ea8..8f559d4 100644
--- a/media/mojo/services/default_mojo_media_client.h
+++ b/media/mojo/services/default_mojo_media_client.h
@@ -38,7 +38,8 @@
   std::unique_ptr<RendererFactory> CreateRendererFactory(
       const scoped_refptr<MediaLog>& media_log) final;
   std::unique_ptr<CdmFactory> CreateCdmFactory(
-      shell::mojom::InterfaceProvider* /* interface_provider */) final;
+      service_manager::mojom::InterfaceProvider* /* interface_provider */)
+      final;
 
  private:
   ScopedAudioManagerPtr audio_manager_;
diff --git a/media/mojo/services/main.cc b/media/mojo/services/main.cc
index 601e2d2e..06e0a351 100644
--- a/media/mojo/services/main.cc
+++ b/media/mojo/services/main.cc
@@ -7,12 +7,12 @@
 #include "base/logging.h"
 #include "base/memory/ptr_util.h"
 #include "media/mojo/services/mojo_media_application_factory.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 namespace {
 
-shell::ServiceRunner* g_runner = nullptr;
+service_manager::ServiceRunner* g_runner = nullptr;
 
 void QuitApplication() {
   DCHECK(g_runner);
@@ -24,15 +24,15 @@
 MojoResult ServiceMain(MojoHandle mojo_handle) {
   // Enable logging.
   base::AtExitManager at_exit;
-  shell::ServiceRunner::InitBaseCommandLine();
+  service_manager::ServiceRunner::InitBaseCommandLine();
 
   logging::LoggingSettings settings;
   settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
   logging::InitLogging(settings);
 
-  std::unique_ptr<shell::Service> service =
+  std::unique_ptr<service_manager::Service> service =
       media::CreateMojoMediaApplication(base::Bind(&QuitApplication));
-  shell::ServiceRunner runner(service.release());
+  service_manager::ServiceRunner runner(service.release());
   g_runner = &runner;
   return runner.Run(mojo_handle, false /* init_base */);
 }
diff --git a/media/mojo/services/media_manifest.json b/media/mojo/services/media_manifest.json
index eeb6d9d0..32358c5f 100644
--- a/media/mojo/services/media_manifest.json
+++ b/media/mojo/services/media_manifest.json
@@ -9,7 +9,7 @@
       "media:service_factory": [ "media::mojom::ServiceFactory" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/media/mojo/services/media_mojo_unittest.cc b/media/mojo/services/media_mojo_unittest.cc
index 9c606d12d..8b5940e 100644
--- a/media/mojo/services/media_mojo_unittest.cc
+++ b/media/mojo/services/media_mojo_unittest.cc
@@ -21,7 +21,7 @@
 #include "media/mojo/interfaces/renderer.mojom.h"
 #include "media/mojo/interfaces/service_factory.mojom.h"
 #include "mojo/public/cpp/bindings/associated_binding.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
 using testing::Exactly;
@@ -62,7 +62,7 @@
   DISALLOW_COPY_AND_ASSIGN(MockRendererClient);
 };
 
-class MediaServiceTest : public shell::test::ServiceTest {
+class MediaServiceTest : public service_manager::test::ServiceTest {
  public:
   MediaServiceTest()
       : ServiceTest("exe:media_mojo_unittests"),
@@ -146,7 +146,7 @@
   std::unique_ptr<MojoDemuxerStreamImpl> mojo_video_stream_;
 
  private:
-  std::unique_ptr<shell::Connection> connection_;
+  std::unique_ptr<service_manager::Connection> connection_;
 
   DISALLOW_COPY_AND_ASSIGN(MediaServiceTest);
 };
diff --git a/media/mojo/services/mojo_decryptor_service.cc b/media/mojo/services/mojo_decryptor_service.cc
index f8c484e..57c143e4 100644
--- a/media/mojo/services/mojo_decryptor_service.cc
+++ b/media/mojo/services/mojo_decryptor_service.cc
@@ -45,7 +45,7 @@
       new MojoDecoderBufferReader(std::move(receive_pipe)));
 }
 
-void MojoDecryptorService::Decrypt(mojom::DemuxerStream::Type stream_type,
+void MojoDecryptorService::Decrypt(StreamType stream_type,
                                    mojom::DecoderBufferPtr encrypted,
                                    const DecryptCallback& callback) {
   DVLOG(3) << __FUNCTION__;
@@ -53,21 +53,18 @@
   scoped_refptr<DecoderBuffer> media_buffer =
       mojo_decoder_buffer_reader_->ReadDecoderBuffer(encrypted);
   if (!media_buffer) {
-    callback.Run(Status::DECRYPTION_ERROR, nullptr);
+    callback.Run(Status::kError, nullptr);
     return;
   }
 
   decryptor_->Decrypt(
-      static_cast<media::Decryptor::StreamType>(stream_type),
-      std::move(media_buffer),
+      stream_type, std::move(media_buffer),
       base::Bind(&MojoDecryptorService::OnDecryptDone, weak_this_, callback));
 }
 
-void MojoDecryptorService::CancelDecrypt(
-    mojom::DemuxerStream::Type stream_type) {
+void MojoDecryptorService::CancelDecrypt(StreamType stream_type) {
   DVLOG(1) << __FUNCTION__;
-  decryptor_->CancelDecrypt(
-      static_cast<media::Decryptor::StreamType>(stream_type));
+  decryptor_->CancelDecrypt(stream_type);
 }
 
 void MojoDecryptorService::InitializeAudioDecoder(
@@ -98,8 +95,7 @@
   scoped_refptr<DecoderBuffer> media_buffer =
       mojo_decoder_buffer_reader_->ReadDecoderBuffer(encrypted);
   if (!media_buffer) {
-    callback.Run(Status::DECRYPTION_ERROR,
-                 std::vector<mojom::AudioBufferPtr>());
+    callback.Run(Status::kError, std::vector<mojom::AudioBufferPtr>());
     return;
   }
 
@@ -116,7 +112,7 @@
   scoped_refptr<DecoderBuffer> media_buffer =
       mojo_decoder_buffer_reader_->ReadDecoderBuffer(encrypted);
   if (!media_buffer) {
-    callback.Run(Status::DECRYPTION_ERROR, nullptr);
+    callback.Run(Status::kError, nullptr);
     return;
   }
 
@@ -125,18 +121,14 @@
       base::Bind(&MojoDecryptorService::OnVideoDecoded, weak_this_, callback));
 }
 
-void MojoDecryptorService::ResetDecoder(
-    mojom::DemuxerStream::Type stream_type) {
+void MojoDecryptorService::ResetDecoder(StreamType stream_type) {
   DVLOG(1) << __FUNCTION__;
-  decryptor_->ResetDecoder(
-      static_cast<media::Decryptor::StreamType>(stream_type));
+  decryptor_->ResetDecoder(stream_type);
 }
 
-void MojoDecryptorService::DeinitializeDecoder(
-    mojom::DemuxerStream::Type stream_type) {
+void MojoDecryptorService::DeinitializeDecoder(StreamType stream_type) {
   DVLOG(1) << __FUNCTION__;
-  decryptor_->DeinitializeDecoder(
-      static_cast<media::Decryptor::StreamType>(stream_type));
+  decryptor_->DeinitializeDecoder(stream_type);
 }
 
 void MojoDecryptorService::ReleaseSharedBuffer(
@@ -147,26 +139,26 @@
 
 void MojoDecryptorService::OnDecryptDone(
     const DecryptCallback& callback,
-    media::Decryptor::Status status,
+    Status status,
     const scoped_refptr<DecoderBuffer>& buffer) {
-  DVLOG_IF(1, status != media::Decryptor::kSuccess) << __FUNCTION__ << "("
-                                                    << status << ")";
-  DVLOG_IF(3, status == media::Decryptor::kSuccess) << __FUNCTION__;
+  DVLOG_IF(1, status != Status::kSuccess) << __FUNCTION__ << "(" << status
+                                          << ")";
+  DVLOG_IF(3, status == Status::kSuccess) << __FUNCTION__;
 
   if (!buffer) {
-    DCHECK_NE(status, media::Decryptor::kSuccess);
-    callback.Run(static_cast<Decryptor::Status>(status), nullptr);
+    DCHECK_NE(status, Status::kSuccess);
+    callback.Run(status, nullptr);
     return;
   }
 
   mojom::DecoderBufferPtr mojo_buffer =
       mojo_decoder_buffer_writer_->WriteDecoderBuffer(buffer);
   if (!mojo_buffer) {
-    callback.Run(Status::DECRYPTION_ERROR, nullptr);
+    callback.Run(Status::kError, nullptr);
     return;
   }
 
-  callback.Run(static_cast<Decryptor::Status>(status), std::move(mojo_buffer));
+  callback.Run(status, std::move(mojo_buffer));
 }
 
 void MojoDecryptorService::OnAudioDecoderInitialized(
@@ -185,31 +177,30 @@
 
 void MojoDecryptorService::OnAudioDecoded(
     const DecryptAndDecodeAudioCallback& callback,
-    media::Decryptor::Status status,
+    Status status,
     const media::Decryptor::AudioFrames& frames) {
-  DVLOG_IF(1, status != media::Decryptor::kSuccess) << __FUNCTION__ << "("
-                                                    << status << ")";
-  DVLOG_IF(3, status == media::Decryptor::kSuccess) << __FUNCTION__;
+  DVLOG_IF(1, status != Status::kSuccess) << __FUNCTION__ << "(" << status
+                                          << ")";
+  DVLOG_IF(3, status == Status::kSuccess) << __FUNCTION__;
 
   std::vector<mojom::AudioBufferPtr> audio_buffers;
   for (const auto& frame : frames)
     audio_buffers.push_back(mojom::AudioBuffer::From(frame));
 
-  callback.Run(static_cast<Decryptor::Status>(status),
-               std::move(audio_buffers));
+  callback.Run(status, std::move(audio_buffers));
 }
 
 void MojoDecryptorService::OnVideoDecoded(
     const DecryptAndDecodeVideoCallback& callback,
-    media::Decryptor::Status status,
+    Status status,
     const scoped_refptr<VideoFrame>& frame) {
-  DVLOG_IF(1, status != media::Decryptor::kSuccess) << __FUNCTION__ << "("
-                                                    << status << ")";
-  DVLOG_IF(3, status == media::Decryptor::kSuccess) << __FUNCTION__;
+  DVLOG_IF(1, status != Status::kSuccess) << __FUNCTION__ << "(" << status
+                                          << ")";
+  DVLOG_IF(3, status == Status::kSuccess) << __FUNCTION__;
 
   if (!frame) {
-    DCHECK_NE(status, media::Decryptor::kSuccess);
-    callback.Run(static_cast<Decryptor::Status>(status), nullptr);
+    DCHECK_NE(status, Status::kSuccess);
+    callback.Run(status, nullptr);
     return;
   }
 
@@ -222,8 +213,7 @@
         std::make_pair(mojo_frame->Handle().value(), frame));
   }
 
-  callback.Run(static_cast<Decryptor::Status>(status),
-               mojom::VideoFrame::From(frame));
+  callback.Run(status, mojom::VideoFrame::From(frame));
 }
 
 }  // namespace media
diff --git a/media/mojo/services/mojo_decryptor_service.h b/media/mojo/services/mojo_decryptor_service.h
index bb68f61f..68ca2b5 100644
--- a/media/mojo/services/mojo_decryptor_service.h
+++ b/media/mojo/services/mojo_decryptor_service.h
@@ -29,6 +29,9 @@
 // and uses a weak binding across the mojo interface.
 class MojoDecryptorService : public mojom::Decryptor {
  public:
+  using StreamType = media::Decryptor::StreamType;
+  using Status = media::Decryptor::Status;
+
   // Constructs a MojoDecryptorService and binds it to the |request|. Keeps a
   // copy of |cdm| to prevent it from being deleted as long as it is needed.
   // |error_handler| will be called if a connection error occurs.
@@ -41,10 +44,10 @@
   // mojom::Decryptor implementation.
   void Initialize(mojo::ScopedDataPipeConsumerHandle receive_pipe,
                   mojo::ScopedDataPipeProducerHandle transmit_pipe) final;
-  void Decrypt(mojom::DemuxerStream::Type stream_type,
+  void Decrypt(StreamType stream_type,
                mojom::DecoderBufferPtr encrypted,
                const DecryptCallback& callback) final;
-  void CancelDecrypt(mojom::DemuxerStream::Type stream_type) final;
+  void CancelDecrypt(StreamType stream_type) final;
   void InitializeAudioDecoder(
       mojom::AudioDecoderConfigPtr config,
       const InitializeAudioDecoderCallback& callback) final;
@@ -57,15 +60,15 @@
   void DecryptAndDecodeVideo(
       mojom::DecoderBufferPtr encrypted,
       const DecryptAndDecodeVideoCallback& callback) final;
-  void ResetDecoder(mojom::DemuxerStream::Type stream_type) final;
-  void DeinitializeDecoder(mojom::DemuxerStream::Type stream_type) final;
+  void ResetDecoder(StreamType stream_type) final;
+  void DeinitializeDecoder(StreamType stream_type) final;
   void ReleaseSharedBuffer(mojo::ScopedSharedBufferHandle buffer,
                            uint64_t buffer_size) final;
 
  private:
   // Callback executed once Decrypt() is done.
   void OnDecryptDone(const DecryptCallback& callback,
-                     media::Decryptor::Status status,
+                     Status status,
                      const scoped_refptr<DecoderBuffer>& buffer);
 
   // Callbacks executed once decoder initialized.
@@ -76,10 +79,10 @@
 
   // Callbacks executed when DecryptAndDecode are done.
   void OnAudioDecoded(const DecryptAndDecodeAudioCallback& callback,
-                      media::Decryptor::Status status,
+                      Status status,
                       const media::Decryptor::AudioFrames& frames);
   void OnVideoDecoded(const DecryptAndDecodeVideoCallback& callback,
-                      media::Decryptor::Status status,
+                      Status status,
                       const scoped_refptr<VideoFrame>& frame);
 
   // A weak binding is used to connect to the MojoDecryptor.
diff --git a/media/mojo/services/mojo_demuxer_stream_adapter.cc b/media/mojo/services/mojo_demuxer_stream_adapter.cc
index f302a2ce..c182562 100644
--- a/media/mojo/services/mojo_demuxer_stream_adapter.cc
+++ b/media/mojo/services/mojo_demuxer_stream_adapter.cc
@@ -22,7 +22,7 @@
     const base::Closure& stream_ready_cb)
     : demuxer_stream_(std::move(demuxer_stream)),
       stream_ready_cb_(stream_ready_cb),
-      type_(DemuxerStream::UNKNOWN),
+      type_(UNKNOWN),
       weak_factory_(this) {
   DVLOG(1) << __FUNCTION__;
   demuxer_stream_->Initialize(base::Bind(
@@ -33,7 +33,7 @@
   DVLOG(1) << __FUNCTION__;
 }
 
-void MojoDemuxerStreamAdapter::Read(const DemuxerStream::ReadCB& read_cb) {
+void MojoDemuxerStreamAdapter::Read(const ReadCB& read_cb) {
   DVLOG(3) << __FUNCTION__;
   // We shouldn't be holding on to a previous callback if a new Read() came in.
   DCHECK(read_cb_.is_null());
@@ -44,12 +44,12 @@
 }
 
 AudioDecoderConfig MojoDemuxerStreamAdapter::audio_decoder_config() {
-  DCHECK_EQ(type_, DemuxerStream::AUDIO);
+  DCHECK_EQ(type_, AUDIO);
   return audio_config_;
 }
 
 VideoDecoderConfig MojoDemuxerStreamAdapter::video_decoder_config() {
-  DCHECK_EQ(type_, DemuxerStream::VIDEO);
+  DCHECK_EQ(type_, VIDEO);
   return video_config_;
 }
 
@@ -86,15 +86,15 @@
 
 // TODO(xhwang): Pass liveness here.
 void MojoDemuxerStreamAdapter::OnStreamReady(
-    mojom::DemuxerStream::Type type,
+    Type type,
     mojo::ScopedDataPipeConsumerHandle consumer_handle,
     mojom::AudioDecoderConfigPtr audio_config,
     mojom::VideoDecoderConfigPtr video_config) {
   DVLOG(1) << __FUNCTION__;
-  DCHECK_EQ(DemuxerStream::UNKNOWN, type_);
+  DCHECK_EQ(UNKNOWN, type_);
   DCHECK(consumer_handle.is_valid());
 
-  type_ = static_cast<DemuxerStream::Type>(type);
+  type_ = type;
 
   mojo_decoder_buffer_reader_.reset(
       new MojoDecoderBufferReader(std::move(consumer_handle)));
@@ -105,48 +105,48 @@
 }
 
 void MojoDemuxerStreamAdapter::OnBufferReady(
-    mojom::DemuxerStream::Status status,
+    Status status,
     mojom::DecoderBufferPtr buffer,
     mojom::AudioDecoderConfigPtr audio_config,
     mojom::VideoDecoderConfigPtr video_config) {
   DVLOG(3) << __FUNCTION__;
   DCHECK(!read_cb_.is_null());
-  DCHECK_NE(type_, DemuxerStream::UNKNOWN);
+  DCHECK_NE(type_, UNKNOWN);
 
-  if (status == mojom::DemuxerStream::Status::CONFIG_CHANGED) {
+  if (status == kConfigChanged) {
     UpdateConfig(std::move(audio_config), std::move(video_config));
-    base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kConfigChanged, nullptr);
+    base::ResetAndReturn(&read_cb_).Run(kConfigChanged, nullptr);
     return;
   }
 
-  if (status == mojom::DemuxerStream::Status::ABORTED) {
-    base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr);
+  if (status == kAborted) {
+    base::ResetAndReturn(&read_cb_).Run(kAborted, nullptr);
     return;
   }
 
-  DCHECK_EQ(status, mojom::DemuxerStream::Status::OK);
+  DCHECK_EQ(status, kOk);
 
   scoped_refptr<DecoderBuffer> media_buffer =
       mojo_decoder_buffer_reader_->ReadDecoderBuffer(buffer);
   if (!media_buffer) {
-    base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kAborted, nullptr);
+    base::ResetAndReturn(&read_cb_).Run(kAborted, nullptr);
     return;
   }
 
-  base::ResetAndReturn(&read_cb_).Run(DemuxerStream::kOk, media_buffer);
+  base::ResetAndReturn(&read_cb_).Run(kOk, media_buffer);
 }
 
 void MojoDemuxerStreamAdapter::UpdateConfig(
     mojom::AudioDecoderConfigPtr audio_config,
     mojom::VideoDecoderConfigPtr video_config) {
-  DCHECK_NE(type_, DemuxerStream::UNKNOWN);
+  DCHECK_NE(type_, UNKNOWN);
 
   switch(type_) {
-    case DemuxerStream::AUDIO:
+    case AUDIO:
       DCHECK(audio_config && !video_config);
       audio_config_ = audio_config.To<AudioDecoderConfig>();
       break;
-    case DemuxerStream::VIDEO:
+    case VIDEO:
       DCHECK(video_config && !audio_config);
       video_config_ = video_config.To<VideoDecoderConfig>();
       break;
diff --git a/media/mojo/services/mojo_demuxer_stream_adapter.h b/media/mojo/services/mojo_demuxer_stream_adapter.h
index a195954..67d2b64e 100644
--- a/media/mojo/services/mojo_demuxer_stream_adapter.h
+++ b/media/mojo/services/mojo_demuxer_stream_adapter.h
@@ -49,14 +49,14 @@
   void SetStreamStatusChangeCB(const StreamStatusChangeCB& cb) override;
 
  private:
-  void OnStreamReady(mojom::DemuxerStream::Type type,
+  void OnStreamReady(Type type,
                      mojo::ScopedDataPipeConsumerHandle consumer_handle,
                      mojom::AudioDecoderConfigPtr audio_config,
                      mojom::VideoDecoderConfigPtr video_config);
 
   // The callback from |demuxer_stream_| that a read operation has completed.
   // |read_cb| is a callback from the client who invoked Read() on |this|.
-  void OnBufferReady(mojom::DemuxerStream::Status status,
+  void OnBufferReady(Status status,
                      mojom::DecoderBufferPtr buffer,
                      mojom::AudioDecoderConfigPtr audio_config,
                      mojom::VideoDecoderConfigPtr video_config);
@@ -70,16 +70,16 @@
 
   // The last ReadCB received through a call to Read().
   // Used to store the results of OnBufferReady() in the event it is called
-  // with DemuxerStream::Status::kConfigChanged and we don't have an up to
-  // date AudioDecoderConfig yet. In that case we can't forward the results
+  // with Status::kConfigChanged and we don't have an up to date
+  // AudioDecoderConfig yet. In that case we can't forward the results
   // on to the caller of Read() until OnAudioDecoderConfigChanged is observed.
-  DemuxerStream::ReadCB read_cb_;
+  ReadCB read_cb_;
 
   // The current config.
   AudioDecoderConfig audio_config_;
   VideoDecoderConfig video_config_;
 
-  DemuxerStream::Type type_;
+  Type type_;
 
   std::unique_ptr<MojoDecoderBufferReader> mojo_decoder_buffer_reader_;
 
diff --git a/media/mojo/services/mojo_media_application.cc b/media/mojo/services/mojo_media_application.cc
index 8295c819..2216f7f 100644
--- a/media/mojo/services/mojo_media_application.cc
+++ b/media/mojo/services/mojo_media_application.cc
@@ -10,8 +10,8 @@
 #include "media/mojo/services/mojo_media_client.h"
 #include "media/mojo/services/service_factory_impl.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace media {
 
@@ -27,12 +27,13 @@
 
 MojoMediaApplication::~MojoMediaApplication() {}
 
-void MojoMediaApplication::OnStart(const shell::Identity& identity) {
+void MojoMediaApplication::OnStart(const service_manager::Identity& identity) {
   mojo_media_client_->Initialize();
 }
 
-bool MojoMediaApplication::OnConnect(const shell::Identity& remote_identity,
-                                     shell::InterfaceRegistry* registry) {
+bool MojoMediaApplication::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::MediaService>(this);
   return true;
 }
@@ -42,14 +43,15 @@
   return true;
 }
 
-void MojoMediaApplication::Create(const shell::Identity& remote_identity,
-                                  mojom::MediaServiceRequest request) {
+void MojoMediaApplication::Create(
+    const service_manager::Identity& remote_identity,
+    mojom::MediaServiceRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
 void MojoMediaApplication::CreateServiceFactory(
     mojom::ServiceFactoryRequest request,
-    shell::mojom::InterfaceProviderPtr remote_interfaces) {
+    service_manager::mojom::InterfaceProviderPtr remote_interfaces) {
   // Ignore request if service has already stopped.
   if (!mojo_media_client_)
     return;
diff --git a/media/mojo/services/mojo_media_application.h b/media/mojo/services/mojo_media_application.h
index e143e32..70ab9be 100644
--- a/media/mojo/services/mojo_media_application.h
+++ b/media/mojo/services/mojo_media_application.h
@@ -16,9 +16,9 @@
 #include "media/mojo/interfaces/service_factory.mojom.h"
 #include "media/mojo/services/media_mojo_export.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context_ref.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context_ref.h"
 #include "url/gurl.h"
 
 namespace media {
@@ -27,8 +27,9 @@
 class MojoMediaClient;
 
 class MEDIA_MOJO_EXPORT MojoMediaApplication
-    : public NON_EXPORTED_BASE(shell::Service),
-      public NON_EXPORTED_BASE(shell::InterfaceFactory<mojom::MediaService>),
+    : public NON_EXPORTED_BASE(service_manager::Service),
+      public NON_EXPORTED_BASE(
+          service_manager::InterfaceFactory<mojom::MediaService>),
       public NON_EXPORTED_BASE(mojom::MediaService) {
  public:
   MojoMediaApplication(std::unique_ptr<MojoMediaClient> mojo_media_client,
@@ -36,20 +37,20 @@
   ~MojoMediaApplication() final;
 
  private:
-  // shell::Service implementation.
-  void OnStart(const shell::Identity& identity) final;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) final;
+  // service_manager::Service implementation.
+  void OnStart(const service_manager::Identity& identity) final;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) final;
   bool OnStop() final;
 
-  // shell::InterfaceFactory<mojom::MediaService> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::MediaService> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::MediaServiceRequest request) final;
 
   // mojom::MediaService implementation.
   void CreateServiceFactory(
       mojom::ServiceFactoryRequest request,
-      shell::mojom::InterfaceProviderPtr remote_interfaces) final;
+      service_manager::mojom::InterfaceProviderPtr remote_interfaces) final;
 
   // Note: Since each instance runs on a different thread, do not share a common
   // MojoMediaClient with other instances to avoid threading issues. Hence using
@@ -57,7 +58,7 @@
   std::unique_ptr<MojoMediaClient> mojo_media_client_;
 
   scoped_refptr<MediaLog> media_log_;
-  shell::ServiceContextRefFactory ref_factory_;
+  service_manager::ServiceContextRefFactory ref_factory_;
 
   mojo::BindingSet<mojom::MediaService> bindings_;
 };
diff --git a/media/mojo/services/mojo_media_application_factory.cc b/media/mojo/services/mojo_media_application_factory.cc
index 715cbc3..81f471b 100644
--- a/media/mojo/services/mojo_media_application_factory.cc
+++ b/media/mojo/services/mojo_media_application_factory.cc
@@ -18,9 +18,9 @@
 namespace media {
 
 // static
-std::unique_ptr<shell::Service> CreateMojoMediaApplication(
+std::unique_ptr<service_manager::Service> CreateMojoMediaApplication(
     const base::Closure& quit_closure) {
-  return std::unique_ptr<shell::Service>(new MojoMediaApplication(
+  return std::unique_ptr<service_manager::Service>(new MojoMediaApplication(
       base::MakeUnique<DefaultClient>(), quit_closure));
 }
 
diff --git a/media/mojo/services/mojo_media_application_factory.h b/media/mojo/services/mojo_media_application_factory.h
index c78de8f1..7a422eb 100644
--- a/media/mojo/services/mojo_media_application_factory.h
+++ b/media/mojo/services/mojo_media_application_factory.h
@@ -9,12 +9,12 @@
 
 #include "base/callback_forward.h"
 #include "media/mojo/services/media_mojo_export.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace media {
 
 // Creates a MojoMediaApplication instance using the default MojoMediaClient.
-std::unique_ptr<shell::Service> MEDIA_MOJO_EXPORT
+std::unique_ptr<service_manager::Service> MEDIA_MOJO_EXPORT
 CreateMojoMediaApplication(const base::Closure& quit_closure);
 
 }  // namespace media
diff --git a/media/mojo/services/mojo_media_client.cc b/media/mojo/services/mojo_media_client.cc
index 7d4de00..86a4145 100644
--- a/media/mojo/services/mojo_media_client.cc
+++ b/media/mojo/services/mojo_media_client.cc
@@ -47,7 +47,7 @@
 }
 
 std::unique_ptr<CdmFactory> MojoMediaClient::CreateCdmFactory(
-    shell::mojom::InterfaceProvider* interface_provider) {
+    service_manager::mojom::InterfaceProvider* interface_provider) {
   return nullptr;
 }
 
diff --git a/media/mojo/services/mojo_media_client.h b/media/mojo/services/mojo_media_client.h
index f07d4c4..c602066 100644
--- a/media/mojo/services/mojo_media_client.h
+++ b/media/mojo/services/mojo_media_client.h
@@ -15,7 +15,7 @@
 class SingleThreadTaskRunner;
 }
 
-namespace shell {
+namespace service_manager {
 namespace mojom {
 class InterfaceProvider;
 }
@@ -63,7 +63,7 @@
 
   // Returns the CdmFactory to be used by MojoCdmService.
   virtual std::unique_ptr<CdmFactory> CreateCdmFactory(
-      shell::mojom::InterfaceProvider* interface_provider);
+      service_manager::mojom::InterfaceProvider* interface_provider);
 
  protected:
   MojoMediaClient();
diff --git a/media/mojo/services/pipeline_apptest_manifest.json b/media/mojo/services/pipeline_apptest_manifest.json
index f2994e3..d72ae75 100644
--- a/media/mojo/services/pipeline_apptest_manifest.json
+++ b/media/mojo/services/pipeline_apptest_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Media Pipeline Integration Apptests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/media/mojo/services/pipeline_test_manifest.json b/media/mojo/services/pipeline_test_manifest.json
index 25978dd..d95a40e 100644
--- a/media/mojo/services/pipeline_test_manifest.json
+++ b/media/mojo/services/pipeline_test_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Media Pipeline Integration Unittests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/media/mojo/services/service_factory_impl.cc b/media/mojo/services/service_factory_impl.cc
index 98bf18a..6d62b34 100644
--- a/media/mojo/services/service_factory_impl.cc
+++ b/media/mojo/services/service_factory_impl.cc
@@ -9,7 +9,7 @@
 #include "media/base/media_log.h"
 #include "media/mojo/services/mojo_media_client.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
 #if defined(ENABLE_MOJO_AUDIO_DECODER)
 #include "media/mojo/services/mojo_audio_decoder_service.h"
@@ -34,9 +34,9 @@
 namespace media {
 
 ServiceFactoryImpl::ServiceFactoryImpl(
-    shell::mojom::InterfaceProviderPtr interfaces,
+    service_manager::mojom::InterfaceProviderPtr interfaces,
     scoped_refptr<MediaLog> media_log,
-    std::unique_ptr<shell::ServiceContextRef> connection_ref,
+    std::unique_ptr<service_manager::ServiceContextRef> connection_ref,
     MojoMediaClient* mojo_media_client)
     :
 #if defined(ENABLE_MOJO_CDM)
diff --git a/media/mojo/services/service_factory_impl.h b/media/mojo/services/service_factory_impl.h
index c7fec62..85d22a12 100644
--- a/media/mojo/services/service_factory_impl.h
+++ b/media/mojo/services/service_factory_impl.h
@@ -10,10 +10,10 @@
 #include "base/macros.h"
 #include "media/mojo/interfaces/service_factory.mojom.h"
 #include "media/mojo/services/mojo_cdm_service_context.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service_context_ref.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service_context_ref.h"
 
-namespace shell {
+namespace service_manager {
 namespace mojom {
 class InterfaceProvider;
 }
@@ -28,10 +28,11 @@
 
 class ServiceFactoryImpl : public mojom::ServiceFactory {
  public:
-  ServiceFactoryImpl(shell::mojom::InterfaceProviderPtr interfaces,
-                     scoped_refptr<MediaLog> media_log,
-                     std::unique_ptr<shell::ServiceContextRef> connection_ref,
-                     MojoMediaClient* mojo_media_client);
+  ServiceFactoryImpl(
+      service_manager::mojom::InterfaceProviderPtr interfaces,
+      scoped_refptr<MediaLog> media_log,
+      std::unique_ptr<service_manager::ServiceContextRef> connection_ref,
+      MojoMediaClient* mojo_media_client);
   ~ServiceFactoryImpl() final;
 
   // mojom::ServiceFactory implementation.
@@ -58,11 +59,11 @@
 
 #if defined(ENABLE_MOJO_CDM)
   std::unique_ptr<CdmFactory> cdm_factory_;
-  shell::mojom::InterfaceProviderPtr interfaces_;
+  service_manager::mojom::InterfaceProviderPtr interfaces_;
 #endif  // defined(ENABLE_MOJO_CDM)
 
   scoped_refptr<MediaLog> media_log_;
-  std::unique_ptr<shell::ServiceContextRef> connection_ref_;
+  std::unique_ptr<service_manager::ServiceContextRef> connection_ref_;
   MojoMediaClient* mojo_media_client_;
 
   DISALLOW_COPY_AND_ASSIGN(ServiceFactoryImpl);
diff --git a/media/mojo/services/test_manifest.json b/media/mojo/services/test_manifest.json
index b4631f329..a1701a2 100644
--- a/media/mojo/services/test_manifest.json
+++ b/media/mojo/services/test_manifest.json
@@ -4,8 +4,8 @@
   "display_name": "Media Mojo Shell Unittests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:media": { "classes": [ "media:service_factory" ] }
+      "*": [ "app" ],
+      "service:media": [ "media:service_factory" ]
     }
   }
 }
diff --git a/media/test/BUILD.gn b/media/test/BUILD.gn
index a09371bc..a2e07aa 100644
--- a/media/test/BUILD.gn
+++ b/media/test/BUILD.gn
@@ -48,7 +48,7 @@
       "//media:test_support",
       "//media/base:test_support",
       "//media/mojo/clients",
-      "//services/shell/public/cpp:service_test_support",
+      "//services/service_manager/public/cpp:service_test_support",
       "//url",
 
       # TODO(dalecurtis): Required since the gmock header is included in the
@@ -103,7 +103,7 @@
       "//media/mojo/clients",
       "//media/mojo/interfaces",
       "//media/mojo/services",
-      "//services/shell/public/cpp:service_test_support",
+      "//services/service_manager/public/cpp:service_test_support",
       "//testing/gtest",
       "//ui/gfx:test_support",
       "//ui/gfx/geometry",
diff --git a/media/test/DEPS b/media/test/DEPS
index 19b44eac..5dbe03e 100644
--- a/media/test/DEPS
+++ b/media/test/DEPS
@@ -1,3 +1,3 @@
 include_rules = [
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
 ]
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index 6fce8069..2489590 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -40,8 +40,8 @@
 #include "media/mojo/clients/mojo_renderer.h"
 #include "media/mojo/interfaces/renderer.mojom.h"
 #include "media/mojo/interfaces/service_factory.mojom.h"
-#include "services/shell/public/cpp/connect.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/connect.h"
+#include "services/service_manager/public/cpp/service_test.h"
 
 // TODO(dalecurtis): The mojo renderer is in another process, so we have no way
 // currently to get hashes for video and audio samples.  This also means that
@@ -675,11 +675,12 @@
 //               preferably by eliminating multiple inheritance here which is
 //               banned by Google C++ style.
 #if defined(MOJO_RENDERER) && defined(ENABLE_MOJO_PIPELINE_INTEGRATION_TEST)
-class PipelineIntegrationTestHost : public shell::test::ServiceTest,
+class PipelineIntegrationTestHost : public service_manager::test::ServiceTest,
                                     public PipelineIntegrationTestBase {
  public:
   PipelineIntegrationTestHost()
-      : shell::test::ServiceTest("exe:media_pipeline_integration_shelltests") {}
+      : service_manager::test::ServiceTest(
+            "exe:media_pipeline_integration_shelltests") {}
 
   void SetUp() override {
     ServiceTest::SetUp();
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn
index def24ea..9440e669 100644
--- a/mojo/BUILD.gn
+++ b/mojo/BUILD.gn
@@ -20,7 +20,7 @@
     deps += [ "//mojo/android" ]
   }
 
-  deps += [ "//services/shell:all" ]
+  deps += [ "//services/service_manager:all" ]
 }
 
 group("tests") {
@@ -36,8 +36,8 @@
     "//mojo/edk/test:mojo_public_bindings_unittests",
     "//mojo/edk/test:mojo_public_system_perftests",
     "//mojo/edk/test:mojo_public_system_unittests",
-    "//services/shell/public/cpp/tests:mojo_public_application_unittests",
-    "//services/shell/runner/host:mojo_runner_host_unittests",
-    "//services/shell/tests",
+    "//services/service_manager/public/cpp/tests:mojo_public_application_unittests",
+    "//services/service_manager/runner/host:mojo_runner_host_unittests",
+    "//services/service_manager/tests",
   ]
 }
diff --git a/mojo/DEPS b/mojo/DEPS
index a659200..49d7fd3 100644
--- a/mojo/DEPS
+++ b/mojo/DEPS
@@ -3,5 +3,5 @@
   "+build",
   "+testing",
 
-  "+services/shell",
+  "+services/service_manager",
 ]
diff --git a/mojo/common/DEPS b/mojo/common/DEPS
index 588c68d..f3e298f 100644
--- a/mojo/common/DEPS
+++ b/mojo/common/DEPS
@@ -1,7 +1,7 @@
 include_rules = [
   # common must not depend on embedder.
   "-mojo",
-  "+services/shell/public/cpp",
+  "+services/service_manager/public/cpp",
   "+mojo/common",
   "+mojo/public",
 ]
diff --git a/mojo/edk/js/handle.cc b/mojo/edk/js/handle.cc
index 9f9f161..7da8e9f 100644
--- a/mojo/edk/js/handle.cc
+++ b/mojo/edk/js/handle.cc
@@ -37,7 +37,8 @@
   if (!handle_.is_valid())
     return;
 
-  FOR_EACH_OBSERVER(HandleCloseObserver, close_observers_, OnWillCloseHandle());
+  for (auto& observer : close_observers_)
+    observer.OnWillCloseHandle();
 }
 
 }  // namespace js
diff --git a/mojo/public/c/system/BUILD.gn b/mojo/public/c/system/BUILD.gn
index cde3228..c3b3d5f 100644
--- a/mojo/public/c/system/BUILD.gn
+++ b/mojo/public/c/system/BUILD.gn
@@ -25,7 +25,7 @@
 
 # This should ONLY be depended upon directly by shared_library targets which
 # need to export the MojoSetSystemThunks symbol, like targets generated by the
-# mojo_native_application template in //services/shell/public/cpp/service.gni.
+# mojo_native_application template in //services/service_manager/public/cpp/service.gni.
 source_set("set_thunks_for_app") {
   sources = [
     "set_thunks_for_app.cc",
diff --git a/mojo/public/cpp/bindings/tests/versioning_apptest.cc b/mojo/public/cpp/bindings/tests/versioning_apptest.cc
index 305ac5c..29c6fcb 100644
--- a/mojo/public/cpp/bindings/tests/versioning_apptest.cc
+++ b/mojo/public/cpp/bindings/tests/versioning_apptest.cc
@@ -7,8 +7,8 @@
 
 #include "base/macros.h"
 #include "mojo/public/interfaces/bindings/tests/versioning_test_client.mojom.h"
-#include "services/shell/public/cpp/application_test_base.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/application_test_base.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace mojo {
 namespace test {
diff --git a/mojo/public/cpp/bindings/tests/versioning_test_service.cc b/mojo/public/cpp/bindings/tests/versioning_test_service.cc
index 4632159b..313a6249 100644
--- a/mojo/public/cpp/bindings/tests/versioning_test_service.cc
+++ b/mojo/public/cpp/bindings/tests/versioning_test_service.cc
@@ -10,10 +10,10 @@
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/public/interfaces/bindings/tests/versioning_test_service.mojom.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 namespace mojo {
 namespace test {
@@ -95,12 +95,12 @@
 };
 
 class HumanResourceSystemServer
-    : public shell::Service,
+    : public service_manager::Service,
       public InterfaceFactory<HumanResourceDatabase> {
  public:
   HumanResourceSystemServer() {}
 
-  // shell::Service implementation.
+  // service_manager::Service implementation.
   bool OnConnect(Connection* connection) override {
     connection->AddInterface<HumanResourceDatabase>(this);
     return true;
diff --git a/mojo/public/tools/bindings/chromium_bindings_configuration.gni b/mojo/public/tools/bindings/chromium_bindings_configuration.gni
index f699c7d9..d8cc54d 100644
--- a/mojo/public/tools/bindings/chromium_bindings_configuration.gni
+++ b/mojo/public/tools/bindings/chromium_bindings_configuration.gni
@@ -19,7 +19,7 @@
   "//mojo/common/typemaps.gni",
   "//mojo/public/cpp/bindings/tests/chromium_typemaps.gni",
   "//net/interfaces/typemaps.gni",
-  "//services/shell/public/cpp/typemaps.gni",
+  "//services/service_manager/public/cpp/typemaps.gni",
   "//services/ui/public/interfaces/display/typemaps.gni",
   "//services/video_capture/public/interfaces/typemaps.gni",
   "//skia/public/interfaces/typemaps.gni",
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
index bb5acd9..f718276c 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
@@ -50,7 +50,8 @@
 {%- from "enum_macros.tmpl" import enum_data_decl -%}
 {%- for enum in all_enums %}
 {%-   if enum|is_native_only_kind %}
-using {{enum.name}}_Data = mojo::internal::NativeEnum_Data;
+using {{enum|get_name_for_kind(flatten_nested_kind=True)}}_Data =
+    mojo::internal::NativeEnum_Data;
 {%-   else %}
 {{enum_data_decl(enum)}}
 {%-   endif %}
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index 07eb45b..2cf791f 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -196,6 +196,11 @@
           not _current_typemap[GetFullMojomNameForKind(kind)]["hashable"]):
         return False
       return all(Check(field.kind) for field in kind.fields)
+    elif mojom.IsEnumKind(kind):
+      if (IsTypemappedKind(kind) and
+          not _current_typemap[GetFullMojomNameForKind(kind)]["hashable"]):
+        return False
+      return True
     elif mojom.IsUnionKind(kind):
       return all(Check(field.kind) for field in kind.fields)
     elif mojom.IsAnyHandleKind(kind):
diff --git a/net/quic/chromium/quic_chromium_client_session.cc b/net/quic/chromium/quic_chromium_client_session.cc
index 1fd83189..846a534 100644
--- a/net/quic/chromium/quic_chromium_client_session.cc
+++ b/net/quic/chromium/quic_chromium_client_session.cc
@@ -32,6 +32,7 @@
 #include "net/quic/core/crypto/quic_server_info.h"
 #include "net/quic/core/quic_client_promised_info.h"
 #include "net/quic/core/quic_crypto_client_stream_factory.h"
+#include "net/quic/core/spdy_utils.h"
 #include "net/spdy/spdy_session.h"
 #include "net/ssl/channel_id_service.h"
 #include "net/ssl/ssl_connection_status_flags.h"
@@ -244,6 +245,8 @@
       token_binding_signatures_(kTokenBindingSignatureMapSize),
       streams_pushed_count_(0),
       streams_pushed_and_claimed_count_(0),
+      bytes_pushed_count_(0),
+      bytes_pushed_and_unclaimed_count_(0),
       migration_pending_(false),
       weak_factory_(this) {
   sockets_.push_back(std::move(socket));
@@ -316,6 +319,11 @@
   UMA_HISTOGRAM_COUNTS("Net.QuicSession.Pushed", streams_pushed_count_);
   UMA_HISTOGRAM_COUNTS("Net.QuicSession.PushedAndClaimed",
                        streams_pushed_and_claimed_count_);
+  UMA_HISTOGRAM_COUNTS_1M("Net.QuicSession.PushedBytes", bytes_pushed_count_);
+  DCHECK_LE(bytes_pushed_and_unclaimed_count_, bytes_pushed_count_);
+  UMA_HISTOGRAM_COUNTS_1M("Net.QuicSession.PushedAndUnclaimedBytes",
+                          bytes_pushed_and_unclaimed_count_);
+
   if (!IsCryptoHandshakeConfirmed())
     return;
 
@@ -539,9 +547,9 @@
   ssl_info->cert_status = cert_verify_result_->cert_status;
   ssl_info->cert = cert_verify_result_->verified_cert;
 
-  // TODO(wtc): Define QUIC "cipher suites".
-  // Report the TLS cipher suite that most closely resembles the crypto
-  // parameters of the QUIC connection.
+  // TODO(davidben): Switch these to the TLS 1.3 AEAD-only ciphers. That will
+  // place them in the cache in the default configuration, so do this when we
+  // are comfortable supporting those values long-term.
   QuicTag aead = crypto_stream_->crypto_negotiated_params().aead;
   uint16_t cipher_suite;
   int security_bits;
@@ -740,6 +748,10 @@
   if (stream) {
     logger_->UpdateReceivedFrameCounts(stream_id, stream->num_frames_received(),
                                        stream->num_duplicate_frames_received());
+    if (stream_id % 2 == 0) {
+      // Stream with even stream is initiated by server for PUSH.
+      bytes_pushed_count_ += stream->stream_bytes_read();
+    }
   }
   QuicSpdySession::CloseStream(stream_id);
   OnClosedStream();
@@ -748,6 +760,13 @@
 void QuicChromiumClientSession::SendRstStream(QuicStreamId id,
                                               QuicRstStreamErrorCode error,
                                               QuicStreamOffset bytes_written) {
+  ReliableQuicStream* stream = GetOrCreateStream(id);
+  if (stream) {
+    if (id % 2 == 0) {
+      // Stream with even stream is initiated by server for PUSH.
+      bytes_pushed_count_ += stream->stream_bytes_read();
+    }
+  }
   QuicSpdySession::SendRstStream(id, error, bytes_written);
   OnClosedStream();
 }
@@ -1408,6 +1427,12 @@
   QuicClientSessionBase::DeletePromised(promised);
 }
 
+void QuicChromiumClientSession::OnPushStreamTimedOut(QuicStreamId stream_id) {
+  QuicSpdyStream* stream = GetPromisedStream(stream_id);
+  DCHECK(stream);
+  bytes_pushed_and_unclaimed_count_ += stream->stream_bytes_read();
+}
+
 const LoadTimingInfo::ConnectTiming&
 QuicChromiumClientSession::GetConnectTiming() {
   connect_timing_.ssl_start = connect_timing_.connect_start;
diff --git a/net/quic/chromium/quic_chromium_client_session.h b/net/quic/chromium/quic_chromium_client_session.h
index ba619692..2b8954d 100644
--- a/net/quic/chromium/quic_chromium_client_session.h
+++ b/net/quic/chromium/quic_chromium_client_session.h
@@ -303,6 +303,8 @@
 
   void DeletePromised(QuicClientPromisedInfo* promised) override;
 
+  void OnPushStreamTimedOut(QuicStreamId stream_id) override;
+
   const LoadTimingInfo::ConnectTiming& GetConnectTiming();
 
  protected:
@@ -382,6 +384,8 @@
   // UMA histogram counters for streams pushed to this session.
   int streams_pushed_count_;
   int streams_pushed_and_claimed_count_;
+  uint64_t bytes_pushed_count_;
+  uint64_t bytes_pushed_and_unclaimed_count_;
   // Stores packet that witnesses socket write error. This packet is
   // written to a new socket after migration completes.
   scoped_refptr<StringIOBuffer> packet_;
diff --git a/net/quic/core/quic_client_promised_info.cc b/net/quic/core/quic_client_promised_info.cc
index 6024bd5..ffd95c1 100644
--- a/net/quic/core/quic_client_promised_info.cc
+++ b/net/quic/core/quic_client_promised_info.cc
@@ -25,6 +25,7 @@
 
 void QuicClientPromisedInfo::CleanupAlarm::OnAlarm() {
   DVLOG(1) << "self GC alarm for stream " << promised_->id_;
+  promised_->session()->OnPushStreamTimedOut(promised_->id_);
   if (FLAGS_quic_send_push_stream_timed_out_error) {
     promised_->Reset(QUIC_PUSH_STREAM_TIMED_OUT);
   } else {
diff --git a/net/quic/core/quic_client_session_base.cc b/net/quic/core/quic_client_session_base.cc
index 2d3bb29..e8a66ee 100644
--- a/net/quic/core/quic_client_session_base.cc
+++ b/net/quic/core/quic_client_session_base.cc
@@ -194,6 +194,8 @@
   promised_by_id_.erase(promised->id());
 }
 
+void QuicClientSessionBase::OnPushStreamTimedOut(QuicStreamId stream_id) {}
+
 void QuicClientSessionBase::ResetPromised(QuicStreamId id,
                                           QuicRstStreamErrorCode error_code) {
   SendRstStream(id, error_code, 0);
diff --git a/net/quic/core/quic_client_session_base.h b/net/quic/core/quic_client_session_base.h
index 0233b0c3..c8ec8bb 100644
--- a/net/quic/core/quic_client_session_base.h
+++ b/net/quic/core/quic_client_session_base.h
@@ -103,6 +103,8 @@
   // promised.
   virtual void DeletePromised(QuicClientPromisedInfo* promised);
 
+  virtual void OnPushStreamTimedOut(QuicStreamId stream_id);
+
   // Sends Rst for the stream, and makes sure that future calls to
   // IsClosedStream(id) return true, which ensures that any subsequent
   // frames related to this stream will be ignored (modulo flow
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc
index 82c8f35..8f22947 100644
--- a/net/socket/ssl_server_socket_unittest.cc
+++ b/net/socket/ssl_server_socket_unittest.cc
@@ -549,17 +549,19 @@
   ASSERT_TRUE(client_socket_->GetSSLInfo(&ssl_info));
   EXPECT_EQ(CERT_STATUS_AUTHORITY_INVALID, ssl_info.cert_status);
 
-  // The default cipher suite should be ECDHE and, unless on NSS and the
-  // platform doesn't support it, an AEAD.
+  // The default cipher suite should be ECDHE and an AEAD.
   uint16_t cipher_suite =
       SSLConnectionStatusToCipherSuite(ssl_info.connection_status);
   const char* key_exchange;
   const char* cipher;
   const char* mac;
   bool is_aead;
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, cipher_suite);
-  EXPECT_STREQ("ECDHE_RSA", key_exchange);
+  bool is_tls13;
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          cipher_suite);
   EXPECT_TRUE(is_aead);
+  ASSERT_FALSE(is_tls13);
+  EXPECT_STREQ("ECDHE_RSA", key_exchange);
 }
 
 // This test makes sure the session cache is working.
diff --git a/net/spdy/mock_spdy_framer_visitor.cc b/net/spdy/mock_spdy_framer_visitor.cc
index c13d4a3..9fd594db 100644
--- a/net/spdy/mock_spdy_framer_visitor.cc
+++ b/net/spdy/mock_spdy_framer_visitor.cc
@@ -9,7 +9,7 @@
 namespace test {
 
 MockSpdyFramerVisitor::MockSpdyFramerVisitor() {
-  DelegateNewHeaderHandling();
+  DelegateHeaderHandling();
 }
 
 MockSpdyFramerVisitor::~MockSpdyFramerVisitor() {}
diff --git a/net/spdy/mock_spdy_framer_visitor.h b/net/spdy/mock_spdy_framer_visitor.h
index 9183883..b9020f4 100644
--- a/net/spdy/mock_spdy_framer_visitor.h
+++ b/net/spdy/mock_spdy_framer_visitor.h
@@ -8,6 +8,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/strings/string_piece.h"
 #include "net/spdy/spdy_framer.h"
 #include "net/spdy/spdy_test_utils.h"
@@ -78,7 +80,7 @@
                     bool exclusive));
   MOCK_METHOD2(OnUnknownFrame, bool(SpdyStreamId stream_id, int frame_type));
 
-  void DelegateNewHeaderHandling() {
+  void DelegateHeaderHandling() {
     ON_CALL(*this, OnHeaderFrameStart(testing::_))
         .WillByDefault(testing::Invoke(
             this, &MockSpdyFramerVisitor::ReturnTestHeadersHandler));
diff --git a/net/spdy/spdy_deframer_visitor_test.cc b/net/spdy/spdy_deframer_visitor_test.cc
index 9b1a1f29..9e94798 100644
--- a/net/spdy/spdy_deframer_visitor_test.cc
+++ b/net/spdy/spdy_deframer_visitor_test.cc
@@ -33,7 +33,6 @@
  protected:
   SpdyDeframerVisitorTest() : encoder_(HTTP2), decoder_(HTTP2) {
     decoder_.set_process_single_input_frame(true);
-    decoder_.set_use_new_methods_for_test(true);
     auto collector = MakeUnique<DeframerCallbackCollector>(&collected_frames_);
     auto log_and_collect =
         SpdyDeframerVisitorInterface::LogBeforeVisiting(std::move(collector));
diff --git a/net/spdy/spdy_flags.cc b/net/spdy/spdy_flags.cc
index 8e99ff5..3bfa052 100644
--- a/net/spdy/spdy_flags.cc
+++ b/net/spdy/spdy_flags.cc
@@ -9,10 +9,6 @@
 // Log compressed size of HTTP/2 requests.
 bool FLAGS_chromium_http2_flag_log_compressed_size = true;
 
-// If true, SpdyFramer uses the new visitor methods OnHeaderFrameStart and
-// OnHeaderFrameEnd.  Fourth attempt.
-bool FLAGS_chromium_http2_flag_spdy_framer_use_new_methods4 = true;
-
 // If true, increase HPACK table size up to optimal size kOptTableSize if
 // clients allow it.
 bool FLAGS_chromium_reloadable_flag_increase_hpack_table_size = false;
diff --git a/net/spdy/spdy_flags.h b/net/spdy/spdy_flags.h
index 44234af..cf0db83 100644
--- a/net/spdy/spdy_flags.h
+++ b/net/spdy/spdy_flags.h
@@ -11,8 +11,6 @@
 
 NET_EXPORT_PRIVATE extern bool FLAGS_chromium_http2_flag_log_compressed_size;
 NET_EXPORT_PRIVATE extern bool
-    FLAGS_chromium_http2_flag_spdy_framer_use_new_methods4;
-NET_EXPORT_PRIVATE extern bool
     FLAGS_chromium_reloadable_flag_increase_hpack_table_size;
 NET_EXPORT_PRIVATE extern bool FLAGS_use_nested_spdy_framer_decoder;
 
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index e4a509c..4166da9 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -7,6 +7,7 @@
 #include <string.h>
 
 #include <algorithm>
+#include <cctype>
 #include <ios>
 #include <iterator>
 #include <list>
@@ -19,6 +20,7 @@
 #include "base/logging.h"
 #include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
+#include "base/strings/string_util.h"
 #include "net/quic/core/quic_flags.h"
 #include "net/spdy/hpack/hpack_constants.h"
 #include "net/spdy/spdy_bitmasks.h"
@@ -1404,9 +1406,11 @@
   SpdyHeaderBlock::const_iterator it;
   for (it = headers->begin(); it != headers->end(); ++it) {
     WriteLengthZ(it->first.size(), length_length, kZStandardData, z);
-    WriteZ(it->first, kZStandardData, z);
 
-    if (it->first == "cookie") {
+    std::string lowercase_key = base::ToLowerASCII(it->first);
+    WriteZ(lowercase_key, kZStandardData, z);
+
+    if (lowercase_key == "cookie") {
       // We require the cookie values (save for the last) to end with a
       // semicolon and (save for the first) to start with a space. This is
       // typically the format that we are given them in but we reserialize them
@@ -1464,19 +1468,19 @@
         }
         WriteZ(cookie, kZCookieData, z);
       }
-    } else if (it->first == "accept" ||
-               it->first == "accept-charset" ||
-               it->first == "accept-encoding" ||
-               it->first == "accept-language" ||
-               it->first == "host" ||
-               it->first == "version" ||
-               it->first == "method" ||
-               it->first == "scheme" ||
-               it->first == ":host" ||
-               it->first == ":version" ||
-               it->first == ":method" ||
-               it->first == ":scheme" ||
-               it->first == "user-agent") {
+    } else if (lowercase_key == "accept" ||
+               lowercase_key == "accept-charset" ||
+               lowercase_key == "accept-encoding" ||
+               lowercase_key == "accept-language" ||
+               lowercase_key == "host" ||
+               lowercase_key == "version" ||
+               lowercase_key == "method" ||
+               lowercase_key == "scheme" ||
+               lowercase_key == ":host" ||
+               lowercase_key == ":version" ||
+               lowercase_key == ":method" ||
+               lowercase_key == ":scheme" ||
+               lowercase_key == "user-agent") {
       WriteLengthZ(it->second.size(), length_length, kZStandardData, z);
       WriteZ(it->second, kZStandardData, z);
     } else {
@@ -1696,7 +1700,7 @@
 #endif
     }
 
-    if (use_new_methods_ && current_frame_type_ != CONTINUATION) {
+    if (current_frame_type_ != CONTINUATION) {
       header_handler_ = visitor_->OnHeaderFrameStart(current_frame_stream_id_);
       if (header_handler_ == nullptr) {
         SPDY_BUG << "visitor_->OnHeaderFrameStart returned nullptr";
@@ -1766,34 +1770,18 @@
         size_t compressed_len = 0;
         if (GetHpackDecoder()->HandleControlFrameHeadersComplete(
                 &compressed_len)) {
-          if (use_new_methods_) {
-            visitor_->OnHeaderFrameEnd(current_frame_stream_id_, true);
-            if (state_ == SPDY_ERROR) {
-              return data_len;
-            }
-          } else {
-            // TODO(jgraettinger): To be removed with migration to
-            // SpdyHeadersHandlerInterface. Serializes the HPACK block as a
-            // SPDY3 block, delivered via reentrant call to
-            // ProcessControlFrameHeaderBlock().
-            DeliverHpackBlockAsSpdy3Block(compressed_len);
-            return process_bytes;
+          visitor_->OnHeaderFrameEnd(current_frame_stream_id_, true);
+          if (state_ == SPDY_ERROR) {
+            return data_len;
           }
         } else {
           set_error(SPDY_DECOMPRESS_FAILURE);
           processed_successfully = false;
         }
       } else {
-        if (use_new_methods_) {
-          visitor_->OnHeaderFrameEnd(current_frame_stream_id_, true);
-          if (state_ == SPDY_ERROR) {
-            return data_len;
-          }
-        } else {
-          // The complete header block has been delivered. We send a zero-length
-          // OnControlFrameHeaderData() to indicated this.
-          visitor_->OnControlFrameHeaderData(current_frame_stream_id_, nullptr,
-                                             0);
+        visitor_->OnHeaderFrameEnd(current_frame_stream_id_, true);
+        if (state_ == SPDY_ERROR) {
+          return data_len;
         }
       }
     }
@@ -2360,6 +2348,14 @@
                << num_headers << ").";
       return false;
     }
+    const char* begin = temp.data();
+    const char* end = begin;
+    std::advance(end, temp.size());
+    if (protocol_version_ == HTTP2 && std::any_of(begin, end, isupper)) {
+      DVLOG(1) << "Malformed header: Header name " << temp
+               << " contains upper-case characters.";
+      return false;
+    }
     std::string name = temp.as_string();
 
     // Read header value.
@@ -3301,17 +3297,11 @@
     if ((rv == Z_OK) || input_exhausted) {
       size_t decompressed_len = arraysize(buffer) - decomp->avail_out;
       if (decompressed_len > 0) {
-        if (use_new_methods_) {
-          processed_successfully =
-              header_parser_->HandleControlFrameHeadersData(stream_id, buffer,
-                                                            decompressed_len);
-          if (header_parser_->get_error() ==
-              SpdyHeadersBlockParser::NEED_MORE_DATA) {
-            processed_successfully = true;
-          }
-        } else {
-          processed_successfully = visitor_->OnControlFrameHeaderData(
-              stream_id, buffer, decompressed_len);
+        processed_successfully = header_parser_->HandleControlFrameHeadersData(
+            stream_id, buffer, decompressed_len);
+        if (header_parser_->get_error() ==
+            SpdyHeadersBlockParser::NEED_MORE_DATA) {
+          processed_successfully = true;
         }
       }
       if (!processed_successfully) {
@@ -3333,16 +3323,10 @@
   bool read_successfully = true;
   while (read_successfully && len > 0) {
     size_t bytes_to_deliver = std::min(len, kHeaderDataChunkMaxSize);
-    if (use_new_methods_) {
-      read_successfully = header_parser_->HandleControlFrameHeadersData(
-          stream_id, data, bytes_to_deliver);
-      if (header_parser_->get_error() ==
-          SpdyHeadersBlockParser::NEED_MORE_DATA) {
-        read_successfully = true;
-      }
-    } else {
-      read_successfully =
-          visitor_->OnControlFrameHeaderData(stream_id, data, bytes_to_deliver);
+    read_successfully = header_parser_->HandleControlFrameHeadersData(
+        stream_id, data, bytes_to_deliver);
+    if (header_parser_->get_error() == SpdyHeadersBlockParser::NEED_MORE_DATA) {
+      read_successfully = true;
     }
     data += bytes_to_deliver;
     len -= bytes_to_deliver;
@@ -3393,7 +3377,7 @@
 
   // Serialize each header.
   for (const auto& header : header_block) {
-    builder->WriteStringPiece32(header.first);
+    builder->WriteStringPiece32(base::ToLowerASCII(header.first));
     builder->WriteStringPiece32(header.second);
   }
 }
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
index 7fd04e4..ecfcc429 100644
--- a/net/spdy/spdy_framer.h
+++ b/net/spdy/spdy_framer.h
@@ -635,11 +635,6 @@
   void SetEncoderHeaderTableDebugVisitor(
       std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor);
 
-  // For testing support (i.e. for clients and backends),
-  // allow overriding the flag on a per framer basis.
-  void set_use_new_methods_for_test(bool v) { use_new_methods_ = v; }
-  bool use_new_methods_for_test() const { return use_new_methods_; }
-
  protected:
   friend class BufferedSpdyFramer;
   friend class HttpNetworkLayer;  // This is temporary for the server.
@@ -907,9 +902,6 @@
   // If true, then ProcessInput returns after processing a full frame,
   // rather than reading all available input.
   bool process_single_input_frame_ = false;
-
-  bool use_new_methods_ =
-      FLAGS_chromium_http2_flag_spdy_framer_use_new_methods4;
 };
 
 }  // namespace net
diff --git a/net/spdy/spdy_framer_decoder_adapter.cc b/net/spdy/spdy_framer_decoder_adapter.cc
index 949cbdf..f8c6f67 100644
--- a/net/spdy/spdy_framer_decoder_adapter.cc
+++ b/net/spdy/spdy_framer_decoder_adapter.cc
@@ -6,6 +6,7 @@
 
 #include <memory>
 #include <string>
+#include <utility>
 
 #include "base/format_macros.h"
 #include "base/logging.h"
@@ -233,12 +234,6 @@
 
   size_t ProcessInput(const char* data, size_t len) override {
     DVLOG(2) << "ProcessInput(data, " << len << ")";
-    const bool use_new_methods = outer_->use_new_methods_for_test();
-    if (framer_.use_new_methods_for_test() != use_new_methods) {
-      DVLOG(1) << "Overriding use_new_methods_ in nested framer, setting="
-               << (use_new_methods ? "true" : "false");
-      framer_.set_use_new_methods_for_test(use_new_methods);
-    }
     size_t result = framer_.ProcessInput(data, len);
     DVLOG(2) << "ProcessInput(data, " << len << ")  returning " << result;
     return result;
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index bbfd025..4c751c2 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -37,8 +37,6 @@
 
 namespace test {
 
-static const size_t kMaxDecompressedSize = 1024;
-
 class MockDebugVisitor : public SpdyFramerDebugVisitorInterface {
  public:
   MOCK_METHOD4(OnSendCompressedFrame,
@@ -64,7 +62,7 @@
   template <class SpdyFrameType>
   static SpdySerializedFrame DecompressFrame(SpdyFramer* framer,
                                              const SpdyFrameType& frame) {
-    NewDecompressionVisitor visitor;
+    DecompressionVisitor visitor;
     framer->set_visitor(&visitor);
     CHECK_EQ(frame.size(), framer->ProcessInput(frame.data(), frame.size()));
     CHECK_EQ(SpdyFramer::SPDY_READY_FOR_FRAME, framer->state());
@@ -74,9 +72,9 @@
     return serializer.SerializeFrame(visitor.GetFrame());
   }
 
-  class NewDecompressionVisitor : public SpdyFramerVisitorInterface {
+  class DecompressionVisitor : public SpdyFramerVisitorInterface {
    public:
-    NewDecompressionVisitor() : finished_(false) {}
+    DecompressionVisitor() : finished_(false) {}
 
     const SpdyFrameIR& GetFrame() const {
       CHECK(finished_);
@@ -210,178 +208,6 @@
     std::unique_ptr<SpdyFrameWithHeaderBlockIR> frame_;
     bool finished_;
 
-    DISALLOW_COPY_AND_ASSIGN(NewDecompressionVisitor);
-  };
-
-  class DecompressionVisitor : public SpdyFramerVisitorInterface {
-   public:
-    explicit DecompressionVisitor(SpdyMajorVersion version)
-        : version_(version), size_(0), finished_(false) {}
-
-    void ResetBuffer() {
-      CHECK(buffer_.get() == NULL);
-      CHECK_EQ(0u, size_);
-      CHECK(!finished_);
-      buffer_.reset(new char[kMaxDecompressedSize]);
-    }
-
-    void OnError(SpdyFramer* framer) override { LOG(FATAL); }
-    void OnDataFrameHeader(SpdyStreamId stream_id,
-                           size_t length,
-                           bool fin) override {
-      LOG(FATAL) << "Unexpected data frame header";
-    }
-    void OnStreamFrameData(SpdyStreamId stream_id,
-                           const char* data,
-                           size_t len) override {
-      LOG(FATAL);
-    }
-
-    void OnStreamEnd(SpdyStreamId stream_id) override { LOG(FATAL); }
-
-    void OnStreamPadding(SpdyStreamId stream_id, size_t len) override {
-      LOG(FATAL);
-    }
-
-    SpdyHeadersHandlerInterface* OnHeaderFrameStart(
-        SpdyStreamId stream_id) override {
-      LOG(FATAL) << "Not implemented.";
-      return nullptr;
-    }
-
-    void OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) override {
-      LOG(FATAL) << "Not implemented.";
-    }
-
-    bool OnControlFrameHeaderData(SpdyStreamId stream_id,
-                                  const char* header_data,
-                                  size_t len) override {
-      CHECK(buffer_.get() != NULL);
-      CHECK_GE(kMaxDecompressedSize, size_ + len);
-      CHECK(!finished_);
-      if (len != 0) {
-        memcpy(buffer_.get() + size_, header_data, len);
-        size_ += len;
-      } else {
-        // Done.
-        finished_ = true;
-      }
-      return true;
-    }
-
-    void OnSynStream(SpdyStreamId stream_id,
-                     SpdyStreamId associated_stream_id,
-                     SpdyPriority priority,
-                     bool fin,
-                     bool unidirectional) override {
-      SpdyFramer framer(version_);
-      framer.set_enable_compression(false);
-      SpdySynStreamIR syn_stream(stream_id);
-      syn_stream.set_associated_to_stream_id(associated_stream_id);
-      syn_stream.set_priority(priority);
-      syn_stream.set_fin(fin);
-      syn_stream.set_unidirectional(unidirectional);
-      SpdySerializedFrame frame(framer.SerializeSynStream(syn_stream));
-      ResetBuffer();
-      memcpy(buffer_.get(), frame.data(), framer.GetSynStreamMinimumSize());
-      size_ += framer.GetSynStreamMinimumSize();
-    }
-
-    void OnSynReply(SpdyStreamId stream_id, bool fin) override {
-      SpdyFramer framer(version_);
-      framer.set_enable_compression(false);
-      SpdyHeadersIR headers(stream_id);
-      headers.set_fin(fin);
-      SpdySerializedFrame frame(framer.SerializeHeaders(headers));
-      ResetBuffer();
-      memcpy(buffer_.get(), frame.data(), framer.GetHeadersMinimumSize());
-      size_ += framer.GetSynStreamMinimumSize();
-    }
-
-    void OnRstStream(SpdyStreamId stream_id,
-                     SpdyRstStreamStatus status) override {
-      LOG(FATAL);
-    }
-    void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) override {
-      LOG(FATAL);
-    }
-    void OnPing(SpdyPingId unique_id, bool is_ack) override { LOG(FATAL); }
-    void OnSettingsEnd() override { LOG(FATAL); }
-    void OnGoAway(SpdyStreamId last_accepted_stream_id,
-                  SpdyGoAwayStatus status) override {
-      LOG(FATAL);
-    }
-
-    void OnHeaders(SpdyStreamId stream_id,
-                   bool has_priority,
-                   int weight,
-                   SpdyStreamId parent_stream_id,
-                   bool exclusive,
-                   bool fin,
-                   bool end) override {
-      SpdyFramer framer(version_);
-      framer.set_enable_compression(false);
-      SpdyHeadersIR headers(stream_id);
-      headers.set_has_priority(has_priority);
-      headers.set_weight(weight);
-      headers.set_parent_stream_id(parent_stream_id);
-      headers.set_exclusive(exclusive);
-      headers.set_fin(fin);
-      SpdySerializedFrame frame(framer.SerializeHeaders(headers));
-      ResetBuffer();
-      memcpy(buffer_.get(), frame.data(), framer.GetHeadersMinimumSize());
-      size_ += framer.GetHeadersMinimumSize();
-    }
-
-    void OnWindowUpdate(SpdyStreamId stream_id,
-                        int delta_window_size) override {
-      LOG(FATAL);
-    }
-
-    void OnPushPromise(SpdyStreamId stream_id,
-                       SpdyStreamId promised_stream_id,
-                       bool end) override {
-      SpdyFramer framer(version_);
-      framer.set_enable_compression(false);
-      SpdyPushPromiseIR push_promise(stream_id, promised_stream_id);
-      SpdySerializedFrame frame(framer.SerializePushPromise(push_promise));
-      ResetBuffer();
-      memcpy(buffer_.get(), frame.data(), framer.GetPushPromiseMinimumSize());
-      size_ += framer.GetPushPromiseMinimumSize();
-    }
-
-    void OnContinuation(SpdyStreamId stream_id, bool end) override {
-      LOG(FATAL);
-    }
-
-    void OnPriority(SpdyStreamId stream_id,
-                    SpdyStreamId parent_stream_id,
-                    int weight,
-                    bool exclusive) override {
-      // Do nothing.
-    }
-
-    bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override {
-      LOG(FATAL);
-      return false;
-    }
-
-    char* ReleaseBuffer() {
-      CHECK(finished_);
-      return buffer_.release();
-    }
-
-    size_t size() const {
-      CHECK(finished_);
-      return size_;
-    }
-
-   private:
-    SpdyMajorVersion version_;
-    std::unique_ptr<char[]> buffer_;
-    size_t size_;
-    bool finished_;
-
     DISALLOW_COPY_AND_ASSIGN(DecompressionVisitor);
   };
 
@@ -1004,6 +830,73 @@
   EXPECT_EQ(0u, visitor.headers_.size());
 }
 
+// Test that we make all header field names (keys) lower case on encoding.
+TEST_P(SpdyFramerTest, HeaderBlockToLowerCase) {
+  // The HPACK encoding path does not lowercase field names.
+  if (IsHttp2()) {
+    return;
+  }
+
+  SpdyFramer framer(spdy_version_);
+  framer.set_enable_compression(true);
+
+  // Encode the header block into a Headers frame.
+  SpdyHeadersIR headers_ir(1);
+  headers_ir.SetHeader("aLpha", "beta");
+  headers_ir.SetHeader("GAMMA", "charlie");
+  headers_ir.SetHeader("foo", "Bar");  // Upper case values are okay.
+  SpdySerializedFrame frame(
+      SpdyFramerPeer::SerializeHeaders(&framer, headers_ir));
+  TestSpdyVisitor visitor(spdy_version_);
+  visitor.use_compression_ = true;
+  visitor.SimulateInFramer(reinterpret_cast<unsigned char*>(frame.data()),
+                           frame.size());
+  EXPECT_EQ(1, visitor.headers_frame_count_);
+  EXPECT_EQ(headers_ir.header_block().size(), visitor.headers_.size());
+  EXPECT_EQ("beta", visitor.headers_["alpha"]);
+  EXPECT_EQ("charlie", visitor.headers_["gamma"]);
+  EXPECT_EQ("Bar", visitor.headers_["foo"]);
+}
+
+// Test that we treat incoming upper-case or mixed-case header values as
+// malformed for HTTP2.
+TEST_P(SpdyFramerTest, RejectUpperCaseHeaderBlockValue) {
+  if (!IsHttp2()) {
+    return;
+  }
+
+  SpdyFramer framer(spdy_version_);
+  framer.set_enable_compression(false);
+
+  SpdyFrameBuilder frame(1024, spdy_version_);
+  frame.BeginNewFrame(framer, HEADERS, 0, 1);
+  frame.WriteUInt32(1);
+  frame.WriteStringPiece32("Name1");
+  frame.WriteStringPiece32("value1");
+  frame.RewriteLength(framer);
+
+  SpdyFrameBuilder frame2(1024, spdy_version_);
+  frame2.BeginNewFrame(framer, HEADERS, 0, 1);
+  frame2.WriteUInt32(2);
+  frame2.WriteStringPiece32("name1");
+  frame2.WriteStringPiece32("value1");
+  frame2.WriteStringPiece32("nAmE2");
+  frame2.WriteStringPiece32("value2");
+  frame2.RewriteLength(framer);
+
+  SpdySerializedFrame control_frame(frame.take());
+  StringPiece serialized_headers = GetSerializedHeaders(control_frame, framer);
+  SpdySerializedFrame control_frame2(frame2.take());
+  StringPiece serialized_headers2 =
+      GetSerializedHeaders(control_frame2, framer);
+
+  SpdyHeaderBlock new_headers;
+  EXPECT_FALSE(framer.ParseHeaderBlockInBuffer(
+      serialized_headers.data(), serialized_headers.size(), &new_headers));
+  EXPECT_FALSE(framer.ParseHeaderBlockInBuffer(
+      serialized_headers2.data(), serialized_headers2.size(), &new_headers));
+}
+
 // Test that we can encode and decode stream dependency values in a header
 // frame.
 TEST_P(SpdyFramerTest, HeaderStreamDependencyValues) {
@@ -4756,7 +4649,7 @@
   const unsigned char kInput[] = {
       0x00, 0x00, 0x14,                       // Length: 20
       0x01,                                   //   Type: HEADERS
-      0x09,                                   //  Flags: FIN, PADDED
+      0x08,                                   //  Flags: PADDED
       0x00, 0x00, 0x00, 0x01,                 // Stream: 1
       0x03,                                   // PadLen: 3 trailing bytes
       0x00,                                   // Unindexed Entry
@@ -4800,6 +4693,65 @@
   EXPECT_EQ(0, visitor.error_count_);
   EXPECT_EQ(1, visitor.headers_frame_count_);
   EXPECT_EQ(2, visitor.continuation_count_);
+  EXPECT_EQ(0, visitor.zero_length_control_frame_header_data_count_);
+  EXPECT_EQ(0, visitor.end_of_stream_count_);
+
+  EXPECT_THAT(
+      visitor.headers_,
+      testing::ElementsAre(testing::Pair("cookie", "foo=bar; baz=bing; "),
+                           testing::Pair("name", "value")));
+}
+
+TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
+  if (!IsHttp2()) {
+    return;
+  }
+  // frame-format off
+  const unsigned char kInput[] = {
+      0x00, 0x00, 0x10,                       // Length: 20
+      0x01,                                   //   Type: HEADERS
+      0x01,                                   //  Flags: END_STREAM
+      0x00, 0x00, 0x00, 0x01,                 // Stream: 1
+      0x00,                                   // Unindexed Entry
+      0x06,                                   // Name Len: 6
+      'c',  'o',  'o',  'k',  'i', 'e',       // Name
+      0x07,                                   // Value Len: 7
+      'f',  'o',  'o',  '=',  'b', 'a', 'r',  // Value
+
+      0x00, 0x00, 0x14,                            // Length: 20
+      0x09,                                        //   Type: CONTINUATION
+      0x00,                                        //  Flags: none
+      0x00, 0x00, 0x00, 0x01,                      // Stream: 1
+      0x00,                                        // Unindexed Entry
+      0x06,                                        // Name Len: 6
+      'c',  'o',  'o',  'k',  'i', 'e',            // Name
+      0x08,                                        // Value Len: 7
+      'b',  'a',  'z',  '=',  'b', 'i', 'n', 'g',  // Value
+      0x00,                                        // Unindexed Entry
+      0x06,                                        // Name Len: 6
+      'c',                                         // Name (split)
+
+      0x00, 0x00, 0x12,             // Length: 18
+      0x09,                         //   Type: CONTINUATION
+      0x04,                         //  Flags: END_HEADERS
+      0x00, 0x00, 0x00, 0x01,       // Stream: 1
+      'o',  'o',  'k',  'i',  'e',  // Name (continued)
+      0x00,                         // Value Len: 0
+      0x00,                         // Unindexed Entry
+      0x04,                         // Name Len: 4
+      'n',  'a',  'm',  'e',        // Name
+      0x05,                         // Value Len: 5
+      'v',  'a',  'l',  'u',  'e',  // Value
+  };
+  // frame-format on
+
+  SpdyFramer framer(spdy_version_);
+  TestSpdyVisitor visitor(spdy_version_);
+  visitor.SimulateInFramer(kInput, sizeof(kInput));
+
+  EXPECT_EQ(0, visitor.error_count_);
+  EXPECT_EQ(1, visitor.headers_frame_count_);
+  EXPECT_EQ(2, visitor.continuation_count_);
   EXPECT_EQ(1, visitor.fin_flag_count_);
   EXPECT_EQ(0, visitor.zero_length_control_frame_header_data_count_);
   EXPECT_EQ(1, visitor.end_of_stream_count_);
@@ -5800,9 +5752,7 @@
     bool end = flags & PUSH_PROMISE_FLAG_END_PUSH_PROMISE;
     EXPECT_CALL(debug_visitor,
                 OnReceiveCompressedFrame(client_id, PUSH_PROMISE, _));
-    EXPECT_CALL(visitor,
-                OnPushPromise(client_id, promised_id,
-                              flags & PUSH_PROMISE_FLAG_END_PUSH_PROMISE));
+    EXPECT_CALL(visitor, OnPushPromise(client_id, promised_id, end));
     EXPECT_CALL(visitor, OnHeaderFrameStart(client_id)).Times(1);
     if (end) {
       EXPECT_CALL(visitor, OnHeaderFrameEnd(client_id, _)).Times(1);
diff --git a/net/ssl/ssl_cipher_suite_names.cc b/net/ssl/ssl_cipher_suite_names.cc
index ba2129aa0..24f54fc0d 100644
--- a/net/ssl/ssl_cipher_suite_names.cc
+++ b/net/ssl/ssl_cipher_suite_names.cc
@@ -129,6 +129,9 @@
     {0xc3, 0x85b},     // TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256
     {0xc4, 0xa5b},     // TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
     {0xc5, 0xc5b},     // TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256
+    {0x1301, 0x1f6f},  // TLS_AES_128_GCM_SHA256
+    {0x1302, 0x1f77},  // TLS_AES_256_GCM_SHA384
+    {0x1303, 0x1f8f},  // TLS_CHACHA20_POLY1305_SHA256
     {0x16b7, 0x128f},  // TLS_CECPQ1_RSA_WITH_CHACHA20_POLY1305_SHA256 (exper)
     {0x16b8, 0x138f},  // TLS_CECPQ1_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (exper)
     {0x16b9, 0x1277},  // TLS_CECPQ1_RSA_WITH_AES_256_GCM_SHA384 (exper)
@@ -206,37 +209,36 @@
     {0xcc14, 0x0e8f},  // TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 (non-standard)
     {0xcca8, 0x108f},  // TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
     {0xcca9, 0x0e8f},  // TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
-    {0xccab, 0x148f},  // TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256
-    {0xd001, 0x146f},  // TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256
-    {0xd002, 0x1477},  // TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384
 };
 
 const struct {
   char name[15];
-} kKeyExchangeNames[21] = {
-  {"NULL"},  // 0
-  {"RSA"},  // 1
-  {"RSA_EXPORT"},  // 2
-  {"DH_DSS_EXPORT"},  // 3
-  {"DH_DSS"},  // 4
-  {"DH_RSA_EXPORT"},  // 5
-  {"DH_RSA"},  // 6
-  {"DHE_DSS_EXPORT"},  // 7
-  {"DHE_DSS"},  // 8
-  {"DHE_RSA_EXPORT"},  // 9
-  {"DHE_RSA"},  // 10
-  {"DH_anon_EXPORT"},  // 11
-  {"DH_anon"},  // 12
-  {"ECDH_ECDSA"},  // 13
-  {"ECDHE_ECDSA"},  // 14
-  {"ECDH_RSA"},  // 15
-  {"ECDHE_RSA"},  // 16
-  {"ECDH_anon"},  // 17
-  {"CECPQ1_RSA"},  // 18
-  {"CECPQ1_ECDSA"},  // 19
-  {"ECDHE_PSK"},  // 20
+} kKeyExchangeNames[20] = {
+    {"NULL"},            // 0
+    {"RSA"},             // 1
+    {"RSA_EXPORT"},      // 2
+    {"DH_DSS_EXPORT"},   // 3
+    {"DH_DSS"},          // 4
+    {"DH_RSA_EXPORT"},   // 5
+    {"DH_RSA"},          // 6
+    {"DHE_DSS_EXPORT"},  // 7
+    {"DHE_DSS"},         // 8
+    {"DHE_RSA_EXPORT"},  // 9
+    {"DHE_RSA"},         // 10
+    {"DH_anon_EXPORT"},  // 11
+    {"DH_anon"},         // 12
+    {"ECDH_ECDSA"},      // 13
+    {"ECDHE_ECDSA"},     // 14
+    {"ECDH_RSA"},        // 15
+    {"ECDHE_RSA"},       // 16
+    {"ECDH_anon"},       // 17
+    {"CECPQ1_RSA"},      // 18
+    {"CECPQ1_ECDSA"},    // 19
+    // 31 is reserved to indicate a TLS 1.3 AEAD-only suite.
 };
 
+constexpr int kTLS13KeyExchangeValue = 31;
+
 const struct {
   char name[18];
 } kCipherNames[18] = {
@@ -323,13 +325,12 @@
     return obsolete_ssl;
   }
 
-  // Only allow ECDHE key exchanges.
   switch (key_exchange) {
     case 14:  // ECDHE_ECDSA
     case 16:  // ECDHE_RSA
     case 18:  // CECPQ1_RSA
     case 19:  // CECPQ1_ECDSA
-    case 20:  // ECDHE_PSK
+    case kTLS13KeyExchangeValue:  // TLS 1.3
       break;
     default:
       obsolete_ssl |= net::OBSOLETE_SSL_MASK_KEY_EXCHANGE;
@@ -359,19 +360,26 @@
                              const char** cipher_str,
                              const char** mac_str,
                              bool* is_aead,
+                             bool* is_tls13,
                              uint16_t cipher_suite) {
   *key_exchange_str = *cipher_str = *mac_str = "???";
   *is_aead = false;
+  *is_tls13 = false;
 
   int key_exchange, cipher, mac;
   if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac))
     return;
 
-  *key_exchange_str = kKeyExchangeNames[key_exchange].name;
+  if (key_exchange == kTLS13KeyExchangeValue) {
+    *key_exchange_str = nullptr;
+    *is_tls13 = true;
+  } else {
+    *key_exchange_str = kKeyExchangeNames[key_exchange].name;
+  }
   *cipher_str = kCipherNames[cipher].name;
   if (mac == kAEADMACValue) {
     *is_aead = true;
-    *mac_str = NULL;
+    *mac_str = nullptr;
   } else {
     *mac_str = kMacNames[mac].name;
   }
@@ -444,7 +452,7 @@
     case 16:  // ECDHE_RSA
     case 18:  // CECPQ1_RSA
     case 19:  // CECPQ1_ECDSA
-    case 20:  // ECDHE_PSK
+    case kTLS13KeyExchangeValue:  // TLS 1.3
       break;
     default:
       return false;
diff --git a/net/ssl/ssl_cipher_suite_names.h b/net/ssl/ssl_cipher_suite_names.h
index 7c1192b..36a6d152 100644
--- a/net/ssl/ssl_cipher_suite_names.h
+++ b/net/ssl/ssl_cipher_suite_names.h
@@ -19,11 +19,15 @@
 // wire and recorded at
 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xml
 // If the cipher suite is unknown, the strings are set to "???".
-// In the case of an AEAD cipher suite, *mac_str is NULL and *is_aead is true.
+// In the case of an AEAD cipher suite, *mac_str is nullptr and *is_aead is
+// true.
+// In the case of a TLS 1.3 AEAD-only cipher suite, *key_exchange_str is nullptr
+// and *is_tls13 is true.
 NET_EXPORT void SSLCipherSuiteToStrings(const char** key_exchange_str,
                                         const char** cipher_str,
                                         const char** mac_str,
                                         bool* is_aead,
+                                        bool* is_tls13,
                                         uint16_t cipher_suite);
 
 // SSLVersionToString returns the name of the SSL protocol version
diff --git a/net/ssl/ssl_cipher_suite_names_unittest.cc b/net/ssl/ssl_cipher_suite_names_unittest.cc
index 83eb55c..5bda4c7 100644
--- a/net/ssl/ssl_cipher_suite_names_unittest.cc
+++ b/net/ssl/ssl_cipher_suite_names_unittest.cc
@@ -39,38 +39,72 @@
 
 TEST(CipherSuiteNamesTest, Basic) {
   const char *key_exchange, *cipher, *mac;
-  bool is_aead;
+  bool is_aead, is_tls13;
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xc001);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0xc001);
   EXPECT_STREQ("ECDH_ECDSA", key_exchange);
   EXPECT_STREQ("NULL", cipher);
   EXPECT_STREQ("HMAC-SHA1", mac);
   EXPECT_FALSE(is_aead);
+  EXPECT_FALSE(is_tls13);
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x009f);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x009f);
   EXPECT_STREQ("DHE_RSA", key_exchange);
   EXPECT_STREQ("AES_256_GCM", cipher);
   EXPECT_TRUE(is_aead);
-  EXPECT_EQ(NULL, mac);
+  EXPECT_FALSE(is_tls13);
+  EXPECT_EQ(nullptr, mac);
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xcca9);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0xcca9);
   EXPECT_STREQ("ECDHE_ECDSA", key_exchange);
   EXPECT_STREQ("CHACHA20_POLY1305", cipher);
   EXPECT_TRUE(is_aead);
-  EXPECT_EQ(NULL, mac);
+  EXPECT_FALSE(is_tls13);
+  EXPECT_EQ(nullptr, mac);
 
   // Non-standard variant.
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xcc14);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0xcc14);
   EXPECT_STREQ("ECDHE_ECDSA", key_exchange);
   EXPECT_STREQ("CHACHA20_POLY1305", cipher);
   EXPECT_TRUE(is_aead);
-  EXPECT_EQ(NULL, mac);
+  EXPECT_FALSE(is_tls13);
+  EXPECT_EQ(nullptr, mac);
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xff31);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0xff31);
   EXPECT_STREQ("???", key_exchange);
   EXPECT_STREQ("???", cipher);
   EXPECT_STREQ("???", mac);
   EXPECT_FALSE(is_aead);
+  EXPECT_FALSE(is_tls13);
+
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x1301);
+  EXPECT_STREQ("AES_128_GCM", cipher);
+  EXPECT_TRUE(is_aead);
+  EXPECT_TRUE(is_tls13);
+  EXPECT_EQ(nullptr, mac);
+  EXPECT_EQ(nullptr, key_exchange);
+
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x1302);
+  EXPECT_STREQ("AES_256_GCM", cipher);
+  EXPECT_TRUE(is_aead);
+  EXPECT_TRUE(is_tls13);
+  EXPECT_EQ(nullptr, mac);
+  EXPECT_EQ(nullptr, key_exchange);
+
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x1303);
+  EXPECT_STREQ("CHACHA20_POLY1305", cipher);
+  EXPECT_TRUE(is_aead);
+  EXPECT_TRUE(is_tls13);
+  EXPECT_EQ(nullptr, mac);
+  EXPECT_EQ(nullptr, key_exchange);
 }
 
 TEST(CipherSuiteNamesTest, ParseSSLCipherString) {
@@ -147,6 +181,9 @@
   EXPECT_EQ(OBSOLETE_SSL_NONE,
             ObsoleteSSLStatus(MakeConnectionStatus(
                 kModernVersion, kModernCipherModernKeyExchange)));
+  EXPECT_EQ(OBSOLETE_SSL_NONE, ObsoleteSSLStatus(MakeConnectionStatus(
+                                   SSL_CONNECTION_VERSION_TLS1_3,
+                                   0x1301 /* AES_128_GCM_SHA256 */)));
 }
 
 TEST(CipherSuiteNamesTest, HTTP2CipherSuites) {
@@ -182,6 +219,9 @@
       0xcca8 /* ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 */));
   EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(
       0xcca9 /* ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 */));
+  EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(0x1301 /* AES_128_GCM_SHA256 */));
+  EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(0x1302 /* AES_256_GCM_SHA384 */));
+  EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(0x1303 /* CHACHA20_POLY1305 */));
 }
 
 TEST(CipherSuiteNamesTest, CECPQ1) {
@@ -192,7 +232,7 @@
       0x16ba,  // TLS_CECPQ1_ECDSA_WITH_AES_256_GCM_SHA384 (non-standard)
   };
   const char *key_exchange, *cipher, *mac;
-  bool is_aead;
+  bool is_aead, is_tls13;
 
   for (const uint16_t cipher_suite_id : kCECPQ1CipherSuites) {
     SCOPED_TRACE(base::StringPrintf("cipher suite %x", cipher_suite_id));
@@ -201,25 +241,31 @@
     int connection_status =
         MakeConnectionStatus(kModernVersion, cipher_suite_id);
     EXPECT_EQ(OBSOLETE_SSL_NONE, ObsoleteSSLStatus(connection_status));
-    SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead,
+    EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(cipher_suite_id));
+    SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
                             cipher_suite_id);
     EXPECT_TRUE(is_aead);
+    EXPECT_FALSE(is_tls13);
     EXPECT_EQ(nullptr, mac);
   }
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16b7);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x16b7);
   EXPECT_STREQ("CECPQ1_RSA", key_exchange);
   EXPECT_STREQ("CHACHA20_POLY1305", cipher);
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16b8);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x16b8);
   EXPECT_STREQ("CECPQ1_ECDSA", key_exchange);
   EXPECT_STREQ("CHACHA20_POLY1305", cipher);
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16b9);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x16b9);
   EXPECT_STREQ("CECPQ1_RSA", key_exchange);
   EXPECT_STREQ("AES_256_GCM", cipher);
 
-  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16ba);
+  SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, &is_tls13,
+                          0x16ba);
   EXPECT_STREQ("CECPQ1_ECDSA", key_exchange);
   EXPECT_STREQ("AES_256_GCM", cipher);
 }
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index dad493a..80b7d2d 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -2341,17 +2341,17 @@
 }
 
 int PDFiumEngine::GetCharCount(int page_index) {
-  DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size()));
+  DCHECK(PageIndexInBounds(page_index));
   return pages_[page_index]->GetCharCount();
 }
 
 pp::FloatRect PDFiumEngine::GetCharBounds(int page_index, int char_index) {
-  DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size()));
+  DCHECK(PageIndexInBounds(page_index));
   return pages_[page_index]->GetCharBounds(char_index);
 }
 
 uint32_t PDFiumEngine::GetCharUnicode(int page_index, int char_index) {
-  DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size()));
+  DCHECK(PageIndexInBounds(page_index));
   return pages_[page_index]->GetCharUnicode(char_index);
 }
 
@@ -2360,7 +2360,7 @@
                                   uint32_t* out_len,
                                   double* out_font_size,
                                   pp::FloatRect* out_bounds) {
-  DCHECK(page_index >= 0 && page_index < static_cast<int>(pages_.size()));
+  DCHECK(PageIndexInBounds(page_index));
   return pages_[page_index]->GetTextRunInfo(start_char_index, out_len,
                                             out_font_size, out_bounds);
 }
@@ -2701,6 +2701,9 @@
 }
 
 void PDFiumEngine::ScrollToPage(int page) {
+  if (!PageIndexInBounds(page))
+    return;
+
   in_flight_visible_page_ = page;
   client_->ScrollToPage(page);
 }
@@ -2771,8 +2774,7 @@
   int rv;
   FPDF_BITMAP bitmap = progressive_paints_[progressive_index].bitmap;
   int page_index = progressive_paints_[progressive_index].page_index;
-  DCHECK_GE(page_index, 0);
-  DCHECK_LT(static_cast<size_t>(page_index), pages_.size());
+  DCHECK(PageIndexInBounds(page_index));
   FPDF_PAGE page = pages_[page_index]->GetPage();
 
   last_progressive_start_time_ = base::Time::Now();
@@ -3424,6 +3426,10 @@
     client_->IsSelectingChanged(selecting);
 }
 
+bool PDFiumEngine::PageIndexInBounds(int index) const {
+  return index >= 0 && index < static_cast<int>(pages_.size());
+}
+
 void PDFiumEngine::Form_Invalidate(FPDF_FORMFILLINFO* param,
                                    FPDF_PAGE page,
                                    double left,
@@ -3507,14 +3513,13 @@
                                      FPDF_DOCUMENT document,
                                      int page_index) {
   PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
-  if (page_index < 0 || page_index >= static_cast<int>(engine->pages_.size()))
+  if (!engine->PageIndexInBounds(page_index))
     return nullptr;
   return engine->pages_[page_index]->GetPage();
 }
 
 FPDF_PAGE PDFiumEngine::Form_GetCurrentPage(FPDF_FORMFILLINFO* param,
                                             FPDF_DOCUMENT document) {
-  // TODO(jam): find out what this is used for.
   PDFiumEngine* engine = static_cast<PDFiumEngine*>(param);
   int index = engine->last_page_mouse_down_;
   if (index == -1) {
diff --git a/pdf/pdfium/pdfium_engine.h b/pdf/pdfium/pdfium_engine.h
index 7826a5d..89406c7d 100644
--- a/pdf/pdfium/pdfium_engine.h
+++ b/pdf/pdfium/pdfium_engine.h
@@ -439,6 +439,8 @@
   // Setting selection status of document.
   void SetSelecting(bool selecting);
 
+  bool PageIndexInBounds(int index) const;
+
   // FPDF_FORMFILLINFO callbacks.
   static void Form_Invalidate(FPDF_FORMFILLINFO* param,
                               FPDF_PAGE page,
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index 5d61429fa..a5fdfca 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -156,11 +156,11 @@
     // destroys the plugin module and in turn the dispatcher.
     ScopedModuleReference scoped_ref(this);
 
-    FOR_EACH_OBSERVER(SyncMessageStatusObserver, sync_status_observer_list_,
-                      BeginBlockOnSyncMessage());
+    for (auto& observer : sync_status_observer_list_)
+      observer.BeginBlockOnSyncMessage();
     bool result = Dispatcher::Send(msg);
-    FOR_EACH_OBSERVER(SyncMessageStatusObserver, sync_status_observer_list_,
-                      EndBlockOnSyncMessage());
+    for (auto& observer : sync_status_observer_list_)
+      observer.EndBlockOnSyncMessage();
 
     return result;
   } else {
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 6317d2ab..dcb8704 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -356,14 +356,6 @@
   event_handler_->OnSessionClosed(this);
 }
 
-void ClientSession::OnInputEventReceived(
-    int64_t event_timestamp) {
-  DCHECK(CalledOnValidThread());
-
-  if (video_stream_.get())
-    video_stream_->OnInputEventReceived(event_timestamp);
-}
-
 void ClientSession::OnRouteChange(
     const std::string& channel_name,
     const protocol::TransportRoute& route) {
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index 35b47e4..96e177f 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -119,7 +119,6 @@
   void CreateMediaStreams() override;
   void OnConnectionChannelsConnected() override;
   void OnConnectionClosed(protocol::ErrorCode error) override;
-  void OnInputEventReceived(int64_t timestamp) override;
   void OnRouteChange(const std::string& channel_name,
                      const protocol::TransportRoute& route) override;
 
diff --git a/remoting/host/register_support_host_request_unittest.cc b/remoting/host/register_support_host_request_unittest.cc
index 9bcfb9d..a467476 100644
--- a/remoting/host/register_support_host_request_unittest.cc
+++ b/remoting/host/register_support_host_request_unittest.cc
@@ -153,11 +153,8 @@
   result->AddElement(support_id_lifetime);
 
   int consumed = 0;
-  base::ObserverListBase<SignalStrategy::Listener>::Iterator it(
-      &signal_strategy_listeners_);
-  SignalStrategy::Listener* listener;
-  while ((listener = it.GetNext()) != nullptr) {
-    if (listener->OnSignalStrategyIncomingStanza(response.get()))
+  for (auto& listener : signal_strategy_listeners_) {
+    if (listener.OnSignalStrategyIncomingStanza(response.get()))
       consumed++;
   }
   EXPECT_EQ(1, consumed);
diff --git a/remoting/protocol/BUILD.gn b/remoting/protocol/BUILD.gn
index ca077717..4d399ef 100644
--- a/remoting/protocol/BUILD.gn
+++ b/remoting/protocol/BUILD.gn
@@ -76,6 +76,8 @@
     "ice_transport.h",
     "ice_transport_channel.cc",
     "ice_transport_channel.h",
+    "input_event_timestamps.cc",
+    "input_event_timestamps.h",
     "input_event_tracker.cc",
     "input_event_tracker.h",
     "input_filter.cc",
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h
index fb7857b4..ea11050 100644
--- a/remoting/protocol/connection_to_client.h
+++ b/remoting/protocol/connection_to_client.h
@@ -53,9 +53,6 @@
     // Called when the network connection is closed or failed.
     virtual void OnConnectionClosed(ErrorCode error) = 0;
 
-    // Called when a new input event is received.
-    virtual void OnInputEventReceived(int64_t timestamp) = 0;
-
     // Called on notification of a route change event, which happens when a
     // channel is connected.
     virtual void OnRouteChange(const std::string& channel_name,
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc
index 03ee5e3..75318b3 100644
--- a/remoting/protocol/connection_unittest.cc
+++ b/remoting/protocol/connection_unittest.cc
@@ -470,7 +470,6 @@
 
   base::RunLoop run_loop;
 
-  EXPECT_CALL(host_event_handler_, OnInputEventReceived(_));
   EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event)))
       .WillOnce(QuitRunLoop(&run_loop));
 
@@ -515,7 +514,6 @@
 
   base::RunLoop run_loop;
 
-  EXPECT_CALL(host_event_handler_, OnInputEventReceived(_));
   EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event)))
       .WillOnce(DoAll(InvokeWithoutArgs(this, &ConnectionTest::DestroyHost),
                       QuitRunLoop(&run_loop)));
@@ -537,12 +535,15 @@
 
   base::TimeTicks start_time = base::TimeTicks::Now();
 
+  scoped_refptr<InputEventTimestampsSourceImpl> input_event_timestamps_source =
+      new InputEventTimestampsSourceImpl();
+  input_event_timestamps_source->OnEventReceived(
+      InputEventTimestamps{start_time, start_time});
+
   std::unique_ptr<VideoStream> video_stream =
       host_connection_->StartVideoStream(
           base::MakeUnique<TestScreenCapturer>());
-
-  // Simulate an input invent injected at the start.
-  video_stream->OnInputEventReceived(start_time.ToInternalValue());
+  video_stream->SetEventTimestampsSource(input_event_timestamps_source);
 
   WaitFirstVideoFrame();
 
diff --git a/remoting/protocol/fake_connection_to_client.cc b/remoting/protocol/fake_connection_to_client.cc
index b5f09be5a..b8556b0 100644
--- a/remoting/protocol/fake_connection_to_client.cc
+++ b/remoting/protocol/fake_connection_to_client.cc
@@ -19,9 +19,10 @@
 FakeVideoStream::FakeVideoStream() : weak_factory_(this) {}
 FakeVideoStream::~FakeVideoStream() {}
 
-void FakeVideoStream::Pause(bool pause) {}
+void FakeVideoStream::SetEventTimestampsSource(
+    scoped_refptr<InputEventTimestampsSource> event_timestamps_source) {}
 
-void FakeVideoStream::OnInputEventReceived(int64_t event_timestamp) {}
+void FakeVideoStream::Pause(bool pause) {}
 
 void FakeVideoStream::SetLosslessEncode(bool want_lossless) {}
 
diff --git a/remoting/protocol/fake_connection_to_client.h b/remoting/protocol/fake_connection_to_client.h
index 2cb73b3..39440af 100644
--- a/remoting/protocol/fake_connection_to_client.h
+++ b/remoting/protocol/fake_connection_to_client.h
@@ -26,8 +26,9 @@
   ~FakeVideoStream() override;
 
   // protocol::VideoStream interface.
+  void SetEventTimestampsSource(scoped_refptr<InputEventTimestampsSource>
+                                    event_timestamps_source) override;
   void Pause(bool pause) override;
-  void OnInputEventReceived(int64_t event_timestamp) override;
   void SetLosslessEncode(bool want_lossless) override;
   void SetLosslessColor(bool want_lossless) override;
   void SetObserver(Observer* observer) override;
diff --git a/remoting/protocol/host_event_dispatcher.cc b/remoting/protocol/host_event_dispatcher.cc
index 0ee78d0..5d3269a 100644
--- a/remoting/protocol/host_event_dispatcher.cc
+++ b/remoting/protocol/host_event_dispatcher.cc
@@ -4,6 +4,7 @@
 
 #include "remoting/protocol/host_event_dispatcher.h"
 
+#include "base/memory/ref_counted.h"
 #include "net/socket/stream_socket.h"
 #include "remoting/base/compound_buffer.h"
 #include "remoting/base/constants.h"
@@ -16,7 +17,9 @@
 namespace protocol {
 
 HostEventDispatcher::HostEventDispatcher()
-    : ChannelDispatcherBase(kEventChannelName) {}
+    : ChannelDispatcherBase(kEventChannelName),
+      event_timestamps_source_(new InputEventTimestampsSourceImpl()) {}
+
 HostEventDispatcher::~HostEventDispatcher() {}
 
 void HostEventDispatcher::OnIncomingMessage(
@@ -28,8 +31,9 @@
   if (!message)
     return;
 
-  if (!on_input_event_callback_.is_null())
-    on_input_event_callback_.Run(message->timestamp());
+  event_timestamps_source_->OnEventReceived(InputEventTimestamps{
+      base::TimeTicks::FromInternalValue(message->timestamp()),
+      base::TimeTicks::Now()});
 
   if (message->has_key_event()) {
     const KeyEvent& event = message->key_event();
diff --git a/remoting/protocol/host_event_dispatcher.h b/remoting/protocol/host_event_dispatcher.h
index 4c9df5e..98186dd 100644
--- a/remoting/protocol/host_event_dispatcher.h
+++ b/remoting/protocol/host_event_dispatcher.h
@@ -9,6 +9,7 @@
 
 #include "base/macros.h"
 #include "remoting/protocol/channel_dispatcher_base.h"
+#include "remoting/protocol/input_event_timestamps.h"
 
 namespace remoting {
 namespace protocol {
@@ -20,8 +21,6 @@
 // channel to InputStub.
 class HostEventDispatcher : public ChannelDispatcherBase {
  public:
-  typedef base::Callback<void(int64_t)> OnInputEventCallback;
-
   HostEventDispatcher();
   ~HostEventDispatcher() override;
 
@@ -30,17 +29,24 @@
   // the dispatcher.
   void set_input_stub(InputStub* input_stub) { input_stub_ = input_stub; }
 
-  // Set callback to notify of each message's sequence number. The
-  // callback cannot tear down this object.
-  void set_on_input_event_callback(const OnInputEventCallback& value) {
-    on_input_event_callback_ = value;
+  // Returns InputEventTimestampsSource for events received on input channel.
+  //
+  // TODO(sergeyu): This timestamps source generates timestamps for input events
+  // as they are received. This means that any potential delay in the input
+  // injector is not accounted for. Consider moving this to InputInjector to
+  // ensure that the timestamps source emits timestamps for each input event
+  // only after it's injected. This would require updating InputStub to get
+  // timestamps for each event.
+  scoped_refptr<InputEventTimestampsSource> event_timestamps_source() {
+    return event_timestamps_source_;
   }
 
  private:
   void OnIncomingMessage(std::unique_ptr<CompoundBuffer> buffer) override;
 
+  scoped_refptr<InputEventTimestampsSourceImpl> event_timestamps_source_;
+
   InputStub* input_stub_ = nullptr;
-  OnInputEventCallback on_input_event_callback_;
 
   DISALLOW_COPY_AND_ASSIGN(HostEventDispatcher);
 };
diff --git a/remoting/protocol/ice_connection_to_client.cc b/remoting/protocol/ice_connection_to_client.cc
index b0ec636..c4a42f1 100644
--- a/remoting/protocol/ice_connection_to_client.cc
+++ b/remoting/protocol/ice_connection_to_client.cc
@@ -92,6 +92,7 @@
   std::unique_ptr<VideoFramePump> pump(
       new VideoFramePump(video_encode_task_runner_, std::move(desktop_capturer),
                          std::move(video_encoder), video_dispatcher_.get()));
+  pump->SetEventTimestampsSource(event_dispatcher_->event_timestamps_source());
   video_dispatcher_->set_video_feedback_stub(pump->video_feedback_stub());
   return std::move(pump);
 }
@@ -152,12 +153,7 @@
       // Initialize channels.
       control_dispatcher_->Init(transport_.GetMultiplexedChannelFactory(),
                                 this);
-
       event_dispatcher_->Init(transport_.GetMultiplexedChannelFactory(), this);
-      event_dispatcher_->set_on_input_event_callback(
-          base::Bind(&IceConnectionToClient::OnInputEventReceived,
-                     base::Unretained(this)));
-
       video_dispatcher_->Init(transport_.GetChannelFactory(), this);
 
       audio_writer_ = AudioWriter::Create(session_->config());
@@ -204,11 +200,6 @@
   NOTREACHED();
 }
 
-void IceConnectionToClient::OnInputEventReceived(int64_t timestamp) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  event_handler_->OnInputEventReceived(timestamp);
-}
-
 void IceConnectionToClient::NotifyIfChannelsReady() {
   DCHECK(thread_checker_.CalledOnValidThread());
 
diff --git a/remoting/protocol/input_event_timestamps.cc b/remoting/protocol/input_event_timestamps.cc
new file mode 100644
index 0000000..b75e69f
--- /dev/null
+++ b/remoting/protocol/input_event_timestamps.cc
@@ -0,0 +1,25 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/protocol/input_event_timestamps.h"
+
+namespace remoting {
+namespace protocol {
+
+InputEventTimestampsSourceImpl::InputEventTimestampsSourceImpl() {}
+InputEventTimestampsSourceImpl::~InputEventTimestampsSourceImpl() {}
+
+void InputEventTimestampsSourceImpl::OnEventReceived(
+    InputEventTimestamps timestamps) {
+  last_timestamps_ = timestamps;
+}
+
+InputEventTimestamps InputEventTimestampsSourceImpl::TakeLastEventTimestamps() {
+  InputEventTimestamps result = last_timestamps_;
+  last_timestamps_ = InputEventTimestamps();
+  return result;
+}
+
+}  // namespace protocol
+}  // namespace remoting
diff --git a/remoting/protocol/input_event_timestamps.h b/remoting/protocol/input_event_timestamps.h
new file mode 100644
index 0000000..52bca48b
--- /dev/null
+++ b/remoting/protocol/input_event_timestamps.h
@@ -0,0 +1,66 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_
+#define REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/time/time.h"
+
+namespace remoting {
+namespace protocol {
+
+// Used on the host side to track timestamps for input events.
+struct InputEventTimestamps {
+  // Client-side timestamps. This value comes from the client clock, so it
+  // should not be used for any calculations on the host side (except in tests).
+  base::TimeTicks client_timestamp;
+
+  // Time when the event was processed by the host.
+  base::TimeTicks host_timestamp;
+
+  bool is_null() { return client_timestamp.is_null(); }
+};
+
+// InputEventTimestampsSource is used by VideoStream implementations to get
+// event timestamps that are sent back to the client as part of VideoStats
+// message.
+class InputEventTimestampsSource
+    : public base::RefCountedThreadSafe<InputEventTimestampsSource> {
+ public:
+  InputEventTimestampsSource() {}
+
+  // Returns event timestamps for the input event that was received since the
+  // previous call. Null InputEventTimestamps value is returned if no input
+  // events were received. If multiple input events were received, then
+  // timestamps for the last one should be returned
+  virtual InputEventTimestamps TakeLastEventTimestamps() = 0;
+
+ protected:
+  friend base::RefCountedThreadSafe<InputEventTimestampsSource>;
+  virtual ~InputEventTimestampsSource() {}
+};
+
+// Simple implementations of InputEventTimestampsSource that just stores the
+// value provided to OnEventReceived().
+class InputEventTimestampsSourceImpl : public InputEventTimestampsSource {
+ public:
+  InputEventTimestampsSourceImpl();
+
+  void OnEventReceived(InputEventTimestamps timestamps);
+
+  // InputEventTimestampsSource implementation.
+  InputEventTimestamps TakeLastEventTimestamps() override;
+
+ protected:
+  ~InputEventTimestampsSourceImpl() override;
+
+ private:
+  InputEventTimestamps last_timestamps_;
+};
+
+}  // namespace protocol
+}  // namespace remoting
+
+#endif  // REMOTING_PROTOCOL_INPUT_EVENT_TIMESTAMPS_H_
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 347db86..49b1f13 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -106,13 +106,13 @@
       base::RandGenerator(std::numeric_limits<uint64_t>::max()));
 
   // Send session-initiate message.
-  JingleMessage message(peer_address_, JingleMessage::SESSION_INITIATE,
-                        session_id_);
-  message.initiator = session_manager_->signal_strategy_->GetLocalJid();
-  message.description.reset(new ContentDescription(
+  std::unique_ptr<JingleMessage> message(new JingleMessage(
+      peer_address_, JingleMessage::SESSION_INITIATE, session_id_));
+  message->initiator = session_manager_->signal_strategy_->GetLocalJid();
+  message->description.reset(new ContentDescription(
       session_manager_->protocol_config_->Clone(),
       authenticator_->GetNextMessage()));
-  SendMessage(message);
+  SendMessage(std::move(message));
 
   SetState(CONNECTING);
 }
@@ -170,16 +170,16 @@
   }
 
   // Send the session-accept message.
-  JingleMessage message(peer_address_, JingleMessage::SESSION_ACCEPT,
-                        session_id_);
+  std::unique_ptr<JingleMessage> message(new JingleMessage(
+      peer_address_, JingleMessage::SESSION_ACCEPT, session_id_));
 
   std::unique_ptr<buzz::XmlElement> auth_message;
   if (authenticator_->state() == Authenticator::MESSAGE_READY)
     auth_message = authenticator_->GetNextMessage();
 
-  message.description.reset(new ContentDescription(
+  message->description.reset(new ContentDescription(
       CandidateSessionConfig::CreateFrom(*config_), std::move(auth_message)));
-  SendMessage(message);
+  SendMessage(std::move(message));
 
   // Update state.
   SetState(ACCEPTED);
@@ -216,13 +216,13 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK_EQ(state_, AUTHENTICATED);
 
-  JingleMessage message(peer_address_, JingleMessage::TRANSPORT_INFO,
-                        session_id_);
-  message.transport_info = std::move(transport_info);
+  std::unique_ptr<JingleMessage> message(new JingleMessage(
+      peer_address_, JingleMessage::TRANSPORT_INFO, session_id_));
+  message->transport_info = std::move(transport_info);
 
-  std::unique_ptr<IqRequest> request = session_manager_->iq_sender()->SendIq(
-      message.ToXml(), base::Bind(&JingleSession::OnTransportInfoResponse,
-                                  base::Unretained(this)));
+  auto request = session_manager_->iq_sender()->SendIq(
+      message->ToXml(), base::Bind(&JingleSession::OnTransportInfoResponse,
+                                   base::Unretained(this)));
   if (request) {
     request->SetTimeout(base::TimeDelta::FromSeconds(kTransportInfoTimeout));
     transport_info_requests_.push_back(std::move(request));
@@ -262,11 +262,11 @@
         reason = JingleMessage::GENERAL_ERROR;
     }
 
-    JingleMessage message(peer_address_, JingleMessage::SESSION_TERMINATE,
-                          session_id_);
-    message.reason = reason;
-    message.error_code = error;
-    SendMessage(message);
+    std::unique_ptr<JingleMessage> message(new JingleMessage(
+        peer_address_, JingleMessage::SESSION_TERMINATE, session_id_));
+    message->reason = reason;
+    message->error_code = error;
+    SendMessage(std::move(message));
   }
 
   error_ = error;
@@ -280,16 +280,16 @@
   }
 }
 
-void JingleSession::SendMessage(const JingleMessage& message) {
+void JingleSession::SendMessage(std::unique_ptr<JingleMessage> message) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  std::unique_ptr<IqRequest> request = session_manager_->iq_sender()->SendIq(
-      message.ToXml(), base::Bind(&JingleSession::OnMessageResponse,
-                                  base::Unretained(this), message.action));
+  auto request = session_manager_->iq_sender()->SendIq(
+      message->ToXml(), base::Bind(&JingleSession::OnMessageResponse,
+                                   base::Unretained(this), message->action));
 
   int timeout = kDefaultMessageTimeout;
-  if (message.action == JingleMessage::SESSION_INITIATE ||
-      message.action == JingleMessage::SESSION_ACCEPT) {
+  if (message->action == JingleMessage::SESSION_INITIATE ||
+      message->action == JingleMessage::SESSION_ACCEPT) {
     timeout = kSessionInitiateAndAcceptTimeout;
   }
   if (request) {
@@ -297,7 +297,7 @@
     pending_requests_.insert(std::move(request));
   } else {
     LOG(ERROR) << "Failed to send a "
-               << JingleMessage::GetActionName(message.action) << " message";
+               << JingleMessage::GetActionName(message->action) << " message";
   }
 }
 
@@ -369,35 +369,35 @@
   }
 }
 
-void JingleSession::OnIncomingMessage(const JingleMessage& message,
+void JingleSession::OnIncomingMessage(std::unique_ptr<JingleMessage> message,
                                       const ReplyCallback& reply_callback) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  if (peer_address_ != message.from) {
+  if (peer_address_ != message->from) {
     // Ignore messages received from a different Jid.
     reply_callback.Run(JingleMessageReply::INVALID_SID);
     return;
   }
 
-  switch (message.action) {
+  switch (message->action) {
     case JingleMessage::SESSION_ACCEPT:
-      OnAccept(message, reply_callback);
+      OnAccept(std::move(message), reply_callback);
       break;
 
     case JingleMessage::SESSION_INFO:
-      OnSessionInfo(message, reply_callback);
+      OnSessionInfo(std::move(message), reply_callback);
       break;
 
     case JingleMessage::TRANSPORT_INFO:
       if (!transport_) {
-        LOG(ERROR) << "Received unexpected transport-info message.";
+        LOG(ERROR) << "Received unexpected transport-info message->";
         reply_callback.Run(JingleMessageReply::NONE);
         return;
       }
 
-      if (!message.transport_info ||
+      if (!message->transport_info ||
           !transport_->ProcessTransportInfo(
-              message.transport_info.get())) {
+              message->transport_info.get())) {
         reply_callback.Run(JingleMessageReply::BAD_REQUEST);
         return;
       }
@@ -406,7 +406,7 @@
       break;
 
     case JingleMessage::SESSION_TERMINATE:
-      OnTerminate(message, reply_callback);
+      OnTerminate(std::move(message), reply_callback);
       break;
 
     default:
@@ -414,7 +414,7 @@
   }
 }
 
-void JingleSession::OnAccept(const JingleMessage& message,
+void JingleSession::OnAccept(std::unique_ptr<JingleMessage> message,
                              const ReplyCallback& reply_callback) {
   if (state_ != CONNECTING) {
     reply_callback.Run(JingleMessageReply::UNEXPECTED_REQUEST);
@@ -424,14 +424,14 @@
   reply_callback.Run(JingleMessageReply::NONE);
 
   const buzz::XmlElement* auth_message =
-      message.description->authenticator_message();
+      message->description->authenticator_message();
   if (!auth_message) {
     DLOG(WARNING) << "Received session-accept without authentication message ";
     Close(INCOMPATIBLE_PROTOCOL);
     return;
   }
 
-  if (!InitializeConfigFromDescription(message.description.get())) {
+  if (!InitializeConfigFromDescription(message->description.get())) {
     Close(INCOMPATIBLE_PROTOCOL);
     return;
   }
@@ -443,10 +443,10 @@
       &JingleSession::ProcessAuthenticationStep,base::Unretained(this)));
 }
 
-void JingleSession::OnSessionInfo(const JingleMessage& message,
+void JingleSession::OnSessionInfo(std::unique_ptr<JingleMessage> message,
                                   const ReplyCallback& reply_callback) {
-  if (!message.info.get() ||
-      !Authenticator::IsAuthenticatorMessage(message.info.get())) {
+  if (!message->info.get() ||
+      !Authenticator::IsAuthenticatorMessage(message->info.get())) {
     reply_callback.Run(JingleMessageReply::UNSUPPORTED_INFO);
     return;
   }
@@ -454,7 +454,7 @@
   if ((state_ != ACCEPTED && state_ != AUTHENTICATING) ||
       authenticator_->state() != Authenticator::WAITING_MESSAGE) {
     LOG(WARNING) << "Received unexpected authenticator message "
-                 << message.info->Str();
+                 << message->info->Str();
     reply_callback.Run(JingleMessageReply::UNEXPECTED_REQUEST);
     Close(INCOMPATIBLE_PROTOCOL);
     return;
@@ -462,11 +462,11 @@
 
   reply_callback.Run(JingleMessageReply::NONE);
 
-  authenticator_->ProcessMessage(message.info.get(), base::Bind(
+  authenticator_->ProcessMessage(message->info.get(), base::Bind(
       &JingleSession::ProcessAuthenticationStep, base::Unretained(this)));
 }
 
-void JingleSession::OnTerminate(const JingleMessage& message,
+void JingleSession::OnTerminate(std::unique_ptr<JingleMessage> message,
                                 const ReplyCallback& reply_callback) {
   if (!is_session_active()) {
     LOG(WARNING) << "Received unexpected session-terminate message.";
@@ -476,11 +476,11 @@
 
   reply_callback.Run(JingleMessageReply::NONE);
 
-  error_ = message.error_code;
+  error_ = message->error_code;
   if (error_ == UNKNOWN_ERROR) {
     // get error code from message.reason for compatibility with older versions
     // that do not add <error-code>.
-    switch (message.reason) {
+    switch (message->reason) {
       case JingleMessage::SUCCESS:
         if (state_ == CONNECTING) {
           error_ = SESSION_REJECTED;
@@ -552,11 +552,11 @@
   }
 
   if (authenticator_->state() == Authenticator::MESSAGE_READY) {
-    JingleMessage message(peer_address_, JingleMessage::SESSION_INFO,
-                          session_id_);
-    message.info = authenticator_->GetNextMessage();
-    DCHECK(message.info.get());
-    SendMessage(message);
+    std::unique_ptr<JingleMessage> message(new JingleMessage(
+        peer_address_, JingleMessage::SESSION_INFO, session_id_));
+    message->info = authenticator_->GetNextMessage();
+    DCHECK(message->info.get());
+    SendMessage(std::move(message));
   }
   DCHECK_NE(authenticator_->state(), Authenticator::MESSAGE_READY);
 
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index b577198..0c16edfe 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -66,7 +66,7 @@
   // Sends |message| to the peer. The session is closed if the send fails or no
   // response is received within a reasonable time. All other responses are
   // ignored.
-  void SendMessage(const JingleMessage& message);
+  void SendMessage(std::unique_ptr<JingleMessage> message);
 
   // Iq response handler.
   void OnMessageResponse(JingleMessage::ActionType request_type,
@@ -81,15 +81,15 @@
   // Called by JingleSessionManager on incoming |message|. Must call
   // |reply_callback| to send reply message before sending any other
   // messages.
-  void OnIncomingMessage(const JingleMessage& message,
+  void OnIncomingMessage(std::unique_ptr<JingleMessage> message,
                          const ReplyCallback& reply_callback);
 
   // Message handlers for incoming messages.
-  void OnAccept(const JingleMessage& message,
+  void OnAccept(std::unique_ptr<JingleMessage> message,
                 const ReplyCallback& reply_callback);
-  void OnSessionInfo(const JingleMessage& message,
+  void OnSessionInfo(std::unique_ptr<JingleMessage> message,
                      const ReplyCallback& reply_callback);
-  void OnTerminate(const JingleMessage& message,
+  void OnTerminate(std::unique_ptr<JingleMessage> message,
                    const ReplyCallback& reply_callback);
 
   // Called from OnAccept() to initialize session config.
diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc
index 1c7b3571..8758e5d 100644
--- a/remoting/protocol/jingle_session_manager.cc
+++ b/remoting/protocol/jingle_session_manager.cc
@@ -67,31 +67,32 @@
   if (!JingleMessage::IsJingleMessage(stanza))
     return false;
 
-  JingleMessage message;
+  std::unique_ptr<JingleMessage> message(new JingleMessage());
   std::string error;
-  if (!message.ParseXml(stanza, &error)) {
+  if (!message->ParseXml(stanza, &error)) {
     SendReply(stanza, JingleMessageReply::BAD_REQUEST);
     return true;
   }
 
-  if (message.action == JingleMessage::SESSION_INITIATE) {
+  if (message->action == JingleMessage::SESSION_INITIATE) {
     // Description must be present in session-initiate messages.
-    DCHECK(message.description.get());
+    DCHECK(message->description.get());
 
     SendReply(stanza, JingleMessageReply::NONE);
 
     std::unique_ptr<Authenticator> authenticator =
         authenticator_factory_->CreateAuthenticator(
-            signal_strategy_->GetLocalJid(), message.from.id());
+            signal_strategy_->GetLocalJid(), message->from.id());
 
     JingleSession* session = new JingleSession(this);
-    session->InitializeIncomingConnection(message, std::move(authenticator));
+    session->InitializeIncomingConnection(*message,
+                                          std::move(authenticator));
     sessions_[session->session_id_] = session;
 
     // Destroy the session if it was rejected due to incompatible protocol.
     if (session->state_ != Session::ACCEPTING) {
       delete session;
-      DCHECK(sessions_.find(message.sid) == sessions_.end());
+      DCHECK(sessions_.find(message->sid) == sessions_.end());
       return true;
     }
 
@@ -100,7 +101,7 @@
       incoming_session_callback_.Run(session, &response);
 
     if (response == SessionManager::ACCEPT) {
-      session->AcceptIncomingConnection(message);
+      session->AcceptIncomingConnection(*message);
     } else {
       ErrorCode error;
       switch (response) {
@@ -119,19 +120,19 @@
 
       session->Close(error);
       delete session;
-      DCHECK(sessions_.find(message.sid) == sessions_.end());
+      DCHECK(sessions_.find(message->sid) == sessions_.end());
     }
 
     return true;
   }
 
-  SessionsMap::iterator it = sessions_.find(message.sid);
+  SessionsMap::iterator it = sessions_.find(message->sid);
   if (it == sessions_.end()) {
     SendReply(stanza, JingleMessageReply::INVALID_SID);
     return true;
   }
 
-  it->second->OnIncomingMessage(message, base::Bind(
+  it->second->OnIncomingMessage(std::move(message), base::Bind(
       &JingleSessionManager::SendReply, base::Unretained(this), stanza));
   return true;
 }
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 4da1ce7f..9cf56b9 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -77,7 +77,6 @@
   MOCK_METHOD1(OnConnectionClosed, void(ErrorCode error));
   MOCK_METHOD1(OnCreateVideoEncoder,
                void(std::unique_ptr<VideoEncoder>* encoder));
-  MOCK_METHOD1(OnInputEventReceived, void(int64_t timestamp));
   MOCK_METHOD2(OnRouteChange,
                void(const std::string& channel_name,
                     const TransportRoute& route));
diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc
index c7c2c11..b9a94ba 100644
--- a/remoting/protocol/video_frame_pump.cc
+++ b/remoting/protocol/video_frame_pump.cc
@@ -69,21 +69,19 @@
   encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release());
 }
 
+void VideoFramePump::SetEventTimestampsSource(
+    scoped_refptr<InputEventTimestampsSource> event_timestamps_source) {
+  DCHECK(thread_checker_.CalledOnValidThread());
+
+  event_timestamps_source_ = event_timestamps_source;
+}
+
 void VideoFramePump::Pause(bool pause) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
   capture_scheduler_.Pause(pause);
 }
 
-void VideoFramePump::OnInputEventReceived(int64_t event_timestamp) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  if (!next_frame_timestamps_)
-    next_frame_timestamps_.reset(new FrameTimestamps());
-  next_frame_timestamps_->input_event_client_timestamp = event_timestamp;
-  next_frame_timestamps_->input_event_received_time = base::TimeTicks::Now();
-}
-
 void VideoFramePump::SetLosslessEncode(bool want_lossless) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
@@ -140,15 +138,14 @@
 void VideoFramePump::CaptureNextFrame() {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  // |next_frame_timestamps_| is not set if no input events were received since
-  // the previous frame. In that case create FrameTimestamps instance without
-  // setting |input_event_client_timestamp| and |input_event_received_time|.
-  if (!next_frame_timestamps_)
-    next_frame_timestamps_.reset(new FrameTimestamps());
-
-  captured_frame_timestamps_ = std::move(next_frame_timestamps_);
+  captured_frame_timestamps_.reset(new FrameTimestamps());
   captured_frame_timestamps_->capture_started_time = base::TimeTicks::Now();
 
+  if (event_timestamps_source_) {
+    captured_frame_timestamps_->input_event_timestamps =
+        event_timestamps_source_->TakeLastEventTimestamps();
+  }
+
   capturer_->Capture(webrtc::DesktopRegion());
 }
 
@@ -209,12 +206,13 @@
 
 void VideoFramePump::UpdateFrameTimers(VideoPacket* packet,
                                        FrameTimestamps* timestamps) {
-  if (!timestamps->input_event_received_time.is_null()) {
-    packet->set_capture_pending_time_ms((timestamps->capture_started_time -
-                                         timestamps->input_event_received_time)
-                                            .InMilliseconds());
+  if (!timestamps->input_event_timestamps.is_null()) {
+    packet->set_capture_pending_time_ms(
+        (timestamps->capture_started_time -
+         timestamps->input_event_timestamps.host_timestamp)
+            .InMilliseconds());
     packet->set_latest_event_timestamp(
-        timestamps->input_event_client_timestamp);
+        timestamps->input_event_timestamps.client_timestamp.ToInternalValue());
   }
 
   packet->set_capture_overhead_time_ms(
diff --git a/remoting/protocol/video_frame_pump.h b/remoting/protocol/video_frame_pump.h
index 5483400..6fe57e8 100644
--- a/remoting/protocol/video_frame_pump.h
+++ b/remoting/protocol/video_frame_pump.h
@@ -80,8 +80,9 @@
   ~VideoFramePump() override;
 
   // VideoStream interface.
+  void SetEventTimestampsSource(scoped_refptr<InputEventTimestampsSource>
+                                    event_timestamps_source) override;
   void Pause(bool pause) override;
-  void OnInputEventReceived(int64_t event_timestamp) override;
   void SetLosslessEncode(bool want_lossless) override;
   void SetLosslessColor(bool want_lossless) override;
   void SetObserver(Observer* observer) override;
@@ -95,12 +96,9 @@
     FrameTimestamps();
     ~FrameTimestamps();
 
-    // The following two fields are set only for one frame after each incoming
-    // input event. |input_event_client_timestamp| is event timestamp
-    // received from the client. |input_event_received_time| is local time when
-    // the event was received.
-    int64_t input_event_client_timestamp = -1;
-    base::TimeTicks input_event_received_time;
+    // The following field is not-null for a single frame after each incoming
+    // input event.
+    InputEventTimestamps input_event_timestamps;
 
     base::TimeTicks capture_started_time;
     base::TimeTicks capture_ended_time;
@@ -159,6 +157,8 @@
   // Used to encode captured frames. Always accessed on the encode thread.
   std::unique_ptr<VideoEncoder> encoder_;
 
+  scoped_refptr<InputEventTimestampsSource> event_timestamps_source_;
+
   // Interface through which video frames are passed to the client.
   protocol::VideoStub* video_stub_;
 
@@ -174,9 +174,6 @@
   // captured.
   CaptureScheduler capture_scheduler_;
 
-  // Timestamps for the frame to be captured next.
-  std::unique_ptr<FrameTimestamps> next_frame_timestamps_;
-
   // Timestamps for the frame that's being captured.
   std::unique_ptr<FrameTimestamps> captured_frame_timestamps_;
 
diff --git a/remoting/protocol/video_stream.h b/remoting/protocol/video_stream.h
index 06045b2c..e97bf2364 100644
--- a/remoting/protocol/video_stream.h
+++ b/remoting/protocol/video_stream.h
@@ -10,6 +10,7 @@
 #include <cstdint>
 
 #include "base/callback_forward.h"
+#include "remoting/protocol/input_event_timestamps.h"
 
 namespace webrtc {
 class DesktopSize;
@@ -33,13 +34,14 @@
   VideoStream() {}
   virtual ~VideoStream() {}
 
+  // Sets event timestamps source to be used for the video stream.
+  virtual void SetEventTimestampsSource(
+      scoped_refptr<InputEventTimestampsSource> event_timestamps_source) = 0;
+
   // Pauses or resumes scheduling of frame captures. Pausing/resuming captures
   // only affects capture scheduling and does not stop/start the capturer.
   virtual void Pause(bool pause) = 0;
 
-  // Should be called whenever an input event is received.
-  virtual void OnInputEventReceived(int64_t event_timestamp) = 0;
-
   // Sets whether the video encoder should be requested to encode losslessly,
   // or to use a lossless color space (typically requiring higher bandwidth).
   virtual void SetLosslessEncode(bool want_lossless) = 0;
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc
index a1df351..60f0282 100644
--- a/remoting/protocol/webrtc_connection_to_client.cc
+++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -83,6 +83,8 @@
   std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream());
   stream->Start(std::move(desktop_capturer), transport_.get(),
                 video_encode_task_runner_);
+  stream->SetEventTimestampsSource(
+      event_dispatcher_->event_timestamps_source());
   return std::move(stream);
 }
 
@@ -181,9 +183,6 @@
   DCHECK(thread_checker_.CalledOnValidThread());
   if (name == event_dispatcher_->channel_name() &&
       !event_dispatcher_->is_connected()) {
-    event_dispatcher_->set_on_input_event_callback(
-        base::Bind(&WebrtcConnectionToClient::OnInputEventReceived,
-                   base::Unretained(this)));
     event_dispatcher_->Init(std::move(pipe), this);
   }
 }
@@ -218,10 +217,5 @@
   Disconnect(INCOMPATIBLE_PROTOCOL);
 }
 
-void WebrtcConnectionToClient::OnInputEventReceived(int64_t timestamp) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  event_handler_->OnInputEventReceived(timestamp);
-}
-
 }  // namespace protocol
 }  // namespace remoting
diff --git a/remoting/protocol/webrtc_connection_to_client.h b/remoting/protocol/webrtc_connection_to_client.h
index af5533d..1ccd2c8 100644
--- a/remoting/protocol/webrtc_connection_to_client.h
+++ b/remoting/protocol/webrtc_connection_to_client.h
@@ -70,9 +70,6 @@
   void OnChannelClosed(ChannelDispatcherBase* channel_dispatcher) override;
 
  private:
-  // Callback for the event dispatcher.
-  void OnInputEventReceived(int64_t timestamp);
-
   base::ThreadChecker thread_checker_;
 
   // Event handler for handling events sent from this object.
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc
index 440b75a..d45430e14 100644
--- a/remoting/protocol/webrtc_video_stream.cc
+++ b/remoting/protocol/webrtc_video_stream.cc
@@ -27,12 +27,9 @@
 const char kVideoLabel[] = "screen_video";
 
 struct WebrtcVideoStream::FrameTimestamps {
-  // The following two fields are set only for one frame after each incoming
-  // input event. |input_event_client_timestamp| is event timestamp
-  // received from the client. |input_event_received_time| is local time when
-  // the event was received.
-  int64_t input_event_client_timestamp = -1;
-  base::TimeTicks input_event_received_time;
+  // The following fields is not null only for one frame after each incoming
+  // input event.
+  InputEventTimestamps input_event_timestamps;
 
   base::TimeTicks capture_started_time;
   base::TimeTicks capture_ended_time;
@@ -114,20 +111,16 @@
                                this);
 }
 
+void WebrtcVideoStream::SetEventTimestampsSource(
+    scoped_refptr<InputEventTimestampsSource> event_timestamps_source) {
+  event_timestamps_source_ = event_timestamps_source;
+}
+
 void WebrtcVideoStream::Pause(bool pause) {
   DCHECK(thread_checker_.CalledOnValidThread());
   scheduler_->Pause(pause);
 }
 
-void WebrtcVideoStream::OnInputEventReceived(int64_t event_timestamp) {
-  DCHECK(thread_checker_.CalledOnValidThread());
-
-  if (!next_frame_timestamps_)
-    next_frame_timestamps_.reset(new FrameTimestamps());
-  next_frame_timestamps_->input_event_client_timestamp = event_timestamp;
-  next_frame_timestamps_->input_event_received_time = base::TimeTicks::Now();
-}
-
 void WebrtcVideoStream::SetLosslessEncode(bool want_lossless) {
   NOTIMPLEMENTED();
 }
@@ -189,15 +182,14 @@
 void WebrtcVideoStream::CaptureNextFrame() {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  // |next_frame_timestamps_| is not set if no input events were received since
-  // the previous frame. In that case create FrameTimestamps instance without
-  // setting |input_event_client_timestamp| and |input_event_received_time|.
-  if (!next_frame_timestamps_)
-    next_frame_timestamps_.reset(new FrameTimestamps());
-
-  captured_frame_timestamps_ = std::move(next_frame_timestamps_);
+  captured_frame_timestamps_.reset(new FrameTimestamps());
   captured_frame_timestamps_->capture_started_time = base::TimeTicks::Now();
 
+  if (event_timestamps_source_) {
+    captured_frame_timestamps_->input_event_timestamps =
+        event_timestamps_source_->TakeLastEventTimestamps();
+  }
+
   capturer_->Capture(webrtc::DesktopRegion());
 }
 
@@ -227,16 +219,19 @@
     return;
   }
 
+  scheduler_->OnFrameEncoded(*frame.frame, result);
+
   // Send FrameStats message.
   if (video_stats_dispatcher_.is_connected()) {
     HostFrameStats stats;
     stats.frame_size = frame.frame->data.size();
 
-    if (!frame.timestamps->input_event_received_time.is_null()) {
-      stats.capture_pending_delay = frame.timestamps->capture_started_time -
-                                    frame.timestamps->input_event_received_time;
-      stats.latest_event_timestamp = base::TimeTicks::FromInternalValue(
-          frame.timestamps->input_event_client_timestamp);
+    if (!frame.timestamps->input_event_timestamps.is_null()) {
+      stats.capture_pending_delay =
+          frame.timestamps->capture_started_time -
+          frame.timestamps->input_event_timestamps.host_timestamp;
+      stats.latest_event_timestamp =
+          frame.timestamps->input_event_timestamps.host_timestamp;
     }
 
     stats.capture_delay = frame.timestamps->capture_delay;
diff --git a/remoting/protocol/webrtc_video_stream.h b/remoting/protocol/webrtc_video_stream.h
index 3f96c010..79d565a 100644
--- a/remoting/protocol/webrtc_video_stream.h
+++ b/remoting/protocol/webrtc_video_stream.h
@@ -46,8 +46,9 @@
              scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner);
 
   // VideoStream interface.
+  void SetEventTimestampsSource(scoped_refptr<InputEventTimestampsSource>
+                                    event_timestamps_source) override;
   void Pause(bool pause) override;
-  void OnInputEventReceived(int64_t event_timestamp) override;
   void SetLosslessEncode(bool want_lossless) override;
   void SetLosslessColor(bool want_lossless) override;
   void SetObserver(Observer* observer) override;
@@ -84,14 +85,13 @@
   // Used to encode captured frames. Always accessed on the encode thread.
   std::unique_ptr<WebrtcVideoEncoder> encoder_;
 
+  scoped_refptr<InputEventTimestampsSource> event_timestamps_source_;
+
   scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_;
   scoped_refptr<webrtc::MediaStreamInterface> stream_;
 
   HostVideoStatsDispatcher video_stats_dispatcher_;
 
-  // Timestamps for the frame to be captured next.
-  std::unique_ptr<FrameTimestamps> next_frame_timestamps_;
-
   // Timestamps for the frame that's being captured.
   std::unique_ptr<FrameTimestamps> captured_frame_timestamps_;
 
diff --git a/remoting/signaling/delegating_signal_strategy.cc b/remoting/signaling/delegating_signal_strategy.cc
index e329a204..d1a374a 100644
--- a/remoting/signaling/delegating_signal_strategy.cc
+++ b/remoting/signaling/delegating_signal_strategy.cc
@@ -38,10 +38,8 @@
     return;
   }
 
-  base::ObserverListBase<Listener>::Iterator it(&listeners_);
-  Listener* listener;
-  while ((listener = it.GetNext()) != nullptr) {
-    if (listener->OnSignalStrategyIncomingStanza(stanza.get()))
+  for (auto& listener : listeners_) {
+    if (listener.OnSignalStrategyIncomingStanza(stanza.get()))
       break;
   }
 }
diff --git a/remoting/signaling/fake_signal_strategy.cc b/remoting/signaling/fake_signal_strategy.cc
index 12cd2c1..69af43d7 100644
--- a/remoting/signaling/fake_signal_strategy.cc
+++ b/remoting/signaling/fake_signal_strategy.cc
@@ -146,10 +146,8 @@
     return;
   }
 
-  base::ObserverListBase<Listener>::Iterator it(&listeners_);
-  Listener* listener;
-  while ((listener = it.GetNext()) != nullptr) {
-    if (listener->OnSignalStrategyIncomingStanza(stanza_ptr))
+  for (auto& listener : listeners_) {
+    if (listener.OnSignalStrategyIncomingStanza(stanza_ptr))
       break;
   }
 }
diff --git a/remoting/signaling/xmpp_signal_strategy.cc b/remoting/signaling/xmpp_signal_strategy.cc
index 2dad2f7..591dac2 100644
--- a/remoting/signaling/xmpp_signal_strategy.cc
+++ b/remoting/signaling/xmpp_signal_strategy.cc
@@ -366,9 +366,8 @@
             << stanza->Str()
             << "\n=========================================================";
 
-  base::ObserverListBase<Listener>::Iterator it(&listeners_);
-  for (Listener* listener = it.GetNext(); listener; listener = it.GetNext()) {
-    if (listener->OnSignalStrategyIncomingStanza(stanza.get()))
+  for (auto& listener : listeners_) {
+    if (listener.OnSignalStrategyIncomingStanza(stanza.get()))
       return;
   }
 }
diff --git a/services/DEPS b/services/DEPS
index 0322d91..748f639 100644
--- a/services/DEPS
+++ b/services/DEPS
@@ -2,5 +2,5 @@
   "+mojo",  # By definition.
 
   "-services",  # Services have to list which other services they depend on.
-  "+services/shell/public",  # Every service talks to shell.
+  "+services/service_manager/public",  # Every service talks to Service Manager.
 ]
diff --git a/services/README.md b/services/README.md
index 2b52b2d1..03e5a7e 100644
--- a/services/README.md
+++ b/services/README.md
@@ -9,7 +9,7 @@
 
 Roughly each subdirectory here corresponds to a service that:
 
-  * is a client of `//services/shell` with its own unique Identity.
+  * is a client of `//services/service_manager` with its own unique Identity.
   * could logically run a standalone process for security/performance isolation
     benefits depending on the constraints of the host OS.
 
diff --git a/services/catalog/BUILD.gn b/services/catalog/BUILD.gn
index 319ca9b..dc44d908 100644
--- a/services/catalog/BUILD.gn
+++ b/services/catalog/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 group("catalog") {
@@ -35,7 +35,7 @@
     "//base",
     "//components/filesystem:lib",
     "//services/catalog/public/interfaces",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 
   public_deps = [
@@ -64,7 +64,7 @@
   deps = [
     ":lib",
     "//base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//testing/gtest",
   ]
 }
diff --git a/services/catalog/catalog.cc b/services/catalog/catalog.cc
index a769147..ef6d7c3 100644
--- a/services/catalog/catalog.cc
+++ b/services/catalog/catalog.cc
@@ -18,9 +18,9 @@
 #include "services/catalog/constants.h"
 #include "services/catalog/instance.h"
 #include "services/catalog/reader.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/names.h"
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/names.h"
+#include "services/service_manager/public/cpp/service_context.h"
 
 namespace catalog {
 namespace {
@@ -50,9 +50,10 @@
     return base::FilePath();
   if (is_service) {
     path.erase(path.begin(),
-      path.begin() + strlen(shell::kNameType_Service) + 1);
+               path.begin() + strlen(service_manager::kNameType_Service) + 1);
   } else {
-    path.erase(path.begin(), path.begin() + strlen(shell::kNameType_Exe) + 1);
+    path.erase(path.begin(),
+               path.begin() + strlen(service_manager::kNameType_Exe) + 1);
   }
   base::TrimString(path, "/", &path);
   size_t end_of_name = path.find('/');
@@ -94,14 +95,15 @@
   system_reader_->OverridePackageName(service_name, package_name);
 }
 
-shell::mojom::ServicePtr Catalog::TakeService() {
+service_manager::mojom::ServicePtr Catalog::TakeService() {
   return std::move(service_);
 }
 
 Catalog::Catalog(std::unique_ptr<Store> store)
     : store_(std::move(store)), weak_factory_(this) {
-  shell::mojom::ServiceRequest request = GetProxy(&service_);
-  shell_connection_.reset(new shell::ServiceContext(this, std::move(request)));
+  service_manager::mojom::ServiceRequest request = GetProxy(&service_);
+  service_manager_connection_.reset(
+      new service_manager::ServiceContext(this, std::move(request)));
 }
 
 void Catalog::ScanSystemPackageDir() {
@@ -113,28 +115,28 @@
                                   weak_factory_.GetWeakPtr()));
 }
 
-bool Catalog::OnConnect(const shell::Identity& remote_identity,
-                        shell::InterfaceRegistry* registry) {
+bool Catalog::OnConnect(const service_manager::Identity& remote_identity,
+                        service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Catalog>(this);
   registry->AddInterface<mojom::CatalogControl>(this);
   registry->AddInterface<filesystem::mojom::Directory>(this);
-  registry->AddInterface<shell::mojom::Resolver>(this);
+  registry->AddInterface<service_manager::mojom::Resolver>(this);
   return true;
 }
 
-void Catalog::Create(const shell::Identity& remote_identity,
-                     shell::mojom::ResolverRequest request) {
+void Catalog::Create(const service_manager::Identity& remote_identity,
+                     service_manager::mojom::ResolverRequest request) {
   Instance* instance = GetInstanceForUserId(remote_identity.user_id());
   instance->BindResolver(std::move(request));
 }
 
-void Catalog::Create(const shell::Identity& remote_identity,
+void Catalog::Create(const service_manager::Identity& remote_identity,
                      mojom::CatalogRequest request) {
   Instance* instance = GetInstanceForUserId(remote_identity.user_id());
   instance->BindCatalog(std::move(request));
 }
 
-void Catalog::Create(const shell::Identity& remote_identity,
+void Catalog::Create(const service_manager::Identity& remote_identity,
                      filesystem::mojom::DirectoryRequest request) {
   if (!lock_table_)
     lock_table_ = new filesystem::LockTable;
@@ -147,7 +149,7 @@
       std::move(request));
 }
 
-void Catalog::Create(const shell::Identity& remote_identity,
+void Catalog::Create(const service_manager::Identity& remote_identity,
                      mojom::CatalogControlRequest request) {
   control_bindings_.AddBinding(this, std::move(request));
 }
diff --git a/services/catalog/catalog.h b/services/catalog/catalog.h
index 1a35725..bf1b985 100644
--- a/services/catalog/catalog.h
+++ b/services/catalog/catalog.h
@@ -16,9 +16,9 @@
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "services/catalog/public/interfaces/catalog.mojom.h"
 #include "services/catalog/types.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/resolver.mojom.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/interfaces/resolver.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace base {
 class SequencedWorkerPool;
@@ -29,7 +29,7 @@
 class LockTable;
 }
 
-namespace shell {
+namespace service_manager {
 class ServiceContext;
 }
 
@@ -42,12 +42,14 @@
 
 // Creates and owns an instance of the catalog. Exposes a ServicePtr that
 // can be passed to the Shell, potentially in a different process.
-class Catalog : public shell::Service,
-                public shell::InterfaceFactory<mojom::Catalog>,
-                public shell::InterfaceFactory<filesystem::mojom::Directory>,
-                public shell::InterfaceFactory<shell::mojom::Resolver>,
-                public shell::InterfaceFactory<mojom::CatalogControl>,
-                public mojom::CatalogControl {
+class Catalog
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::Catalog>,
+      public service_manager::InterfaceFactory<filesystem::mojom::Directory>,
+      public service_manager::InterfaceFactory<
+          service_manager::mojom::Resolver>,
+      public service_manager::InterfaceFactory<mojom::CatalogControl>,
+      public mojom::CatalogControl {
  public:
   // |manifest_provider| may be null.
   Catalog(base::SequencedWorkerPool* worker_pool,
@@ -64,7 +66,7 @@
   void OverridePackageName(const std::string& service_name,
                            const std::string& package_name);
 
-  shell::mojom::ServicePtr TakeService();
+  service_manager::mojom::ServicePtr TakeService();
 
  private:
   explicit Catalog(std::unique_ptr<Store> store);
@@ -72,24 +74,24 @@
   // Starts a scane for system packages.
   void ScanSystemPackageDir();
 
-  // shell::Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
-  // shell::InterfaceFactory<shell::mojom::Resolver>:
-  void Create(const shell::Identity& remote_identity,
-              shell::mojom::ResolverRequest request) override;
+  // service_manager::InterfaceFactory<service_manager::mojom::Resolver>:
+  void Create(const service_manager::Identity& remote_identity,
+              service_manager::mojom::ResolverRequest request) override;
 
-  // shell::InterfaceFactory<mojom::Catalog>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Catalog>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::CatalogRequest request) override;
 
-  // shell::InterfaceFactory<filesystem::mojom::Directory>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<filesystem::mojom::Directory>:
+  void Create(const service_manager::Identity& remote_identity,
               filesystem::mojom::DirectoryRequest request) override;
 
-  // shell::InterfaceFactory<mojom::CatalogControl>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::CatalogControl>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::CatalogControlRequest request) override;
 
   // mojom::CatalogControl:
@@ -104,8 +106,8 @@
 
   std::unique_ptr<Store> store_;
 
-  shell::mojom::ServicePtr service_;
-  std::unique_ptr<shell::ServiceContext> shell_connection_;
+  service_manager::mojom::ServicePtr service_;
+  std::unique_ptr<service_manager::ServiceContext> service_manager_connection_;
 
   std::map<std::string, std::unique_ptr<Instance>> instances_;
 
diff --git a/services/catalog/data/capabilities b/services/catalog/data/capabilities
index 793c727..b9ce1238 100644
--- a/services/catalog/data/capabilities
+++ b/services/catalog/data/capabilities
@@ -5,7 +5,7 @@
   "process-group": "bar",
   "capabilities": {
     "required": {
-      "service:bar": { "interfaces": [ "mojo::Bar" ] }
+      "service:bar": [ "bar:bar" ]
     }
   }
 }
diff --git a/services/catalog/data/serialization b/services/catalog/data/serialization
index 6f13c97..aa68a48 100644
--- a/services/catalog/data/serialization
+++ b/services/catalog/data/serialization
@@ -9,10 +9,7 @@
       "bar": ["mojo::Bork"]
     },
     "required": {
-      "service:bar": {
-        "classes": ["a", "b"],
-        "interfaces": ["mojo::Blork", "mojo::Blark"]
-      }
+      "service:bar":["a", "b"]
     }
   }
 }
diff --git a/services/catalog/data/wildcard_interfaces b/services/catalog/data/wildcard_interfaces
deleted file mode 100644
index cc3a0de..0000000
--- a/services/catalog/data/wildcard_interfaces
+++ /dev/null
@@ -1,12 +0,0 @@
-{
-  "manifest_version":  1,
-  "name": "service:foo",
-  "display_name": "Foo",
-  "capabilities": {
-    "required": {
-      "service:bar": {
-        "interfaces": [ "*" ]
-      }
-    }
-  }
-}
diff --git a/services/catalog/entry.cc b/services/catalog/entry.cc
index 4cca6c3..72a0ff5 100644
--- a/services/catalog/entry.cc
+++ b/services/catalog/entry.cc
@@ -6,7 +6,7 @@
 
 #include "base/values.h"
 #include "services/catalog/store.h"
-#include "services/shell/public/cpp/names.h"
+#include "services/service_manager/public/cpp/names.h"
 
 namespace catalog {
 namespace {
@@ -35,21 +35,8 @@
   return ReadStringSet(*list_value, string_set);
 }
 
-bool ReadStringSetFromDictionary(const base::DictionaryValue& dictionary,
-                                 const std::string& key,
-                                 std::set<std::string>* string_set) {
-  const base::ListValue* list_value = nullptr;
-  if (dictionary.HasKey(key) && !dictionary.GetList(key, &list_value)) {
-    LOG(ERROR) << "Entry::Deserialize: " << key << " must be a list.";
-    return false;
-  }
-  if (list_value)
-    return ReadStringSet(*list_value, string_set);
-  return true;
-}
-
 bool BuildCapabilities(const base::DictionaryValue& value,
-                       shell::CapabilitySpec* capabilities) {
+                       service_manager::CapabilitySpec* capabilities) {
   DCHECK(capabilities);
   const base::DictionaryValue* provided_value = nullptr;
   if (value.HasKey(Store::kCapabilities_ProvidedKey) &&
@@ -60,10 +47,9 @@
     return false;
   }
   if (provided_value) {
-    shell::CapabilityRequest provided;
     base::DictionaryValue::Iterator it(*provided_value);
     for(; !it.IsAtEnd(); it.Advance()) {
-      shell::Interfaces interfaces;
+      service_manager::Interfaces interfaces;
       if (!ReadStringSetFromValue(it.value(), &interfaces)) {
         LOG(ERROR) << "Entry::Deserialize: Invalid interface list in provided "
                    << " classes dictionary";
@@ -84,35 +70,20 @@
   if (required_value) {
     base::DictionaryValue::Iterator it(*required_value);
     for (; !it.IsAtEnd(); it.Advance()) {
-      shell::CapabilityRequest spec;
-      const base::DictionaryValue* entry_value = nullptr;
-      if (!it.value().GetAsDictionary(&entry_value)) {
+      service_manager::Classes classes;
+      const base::ListValue* entry_value = nullptr;
+      if (!it.value().GetAsList(&entry_value)) {
         LOG(ERROR) << "Entry::Deserialize: " << Store::kCapabilities_RequiredKey
-                   << " must be a dictionary.";
+                   << " entry must be a list.";
         return false;
       }
-      if (!ReadStringSetFromDictionary(
-              *entry_value, Store::kCapabilities_ClassesKey, &spec.classes)) {
+      if (!ReadStringSet(*entry_value, &classes)) {
         LOG(ERROR) << "Entry::Deserialize: Invalid classes list in required "
                    << "capabilities dictionary.";
         return false;
       }
-      shell::Interfaces interfaces;
-      if (!ReadStringSetFromDictionary(*entry_value,
-                                       Store::kCapabilities_InterfacesKey,
-                                       &interfaces)) {
-        LOG(ERROR) << "Entry::Deserialize: Invalid interfaces list in required "
-                   << "capabilities dictionary.";
-        return false;
-      }
-      if (interfaces.count("*") > 0) {
-        LOG(ERROR) << "Entry::Deserializer: Wildcard not valid in interfaces "
-                   << "list.";
-        return false;
-      }
-      spec.interfaces = interfaces;
 
-      capabilities->required[it.key()] = spec;
+      capabilities->required[it.key()] = classes;
     }
   }
   return true;
@@ -122,7 +93,9 @@
 
 Entry::Entry() {}
 Entry::Entry(const std::string& name)
-    : name_(name), qualifier_(shell::GetNamePath(name)), display_name_(name) {}
+    : name_(name),
+      qualifier_(service_manager::GetNamePath(name)),
+      display_name_(name) {}
 Entry::~Entry() {}
 
 std::unique_ptr<base::DictionaryValue> Entry::Serialize() const {
@@ -144,16 +117,10 @@
 
   std::unique_ptr<base::DictionaryValue> required(new base::DictionaryValue);
   for (const auto& i : capabilities_.required) {
-    std::unique_ptr<base::DictionaryValue> request(new base::DictionaryValue);
     std::unique_ptr<base::ListValue> classes(new base::ListValue);
-    for (const auto& class_name : i.second.classes)
+    for (const auto& class_name : i.second)
       classes->AppendString(class_name);
-    request->Set(Store::kCapabilities_ClassesKey, std::move(classes));
-    std::unique_ptr<base::ListValue> interfaces(new base::ListValue);
-    for (const auto& interface_name : i.second.interfaces)
-      interfaces->AppendString(interface_name);
-    request->Set(Store::kCapabilities_InterfacesKey, std::move(interfaces));
-    required->Set(i.first, std::move(request));
+    required->Set(i.first, std::move(classes));
   }
   spec->Set(Store::kCapabilities_RequiredKey, std::move(required));
 
@@ -185,7 +152,7 @@
                << Store::kNameKey << " key";
     return nullptr;
   }
-  if (!shell::IsValidName(name_string)) {
+  if (!service_manager::IsValidName(name_string)) {
     LOG(ERROR) << "Entry::Deserialize: " << name_string << " is not a valid "
                << "Mojo name";
     return nullptr;
@@ -202,7 +169,7 @@
     }
     entry->set_qualifier(qualifier);
   } else {
-    entry->set_qualifier(shell::GetNamePath(name_string));
+    entry->set_qualifier(service_manager::GetNamePath(name_string));
   }
 
   // Human-readable name.
@@ -222,7 +189,7 @@
     return nullptr;
   }
 
-  shell::CapabilitySpec spec;
+  service_manager::CapabilitySpec spec;
   if (!BuildCapabilities(*capabilities, &spec)) {
     LOG(ERROR) << "Entry::Deserialize: failed to build capability spec for "
                << entry->name();
@@ -269,10 +236,11 @@
 namespace mojo {
 
 // static
-shell::mojom::ResolveResultPtr
-    TypeConverter<shell::mojom::ResolveResultPtr, catalog::Entry>::Convert(
-        const catalog::Entry& input) {
-  shell::mojom::ResolveResultPtr result(shell::mojom::ResolveResult::New());
+service_manager::mojom::ResolveResultPtr
+TypeConverter<service_manager::mojom::ResolveResultPtr,
+              catalog::Entry>::Convert(const catalog::Entry& input) {
+  service_manager::mojom::ResolveResultPtr result(
+      service_manager::mojom::ResolveResult::New());
   result->name = input.name();
   const catalog::Entry& package = input.package() ? *input.package() : input;
   result->resolved_name = package.name();
diff --git a/services/catalog/entry.h b/services/catalog/entry.h
index 93d4a91..fc4b714 100644
--- a/services/catalog/entry.h
+++ b/services/catalog/entry.h
@@ -11,8 +11,8 @@
 
 #include "base/files/file_path.h"
 #include "services/catalog/public/interfaces/catalog.mojom.h"
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/interfaces/resolver.mojom.h"
+#include "services/service_manager/public/cpp/capabilities.h"
+#include "services/service_manager/public/interfaces/resolver.mojom.h"
 
 namespace base {
 class DictionaryValue;
@@ -49,8 +49,10 @@
   void set_display_name(const std::string& display_name) {
     display_name_ = display_name;
   }
-  const shell::CapabilitySpec& capabilities() const { return capabilities_; }
-  void set_capabilities(const shell::CapabilitySpec& capabilities) {
+  const service_manager::CapabilitySpec& capabilities() const {
+    return capabilities_;
+  }
+  void set_capabilities(const service_manager::CapabilitySpec& capabilities) {
     capabilities_ = capabilities;
   }
   const Entry* package() const { return package_; }
@@ -65,7 +67,7 @@
   base::FilePath path_;
   std::string qualifier_;
   std::string display_name_;
-  shell::CapabilitySpec capabilities_;
+  service_manager::CapabilitySpec capabilities_;
   Entry* package_ = nullptr;
   std::vector<std::unique_ptr<Entry>> children_;
 };
@@ -74,8 +76,9 @@
 
 namespace mojo {
 template <>
-struct TypeConverter<shell::mojom::ResolveResultPtr, catalog::Entry> {
-  static shell::mojom::ResolveResultPtr Convert(const catalog::Entry& input);
+struct TypeConverter<service_manager::mojom::ResolveResultPtr, catalog::Entry> {
+  static service_manager::mojom::ResolveResultPtr Convert(
+      const catalog::Entry& input);
 };
 
 template<>
diff --git a/services/catalog/entry_unittest.cc b/services/catalog/entry_unittest.cc
index a10c8e6..0df809c 100644
--- a/services/catalog/entry_unittest.cc
+++ b/services/catalog/entry_unittest.cc
@@ -9,8 +9,8 @@
 #include "base/macros.h"
 #include "base/path_service.h"
 #include "base/values.h"
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/cpp/names.h"
+#include "services/service_manager/public/cpp/capabilities.h"
+#include "services/service_manager/public/cpp/names.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace catalog {
@@ -56,15 +56,10 @@
 TEST_F(EntryTest, Simple) {
   std::unique_ptr<Entry> entry = ReadEntry("simple", nullptr);
   EXPECT_EQ("service:foo", entry->name());
-  EXPECT_EQ(shell::GetNamePath(entry->name()), entry->qualifier());
+  EXPECT_EQ(service_manager::GetNamePath(entry->name()), entry->qualifier());
   EXPECT_EQ("Foo", entry->display_name());
 }
 
-TEST_F(EntryTest, NoWildcardInInterfaces) {
-  std::unique_ptr<Entry> entry = ReadEntry("wildcard_interfaces", nullptr);
-  EXPECT_EQ(nullptr, entry.get());
-}
-
 TEST_F(EntryTest, Instance) {
   std::unique_ptr<Entry> entry = ReadEntry("instance", nullptr);
   EXPECT_EQ("service:foo", entry->name());
@@ -78,10 +73,10 @@
   EXPECT_EQ("service:foo", entry->name());
   EXPECT_EQ("bar", entry->qualifier());
   EXPECT_EQ("Foo", entry->display_name());
-  shell::CapabilitySpec spec;
-  shell::CapabilityRequest request;
-  request.interfaces.insert("mojo::Bar");
-  spec.required["service:bar"] = request;
+  service_manager::CapabilitySpec spec;
+  service_manager::Classes classes;
+  classes.insert("bar:bar");
+  spec.required["service:bar"] = classes;
   EXPECT_EQ(spec, entry->capabilities());
 }
 
diff --git a/services/catalog/instance.cc b/services/catalog/instance.cc
index d5ee23fe..dbedda96 100644
--- a/services/catalog/instance.cc
+++ b/services/catalog/instance.cc
@@ -9,7 +9,7 @@
 #include "services/catalog/manifest_provider.h"
 #include "services/catalog/reader.h"
 #include "services/catalog/store.h"
-#include "services/shell/public/cpp/names.h"
+#include "services/service_manager/public/cpp/names.h"
 
 namespace catalog {
 namespace {
@@ -32,7 +32,7 @@
       weak_factory_(this) {}
 Instance::~Instance() {}
 
-void Instance::BindResolver(shell::mojom::ResolverRequest request) {
+void Instance::BindResolver(service_manager::mojom::ResolverRequest request) {
   if (system_cache_)
     resolver_bindings_.AddBinding(this, std::move(request));
   else
@@ -56,17 +56,18 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// Instance, shell::mojom::Resolver:
+// Instance, service_manager::mojom::Resolver:
 
 void Instance::ResolveMojoName(const std::string& mojo_name,
                                const ResolveMojoNameCallback& callback) {
   DCHECK(system_cache_);
 
-  std::string type = shell::GetNameType(mojo_name);
-  if (type != shell::kNameType_Service && type != shell::kNameType_Exe) {
+  std::string type = service_manager::GetNameType(mojo_name);
+  if (type != service_manager::kNameType_Service &&
+      type != service_manager::kNameType_Exe) {
     std::unique_ptr<Entry> entry(new Entry(mojo_name));
-    shell::mojom::ResolveResultPtr result =
-        shell::mojom::ResolveResult::From(*entry);
+    service_manager::mojom::ResolveResultPtr result =
+        service_manager::mojom::ResolveResult::From(*entry);
     result->capabilities = base::nullopt;
     callback.Run(std::move(result));
     return;
@@ -75,12 +76,12 @@
   // TODO(beng): per-user catalogs.
   auto entry = system_cache_->find(mojo_name);
   if (entry != system_cache_->end()) {
-    callback.Run(shell::mojom::ResolveResult::From(*entry->second));
+    callback.Run(service_manager::mojom::ResolveResult::From(*entry->second));
     return;
   }
 
   // Manifests for mojo: names should always be in the catalog by this point.
-  //DCHECK(type == shell::kNameType_Exe);
+  // DCHECK(type == service_manager::kNameType_Exe);
   system_reader_->CreateEntryForName(
       mojo_name, system_cache_,
       base::Bind(&Instance::OnReadManifest, weak_factory_.GetWeakPtr(),
@@ -170,7 +171,7 @@
 void Instance::OnReadManifest(base::WeakPtr<Instance> instance,
                               const std::string& mojo_name,
                               const ResolveMojoNameCallback& callback,
-                              shell::mojom::ResolveResultPtr result) {
+                              service_manager::mojom::ResolveResultPtr result) {
   callback.Run(std::move(result));
   if (instance)
     instance->SerializeCatalog();
diff --git a/services/catalog/instance.h b/services/catalog/instance.h
index 0c82d47..e81f2d67 100644
--- a/services/catalog/instance.h
+++ b/services/catalog/instance.h
@@ -14,29 +14,29 @@
 #include "services/catalog/public/interfaces/catalog.mojom.h"
 #include "services/catalog/store.h"
 #include "services/catalog/types.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/interfaces/resolver.mojom.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/interfaces/resolver.mojom.h"
 
 namespace catalog {
 
 class Reader;
 class Store;
 
-class Instance : public shell::mojom::Resolver,
+class Instance : public service_manager::mojom::Resolver,
                  public mojom::Catalog {
  public:
   // |manifest_provider| may be null.
   Instance(std::unique_ptr<Store> store, Reader* system_reader);
   ~Instance() override;
 
-  void BindResolver(shell::mojom::ResolverRequest request);
+  void BindResolver(service_manager::mojom::ResolverRequest request);
   void BindCatalog(mojom::CatalogRequest request);
 
   // Called when |cache| has been populated by a directory scan.
   void CacheReady(EntryCache* cache);
 
  private:
-  // shell::mojom::Resolver:
+  // service_manager::mojom::Resolver:
   void ResolveMojoName(const std::string& mojo_name,
                        const ResolveMojoNameCallback& callback) override;
 
@@ -62,12 +62,12 @@
   static void OnReadManifest(base::WeakPtr<Instance> instance,
                              const std::string& mojo_name,
                              const ResolveMojoNameCallback& callback,
-                             shell::mojom::ResolveResultPtr result);
+                             service_manager::mojom::ResolveResultPtr result);
 
   // User-specific persistent storage of package manifests and other settings.
   std::unique_ptr<Store> store_;
 
-  mojo::BindingSet<shell::mojom::Resolver> resolver_bindings_;
+  mojo::BindingSet<service_manager::mojom::Resolver> resolver_bindings_;
   mojo::BindingSet<mojom::Catalog> catalog_bindings_;
 
   Reader* system_reader_;
@@ -79,7 +79,8 @@
 
   // We only bind requests for these interfaces once the catalog has been
   // populated. These data structures queue requests until that happens.
-  std::vector<shell::mojom::ResolverRequest> pending_resolver_requests_;
+  std::vector<service_manager::mojom::ResolverRequest>
+      pending_resolver_requests_;
   std::vector<mojom::CatalogRequest> pending_catalog_requests_;
 
   base::WeakPtrFactory<Instance> weak_factory_;
diff --git a/services/catalog/manifest.json b/services/catalog/manifest.json
index 0486dce..384dd6e8d 100644
--- a/services/catalog/manifest.json
+++ b/services/catalog/manifest.json
@@ -13,7 +13,7 @@
       "control": [ "catalog::mojom::CatalogControl" ]
     },
     "required": {
-      "service:shell": { "classes": [ "shell:all_users", "shell:explicit_class" ] }
+      "service:shell": [ "shell:all_users", "shell:explicit_class" ]
     }
   }
 }
diff --git a/services/catalog/public/cpp/BUILD.gn b/services/catalog/public/cpp/BUILD.gn
index 3b2def1..565970d 100644
--- a/services/catalog/public/cpp/BUILD.gn
+++ b/services/catalog/public/cpp/BUILD.gn
@@ -13,6 +13,6 @@
     "//components/filesystem/public/interfaces",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 }
diff --git a/services/catalog/public/cpp/resource_loader.cc b/services/catalog/public/cpp/resource_loader.cc
index 737fb19..e8c7475 100644
--- a/services/catalog/public/cpp/resource_loader.cc
+++ b/services/catalog/public/cpp/resource_loader.cc
@@ -11,8 +11,8 @@
 #include "base/files/file.h"
 #include "components/filesystem/public/interfaces/directory.mojom.h"
 #include "mojo/public/cpp/system/platform_handle.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
 namespace catalog {
 
diff --git a/services/catalog/reader.cc b/services/catalog/reader.cc
index 43994566..3c6afca 100644
--- a/services/catalog/reader.cc
+++ b/services/catalog/reader.cc
@@ -16,7 +16,7 @@
 #include "services/catalog/constants.h"
 #include "services/catalog/entry.h"
 #include "services/catalog/manifest_provider.h"
-#include "services/shell/public/cpp/names.h"
+#include "services/service_manager/public/cpp/names.h"
 
 namespace catalog {
 namespace {
@@ -25,9 +25,9 @@
                                const std::string& name,
                                const std::string& package_name_override) {
   // TODO(beng): think more about how this should be done for exe targets.
-  std::string type = shell::GetNameType(name);
-  std::string path = shell::GetNamePath(name);
-  if (type == shell::kNameType_Service) {
+  std::string type = service_manager::GetNameType(name);
+  std::string path = service_manager::GetNamePath(name);
+  if (type == service_manager::kNameType_Service) {
     std::string package_name;
     if (package_name_override.empty())
       package_name = path;
@@ -36,26 +36,27 @@
     return package_dir.AppendASCII(kPackagesDirName).AppendASCII(
         package_name + "/manifest.json");
   }
-  if (type == shell::kNameType_Exe)
+  if (type == service_manager::kNameType_Exe)
     return package_dir.AppendASCII(path + "_manifest.json");
   return base::FilePath();
 }
 
 base::FilePath GetExecutablePath(const base::FilePath& package_dir,
                                  const std::string& name) {
-  std::string type = shell::GetNameType(name);
-  if (type == shell::kNameType_Service) {
+  std::string type = service_manager::GetNameType(name);
+  if (type == service_manager::kNameType_Service) {
     // It's still a mojo: URL, use the default mapping scheme.
-    const std::string host = shell::GetNamePath(name);
+    const std::string host = service_manager::GetNamePath(name);
     return package_dir.AppendASCII(host + "/" + host + ".library");
   }
-  if (type == shell::kNameType_Exe) {
+  if (type == service_manager::kNameType_Exe) {
 #if defined OS_WIN
     std::string extension = ".exe";
 #else
     std::string extension;
 #endif
-    return package_dir.AppendASCII(shell::GetNamePath(name) + extension);
+    return package_dir.AppendASCII(service_manager::GetNamePath(name) +
+                                   extension);
   }
   return base::FilePath();
 }
@@ -156,7 +157,7 @@
   (*cache)[entry->name()] = std::move(entry);
 }
 
-void DoNothing(shell::mojom::ResolveResultPtr) {}
+void DoNothing(service_manager::mojom::ResolveResultPtr) {}
 
 }  // namespace
 
@@ -251,8 +252,8 @@
     std::unique_ptr<Entry> entry) {
   if (!entry)
     return;
-  shell::mojom::ResolveResultPtr result =
-      shell::mojom::ResolveResult::From(*entry);
+  service_manager::mojom::ResolveResultPtr result =
+      service_manager::mojom::ResolveResult::From(*entry);
   AddEntryToCache(cache, std::move(entry));
   entry_created_callback.Run(std::move(result));
 }
diff --git a/services/catalog/reader.h b/services/catalog/reader.h
index 1bba68d..f46c750 100644
--- a/services/catalog/reader.h
+++ b/services/catalog/reader.h
@@ -14,7 +14,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "services/catalog/types.h"
-#include "services/shell/public/interfaces/resolver.mojom.h"
+#include "services/service_manager/public/interfaces/resolver.mojom.h"
 
 namespace base {
 class SequencedWorkerPool;
@@ -31,7 +31,7 @@
  public:
   using ReadManifestCallback = base::Callback<void(std::unique_ptr<Entry>)>;
   using CreateEntryForNameCallback =
-      base::Callback<void(shell::mojom::ResolveResultPtr)>;
+      base::Callback<void(service_manager::mojom::ResolveResultPtr)>;
 
   Reader(base::SequencedWorkerPool* worker_pool,
          ManifestProvider* manifest_provider);
diff --git a/services/catalog/store.cc b/services/catalog/store.cc
index 1dba01e..40a593e5 100644
--- a/services/catalog/store.cc
+++ b/services/catalog/store.cc
@@ -21,10 +21,6 @@
 // static
 const char Store::kCapabilities_RequiredKey[] = "required";
 // static
-const char Store::kCapabilities_ClassesKey[] = "classes";
-// static
-const char Store::kCapabilities_InterfacesKey[] = "interfaces";
-// static
 const char Store::kServicesKey[] = "services";
 
 }  // namespace catalog
diff --git a/services/catalog/store.h b/services/catalog/store.h
index e563b2c..c91e870 100644
--- a/services/catalog/store.h
+++ b/services/catalog/store.h
@@ -31,10 +31,6 @@
   // Value is a dictionary.
   static const char kCapabilities_RequiredKey[];
   // Value is a list.
-  static const char kCapabilities_ClassesKey[];
-  // Value is a list.
-  static const char kCapabilities_InterfacesKey[];
-  // Value is a list.
   static const char kServicesKey[];
 
   virtual ~Store() {}
diff --git a/services/file/BUILD.gn b/services/file/BUILD.gn
index 0db315f..ff1e39106 100644
--- a/services/file/BUILD.gn
+++ b/services/file/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 
 source_set("lib") {
   sources = [
@@ -24,8 +24,8 @@
     "//mojo/common",
     "//mojo/common:common_base",
     "//services/file/public/interfaces",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//url",
   ]
diff --git a/services/file/file_service.cc b/services/file/file_service.cc
index ecc330dd..85a53b12 100644
--- a/services/file/file_service.cc
+++ b/services/file/file_service.cc
@@ -11,7 +11,7 @@
 #include "components/leveldb/leveldb_service_impl.h"
 #include "services/file/file_system.h"
 #include "services/file/user_id_map.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 
 namespace file {
 
@@ -25,7 +25,7 @@
   ~FileSystemObjects() {}
 
   // Called on the |file_service_runner_|.
-  void OnFileSystemRequest(const shell::Identity& remote_identity,
+  void OnFileSystemRequest(const service_manager::Identity& remote_identity,
                            mojom::FileSystemRequest request) {
     if (!lock_table_)
       lock_table_ = new filesystem::LockTable;
@@ -52,7 +52,7 @@
   ~LevelDBServiceObjects() {}
 
   // Called on the |leveldb_service_runner_|.
-  void OnLevelDBServiceRequest(const shell::Identity& remote_identity,
+  void OnLevelDBServiceRequest(const service_manager::Identity& remote_identity,
                                leveldb::mojom::LevelDBServiceRequest request) {
     if (!leveldb_service_)
       leveldb_service_.reset(new leveldb::LevelDBServiceImpl(task_runner_));
@@ -69,7 +69,7 @@
   DISALLOW_COPY_AND_ASSIGN(LevelDBServiceObjects);
 };
 
-std::unique_ptr<shell::Service> CreateFileService(
+std::unique_ptr<service_manager::Service> CreateFileService(
     scoped_refptr<base::SingleThreadTaskRunner> file_service_runner,
     scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner,
     const base::Closure& quit_closure) {
@@ -88,22 +88,22 @@
   leveldb_service_runner_->DeleteSoon(FROM_HERE, leveldb_objects_.release());
 }
 
-void FileService::OnStart(const shell::Identity& identity) {
+void FileService::OnStart(const service_manager::Identity& identity) {
   file_system_objects_.reset(new FileService::FileSystemObjects(
       GetUserDirForUserId(identity.user_id())));
   leveldb_objects_.reset(
       new FileService::LevelDBServiceObjects(leveldb_service_runner_));
 }
 
-bool FileService::OnConnect(const shell::Identity& remote_identity,
-                                shell::InterfaceRegistry* registry) {
+bool FileService::OnConnect(const service_manager::Identity& remote_identity,
+                            service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<leveldb::mojom::LevelDBService>(this);
   registry->AddInterface<mojom::FileSystem>(this);
   return true;
 }
 
-void FileService::Create(const shell::Identity& remote_identity,
-                             mojom::FileSystemRequest request) {
+void FileService::Create(const service_manager::Identity& remote_identity,
+                         mojom::FileSystemRequest request) {
   file_service_runner_->PostTask(
       FROM_HERE,
       base::Bind(&FileService::FileSystemObjects::OnFileSystemRequest,
@@ -111,8 +111,8 @@
                  base::Passed(&request)));
 }
 
-void FileService::Create(const shell::Identity& remote_identity,
-                             leveldb::mojom::LevelDBServiceRequest request) {
+void FileService::Create(const service_manager::Identity& remote_identity,
+                         leveldb::mojom::LevelDBServiceRequest request) {
   leveldb_service_runner_->PostTask(
       FROM_HERE,
       base::Bind(
diff --git a/services/file/file_service.h b/services/file/file_service.h
index 9a8c78d..6ec9e1e 100644
--- a/services/file/file_service.h
+++ b/services/file/file_service.h
@@ -11,20 +11,20 @@
 #include "components/leveldb/public/interfaces/leveldb.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "services/file/public/interfaces/file_system.mojom.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace file {
 
-std::unique_ptr<shell::Service> CreateFileService(
+std::unique_ptr<service_manager::Service> CreateFileService(
     scoped_refptr<base::SingleThreadTaskRunner> file_service_runner,
     scoped_refptr<base::SingleThreadTaskRunner> leveldb_service_runner,
     const base::Closure& quit_closure);
 
 class FileService
-    : public shell::Service,
-      public shell::InterfaceFactory<mojom::FileSystem>,
-      public shell::InterfaceFactory<leveldb::mojom::LevelDBService> {
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::FileSystem>,
+      public service_manager::InterfaceFactory<leveldb::mojom::LevelDBService> {
  public:
   FileService(
       scoped_refptr<base::SingleThreadTaskRunner> file_service_runner,
@@ -33,16 +33,16 @@
 
  private:
   // |Service| override:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // |InterfaceFactory<mojom::FileSystem>| implementation:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               mojom::FileSystemRequest request) override;
 
   // |InterfaceFactory<LevelDBService>| implementation:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               leveldb::mojom::LevelDBServiceRequest request) override;
 
   void OnLevelDBServiceError();
diff --git a/services/file/file_system.cc b/services/file/file_system.cc
index 72d42c4..f408c34 100644
--- a/services/file/file_system.cc
+++ b/services/file/file_system.cc
@@ -13,7 +13,7 @@
 #include "components/filesystem/lock_table.h"
 #include "components/filesystem/public/interfaces/types.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 
 namespace file {
 
diff --git a/services/file/file_system.h b/services/file/file_system.h
index 3ecc0df..c86e9f0 100644
--- a/services/file/file_system.h
+++ b/services/file/file_system.h
@@ -10,7 +10,7 @@
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "services/file/public/interfaces/file_system.mojom.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 
 namespace filesystem {
 class LockTable;
diff --git a/services/file/manifest.json b/services/file/manifest.json
index bde2547f..bc14b37 100644
--- a/services/file/manifest.json
+++ b/services/file/manifest.json
@@ -9,7 +9,7 @@
       "file:leveldb": [ "leveldb::mojom::LevelDBService" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/services/navigation/BUILD.gn b/services/navigation/BUILD.gn
index 805a9bf..ebce5ae 100644
--- a/services/navigation/BUILD.gn
+++ b/services/navigation/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 import("//tools/grit/repack.gni")
 
@@ -30,8 +30,8 @@
     "//content/public/app:both",
     "//mojo/public/cpp/bindings",
     "//services/navigation/content_client",
-    "//services/shell/runner:init",
-    "//services/shell/runner/common",
+    "//services/service_manager/runner:init",
+    "//services/service_manager/runner/common",
     "//services/ui/public/cpp",
     "//ui/views",
     "//ui/views/controls/webview",
@@ -63,7 +63,7 @@
     "//content/public/common",
     "//mojo/public/cpp/bindings",
     "//services/navigation/public/interfaces",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/public/cpp",
   ]
 
@@ -86,9 +86,9 @@
     "//base",
     "//base/test:test_support",
     "//services/navigation/public/interfaces",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
     "//testing/gtest",
   ]
 
diff --git a/services/navigation/DEPS b/services/navigation/DEPS
index 3c140aad..f0cab60 100644
--- a/services/navigation/DEPS
+++ b/services/navigation/DEPS
@@ -4,6 +4,6 @@
   "+content/shell",
   "+net/base",
   "+sandbox",
-  "+services/shell",
+  "+services/service_manager",
   "+ui"
 ]
diff --git a/services/navigation/main.cc b/services/navigation/main.cc
index 942a6e0..cdb3402 100644
--- a/services/navigation/main.cc
+++ b/services/navigation/main.cc
@@ -9,7 +9,7 @@
 #include "base/path_service.h"
 #include "content/public/app/content_main.h"
 #include "services/navigation/content_client/main_delegate.h"
-#include "services/shell/runner/init.h"
+#include "services/service_manager/runner/init.h"
 
 #if defined(OS_WIN)
 #include "content/public/app/sandbox_helper_win.h"
@@ -24,7 +24,7 @@
 int main(int argc, const char** argv) {
 #endif
   base::CommandLine::Init(argc, argv);
-  shell::WaitForDebuggerIfNecessary();
+  service_manager::WaitForDebuggerIfNecessary();
 
 #if !defined(OFFICIAL_BUILD)
 #if defined(OS_WIN)
diff --git a/services/navigation/manifest.json b/services/navigation/manifest.json
index 9e5680c..d26ac45 100644
--- a/services/navigation/manifest.json
+++ b/services/navigation/manifest.json
@@ -7,8 +7,10 @@
       "app": [ "navigation::mojom::ViewFactory" ]
     },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:shell": { "classes": [ "shell:client_process", "shell:user_id", "shell:instance_name" ] }
+      "*": [ "app" ],
+      "service:shell": [ "shell:client_process",
+                         "shell:user_id",
+                         "shell:instance_name" ]
     }
   }
 }
diff --git a/services/navigation/navigation.cc b/services/navigation/navigation.cc
index 824284e..7c3ef222 100644
--- a/services/navigation/navigation.cc
+++ b/services/navigation/navigation.cc
@@ -9,18 +9,18 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "services/navigation/view_impl.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace navigation {
 
 namespace {
 
 void CreateViewOnViewTaskRunner(
-    std::unique_ptr<shell::Connector> connector,
+    std::unique_ptr<service_manager::Connector> connector,
     const std::string& client_user_id,
     mojom::ViewClientPtr client,
     mojom::ViewRequest request,
-    std::unique_ptr<shell::ServiceContextRef> context_ref) {
+    std::unique_ptr<service_manager::ServiceContextRef> context_ref) {
   mojo::MakeStrongBinding(
       base::MakeUnique<ViewImpl>(std::move(connector), client_user_id,
                                  std::move(client), std::move(context_ref)),
@@ -38,9 +38,9 @@
 }
 Navigation::~Navigation() {}
 
-bool Navigation::OnConnect(const shell::Identity& remote_identity,
-                           shell::InterfaceRegistry* registry,
-                           shell::Connector* connector) {
+bool Navigation::OnConnect(const service_manager::Identity& remote_identity,
+                           service_manager::InterfaceRegistry* registry,
+                           service_manager::Connector* connector) {
   std::string remote_user_id = remote_identity.user_id();
   if (!client_user_id_.empty() && client_user_id_ != remote_user_id) {
     LOG(ERROR) << "Must have a separate Navigation service instance for "
@@ -56,8 +56,9 @@
 
 void Navigation::CreateView(mojom::ViewClientPtr client,
                             mojom::ViewRequest request) {
-  std::unique_ptr<shell::Connector> new_connector = connector_->Clone();
-  std::unique_ptr<shell::ServiceContextRef> context_ref =
+  std::unique_ptr<service_manager::Connector> new_connector =
+      connector_->Clone();
+  std::unique_ptr<service_manager::ServiceContextRef> context_ref =
       ref_factory_.CreateRef();
   view_task_runner_->PostTask(
       FROM_HERE,
diff --git a/services/navigation/navigation.h b/services/navigation/navigation.h
index 1c2b26b..635dc3b 100644
--- a/services/navigation/navigation.h
+++ b/services/navigation/navigation.h
@@ -11,9 +11,9 @@
 #include "content/public/common/connection_filter.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "services/navigation/public/interfaces/view.mojom.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context_ref.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context_ref.h"
 
 namespace content {
 class BrowserContext;
@@ -28,9 +28,9 @@
 
  private:
   // content::ConnectionFilter:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry,
-                 shell::Connector* connector) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry,
+                 service_manager::Connector* connector) override;
 
   // mojom::ViewFactory:
   void CreateView(mojom::ViewClientPtr client,
@@ -41,11 +41,11 @@
 
   scoped_refptr<base::SequencedTaskRunner> view_task_runner_;
 
-  shell::Connector* connector_ = nullptr;
+  service_manager::Connector* connector_ = nullptr;
   std::string client_user_id_;
 
-  shell::ServiceContextRefFactory ref_factory_;
-  std::set<std::unique_ptr<shell::ServiceContextRef>> refs_;
+  service_manager::ServiceContextRefFactory ref_factory_;
+  std::set<std::unique_ptr<service_manager::ServiceContextRef>> refs_;
 
   mojo::BindingSet<mojom::ViewFactory> bindings_;
 
diff --git a/services/navigation/navigation_unittest.cc b/services/navigation/navigation_unittest.cc
index eb067676..1237ebb 100644
--- a/services/navigation/navigation_unittest.cc
+++ b/services/navigation/navigation_unittest.cc
@@ -7,22 +7,22 @@
 #include "base/macros.h"
 #include "base/run_loop.h"
 #include "services/navigation/public/interfaces/view.mojom.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_test.h"
 
 namespace navigation {
 
-class NavigationTest : public shell::test::ServiceTest,
+class NavigationTest : public service_manager::test::ServiceTest,
                        public mojom::ViewClient {
  public:
   NavigationTest()
-      : shell::test::ServiceTest("exe:navigation_unittests"),
+      : service_manager::test::ServiceTest("exe:navigation_unittests"),
         binding_(this) {}
   ~NavigationTest() override {}
 
  protected:
    void SetUp() override {
-     shell::test::ServiceTest::SetUp();
+     service_manager::test::ServiceTest::SetUp();
      window_manager_connection_ = connector()->Connect("service:test_wm");
    }
 
@@ -65,7 +65,7 @@
   int load_count_ = 0;
   mojo::Binding<mojom::ViewClient> binding_;
   base::RunLoop* loop_ = nullptr;
-  std::unique_ptr<shell::Connection> window_manager_connection_;
+  std::unique_ptr<service_manager::Connection> window_manager_connection_;
 
   DISALLOW_COPY_AND_ASSIGN(NavigationTest);
 };
diff --git a/services/navigation/unittest_manifest.json b/services/navigation/unittest_manifest.json
index 9414d91..6a0b814 100644
--- a/services/navigation/unittest_manifest.json
+++ b/services/navigation/unittest_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Navigation Unittests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/services/navigation/view_impl.cc b/services/navigation/view_impl.cc
index 7de18b47..5be420e9 100644
--- a/services/navigation/view_impl.cc
+++ b/services/navigation/view_impl.cc
@@ -16,7 +16,7 @@
 #include "content/public/browser/notification_source.h"
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/web_contents.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/window_tree_client.h"
 #include "ui/views/controls/webview/webview.h"
 #include "ui/views/mus/native_widget_mus.h"
@@ -58,10 +58,10 @@
 
 }  // namespace
 
-ViewImpl::ViewImpl(std::unique_ptr<shell::Connector> connector,
+ViewImpl::ViewImpl(std::unique_ptr<service_manager::Connector> connector,
                    const std::string& client_user_id,
                    mojom::ViewClientPtr client,
-                   std::unique_ptr<shell::ServiceContextRef> ref)
+                   std::unique_ptr<service_manager::ServiceContextRef> ref)
     : connector_(std::move(connector)),
       client_(std::move(client)),
       ref_(std::move(ref)),
diff --git a/services/navigation/view_impl.h b/services/navigation/view_impl.h
index cad292b6..b909f09 100644
--- a/services/navigation/view_impl.h
+++ b/services/navigation/view_impl.h
@@ -13,9 +13,9 @@
 #include "content/public/browser/web_contents_delegate.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "services/navigation/public/interfaces/view.mojom.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context_ref.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context_ref.h"
 #include "services/ui/public/cpp/window_tree_client_delegate.h"
 #include "ui/gfx/geometry/size.h"
 #include "ui/views/widget/widget_delegate.h"
@@ -33,10 +33,10 @@
                  public ui::WindowTreeClientDelegate,
                  public views::WidgetDelegate {
  public:
-  ViewImpl(std::unique_ptr<shell::Connector> connector,
+  ViewImpl(std::unique_ptr<service_manager::Connector> connector,
            const std::string& client_user_id,
            mojom::ViewClientPtr client,
-           std::unique_ptr<shell::ServiceContextRef> ref);
+           std::unique_ptr<service_manager::ServiceContextRef> ref);
   ~ViewImpl() override;
 
  private:
@@ -87,9 +87,9 @@
   views::Widget* GetWidget() override;
   const views::Widget* GetWidget() const override;
 
-  std::unique_ptr<shell::Connector> connector_;
+  std::unique_ptr<service_manager::Connector> connector_;
   mojom::ViewClientPtr client_;
-  std::unique_ptr<shell::ServiceContextRef> ref_;
+  std::unique_ptr<service_manager::ServiceContextRef> ref_;
 
   std::unique_ptr<ui::WindowTreeClient> window_tree_client_;
 
diff --git a/services/shell/BUILD.gn b/services/service_manager/BUILD.gn
similarity index 72%
rename from services/shell/BUILD.gn
rename to services/service_manager/BUILD.gn
index e2987f2..85e0cfa 100644
--- a/services/shell/BUILD.gn
+++ b/services/service_manager/BUILD.gn
@@ -2,23 +2,22 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//testing/test.gni")
 
 group("all") {
   testonly = true
   deps = [
-    ":shell",
-    "//services/shell/background",
-    "//services/shell/runner",
-    "//services/shell/standalone",
-    "//services/shell/tests",
+    ":service_manager",
+    "//services/service_manager/background",
+    "//services/service_manager/runner",
+    "//services/service_manager/standalone",
+    "//services/service_manager/tests",
   ]
 }
 
-source_set("shell") {
-  output_name = "mojo_shell"
+source_set("service_manager") {
   sources = [
     "connect_params.cc",
     "connect_params.h",
@@ -40,8 +39,8 @@
     "//mojo/common",
     "//mojo/public/cpp/bindings",
     "//services/catalog/public/interfaces",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
 
   public_deps = [
diff --git a/services/shell/OWNERS b/services/service_manager/OWNERS
similarity index 100%
rename from services/shell/OWNERS
rename to services/service_manager/OWNERS
diff --git a/services/shell/README.md b/services/service_manager/README.md
similarity index 87%
rename from services/shell/README.md
rename to services/service_manager/README.md
index b644233..bd2f227 100644
--- a/services/shell/README.md
+++ b/services/service_manager/README.md
@@ -61,14 +61,14 @@
 pair. In Chrome an example of this would be multiple instances of the renderer
 or the same profile.
 
-A Service implements the Mojo interface shell.mojom.Service, which is the
+A Service implements the Mojo interface service_manager.mojom.Service, which is the
 primary means the Service Manager has of communicating with its service. Service
 has two methods: OnStart(), called once at when the Service Manager first learns
 about the service, and OnConnect(), which the Service Manager calls every time
 some other service tries to connect to this one.
 
 Services have a link back to the Service Manager too, primarily in the form of
-the shell.mojom.Connector interface. The Connector allows services to open
+the service_manager.mojom.Connector interface. The Connector allows services to open
 connections to other services.
 
 A unique connection from the Service Manager to a service is called an
@@ -90,27 +90,27 @@
 **app.cc:**
 
     #include “"mojo/public/c/system/main.h”"
-    #include “"services/shell/public/cpp/application_runner.h”"
-    #include “"services/shell/public/cpp/connector.h”"
-    #include “"services/shell/public/cpp/connection.h”"
-    #include “"services/shell/public/cpp/identity.h”"
-    #include “"services/shell/public/cpp/service.h”"
+    #include “"services/service_manager/public/cpp/application_runner.h”"
+    #include “"services/service_manager/public/cpp/connector.h”"
+    #include “"services/service_manager/public/cpp/connection.h”"
+    #include “"services/service_manager/public/cpp/identity.h”"
+    #include “"services/service_manager/public/cpp/service.h”"
 
-    class Service : public shell::Service {
+    class Service : public service_manager::Service {
      public:
       Service() {}
       ~Service() override {}
 
-      // Overridden from shell::Service:
-      void OnStart(const shell::Identity& identity) override {
+      // Overridden from service_manager::Service:
+      void OnStart(const service_manager::Identity& identity) override {
       }
-      bool OnConnect(shell::Connection* connection) override {
+      bool OnConnect(service_manager::Connection* connection) override {
         return true;
       }
     };
 
     MojoResult ServiceMain(MojoHandle service_request_handle) {
-      return shell::ServiceRunner(new Service).Run(service_request_handle);
+      return service_manager::ServiceRunner(new Service).Run(service_request_handle);
     }
 
     app_manifest.json:
@@ -128,7 +128,7 @@
 
     service(“"app"”) {
       sources = [ "“app.cc"” ]
-      deps = [ "“//base"”, "“//mojo/shell/public/cpp”" ]
+      deps = [ "“//base"”, "“//services/service_manager/public/cpp”" ]
       data_deps = [ “":manifest"” ]
     }
 
@@ -150,18 +150,18 @@
 
 ##### OnStart Parameters
 
-###### const shell::Identity& identity
+###### const service_manager::Identity& identity
 This is the identity this service is known to the Service Manager as. It
 includes the serviceÂ’s Name, User ID and Instance Name.
 
 ##### OnConnect Parameters
 
-###### shell::Connection* connection
+###### service_manager::Connection* connection
 This is a pointer to an object that encapsulates the connection with a remote
 service. The service uses this object to learn about the service at the remote
 end, to bind interfaces from it, and to expose interfaces to it. The
 “Connection” concept is implemented under the hood by a pair of
-shell.mojom.InterfaceProviders - this is the physical link between the service
+service_manager.mojom.InterfaceProviders - this is the physical link between the service
 that give the Connection its utility. The Connection object is owned by the
 caller of OnConnect, and will outlive the underlying pipes.
 
@@ -178,8 +178,8 @@
 Once we have a Connector, we can connect to other services and bind interfaces
 from them. In the trivial app above we can do this directly in OnStart:
 
-    void OnStart(const shell::Identity& identity) override {
-      scoped_ptr<shell::Connection> connection = 
+    void OnStart(const service_manager::Identity& identity) override {
+      scoped_ptr<service_manager::Connection> connection =
           connector()->Connect(“"mojo:service"”);
       mojom::SomeInterfacePtr some_interface;
       connection->GetInterface(&some_interface);
@@ -192,7 +192,7 @@
 What is happening here? LetÂ’s look line-by-line
 
 
-    scoped_ptr<shell::Connection> connection = 
+    scoped_ptr<service_manager::Connection> connection =
         connector->Connect("“mojo:service”");
 
 This asks the Service Manager to open a connection to the service named
@@ -254,20 +254,20 @@
 
 **service.cc:**
 
-    class Service : public shell::Service,
-                    public shell::InterfaceFactory<mojom::SomeInterface>,
+    class Service : public service_manager::Service,
+                    public service_manager::InterfaceFactory<mojom::SomeInterface>,
                     public mojom::SomeInterface {
      public:
       ..
 
-      // Overridden from shell::Service:
-      bool OnConnect(shell::Connection* connection) override {
+      // Overridden from service_manager::Service:
+      bool OnConnect(service_manager::Connection* connection) override {
         connection->AddInterface<mojom::SomeInterface>(this);
         return true;
       }
 
-      // Overridden from shell::InterfaceFactory<mojom::SomeInterface>:
-      void Create(shell::Connection* connection,
+      // Overridden from service_manager::InterfaceFactory<mojom::SomeInterface>:
+      void Create(service_manager::Connection* connection,
                   mojom::SomeInterfaceRequest request) override {
         bindings_.AddBinding(this, std::move(request));
       }
@@ -410,21 +410,21 @@
 
 Now that weÂ’ve built a simple application and service, itÂ’s time to write a test
 for them. The Shell client library provides a gtest base class
-**shell::test::ServiceTest** that makes writing integration tests of services
+**service_manager::test::ServiceTest** that makes writing integration tests of services
 straightforward. LetÂ’s look at a simple test of our service:
 
     #include "“base/bind.h”"
     #include “"base/run_loop.h”"
-    #include “"mojo/shell/public/cpp/service_test.h”"
+    #include “"services/service_manager/public/cpp/service_test.h”"
     #include “"path/to/some_interface.mojom.h”"
 
     void QuitLoop(base::RunLoop* loop) {
       loop->Quit();
     }
 
-    class Test : public shell::test::ServiceTest {
+    class Test : public service_manager::test::ServiceTest {
      public:
-      Test() : shell::test::ServiceTest(“exe:service_unittest”) {}
+      Test() : service_manager::test::ServiceTest(“exe:service_unittest”) {}
       ~Test() override {}
     }
 
@@ -437,7 +437,8 @@
     }
 
 The BUILD.gn for this test file looks like any other using the test() template.
-It must also depend on //services/shell/public/cpp:shell_test_support.
+It must also depend on
+//services/service_manager/public/cpp:service_test_support.
 
 ServiceTest does a few things, but most importantly it register the test itself
 as a Service, with the name you pass it via its constructor. In the example
@@ -458,14 +459,14 @@
 the callback as a parameter, and run it. In the test, we spin a RunLoop until we
 get that response. In real world cases we can pass back state & validate
 expectations. You can see real examples of this test framework in use in the
-Service ManagerÂ’s own suite of tests, under //services/shell/tests.
+Service ManagerÂ’s own suite of tests, under //services/service_manager/tests.
 
 ### Packaging
 
 By default a .library statically links its dependencies, so having many of them
 will yield an installed product many times larger than Chrome today. For this
 reason itÂ’s desirable to package several Services together in a single binary.
-The Service Manager provides an interface **shell.mojom.ServiceFactory**:
+The Service Manager provides an interface **service_manager.mojom.ServiceFactory**:
 
     interface ServiceFactory {
       CreateService(Service& service, string name);
@@ -479,11 +480,11 @@
 mojo:services - the latter implements ServiceFactory and instantiates the other
 two:
 
-    using shell::mojom::ServiceFactory;
-    using shell::mojom::ServiceRequest;
+    using service_manager::mojom::ServiceFactory;
+    using service_manager::mojom::ServiceRequest;
 
-    class Services : public shell::Service,
-                     public shell::InterfaceFactory<ServiceFactory>,
+    class Services : public service_manager::Service,
+                     public service_manager::InterfaceFactory<ServiceFactory>,
                      public ServiceFactory {
 
       // Expose ServiceFactory to inbound connections and implement
@@ -540,7 +541,7 @@
 
 At startup, the Service Manager will scan the package directory and consume the
 manifests it finds, so it can learn about how to resolve aliases that it might
-encounter subsequently. 
+encounter subsequently.
 
 ### Executables
 
@@ -557,20 +558,20 @@
 the following lines at some point early in application startup to establish the
 connection with the Service Manager:
 
-    #include “"services/shell/public/cpp/service.h”"
-    #include “"services/shell/public/cpp/service_context.h”"
-    #include “"services/shell/runner/child/runner_connection.h”"
+    #include “"services/service_manager/public/cpp/service.h”"
+    #include “"services/service_manager/public/cpp/service_context.h”"
+    #include “"services/service_manager/runner/child/runner_connection.h”"
 
-    class MyClient : public shell::Service {
+    class MyClient : public service_manager::Service {
     ..
     };
 
-    shell::mojom::ServiceRequest request;
-    scoped_ptr<shell::RunnerConnection> connection(
-       shell::RunnerConnection::ConnectToRunner(
+    service_manager::mojom::ServiceRequest request;
+    scoped_ptr<service_manager::RunnerConnection> connection(
+       service_manager::RunnerConnection::ConnectToRunner(
             &request, ScopedMessagePipeHandle()));
     MyService service;
-    shell::ServiceContext context(&service, std::move(request));
+    service_manager::ServiceContext context(&service, std::move(request));
 
 WhatÂ’s happening here? The Service/ServiceContext usage should be familiar from
 our earlier examples. The interesting part here happens in
@@ -615,23 +616,23 @@
     pair.PrepareToPassClientHandleToChildProcess(&target_command_line, &info);
 
     std::string token = mojo::edk::GenerateRandomToken();
-    target_command_line.AppendSwitchASCII(switches::kPrimordialPipeToken, 
+    target_command_line.AppendSwitchASCII(switches::kPrimordialPipeToken,
                                           token);
 
     mojo::ScopedMessagePipeHandle pipe =
         mojo::edk::CreateParentMessagePipe(token);
 
-    shell::mojom::ServiceFactoryPtr factory;
+    service_manager::mojom::ServiceFactoryPtr factory;
     factory.Bind(
-        mojo::InterfacePtrInfo<shell::mojom::ServiceFactory>(
+        mojo::InterfacePtrInfo<service_manager::mojom::ServiceFactory>(
             std::move(pipe), 0u));
-    shell::mojom::PIDReceiverPtr receiver;
+    service_manager::mojom::PIDReceiverPtr receiver;
 
-    shell::Identity target(“"exe:target”",shell::mojom::kInheritUserID);
-    shell::Connector::ConnectParams params(target);
-    params.set_client_process_connection(std::move(factory), 
+    service_manager::Identity target(“"exe:target”",service_manager::mojom::kInheritUserID);
+    service_manager::Connector::ConnectParams params(target);
+    params.set_client_process_connection(std::move(factory),
                                          GetProxy(&receiver));
-    scoped_ptr<shell::Connection> connection = connector->Connect(&params);
+    scoped_ptr<service_manager::Connection> connection = connector->Connect(&params);
 
     base::LaunchOptions options;
     options.handles_to_inherit = &info;
@@ -649,11 +650,11 @@
 
 In this example the target executable could be the same as the previous example.
 
-A word about process lifetimes. Processes created by the shell are managed by
-the Service Manager. While a service-launched process may quit itself at any
-point, when the Service Manager shuts down it will also shut down any process it
-started. Processes created by services themselves are left to those services to
-manage.
+A word about process lifetimes. Processes created by the Service Manager are
+also managed by the Service Manager. While a service-launched process may quit
+itself at any point, when the Service Manager shuts down it will also shut down
+any process it started. Processes created by services themselves are left to
+those services to manage.
 
 ***
 
diff --git a/services/service_manager/background/BUILD.gn b/services/service_manager/background/BUILD.gn
new file mode 100644
index 0000000..7af3cc6
--- /dev/null
+++ b/services/service_manager/background/BUILD.gn
@@ -0,0 +1,42 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+group("background") {
+  testonly = true
+  deps = [
+    ":lib",
+    ":main",
+  ]
+}
+
+source_set("lib") {
+  sources = [
+    "background_shell.cc",
+    "background_shell.h",
+  ]
+  deps = [
+    "//base",
+    "//services/catalog:lib",
+    "//services/service_manager",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/runner:init",
+    "//services/service_manager/standalone:lib",
+  ]
+}
+
+source_set("main") {
+  sources = [
+    "background_shell_main.cc",
+    "background_shell_main.h",
+  ]
+  deps = [
+    "//base",
+    "//services/service_manager",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/runner:init",
+    "//services/service_manager/runner/common",
+    "//services/service_manager/runner/host:lib",
+    "//services/service_manager/standalone:lib",
+  ]
+}
diff --git a/services/shell/background/DEPS b/services/service_manager/background/DEPS
similarity index 100%
rename from services/shell/background/DEPS
rename to services/service_manager/background/DEPS
diff --git a/services/shell/background/background_shell.cc b/services/service_manager/background/background_shell.cc
similarity index 92%
rename from services/shell/background/background_shell.cc
rename to services/service_manager/background/background_shell.cc
index bbe6be8..6411a6f 100644
--- a/services/shell/background/background_shell.cc
+++ b/services/service_manager/background/background_shell.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/background/background_shell.h"
+#include "services/service_manager/background/background_shell.h"
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
@@ -16,13 +16,13 @@
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/simple_thread.h"
 #include "services/catalog/store.h"
-#include "services/shell/connect_params.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/service_manager.h"
-#include "services/shell/standalone/context.h"
+#include "services/service_manager/connect_params.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/service_manager.h"
+#include "services/service_manager/standalone/context.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -175,4 +175,4 @@
                             base::Unretained(thread_.get()), callback));
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/background/background_shell.h b/services/service_manager/background/background_shell.h
similarity index 84%
rename from services/shell/background/background_shell.h
rename to services/service_manager/background/background_shell.h
index 363b88bd..c2a53c92 100644
--- a/services/shell/background/background_shell.h
+++ b/services/service_manager/background/background_shell.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_BACKGROUND_BACKGROUND_SHELL_H_
-#define SERVICES_SHELL_BACKGROUND_BACKGROUND_SHELL_H_
+#ifndef SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SHELL_H_
+#define SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SHELL_H_
 
 #include <memory>
 #include <vector>
@@ -11,13 +11,13 @@
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "services/catalog/store.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace catalog {
 class Store;
 }
 
-namespace shell {
+namespace service_manager {
 
 class NativeRunnerDelegate;
 class ServiceManager;
@@ -64,6 +64,6 @@
   DISALLOW_COPY_AND_ASSIGN(BackgroundShell);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_BACKGROUND_BACKGROUND_SHELL_H_
+#endif  // SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SHELL_H_
diff --git a/services/shell/background/background_shell_main.cc b/services/service_manager/background/background_shell_main.cc
similarity index 72%
rename from services/shell/background/background_shell_main.cc
rename to services/service_manager/background/background_shell_main.cc
index e8d7b21..1f4590dd 100644
--- a/services/shell/background/background_shell_main.cc
+++ b/services/service_manager/background/background_shell_main.cc
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/background/background_shell_main.h"
+#include "services/service_manager/background/background_shell_main.h"
 
 #include "base/at_exit.h"
 #include "base/command_line.h"
 #include "base/debug/debugger.h"
 #include "base/process/launch.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/host/child_process.h"
-#include "services/shell/runner/init.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/host/child_process.h"
+#include "services/service_manager/runner/init.h"
 
-namespace shell {
+namespace service_manager {
 namespace {
 
 int RunChildProcess() {
@@ -26,13 +26,13 @@
 }
 
 }  // namespace
-}  // namespace shell
+}  // namespace service_manager
 
 int main(int argc, char** argv) {
   base::CommandLine::Init(argc, argv);
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kChildProcess)) {
-    return shell::RunChildProcess();
+    return service_manager::RunChildProcess();
   }
   // Reset CommandLine as most likely main() is going to use CommandLine too
   // and expect to be able to initialize it.
diff --git a/services/shell/background/background_shell_main.h b/services/service_manager/background/background_shell_main.h
similarity index 63%
rename from services/shell/background/background_shell_main.h
rename to services/service_manager/background/background_shell_main.h
index 1475c35..67575a1 100644
--- a/services/shell/background/background_shell_main.h
+++ b/services/service_manager/background/background_shell_main.h
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_BACKGROUND_BACKGROUND_SHELL_MAIN_H_
-#define SERVICES_SHELL_BACKGROUND_BACKGROUND_SHELL_MAIN_H_
+#ifndef SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SHELL_MAIN_H_
+#define SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SHELL_MAIN_H_
 
 // The "main" gn target supplies a file with a main() that calls to the child
 // process as necessary. For the main process this function is called.
 int MasterProcessMain(int argc, char** argv);
 
-#endif  // SERVICES_SHELL_BACKGROUND_BACKGROUND_SHELL_MAIN_H_
+#endif  // SERVICES_SERVICE_MANAGER_BACKGROUND_BACKGROUND_SHELL_MAIN_H_
diff --git a/services/service_manager/background/tests/BUILD.gn b/services/service_manager/background/tests/BUILD.gn
new file mode 100644
index 0000000..8d4f381
--- /dev/null
+++ b/services/service_manager/background/tests/BUILD.gn
@@ -0,0 +1,78 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//mojo/public/tools/bindings/mojom.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
+import("//testing/test.gni")
+
+static_library("test_support") {
+  sources = [
+    "test_catalog_store.cc",
+    "test_catalog_store.h",
+  ]
+
+  deps = [
+    "//base",
+    "//services/catalog:lib",
+    "//url",
+  ]
+}
+
+source_set("unittests") {
+  testonly = true
+  sources = [
+    "background_shell_unittest.cc",
+  ]
+
+  deps = [
+    ":test_service_interfaces",
+    "//base",
+    "//services/service_manager/background:lib",
+    "//services/service_manager/background:main",
+    "//services/service_manager/public/cpp:sources",
+    "//testing/gtest",
+    "//url",
+  ]
+
+  data_deps = [
+    ":background_shell_test_service",
+    ":test_manifest",
+  ]
+}
+
+mojom("test_service_interfaces") {
+  sources = [
+    "test.mojom",
+  ]
+
+  use_new_wrapper_types = false
+}
+
+service("background_shell_test_service") {
+  sources = [
+    "test_service.cc",
+  ]
+
+  deps = [
+    ":test_service_interfaces",
+    "//base",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
+  ]
+
+  data_deps = [
+    ":test_service_manifest",
+  ]
+}
+
+service_manifest("test_manifest") {
+  name = "background_shell_unittest"
+  source = "test_manifest.json"
+}
+
+service_manifest("test_service_manifest") {
+  name = "background_shell_test_service"
+  source = "test_service_manifest.json"
+}
diff --git a/services/service_manager/background/tests/background_shell_unittest.cc b/services/service_manager/background/tests/background_shell_unittest.cc
new file mode 100644
index 0000000..0c25ac1
--- /dev/null
+++ b/services/service_manager/background/tests/background_shell_unittest.cc
@@ -0,0 +1,65 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/service_manager/background/background_shell.h"
+
+#include <memory>
+
+#include "base/memory/ptr_util.h"
+#include "base/run_loop.h"
+#include "services/service_manager/background/tests/test.mojom.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace service_manager {
+namespace {
+
+const char kTestName[] = "service:background_shell_unittest";
+const char kAppName[] = "service:background_shell_test_service";
+
+class ServiceImpl : public Service {
+ public:
+  ServiceImpl() {}
+  ~ServiceImpl() override {}
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(ServiceImpl);
+};
+
+void SetFlagAndRunClosure(bool* flag, const base::Closure& closure) {
+  *flag = true;
+  closure.Run();
+}
+
+}  // namespace
+
+// Uses BackgroundShell to start the shell in the background and connects to
+// background_shell_test_app, verifying we can send a message to the app.
+#if defined(OS_ANDROID)
+// TODO(crbug.com/589784): This test is disabled, as it fails
+// on the Android GN bot.
+#define MAYBE_Basic DISABLED_Basic
+#else
+#define MAYBE_Basic Basic
+#endif
+TEST(BackgroundShellTest, MAYBE_Basic) {
+  base::MessageLoop message_loop;
+  BackgroundShell background_shell;
+  background_shell.Init(nullptr);
+  ServiceImpl service;
+  ServiceContext service_context(
+      &service, background_shell.CreateServiceRequest(kTestName));
+  mojom::TestServicePtr test_service;
+  service_context.connector()->ConnectToInterface(kAppName, &test_service);
+  base::RunLoop run_loop;
+  bool got_result = false;
+  test_service->Test(base::Bind(&SetFlagAndRunClosure, &got_result,
+                                run_loop.QuitClosure()));
+  run_loop.Run();
+  EXPECT_TRUE(got_result);
+}
+
+}  // namespace service_manager
diff --git a/services/shell/background/tests/test.mojom b/services/service_manager/background/tests/test.mojom
similarity index 87%
rename from services/shell/background/tests/test.mojom
rename to services/service_manager/background/tests/test.mojom
index 18a92ec..efbdb67b 100644
--- a/services/shell/background/tests/test.mojom
+++ b/services/service_manager/background/tests/test.mojom
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
 interface TestService {
   Test() => ();
diff --git a/services/service_manager/background/tests/test_catalog_store.cc b/services/service_manager/background/tests/test_catalog_store.cc
new file mode 100644
index 0000000..b2cf09a5
--- /dev/null
+++ b/services/service_manager/background/tests/test_catalog_store.cc
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/service_manager/background/tests/test_catalog_store.h"
+
+using catalog::Store;
+
+namespace service_manager {
+
+TestCatalogStore::TestCatalogStore(std::unique_ptr<base::ListValue> store)
+    : store_(std::move(store)) {}
+
+TestCatalogStore::~TestCatalogStore() {}
+
+const base::ListValue* TestCatalogStore::GetStore() {
+  get_store_called_ = true;
+  return store_.get();
+}
+
+void TestCatalogStore::UpdateStore(std::unique_ptr<base::ListValue> store) {}
+
+std::unique_ptr<base::DictionaryValue> BuildPermissiveSerializedAppInfo(
+    const std::string& name,
+    const std::string& display_name) {
+  std::unique_ptr<base::DictionaryValue> app(new base::DictionaryValue);
+  app->SetString(Store::kNameKey, name);
+  app->SetString(Store::kDisplayNameKey, display_name);
+  app->SetInteger(Store::kManifestVersionKey, 1);
+
+  std::unique_ptr<base::DictionaryValue> capabilities(
+      new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> provided_classes(
+      new base::DictionaryValue);
+  std::unique_ptr<base::ListValue> provided_classes_list(
+      new base::ListValue);
+  provided_classes_list->AppendString("service_manager::mojom::TestService");
+  provided_classes->Set("shell:test_service", std::move(provided_classes_list));
+  capabilities->Set(Store::kCapabilities_ProvidedKey,
+                    std::move(provided_classes));
+  std::unique_ptr<base::DictionaryValue> required_capabilities(
+      new base::DictionaryValue);
+  std::unique_ptr<base::DictionaryValue> classes_dictionary(
+      new base::DictionaryValue);
+  std::unique_ptr<base::ListValue> classes_list(new base::ListValue);
+  classes_list->AppendString("shell:test_service");
+  classes_dictionary->Set("classes", std::move(classes_list));
+  required_capabilities->Set("*", std::move(classes_dictionary));
+  capabilities->Set(Store::kCapabilities_RequiredKey,
+                    std::move(required_capabilities));
+  app->Set(Store::kCapabilitiesKey, std::move(capabilities));
+  return app;
+}
+
+}  // namespace service_manager
diff --git a/services/shell/background/tests/test_catalog_store.h b/services/service_manager/background/tests/test_catalog_store.h
similarity index 79%
rename from services/shell/background/tests/test_catalog_store.h
rename to services/service_manager/background/tests/test_catalog_store.h
index 612075f6..c592960 100644
--- a/services/shell/background/tests/test_catalog_store.h
+++ b/services/service_manager/background/tests/test_catalog_store.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_BACKGROUND_TESTS_TEST_CATALOG_STORE_H_
-#define SERVICES_SHELL_BACKGROUND_TESTS_TEST_CATALOG_STORE_H_
+#ifndef SERVICES_SERVICE_MANAGER_BACKGROUND_TESTS_TEST_CATALOG_STORE_H_
+#define SERVICES_SERVICE_MANAGER_BACKGROUND_TESTS_TEST_CATALOG_STORE_H_
 
 #include <memory>
 #include <string>
@@ -11,7 +11,7 @@
 #include "base/values.h"
 #include "services/catalog/store.h"
 
-namespace shell {
+namespace service_manager {
 
 // ApplicationCatalogStore implementation that takes the ListValue to return
 // as store.
@@ -39,6 +39,6 @@
     const std::string& name,
     const std::string& display_name);
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_BACKGROUND_TESTS_TEST_CATALOG_STORE_H_
+#endif  // SERVICES_SERVICE_MANAGER_BACKGROUND_TESTS_TEST_CATALOG_STORE_H_
diff --git a/services/service_manager/background/tests/test_manifest.json b/services/service_manager/background/tests/test_manifest.json
new file mode 100644
index 0000000..e2b4c63
--- /dev/null
+++ b/services/service_manager/background/tests/test_manifest.json
@@ -0,0 +1,12 @@
+{
+  "manifest_version": 1,
+  "name": "service:background_shell_unittest",
+  "display_name": "Background Shell Unittest",
+  "capabilities": {
+    "required": {
+      "service:background_shell_test_service": [
+        "background_shell_unittest:test_service"
+      ]
+    }
+  }
+}
diff --git a/services/shell/background/tests/test_service.cc b/services/service_manager/background/tests/test_service.cc
similarity index 72%
rename from services/shell/background/tests/test_service.cc
rename to services/service_manager/background/tests/test_service.cc
index cde26bb..d60455c 100644
--- a/services/shell/background/tests/test_service.cc
+++ b/services/service_manager/background/tests/test_service.cc
@@ -3,13 +3,13 @@
 // found in the LICENSE file.
 
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/background/tests/test.mojom.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/background/tests/test.mojom.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
-namespace shell {
+namespace service_manager {
 
 class TestClient : public Service,
                    public InterfaceFactory<mojom::TestService>,
@@ -45,9 +45,9 @@
   DISALLOW_COPY_AND_ASSIGN(TestClient);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new shell::TestClient);
+  service_manager::ServiceRunner runner(new service_manager::TestClient);
   return runner.Run(service_request_handle);
 }
diff --git a/services/service_manager/background/tests/test_service_manifest.json b/services/service_manager/background/tests/test_service_manifest.json
new file mode 100644
index 0000000..0486f6e
--- /dev/null
+++ b/services/service_manager/background/tests/test_service_manifest.json
@@ -0,0 +1,12 @@
+{
+  "manifest_version": 1,
+  "name": "service:background_shell_test_service",
+  "display_name": "Background Shell Test Service",
+  "capabilities": {
+    "provided": {
+      "background_shell_unittest:test_service": [
+        "service_manager::mojom::TestService"
+      ]
+    }
+  }
+}
diff --git a/services/shell/connect_params.cc b/services/service_manager/connect_params.cc
similarity index 67%
rename from services/shell/connect_params.cc
rename to services/service_manager/connect_params.cc
index d59ba1f..e8464a8 100644
--- a/services/shell/connect_params.cc
+++ b/services/service_manager/connect_params.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/connect_params.h"
+#include "services/service_manager/connect_params.h"
 
-namespace shell {
+namespace service_manager {
 
 ConnectParams::ConnectParams() {}
 ConnectParams::~ConnectParams() {}
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/connect_params.h b/services/service_manager/connect_params.h
similarity index 81%
rename from services/shell/connect_params.h
rename to services/service_manager/connect_params.h
index 7b829669..102e28d 100644
--- a/services/shell/connect_params.h
+++ b/services/service_manager/connect_params.h
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_CONNECT_PARAMS_H_
-#define SERVICES_SHELL_CONNECT_PARAMS_H_
+#ifndef SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_
+#define SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_
 
 #include <string>
 #include <utility>
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 // This class represents a request for the application manager to connect to an
 // application.
@@ -64,6 +64,6 @@
   DISALLOW_COPY_AND_ASSIGN(ConnectParams);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_CONNECT_PARAMS_H_
+#endif  // SERVICES_SERVICE_MANAGER_CONNECT_PARAMS_H_
diff --git a/services/shell/connect_util.cc b/services/service_manager/connect_util.cc
similarity index 78%
rename from services/shell/connect_util.cc
rename to services/service_manager/connect_util.cc
index 0bf502e..e3e3fe4 100644
--- a/services/shell/connect_util.cc
+++ b/services/service_manager/connect_util.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/connect_util.h"
+#include "services/service_manager/connect_util.h"
 
 #include <memory>
 #include <utility>
 
-#include "services/shell/connect_params.h"
-#include "services/shell/service_manager.h"
+#include "services/service_manager/connect_params.h"
+#include "services/service_manager/service_manager.h"
 
-namespace shell {
+namespace service_manager {
 
 mojo::ScopedMessagePipeHandle ConnectToInterfaceByName(
     ServiceManager* service_manager,
@@ -28,4 +28,4 @@
   return std::move(pipe.handle0);
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/connect_util.h b/services/service_manager/connect_util.h
similarity index 82%
rename from services/shell/connect_util.h
rename to services/service_manager/connect_util.h
index 0524016..d6cf0d1 100644
--- a/services/shell/connect_util.h
+++ b/services/service_manager/connect_util.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_CONNECT_UTIL_H_
-#define SERVICES_SHELL_CONNECT_UTIL_H_
+#ifndef SERVICES_SERVICE_MANAGER_CONNECT_UTIL_H_
+#define SERVICES_SERVICE_MANAGER_CONNECT_UTIL_H_
 
 #include "mojo/public/cpp/bindings/interface_ptr.h"
 #include "mojo/public/cpp/system/handle.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 class ServiceManager;
 
@@ -44,6 +44,6 @@
   ptr->Bind(mojo::InterfacePtrInfo<Interface>(std::move(service_handle), 0u));
 }
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_CONNECT_UTIL_H_
+#endif  // SERVICES_SERVICE_MANAGER_CONNECT_UTIL_H_
diff --git a/services/shell/manifest.json b/services/service_manager/manifest.json
similarity index 91%
rename from services/shell/manifest.json
rename to services/service_manager/manifest.json
index 4c6e59be..dd7eb23e 100644
--- a/services/shell/manifest.json
+++ b/services/service_manager/manifest.json
@@ -27,10 +27,10 @@
       // capability interface sets.
       "shell:explicit_class": [ ],
 
-      "shell:service_manager": [ "shell::mojom::ServiceManager" ]
+      "shell:service_manager": [ "service_manager::mojom::ServiceManager" ]
     },
     "required": {
-      "service:shell": { "classes": [ "shell:all_users" ] }
+      "service:shell": [ "shell:all_users" ]
     }
   }
 }
diff --git a/services/shell/native_runner.h b/services/service_manager/native_runner.h
similarity index 79%
rename from services/shell/native_runner.h
rename to services/service_manager/native_runner.h
index 20d0a84..12f0b121f 100644
--- a/services/shell/native_runner.h
+++ b/services/service_manager/native_runner.h
@@ -2,21 +2,21 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_NATIVE_RUNNER_H_
-#define SERVICES_SHELL_NATIVE_RUNNER_H_
+#ifndef SERVICES_SERVICE_MANAGER_NATIVE_RUNNER_H_
+#define SERVICES_SERVICE_MANAGER_NATIVE_RUNNER_H_
 
 #include <memory>
 
 #include "base/callback_forward.h"
 #include "base/process/process_handle.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace base {
 class FilePath;
 }
 
-namespace shell {
+namespace service_manager {
 class Identity;
 
 // Shell requires implementations of NativeRunner and NativeRunnerFactory to run
@@ -43,6 +43,6 @@
       const base::FilePath& app_path) = 0;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_NATIVE_RUNNER_H_
+#endif  // SERVICES_SERVICE_MANAGER_NATIVE_RUNNER_H_
diff --git a/services/shell/native_runner_delegate.h b/services/service_manager/native_runner_delegate.h
similarity index 70%
rename from services/shell/native_runner_delegate.h
rename to services/service_manager/native_runner_delegate.h
index 8c22d5a..3e2815d 100644
--- a/services/shell/native_runner_delegate.h
+++ b/services/service_manager/native_runner_delegate.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_NATIVE_RUNNER_DELEGATE_H_
-#define SERVICES_SHELL_NATIVE_RUNNER_DELEGATE_H_
+#ifndef SERVICES_SERVICE_MANAGER_NATIVE_RUNNER_DELEGATE_H_
+#define SERVICES_SERVICE_MANAGER_NATIVE_RUNNER_DELEGATE_H_
 
 namespace base {
 class CommandLine;
 }
 
-namespace shell {
+namespace service_manager {
 class Identity;
 
 class NativeRunnerDelegate {
@@ -24,6 +24,6 @@
   virtual ~NativeRunnerDelegate() {}
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_NATIVE_RUNNER_DELEGATE_H_
+#endif  // SERVICES_SERVICE_MANAGER_NATIVE_RUNNER_DELEGATE_H_
diff --git a/services/shell/public/c/main.h b/services/service_manager/public/c/main.h
similarity index 82%
rename from services/shell/public/c/main.h
rename to services/service_manager/public/c/main.h
index bae2fdc..bb659a6 100644
--- a/services/shell/public/c/main.h
+++ b/services/service_manager/public/c/main.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_C_MAIN_H_
-#define SERVICES_SHELL_PUBLIC_C_MAIN_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_C_MAIN_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_C_MAIN_H_
 
 #include "mojo/public/c/system/types.h"
 
@@ -30,4 +30,4 @@
 }  // extern "C"
 #endif
 
-#endif  // SERVICES_SHELL_PUBLIC_C_MAIN_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_C_MAIN_H_
diff --git a/services/shell/public/constants.gni b/services/service_manager/public/constants.gni
similarity index 100%
rename from services/shell/public/constants.gni
rename to services/service_manager/public/constants.gni
diff --git a/services/shell/public/cpp/BUILD.gn b/services/service_manager/public/cpp/BUILD.gn
similarity index 91%
rename from services/shell/public/cpp/BUILD.gn
rename to services/service_manager/public/cpp/BUILD.gn
index bab0662f..34f7e89 100644
--- a/services/shell/public/cpp/BUILD.gn
+++ b/services/service_manager/public/cpp/BUILD.gn
@@ -48,7 +48,7 @@
     "//base",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
     "//url",
   ]
 }
@@ -86,8 +86,8 @@
       "//base/test:test_support",
       "//mojo/public/cpp/bindings",
       "//mojo/public/cpp/system",
-      "//services/shell/background:lib",
-      "//services/shell/public/interfaces:interfaces_cpp_sources",
+      "//services/service_manager/background:lib",
+      "//services/service_manager/public/interfaces:interfaces_cpp_sources",
     ]
 
     data_deps = []
diff --git a/services/shell/public/cpp/OWNERS b/services/service_manager/public/cpp/OWNERS
similarity index 100%
rename from services/shell/public/cpp/OWNERS
rename to services/service_manager/public/cpp/OWNERS
diff --git a/services/service_manager/public/cpp/capabilities.h b/services/service_manager/public/cpp/capabilities.h
new file mode 100644
index 0000000..f82e908e
--- /dev/null
+++ b/services/service_manager/public/cpp/capabilities.h
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CAPABILITIES_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CAPABILITIES_H_
+
+#include <map>
+#include <set>
+#include <string>
+
+namespace service_manager {
+
+using Class = std::string;
+using Classes = std::set<std::string>;
+using Interface = std::string;
+using Interfaces = std::set<std::string>;
+using Name = std::string;
+
+// See comments in
+// services/service_manager/public/interfaces/capabilities.mojom for a
+// description of CapabilitySpec.
+struct CapabilitySpec {
+  CapabilitySpec();
+  CapabilitySpec(const CapabilitySpec& other);
+  ~CapabilitySpec();
+  bool operator==(const CapabilitySpec& other) const;
+  bool operator<(const CapabilitySpec& other) const;
+  std::map<Class, Interfaces> provided;
+  std::map<Name, Classes> required;
+};
+
+}  // namespace service_manager
+
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CAPABILITIES_H_
diff --git a/services/service_manager/public/cpp/capabilities.typemap b/services/service_manager/public/cpp/capabilities.typemap
new file mode 100644
index 0000000..8994c7d
--- /dev/null
+++ b/services/service_manager/public/cpp/capabilities.typemap
@@ -0,0 +1,15 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+mojom = "//services/service_manager/public/interfaces/capabilities.mojom"
+public_headers = [ "//services/service_manager/public/cpp/capabilities.h" ]
+traits_headers =
+    [ "//services/service_manager/public/cpp/capabilities_struct_traits.h" ]
+
+type_mappings = [
+  "service_manager.mojom.CapabilityRequest=::service_manager::CapabilityRequest",
+  "service_manager.mojom.CapabilitySpec=::service_manager::CapabilitySpec",
+  "service_manager.mojom.Interfaces=::service_manager::Interfaces",
+  "service_manager.mojom.Classes=::service_manager::Classes",
+]
diff --git a/services/service_manager/public/cpp/capabilities_struct_traits.h b/services/service_manager/public/cpp/capabilities_struct_traits.h
new file mode 100644
index 0000000..21d8a52
--- /dev/null
+++ b/services/service_manager/public/cpp/capabilities_struct_traits.h
@@ -0,0 +1,81 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CAPABILITIES_STRUCT_TRAITS_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CAPABILITIES_STRUCT_TRAITS_H_
+
+#include "services/service_manager/public/cpp/capabilities.h"
+#include "services/service_manager/public/interfaces/capabilities.mojom.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<service_manager::mojom::CapabilitySpec::DataView,
+                    service_manager::CapabilitySpec> {
+  static const std::map<service_manager::Class, service_manager::Interfaces>&
+  provided(const service_manager::CapabilitySpec& spec) {
+    return spec.provided;
+  }
+  static const std::map<service_manager::Name, service_manager::Classes>&
+  required(const service_manager::CapabilitySpec& spec) {
+    return spec.required;
+  }
+  static bool Read(service_manager::mojom::CapabilitySpecDataView data,
+                   service_manager::CapabilitySpec* out) {
+    return data.ReadProvided(&out->provided) &&
+           data.ReadRequired(&out->required);
+  }
+};
+
+template <>
+struct StructTraits<service_manager::mojom::Interfaces::DataView,
+                    service_manager::Interfaces> {
+  static std::vector<std::string> interfaces(
+      const service_manager::Interfaces& spec) {
+    std::vector<std::string> vec;
+    for (const auto& interface_name : spec)
+      vec.push_back(interface_name);
+    return vec;
+  }
+  static bool Read(service_manager::mojom::InterfacesDataView data,
+                   service_manager::Interfaces* out) {
+    ArrayDataView<StringDataView> interfaces_data_view;
+    data.GetInterfacesDataView(&interfaces_data_view);
+    for (size_t i = 0; i < interfaces_data_view.size(); ++i) {
+      std::string interface_name;
+      if (!interfaces_data_view.Read(i, &interface_name))
+        return false;
+      out->insert(std::move(interface_name));
+    }
+    return true;
+  }
+};
+
+template <>
+struct StructTraits<service_manager::mojom::Classes::DataView,
+                    service_manager::Classes> {
+  static std::vector<std::string> classes(
+      const service_manager::Classes& spec) {
+    std::vector<std::string> vec;
+    for (const auto& class_name : spec)
+      vec.push_back(class_name);
+    return vec;
+  }
+  static bool Read(service_manager::mojom::ClassesDataView data,
+                   service_manager::Classes* out) {
+    ArrayDataView<StringDataView> classes_data_view;
+    data.GetClassesDataView(&classes_data_view);
+    for (size_t i = 0; i < classes_data_view.size(); ++i) {
+      std::string class_name;
+      if (!classes_data_view.Read(i, &class_name))
+        return false;
+      out->insert(std::move(class_name));
+    }
+    return true;
+  }
+};
+
+}  // namespace mojo
+
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CAPABILITIES_STRUCT_TRAITS_H_
diff --git a/services/shell/public/cpp/connect.h b/services/service_manager/public/cpp/connect.h
similarity index 65%
rename from services/shell/public/cpp/connect.h
rename to services/service_manager/public/cpp/connect.h
index ecce18b9..8731133 100644
--- a/services/shell/public/cpp/connect.h
+++ b/services/service_manager/public/cpp/connect.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECT_H_
-#define SERVICES_SHELL_PUBLIC_CPP_CONNECT_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECT_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECT_H_
 
 #include <utility>
 
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 // Binds |ptr| to a remote implementation of Interface from |interfaces|.
 template <typename Interface>
@@ -20,6 +20,6 @@
   interfaces->GetInterface(Interface::Name_, std::move(pipe.handle1));
 }
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_CONNECT_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECT_H_
diff --git a/services/shell/public/cpp/connection.h b/services/service_manager/public/cpp/connection.h
similarity index 87%
rename from services/shell/public/cpp/connection.h
rename to services/service_manager/public/cpp/connection.h
index 7dea805..096f9cf 100644
--- a/services/shell/public/cpp/connection.h
+++ b/services/service_manager/public/cpp/connection.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_
-#define SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTION_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTION_H_
 
 #include "base/memory/weak_ptr.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/interface_provider.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 class InterfaceProvider;
 
@@ -89,6 +89,6 @@
   virtual base::WeakPtr<Connection> GetWeakPtr() = 0;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_CONNECTION_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTION_H_
diff --git a/services/shell/public/cpp/connector.h b/services/service_manager/public/cpp/connector.h
similarity index 87%
rename from services/shell/public/cpp/connector.h
rename to services/service_manager/public/cpp/connector.h
index 30e4aa6b..58d095f 100644
--- a/services/shell/public/cpp/connector.h
+++ b/services/service_manager/public/cpp/connector.h
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_
-#define SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_
 
 #include <memory>
 
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 // An interface that encapsulates the Mojo Shell's broker interface by which
 // connections between applications are established. Once Connect() is called,
@@ -108,6 +108,6 @@
   virtual std::unique_ptr<Connector> Clone() = 0;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_CONNECTOR_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_CONNECTOR_H_
diff --git a/services/shell/public/cpp/identity.h b/services/service_manager/public/cpp/identity.h
similarity index 83%
rename from services/shell/public/cpp/identity.h
rename to services/service_manager/public/cpp/identity.h
index 086b224..728dea9 100644
--- a/services/shell/public/cpp/identity.h
+++ b/services/service_manager/public/cpp/identity.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_IDENTITY_H_
-#define SERVICES_SHELL_PUBLIC_CPP_IDENTITY_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_H_
 
 #include <string>
 
-namespace shell {
+namespace service_manager {
 
 // Represents the identity of an application.
 // |name| is the structured name of the application.
@@ -39,6 +39,6 @@
   std::string instance_;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_IDENTITY_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_H_
diff --git a/services/service_manager/public/cpp/identity.typemap b/services/service_manager/public/cpp/identity.typemap
new file mode 100644
index 0000000..7aec8d2c
--- /dev/null
+++ b/services/service_manager/public/cpp/identity.typemap
@@ -0,0 +1,10 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+mojom = "//services/service_manager/public/interfaces/connector.mojom"
+public_headers = [ "//services/service_manager/public/cpp/identity.h" ]
+traits_headers =
+    [ "//services/service_manager/public/cpp/identity_struct_traits.h" ]
+
+type_mappings = [ "service_manager.mojom.Identity=::service_manager::Identity" ]
diff --git a/services/service_manager/public/cpp/identity_struct_traits.h b/services/service_manager/public/cpp/identity_struct_traits.h
new file mode 100644
index 0000000..bfe0d9a
--- /dev/null
+++ b/services/service_manager/public/cpp/identity_struct_traits.h
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
+
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<service_manager::mojom::IdentityDataView,
+                    service_manager::Identity> {
+  static const std::string& name(const service_manager::Identity& identity) {
+    return identity.name();
+  }
+  static const std::string& user_id(const service_manager::Identity& identity) {
+    return identity.user_id();
+  }
+  static const std::string& instance(
+      const service_manager::Identity& identity) {
+    return identity.instance();
+  }
+  static bool Read(service_manager::mojom::IdentityDataView data,
+                   service_manager::Identity* out) {
+    std::string name, user_id, instance;
+    if (!data.ReadName(&name))
+      return false;
+
+    if (!data.ReadUserId(&user_id))
+      return false;
+
+    if (!data.ReadInstance(&instance))
+      return false;
+
+    *out = service_manager::Identity(name, user_id, instance);
+    return true;
+  }
+};
+
+}  // namespace mojo
+
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
diff --git a/services/shell/public/cpp/interface_binder.h b/services/service_manager/public/cpp/interface_binder.h
similarity index 74%
rename from services/shell/public/cpp/interface_binder.h
rename to services/service_manager/public/cpp/interface_binder.h
index 4d86435..6be9a7d 100644
--- a/services/shell/public/cpp/interface_binder.h
+++ b/services/service_manager/public/cpp/interface_binder.h
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_BINDER_H_
-#define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_BINDER_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_
 
 #include <string>
 
 #include "mojo/public/cpp/system/message_pipe.h"
 
-namespace shell {
+namespace service_manager {
 
 class Identity;
 
@@ -25,6 +25,6 @@
                              mojo::ScopedMessagePipeHandle handle) = 0;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_BINDER_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_
diff --git a/services/shell/public/cpp/interface_factory.h b/services/service_manager/public/cpp/interface_factory.h
similarity index 73%
rename from services/shell/public/cpp/interface_factory.h
rename to services/service_manager/public/cpp/interface_factory.h
index 2dec4003..c0c5990 100644
--- a/services/shell/public/cpp/interface_factory.h
+++ b/services/service_manager/public/cpp/interface_factory.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_FACTORY_H_
-#define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_FACTORY_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_FACTORY_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_FACTORY_H_
 
 #include "mojo/public/cpp/bindings/interface_request.h"
 
-namespace shell {
+namespace service_manager {
 
 class Identity;
 
@@ -23,6 +23,6 @@
                       mojo::InterfaceRequest<Interface> request) = 0;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_FACTORY_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_FACTORY_H_
diff --git a/services/shell/public/cpp/interface_factory_impl.h b/services/service_manager/public/cpp/interface_factory_impl.h
similarity index 80%
rename from services/shell/public/cpp/interface_factory_impl.h
rename to services/service_manager/public/cpp/interface_factory_impl.h
index 4f5c710..d840853 100644
--- a/services/shell/public/cpp/interface_factory_impl.h
+++ b/services/service_manager/public/cpp/interface_factory_impl.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_FACTORY_IMPL_H_
-#define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_FACTORY_IMPL_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_FACTORY_IMPL_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_FACTORY_IMPL_H_
 
-#include "services/shell/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
 
-namespace shell {
+namespace service_manager {
 
 // Use this class to allocate and bind instances of Impl to interface requests.
 // The lifetime of the constructed Impl is bound to the pipe.
@@ -44,6 +44,6 @@
   Context* context_;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_FACTORY_IMPL_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_FACTORY_IMPL_H_
diff --git a/services/shell/public/cpp/interface_provider.h b/services/service_manager/public/cpp/interface_provider.h
similarity index 92%
rename from services/shell/public/cpp/interface_provider.h
rename to services/service_manager/public/cpp/interface_provider.h
index 01c3c8c..6a872bc4 100644
--- a/services/shell/public/cpp/interface_provider.h
+++ b/services/service_manager/public/cpp/interface_provider.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_
-#define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_PROVIDER_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_PROVIDER_H_
 
 #include "base/bind.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 // Encapsulates a mojom::InterfaceProviderPtr implemented in a remote
 // application. Provides two main features:
@@ -117,6 +117,6 @@
   DISALLOW_COPY_AND_ASSIGN(InterfaceProvider);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_PROVIDER_H_
diff --git a/services/shell/public/cpp/interface_registry.h b/services/service_manager/public/cpp/interface_registry.h
similarity index 88%
rename from services/shell/public/cpp/interface_registry.h
rename to services/service_manager/public/cpp/interface_registry.h
index 9a3fa1e..757c5a7 100644
--- a/services/shell/public/cpp/interface_registry.h
+++ b/services/service_manager/public/cpp/interface_registry.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
-#define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_
 
 #include <memory>
 #include <queue>
@@ -13,13 +13,13 @@
 #include "base/callback.h"
 #include "base/memory/ptr_util.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/lib/callback_binder.h"
-#include "services/shell/public/cpp/lib/interface_factory_binder.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/cpp/capabilities.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/lib/callback_binder.h"
+#include "services/service_manager/public/cpp/lib/interface_factory_binder.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connection;
 class InterfaceBinder;
 
@@ -79,11 +79,11 @@
   // Construct an InterfaceRegistry with no filtering rules applied.
   InterfaceRegistry();
 
-  // Construct an InterfaceRegistry with filtering rules as specified in
-  // |capability_request| applied.
+  // Construct an InterfaceRegistry in |local_identity| that exposes only
+  // |allowed_interfaces| to |remote_identity|.
   InterfaceRegistry(const Identity& local_identity,
                     const Identity& remote_identity,
-                    const CapabilityRequest& capability_request);
+                    const Interfaces& allowed_interfaces);
   ~InterfaceRegistry() override;
 
   // Sets a default handler for incoming interface requests which are allowed by
@@ -165,7 +165,7 @@
   mojo::Binding<mojom::InterfaceProvider> binding_;
   const Identity local_identity_;
   const Identity remote_identity_;
-  const CapabilityRequest capability_request_;
+  const Interfaces allowed_interfaces_;
   const bool allow_all_interfaces_;
 
   NameToInterfaceBinderMap name_to_binder_;
@@ -183,6 +183,6 @@
   DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_
diff --git a/services/shell/public/cpp/lib/callback_binder.cc b/services/service_manager/public/cpp/lib/callback_binder.cc
similarity index 89%
rename from services/shell/public/cpp/lib/callback_binder.cc
rename to services/service_manager/public/cpp/lib/callback_binder.cc
index 63ac9de..722271e 100644
--- a/services/shell/public/cpp/lib/callback_binder.cc
+++ b/services/service_manager/public/cpp/lib/callback_binder.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/lib/callback_binder.h"
+#include "services/service_manager/public/cpp/lib/callback_binder.h"
 
-namespace shell {
+namespace service_manager {
 namespace internal {
 
 GenericCallbackBinder::GenericCallbackBinder(
@@ -36,4 +36,4 @@
 }
 
 }  // namespace internal
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/callback_binder.h b/services/service_manager/public/cpp/lib/callback_binder.h
similarity index 85%
rename from services/shell/public/cpp/lib/callback_binder.h
rename to services/service_manager/public/cpp/lib/callback_binder.h
index 87cb04392..90ef65a 100644
--- a/services/shell/public/cpp/lib/callback_binder.h
+++ b/services/service_manager/public/cpp/lib/callback_binder.h
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
-#define SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
 
 #include <utility>
 
 #include "base/bind.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/interface_binder.h"
+#include "services/service_manager/public/cpp/interface_binder.h"
 
-namespace shell {
+namespace service_manager {
 namespace internal {
 
 template <typename Interface>
@@ -67,7 +67,7 @@
 
  private:
   // InterfaceBinder:
-  void BindInterface(const shell::Identity& remote_identity,
+  void BindInterface(const service_manager::Identity& remote_identity,
                      const std::string& interface_name,
                      mojo::ScopedMessagePipeHandle handle) override;
 
@@ -81,6 +81,6 @@
 };
 
 }  // namespace internal
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CALLBACK_BINDER_H_
diff --git a/services/service_manager/public/cpp/lib/capabilities.cc b/services/service_manager/public/cpp/lib/capabilities.cc
new file mode 100644
index 0000000..639ce7d
--- /dev/null
+++ b/services/service_manager/public/cpp/lib/capabilities.cc
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/service_manager/public/cpp/capabilities.h"
+
+#include <tuple>
+
+namespace service_manager {
+
+CapabilitySpec::CapabilitySpec() {}
+CapabilitySpec::CapabilitySpec(const CapabilitySpec& other) = default;
+CapabilitySpec::~CapabilitySpec() {}
+
+bool CapabilitySpec::operator==(const CapabilitySpec& other) const {
+  return other.provided == provided && other.required == required;
+}
+
+bool CapabilitySpec::operator<(const CapabilitySpec& other) const {
+  return std::tie(provided, required) <
+      std::tie(other.provided, other.required);
+}
+
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/connection_impl.cc b/services/service_manager/public/cpp/lib/connection_impl.cc
similarity index 75%
rename from services/shell/public/cpp/lib/connection_impl.cc
rename to services/service_manager/public/cpp/lib/connection_impl.cc
index d699af7..bd4ca44 100644
--- a/services/shell/public/cpp/lib/connection_impl.cc
+++ b/services/service_manager/public/cpp/lib/connection_impl.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/lib/connection_impl.h"
+#include "services/service_manager/public/cpp/lib/connection_impl.h"
 
 #include <stdint.h>
 
@@ -10,10 +10,10 @@
 
 #include "base/bind.h"
 #include "base/logging.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_binder.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/interface_binder.h"
 
-namespace shell {
+namespace service_manager {
 namespace internal {
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -36,7 +36,8 @@
   set_remote_interfaces(remote_interfaces_owner_.get());
 }
 
-shell::mojom::Connector::ConnectCallback ConnectionImpl::GetConnectCallback() {
+service_manager::mojom::Connector::ConnectCallback
+ConnectionImpl::GetConnectCallback() {
   return base::Bind(&ConnectionImpl::OnConnectionCompleted,
                     weak_factory_.GetWeakPtr());
 }
@@ -52,7 +53,7 @@
   remote_interfaces_->SetConnectionLostClosure(handler);
 }
 
-shell::mojom::ConnectResult ConnectionImpl::GetResult() const {
+service_manager::mojom::ConnectResult ConnectionImpl::GetResult() const {
   return result_;
 }
 
@@ -79,13 +80,15 @@
 ////////////////////////////////////////////////////////////////////////////////
 // ConnectionImpl, private:
 
-void ConnectionImpl::OnConnectionCompleted(shell::mojom::ConnectResult result,
-                                           const std::string& target_user_id) {
+void ConnectionImpl::OnConnectionCompleted(
+    service_manager::mojom::ConnectResult result,
+    const std::string& target_user_id) {
   DCHECK(State::PENDING == state_);
 
   result_ = result;
-  state_ = result_ == shell::mojom::ConnectResult::SUCCEEDED ?
-      State::CONNECTED : State::DISCONNECTED;
+  state_ = result_ == service_manager::mojom::ConnectResult::SUCCEEDED
+               ? State::CONNECTED
+               : State::DISCONNECTED;
   remote_.set_user_id(target_user_id);
   std::vector<base::Closure> callbacks;
   callbacks.swap(connection_completed_callbacks_);
@@ -94,4 +97,4 @@
 }
 
 }  // namespace internal
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/connection_impl.h b/services/service_manager/public/cpp/lib/connection_impl.h
similarity index 65%
rename from services/shell/public/cpp/lib/connection_impl.h
rename to services/service_manager/public/cpp/lib/connection_impl.h
index ec205abd..2861c25f 100644
--- a/services/shell/public/cpp/lib/connection_impl.h
+++ b/services/service_manager/public/cpp/lib/connection_impl.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
-#define SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
 
 #include <stdint.h>
 
@@ -12,13 +12,13 @@
 
 #include "base/callback.h"
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/cpp/capabilities.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 
-namespace shell {
+namespace service_manager {
 namespace internal {
 
 // A ConnectionImpl represents each half of a connection between two
@@ -39,25 +39,26 @@
     remote_interfaces_ = remote_interfaces;
   }
 
-  shell::mojom::Connector::ConnectCallback GetConnectCallback();
+  service_manager::mojom::Connector::ConnectCallback GetConnectCallback();
 
  private:
   // Connection:
   const Identity& GetRemoteIdentity() const override;
   void SetConnectionLostClosure(const base::Closure& handler) override;
-  shell::mojom::ConnectResult GetResult() const override;
+  service_manager::mojom::ConnectResult GetResult() const override;
   bool IsPending() const override;
   void AddConnectionCompletedClosure(const base::Closure& callback) override;
   InterfaceProvider* GetRemoteInterfaces() override;
   base::WeakPtr<Connection> GetWeakPtr() override;
 
-  void OnConnectionCompleted(shell::mojom::ConnectResult result,
+  void OnConnectionCompleted(service_manager::mojom::ConnectResult result,
                              const std::string& target_user_id);
 
   Identity remote_;
 
   State state_;
-  shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED;
+  service_manager::mojom::ConnectResult result_ =
+      service_manager::mojom::ConnectResult::SUCCEEDED;
   std::vector<base::Closure> connection_completed_callbacks_;
 
   InterfaceProvider* remote_interfaces_ = nullptr;
@@ -70,6 +71,6 @@
 };
 
 }  // namespace internal
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTION_IMPL_H_
diff --git a/services/shell/public/cpp/lib/connector_impl.cc b/services/service_manager/public/cpp/lib/connector_impl.cc
similarity index 94%
rename from services/shell/public/cpp/lib/connector_impl.cc
rename to services/service_manager/public/cpp/lib/connector_impl.cc
index 5be6b79..8dc32f1 100644
--- a/services/shell/public/cpp/lib/connector_impl.cc
+++ b/services/service_manager/public/cpp/lib/connector_impl.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/lib/connector_impl.h"
+#include "services/service_manager/public/cpp/lib/connector_impl.h"
 
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/lib/connection_impl.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/lib/connection_impl.h"
 
-namespace shell {
+namespace service_manager {
 
 Connector::ConnectParams::ConnectParams(const Identity& target)
     : target_(target) {}
@@ -122,4 +122,4 @@
   return base::MakeUnique<ConnectorImpl>(proxy.PassInterface());
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/connector_impl.h b/services/service_manager/public/cpp/lib/connector_impl.h
similarity index 69%
rename from services/shell/public/cpp/lib/connector_impl.h
rename to services/service_manager/public/cpp/lib/connector_impl.h
index 003e3fd..487a33b0 100644
--- a/services/shell/public/cpp/lib/connector_impl.h
+++ b/services/service_manager/public/cpp/lib/connector_impl.h
@@ -2,17 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
-#define SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
 
 #include <memory>
 
 #include "base/callback.h"
 #include "base/threading/thread_checker.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 class ConnectorImpl : public Connector {
  public:
@@ -38,6 +38,6 @@
   DISALLOW_COPY_AND_ASSIGN(ConnectorImpl);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_CONNECTOR_IMPL_H_
diff --git a/services/shell/public/cpp/lib/identity.cc b/services/service_manager/public/cpp/lib/identity.cc
similarity index 86%
rename from services/shell/public/cpp/lib/identity.cc
rename to services/service_manager/public/cpp/lib/identity.cc
index 5193207f..241b3f48 100644
--- a/services/shell/public/cpp/lib/identity.cc
+++ b/services/service_manager/public/cpp/lib/identity.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/identity.h"
 
 #include "base/guid.h"
-#include "services/shell/public/cpp/names.h"
+#include "services/service_manager/public/cpp/names.h"
 
-namespace shell {
+namespace service_manager {
 
 Identity::Identity() {}
 
@@ -40,4 +40,4 @@
          other.user_id_ == user_id_;
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/init_commandline.cc b/services/service_manager/public/cpp/lib/init_commandline.cc
similarity index 73%
rename from services/shell/public/cpp/lib/init_commandline.cc
rename to services/service_manager/public/cpp/lib/init_commandline.cc
index eebfa8e8..79a2d2f 100644
--- a/services/shell/public/cpp/lib/init_commandline.cc
+++ b/services/service_manager/public/cpp/lib/init_commandline.cc
@@ -4,19 +4,19 @@
 
 #include "build/build_config.h"
 
-namespace shell {
+namespace service_manager {
 
 extern int g_service_runner_argc;
 extern const char* const* g_service_runner_argv;
 
-}  // namespace shell
+}  // namespace service_manager
 
 #if !defined(OS_WIN)
 extern "C" {
 __attribute__((visibility("default"))) void InitCommandLineArgs(
     int argc, const char* const* argv) {
-  shell::g_service_runner_argc = argc;
-  shell::g_service_runner_argv = argv;
+  service_manager::g_service_runner_argc = argc;
+  service_manager::g_service_runner_argv = argv;
 }
 }
 #endif
diff --git a/services/shell/public/cpp/lib/initialize_base_and_icu.cc b/services/service_manager/public/cpp/lib/initialize_base_and_icu.cc
similarity index 100%
rename from services/shell/public/cpp/lib/initialize_base_and_icu.cc
rename to services/service_manager/public/cpp/lib/initialize_base_and_icu.cc
diff --git a/services/shell/public/cpp/lib/interface_factory_binder.h b/services/service_manager/public/cpp/lib/interface_factory_binder.h
similarity index 69%
rename from services/shell/public/cpp/lib/interface_factory_binder.h
rename to services/service_manager/public/cpp/lib/interface_factory_binder.h
index e5ff37b..304a871 100644
--- a/services/shell/public/cpp/lib/interface_factory_binder.h
+++ b/services/service_manager/public/cpp/lib/interface_factory_binder.h
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_LIB_INTERFACE_FACTORY_BINDER_H_
-#define SERVICES_SHELL_PUBLIC_CPP_LIB_INTERFACE_FACTORY_BINDER_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_INTERFACE_FACTORY_BINDER_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_INTERFACE_FACTORY_BINDER_H_
 
 #include <utility>
 
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/interface_binder.h"
-#include "services/shell/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_binder.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
 
-namespace shell {
+namespace service_manager {
 namespace internal {
 
 template <typename Interface>
@@ -34,6 +34,6 @@
 };
 
 }  // namespace internal
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_LIB_INTERFACE_FACTORY_BINDER_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_LIB_INTERFACE_FACTORY_BINDER_H_
diff --git a/services/shell/public/cpp/lib/interface_provider.cc b/services/service_manager/public/cpp/lib/interface_provider.cc
similarity index 93%
rename from services/shell/public/cpp/lib/interface_provider.cc
rename to services/service_manager/public/cpp/lib/interface_provider.cc
index 0934ee15..2034933 100644
--- a/services/shell/public/cpp/lib/interface_provider.cc
+++ b/services/service_manager/public/cpp/lib/interface_provider.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/interface_provider.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 
-namespace shell {
+namespace service_manager {
 
 InterfaceProvider::InterfaceProvider() : weak_factory_(this) {
   pending_request_ = GetProxy(&interface_provider_);
@@ -62,4 +62,4 @@
   binders_.clear();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/interface_registry.cc b/services/service_manager/public/cpp/lib/interface_registry.cc
similarity index 88%
rename from services/shell/public/cpp/lib/interface_registry.cc
rename to services/service_manager/public/cpp/lib/interface_registry.cc
index 2169bac..3a38210 100644
--- a/services/shell/public/cpp/lib/interface_registry.cc
+++ b/services/service_manager/public/cpp/lib/interface_registry.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 #include <sstream>
 
 #include "mojo/public/cpp/bindings/message.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 
-namespace shell {
+namespace service_manager {
 
 InterfaceRegistry::InterfaceRegistry()
     : binding_(this), allow_all_interfaces_(true), weak_factory_(this) {}
@@ -17,13 +17,13 @@
 InterfaceRegistry::InterfaceRegistry(
     const Identity& local_identity,
     const Identity& remote_identity,
-    const CapabilityRequest& capability_request)
+    const Interfaces& allowed_interfaces)
     : binding_(this),
       local_identity_(local_identity),
       remote_identity_(remote_identity),
-      capability_request_(capability_request),
-      allow_all_interfaces_(capability_request.interfaces.size() == 1 &&
-                            capability_request.interfaces.count("*") == 1),
+      allowed_interfaces_(allowed_interfaces),
+      allow_all_interfaces_(allowed_interfaces_.size() == 1 &&
+                            allowed_interfaces_.count("*") == 1),
       weak_factory_(this) {}
 
 InterfaceRegistry::~InterfaceRegistry() {}
@@ -123,8 +123,7 @@
 
 bool InterfaceRegistry::CanBindRequestForInterface(
     const std::string& interface_name) const {
-  return allow_all_interfaces_ ||
-      capability_request_.interfaces.count(interface_name);
+  return allow_all_interfaces_ || allowed_interfaces_.count(interface_name);
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/names.cc b/services/service_manager/public/cpp/lib/names.cc
similarity index 91%
rename from services/shell/public/cpp/lib/names.cc
rename to services/service_manager/public/cpp/lib/names.cc
index 3312db7..b088db62 100644
--- a/services/shell/public/cpp/lib/names.cc
+++ b/services/service_manager/public/cpp/lib/names.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/names.h"
+#include "services/service_manager/public/cpp/names.h"
 
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
 
-namespace shell {
+namespace service_manager {
 
 const char kNameType_Service[] = "service";
 const char kNameType_Exe[] = "exe";
@@ -43,4 +43,4 @@
   return parts.back();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/service.cc b/services/service_manager/public/cpp/lib/service.cc
similarity index 78%
rename from services/shell/public/cpp/lib/service.cc
rename to services/service_manager/public/cpp/lib/service.cc
index aa45468..271c357 100644
--- a/services/shell/public/cpp/lib/service.cc
+++ b/services/service_manager/public/cpp/lib/service.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_context.h"
 
-namespace shell {
+namespace service_manager {
 
 Service::Service() {}
 Service::~Service() {}
@@ -32,4 +32,4 @@
   context_ = std::move(context);
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/service_context.cc b/services/service_manager/public/cpp/lib/service_context.cc
similarity index 80%
rename from services/shell/public/cpp/lib/service_context.cc
rename to services/service_manager/public/cpp/lib/service_context.cc
index dcf3085b..aff187f 100644
--- a/services/shell/public/cpp/lib/service_context.cc
+++ b/services/service_manager/public/cpp/lib/service_context.cc
@@ -2,24 +2,24 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_context.h"
 
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/lib/connector_impl.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/capabilities.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/lib/connector_impl.h"
+#include "services/service_manager/public/cpp/service.h"
 
-namespace shell {
+namespace service_manager {
 
 ////////////////////////////////////////////////////////////////////////////////
 // ServiceContext, public:
 
-ServiceContext::ServiceContext(shell::Service* service,
+ServiceContext::ServiceContext(service_manager::Service* service,
                                mojom::ServiceRequest request,
                                std::unique_ptr<Connector> connector,
                                mojom::ConnectorRequest connector_request)
@@ -49,7 +49,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 // ServiceContext, mojom::Service implementation:
 
-void ServiceContext::OnStart(const shell::Identity& identity,
+void ServiceContext::OnStart(const service_manager::Identity& identity,
                              const OnStartCallback& callback) {
   identity_ = identity;
   if (!initialize_handler_.is_null())
@@ -63,9 +63,11 @@
 void ServiceContext::OnConnect(
     const Identity& source,
     mojom::InterfaceProviderRequest interfaces,
-    const CapabilityRequest& allowed_capabilities) {
+    const Interfaces& allowed_interfaces,
+    const Classes& allowed_classes) {
+  // TODO(beng): do something with |allowed_classes|.
   std::unique_ptr<InterfaceRegistry> registry(
-      new InterfaceRegistry(identity_, source, allowed_capabilities));
+      new InterfaceRegistry(identity_, source, allowed_interfaces));
   registry->Bind(std::move(interfaces));
 
   if (!service_->OnConnect(source, registry.get()))
@@ -91,4 +93,4 @@
   // Connect() will return nullptr if they try to connect to anything.
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/service_context_ref.cc b/services/service_manager/public/cpp/lib/service_context_ref.cc
similarity index 94%
rename from services/shell/public/cpp/lib/service_context_ref.cc
rename to services/service_manager/public/cpp/lib/service_context_ref.cc
index 177010b1..0a06f1f 100644
--- a/services/shell/public/cpp/lib/service_context_ref.cc
+++ b/services/service_manager/public/cpp/lib/service_context_ref.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/service_context_ref.h"
+#include "services/service_manager/public/cpp/service_context_ref.h"
 
 #include "base/bind.h"
 #include "base/memory/ptr_util.h"
@@ -10,7 +10,7 @@
 #include "base/threading/thread_checker.h"
 #include "base/threading/thread_task_runner_handle.h"
 
-namespace shell {
+namespace service_manager {
 
 class ServiceContextRefImpl : public ServiceContextRef {
  public:
@@ -83,4 +83,4 @@
     quit_closure_.Run();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/service_runner.cc b/services/service_manager/public/cpp/lib/service_runner.cc
similarity index 91%
rename from services/shell/public/cpp/lib/service_runner.cc
rename to services/service_manager/public/cpp/lib/service_runner.cc
index bff97dbe..4cf3976 100644
--- a/services/shell/public/cpp/lib/service_runner.cc
+++ b/services/service_manager/public/cpp/lib/service_runner.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
 #include "base/at_exit.h"
 #include "base/bind.h"
@@ -10,10 +10,10 @@
 #include "base/message_loop/message_loop.h"
 #include "base/process/launch.h"
 #include "base/run_loop.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
 
-namespace shell {
+namespace service_manager {
 
 int g_service_runner_argc;
 const char* const* g_service_runner_argv;
@@ -88,4 +88,4 @@
   base::MessageLoop::current()->QuitWhenIdle();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/lib/service_test.cc b/services/service_manager/public/cpp/lib/service_test.cc
similarity index 86%
rename from services/shell/public/cpp/lib/service_test.cc
rename to services/service_manager/public/cpp/lib/service_test.cc
index 3a6cf66..ba9c2b5 100644
--- a/services/shell/public/cpp/lib/service_test.cc
+++ b/services/service_manager/public/cpp/lib/service_test.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 
 #include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
-#include "services/shell/background/background_shell.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/background/background_shell.h"
+#include "services/service_manager/public/cpp/service.h"
 
-namespace shell {
+namespace service_manager {
 namespace test {
 
 ServiceTestClient::ServiceTestClient(ServiceTest* test) : test_(test) {}
@@ -51,7 +51,7 @@
 void ServiceTest::SetUp() {
   service_ = CreateService();
   message_loop_ = CreateMessageLoop();
-  background_shell_.reset(new shell::BackgroundShell);
+  background_shell_.reset(new service_manager::BackgroundShell);
   background_shell_->Init(nullptr);
 
   // Create the shell connection. We don't proceed until we get our
@@ -75,4 +75,4 @@
 }
 
 }  // namespace test
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/public/cpp/names.h b/services/service_manager/public/cpp/names.h
similarity index 88%
rename from services/shell/public/cpp/names.h
rename to services/service_manager/public/cpp/names.h
index 060c8fa6c..6d353ab 100644
--- a/services/shell/public/cpp/names.h
+++ b/services/service_manager/public/cpp/names.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_NAMES_H_
-#define SERVICES_SHELL_PUBLIC_CPP_NAMES_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_NAMES_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_NAMES_H_
 
 #include <string>
 
-namespace shell {
+namespace service_manager {
 
 extern const char kNameType_Service[];
 extern const char kNameType_Exe[];
@@ -48,6 +48,6 @@
 // Get the path component of the specified name.
 std::string GetNamePath(const std::string& name);
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_NAMES_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_NAMES_H_
diff --git a/services/shell/public/cpp/service.gni b/services/service_manager/public/cpp/service.gni
similarity index 95%
rename from services/shell/public/cpp/service.gni
rename to services/service_manager/public/cpp/service.gni
index 23162f9..5faeb25 100644
--- a/services/shell/public/cpp/service.gni
+++ b/services/service_manager/public/cpp/service.gni
@@ -3,7 +3,7 @@
 # found in the LICENSE file.
 
 import("//build/toolchain/toolchain.gni")
-import("//services/shell/public/constants.gni")
+import("//services/service_manager/public/constants.gni")
 
 if (is_android) {
   import("//build/config/android/rules.gni")
@@ -86,7 +86,7 @@
     data_deps = []
     if (!defined(invoker.avoid_runner_cycle) || !invoker.avoid_runner_cycle) {
       # Give the user an out; as some Services are depended on by the runner.
-      data_deps += [ "//services/shell/standalone" ]
+      data_deps += [ "//services/service_manager/standalone" ]
     }
     if (defined(invoker.data_deps)) {
       data_deps += invoker.data_deps
@@ -95,7 +95,7 @@
 
     deps = [
       "//mojo/public/c/system:set_thunks_for_app",
-      "//services/shell/public/cpp:application_support",
+      "//services/service_manager/public/cpp:application_support",
     ]
 
     deps += library_deps
diff --git a/services/shell/public/cpp/service.h b/services/service_manager/public/cpp/service.h
similarity index 87%
rename from services/shell/public/cpp/service.h
rename to services/service_manager/public/cpp/service.h
index e84ebd2..83d75b02 100644
--- a/services/shell/public/cpp/service.h
+++ b/services/service_manager/public/cpp/service.h
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_
-#define SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_
 
 #include <stdint.h>
 #include <string>
 
 #include "base/macros.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
-namespace shell {
+namespace service_manager {
 
 class Connector;
 class Identity;
@@ -63,6 +63,6 @@
   DISALLOW_COPY_AND_ASSIGN(Service);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_SERVICE_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_H_
diff --git a/services/shell/public/cpp/service_context.h b/services/service_manager/public/cpp/service_context.h
similarity index 81%
rename from services/shell/public/cpp/service_context.h
rename to services/service_manager/public/cpp/service_context.h
index e162d02..e898079 100644
--- a/services/shell/public/cpp/service_context.h
+++ b/services/service_manager/public/cpp/service_context.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_H_
-#define SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_
 
 #include <memory>
 #include <utility>
@@ -13,12 +13,12 @@
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/core.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 // Encapsulates a connection to the Service Manager in two parts:
 // - a bound InterfacePtr to mojom::Connector, the primary mechanism
@@ -48,7 +48,7 @@
   // ServiceContext. If either |connector| or |connector_request| is non-null
   // both must be non-null. If both are null, the connection will create its own
   // Connector and request to pass to the Service Manager on initialization.
-  ServiceContext(shell::Service* service,
+  ServiceContext(service_manager::Service* service,
                  mojom::ServiceRequest request,
                  std::unique_ptr<Connector> connector = nullptr,
                  mojom::ConnectorRequest connector_request = nullptr);
@@ -69,7 +69,8 @@
                const OnStartCallback& callback) override;
   void OnConnect(const Identity& source,
                  mojom::InterfaceProviderRequest interfaces,
-                 const CapabilityRequest& allowed_capabilities) override;
+                 const Interfaces& allowed_interfaces,
+                 const Classes& allowed_classes) override;
 
   void OnConnectionError();
 
@@ -84,10 +85,10 @@
   // Manager.
   mojom::ConnectorRequest pending_connector_request_;
 
-  shell::Service* service_;
+  service_manager::Service* service_;
   mojo::Binding<mojom::Service> binding_;
   std::unique_ptr<Connector> connector_;
-  shell::Identity identity_;
+  service_manager::Identity identity_;
   bool should_run_connection_lost_closure_ = false;
 
   base::Closure connection_lost_closure_;
@@ -95,6 +96,6 @@
   DISALLOW_COPY_AND_ASSIGN(ServiceContext);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_H_
diff --git a/services/shell/public/cpp/service_context_ref.h b/services/service_manager/public/cpp/service_context_ref.h
similarity index 84%
rename from services/shell/public/cpp/service_context_ref.h
rename to services/service_manager/public/cpp/service_context_ref.h
index 0b81e8d..df7ae82 100644
--- a/services/shell/public/cpp/service_context_ref.h
+++ b/services/service_manager/public/cpp/service_context_ref.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_REF_H_
-#define SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_REF_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_REF_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_REF_H_
 
 #include <memory>
 
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 
-namespace shell {
+namespace service_manager {
 
 class ServiceContextRefImpl;
 
@@ -54,6 +54,6 @@
   DISALLOW_COPY_AND_ASSIGN(ServiceContextRefFactory);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_SERVICE_CONTEXT_REF_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_CONTEXT_REF_H_
diff --git a/services/shell/public/cpp/service_runner.h b/services/service_manager/public/cpp/service_runner.h
similarity index 87%
rename from services/shell/public/cpp/service_runner.h
rename to services/service_manager/public/cpp/service_runner.h
index 3e62831..0f587d1 100644
--- a/services/shell/public/cpp/service_runner.h
+++ b/services/service_manager/public/cpp/service_runner.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_
-#define SERVICES_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_
 
 #include <memory>
 
 #include "base/message_loop/message_loop.h"
 #include "mojo/public/cpp/system/core.h"
 
-namespace shell {
+namespace service_manager {
 
 class Service;
 class ServiceContext;
@@ -19,7 +19,7 @@
 // use from your ServiceMain:
 //
 //  MojoResult ServiceMain(MojoHandle service_request_handle) {
-//    shell::ServiceRunner runner(new MyService);
+//    service_manager::ServiceRunner runner(new MyService);
 //    return runner.Run(service_request_handle);
 //  }
 //
@@ -69,6 +69,6 @@
   DISALLOW_COPY_AND_ASSIGN(ServiceRunner);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_
diff --git a/services/shell/public/cpp/service_test.h b/services/service_manager/public/cpp/service_test.h
similarity index 83%
rename from services/shell/public/cpp/service_test.h
rename to services/service_manager/public/cpp/service_test.h
index 714232a..7ef568b 100644
--- a/services/shell/public/cpp/service_test.h
+++ b/services/service_manager/public/cpp/service_test.h
@@ -2,22 +2,22 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_TEST_H_
-#define SERVICES_SHELL_PUBLIC_CPP_SERVICE_TEST_H_
+#ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_
+#define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_
 
 #include <memory>
 
 #include "base/macros.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace base {
 class MessageLoop;
 }
 
-namespace shell {
+namespace service_manager {
 
 class BackgroundShell;
 
@@ -95,8 +95,8 @@
 
   Connector* connector_ = nullptr;
   std::string initialize_name_;
-  std::string initialize_userid_ = shell::mojom::kInheritUserID;
-  uint32_t initialize_instance_id_ = shell::mojom::kInvalidInstanceID;
+  std::string initialize_userid_ = service_manager::mojom::kInheritUserID;
+  uint32_t initialize_instance_id_ = service_manager::mojom::kInvalidInstanceID;
 
   base::Closure initialize_called_;
 
@@ -104,6 +104,6 @@
 };
 
 }  // namespace test
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_PUBLIC_CPP_SERVICE_TEST_H_
+#endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_
diff --git a/services/shell/public/cpp/test/BUILD.gn b/services/service_manager/public/cpp/test/BUILD.gn
similarity index 82%
rename from services/shell/public/cpp/test/BUILD.gn
rename to services/service_manager/public/cpp/test/BUILD.gn
index 48bf72b8..9158aed3 100644
--- a/services/shell/public/cpp/test/BUILD.gn
+++ b/services/service_manager/public/cpp/test/BUILD.gn
@@ -22,7 +22,7 @@
     "//base",
     "//base/test:test_support",
     "//mojo/edk/system",
-    "//services/shell/background:lib",
-    "//services/shell/background:main",
+    "//services/service_manager/background:lib",
+    "//services/service_manager/background:main",
   ]
 }
diff --git a/services/shell/public/cpp/test/run_all_shelltests.cc b/services/service_manager/public/cpp/test/run_all_shelltests.cc
similarity index 87%
rename from services/shell/public/cpp/test/run_all_shelltests.cc
rename to services/service_manager/public/cpp/test/run_all_shelltests.cc
index 368116d..54b058f 100644
--- a/services/shell/public/cpp/test/run_all_shelltests.cc
+++ b/services/service_manager/public/cpp/test/run_all_shelltests.cc
@@ -5,7 +5,7 @@
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
 #include "mojo/edk/embedder/embedder.h"
-#include "services/shell/background/background_shell_main.h"
+#include "services/service_manager/background/background_shell_main.h"
 
 int MasterProcessMain(int argc, char** argv) {
   base::TestSuite test_suite(argc, argv);
diff --git a/services/shell/public/cpp/tests/BUILD.gn b/services/service_manager/public/cpp/tests/BUILD.gn
similarity index 89%
rename from services/shell/public/cpp/tests/BUILD.gn
rename to services/service_manager/public/cpp/tests/BUILD.gn
index 36887421..3a5a834b 100644
--- a/services/shell/public/cpp/tests/BUILD.gn
+++ b/services/service_manager/public/cpp/tests/BUILD.gn
@@ -12,7 +12,7 @@
   deps = [
     "//base",
     "//mojo/edk/test:run_all_unittests",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//testing/gtest",
   ]
 }
diff --git a/services/shell/public/cpp/tests/interface_registry_unittest.cc b/services/service_manager/public/cpp/tests/interface_registry_unittest.cc
similarity index 87%
rename from services/shell/public/cpp/tests/interface_registry_unittest.cc
rename to services/service_manager/public/cpp/tests/interface_registry_unittest.cc
index 747d9da2..bf342ab 100644
--- a/services/shell/public/cpp/tests/interface_registry_unittest.cc
+++ b/services/service_manager/public/cpp/tests/interface_registry_unittest.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 #include "base/message_loop/message_loop.h"
-#include "services/shell/public/cpp/interface_binder.h"
+#include "services/service_manager/public/cpp/interface_binder.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-namespace shell {
+namespace service_manager {
 namespace internal {
 namespace {
 
@@ -16,7 +16,7 @@
  public:
   explicit TestBinder(int* delete_count) : delete_count_(delete_count) {}
   ~TestBinder() override { (*delete_count_)++; }
-  void BindInterface(const shell::Identity& remote_identity,
+  void BindInterface(const service_manager::Identity& remote_identity,
                      const std::string& interface_name,
                      mojo::ScopedMessagePipeHandle client_handle) override {}
 
@@ -69,4 +69,4 @@
 
 }  // namespace
 }  // namespace internal
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/service_manager/public/cpp/typemaps.gni b/services/service_manager/public/cpp/typemaps.gni
new file mode 100644
index 0000000..a1deb8a
--- /dev/null
+++ b/services/service_manager/public/cpp/typemaps.gni
@@ -0,0 +1,4 @@
+typemaps = [
+  "//services/service_manager/public/cpp/capabilities.typemap",
+  "//services/service_manager/public/cpp/identity.typemap",
+]
diff --git a/services/shell/public/interfaces/BUILD.gn b/services/service_manager/public/interfaces/BUILD.gn
similarity index 100%
rename from services/shell/public/interfaces/BUILD.gn
rename to services/service_manager/public/interfaces/BUILD.gn
diff --git a/services/shell/public/interfaces/OWNERS b/services/service_manager/public/interfaces/OWNERS
similarity index 100%
rename from services/shell/public/interfaces/OWNERS
rename to services/service_manager/public/interfaces/OWNERS
diff --git a/services/service_manager/public/interfaces/capabilities.mojom b/services/service_manager/public/interfaces/capabilities.mojom
new file mode 100644
index 0000000..cb1ddbb
--- /dev/null
+++ b/services/service_manager/public/interfaces/capabilities.mojom
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module service_manager.mojom;
+
+// Capabilities ----------------------------------------------------------------
+//
+// Services expose interfaces and capability classes to one another.
+//
+// In a CapabilitySpec, an interface is represented by its fully qualified name,
+// which is serialized based on the interface name and module path:
+// module::InterfaceName.
+//
+// A class is an alias to something, either a set of interface names granted
+// with that class, or some behavior specific to the application that provides
+// it.
+
+// Defines a collection of interfaces. We don't represent this as a bare array
+// in-situ in mojom because we rely on type maps to generate a set container in
+// C++ which is unavailable for a bare array.
+struct Interfaces {
+  array<string> interfaces;
+};
+
+// Defines a collection of classes. See note above about not just using a bare
+// array.
+struct Classes {
+  array<string> classes;
+};
+
+// Describes the capabilities offered and requested by an service.
+// This struct is populated from the service manifest.
+struct CapabilitySpec {
+  // The classes offered by this service, and for each class an array of
+  // interfaces. If no interfaces are granted with a class, the array will be
+  // empty.
+  // A map of class name -> array of interfaces. The array can be empty,
+  // non-empty, or ["*"], which means allow access to all interfaces.
+  map<string, Interfaces> provided;
+
+  // The services this service needs to speak to, and the classes it requires.
+  // A map of service name -> collection of required classes. "*" is also
+  // supported as the key, which supplies a set of classes required from all
+  // services in addition to specific ones specified.
+  map<string, Classes> required;
+};
diff --git a/services/shell/public/interfaces/connector.mojom b/services/service_manager/public/interfaces/connector.mojom
similarity index 97%
rename from services/shell/public/interfaces/connector.mojom
rename to services/service_manager/public/interfaces/connector.mojom
index 8b2f13a..a9fe3c97 100644
--- a/services/shell/public/interfaces/connector.mojom
+++ b/services/service_manager/public/interfaces/connector.mojom
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
-import "services/shell/public/interfaces/interface_provider.mojom";
+import "services/service_manager/public/interfaces/interface_provider.mojom";
 
 const string kRootUserID = "505C0EE9-3013-43C0-82B0-A84F50CF8D84";
 const string kInheritUserID = "D26290E4-4485-4EAE-81A2-66D1EEB40A9D";
diff --git a/services/shell/public/interfaces/interface_provider.mojom b/services/service_manager/public/interfaces/interface_provider.mojom
similarity index 96%
rename from services/shell/public/interfaces/interface_provider.mojom
rename to services/service_manager/public/interfaces/interface_provider.mojom
index c64f52f..44b67c95 100644
--- a/services/shell/public/interfaces/interface_provider.mojom
+++ b/services/service_manager/public/interfaces/interface_provider.mojom
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
 // An interface through which a client may request interfaces from a host.
 // Instances of this interface are created within the context of an
diff --git a/services/shell/public/interfaces/resolver.mojom b/services/service_manager/public/interfaces/resolver.mojom
similarity index 92%
rename from services/shell/public/interfaces/resolver.mojom
rename to services/service_manager/public/interfaces/resolver.mojom
index bee6c98..17234f9 100644
--- a/services/shell/public/interfaces/resolver.mojom
+++ b/services/service_manager/public/interfaces/resolver.mojom
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
 import "mojo/common/common_custom_types.mojom";
-import "services/shell/public/interfaces/capabilities.mojom";
+import "services/service_manager/public/interfaces/capabilities.mojom";
 
 // The result of a Resolve operation via Resolver.
 struct ResolveResult {
diff --git a/services/shell/public/interfaces/service.mojom b/services/service_manager/public/interfaces/service.mojom
similarity index 62%
rename from services/shell/public/interfaces/service.mojom
rename to services/service_manager/public/interfaces/service.mojom
index b429eec..12ffb305 100644
--- a/services/shell/public/interfaces/service.mojom
+++ b/services/service_manager/public/interfaces/service.mojom
@@ -2,43 +2,44 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
-import "services/shell/public/interfaces/capabilities.mojom";
-import "services/shell/public/interfaces/connector.mojom";
-import "services/shell/public/interfaces/interface_provider.mojom";
+import "services/service_manager/public/interfaces/capabilities.mojom";
+import "services/service_manager/public/interfaces/connector.mojom";
+import "services/service_manager/public/interfaces/interface_provider.mojom";
 
 // Implemented by something "known to" the Mojo Shell (e.g. an application or
 // service), for which an instance is tracked. It allows the implementor to
 // receive lifecycle events and service inbound connection attempts.
 interface Service {
-  // Called by the shell once an instance for this application has been created.
-  // This method will be called exactly once before any other method is called.
+  // Called by the service manager once an instance for this service has been
+  // created. This method will be called exactly once before any other method is
+  // called.
   //
   // Parameters:
   //
   //  identity
-  //    The identity of this instance in the shell. Includes:
+  //    The identity of this instance in the service manager. Includes:
   //    * The resolved name used in the connection request that resulted in this
   //      instance being initialized.
-  //    * The user associated with this instance in the shell. This will never
-  //      be kInheritUserID.
+  //    * The user associated with this instance in the service manager. This
+  //      will never be kInheritUserID.
   //    * The instance group this instance belongs to.
   //
   // Response parameters:
   //
   //  connector_request
-  //    An optional Connector request for the shell to bind, allowing the
-  //    initialized client to connect to others.
+  //    An optional Connector request for the service manager to bind, allowing
+  //    the initialized client to connect to others.
   //
   OnStart(Identity identity) => (Connector&? connector_request);
 
   // Called when another application attempts to open a connection to this
   // application. An application implements this method to complete the exchange
   // of interface implementations with the remote application. See also
-  // documentation in shell.mojom for Connect(). The application originating
-  // the request is referred to as the "source" and the one receiving the
-  // "target".
+  // documentation in service_manager.mojom for Connect(). The application
+  // originating the request is referred to as the "source" and the one
+  // receiving the "target".
   //
   // Parameters:
   //
@@ -57,5 +58,6 @@
   //
   OnConnect(Identity source,
             InterfaceProvider&? interfaces,
-            CapabilityRequest allowed_capabilities);
+            Interfaces required_interfaces,
+            Classes required_classes);
 };
diff --git a/services/shell/public/interfaces/service_factory.mojom b/services/service_manager/public/interfaces/service_factory.mojom
similarity index 77%
rename from services/shell/public/interfaces/service_factory.mojom
rename to services/service_manager/public/interfaces/service_factory.mojom
index f54a814..337218c 100644
--- a/services/shell/public/interfaces/service_factory.mojom
+++ b/services/service_manager/public/interfaces/service_factory.mojom
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
-import "services/shell/public/interfaces/service.mojom";
+import "services/service_manager/public/interfaces/service.mojom";
 
 // Implemented by a package containing multiple services identified by
 // unique names.
diff --git a/services/shell/public/interfaces/service_manager.mojom b/services/service_manager/public/interfaces/service_manager.mojom
similarity index 92%
rename from services/shell/public/interfaces/service_manager.mojom
rename to services/service_manager/public/interfaces/service_manager.mojom
index 508c9db9..52a1d77d8 100644
--- a/services/shell/public/interfaces/service_manager.mojom
+++ b/services/service_manager/public/interfaces/service_manager.mojom
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
-import "services/shell/public/interfaces/connector.mojom";
+import "services/service_manager/public/interfaces/connector.mojom";
 
 struct ServiceInfo {
   uint32 id;
diff --git a/services/service_manager/public/java/BUILD.gn b/services/service_manager/public/java/BUILD.gn
new file mode 100644
index 0000000..6386676
--- /dev/null
+++ b/services/service_manager/public/java/BUILD.gn
@@ -0,0 +1,18 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/android/rules.gni")
+
+android_library("service_manager_java") {
+  java_files = [
+    "src/org/chromium/services/service_manager/InterfaceFactory.java",
+    "src/org/chromium/services/service_manager/InterfaceRegistry.java",
+  ]
+  deps = [
+    "//base:base_java",
+    "//mojo/public/java:bindings",
+    "//mojo/public/java:system",
+    "//services/service_manager/public/interfaces:interfaces_java",
+  ]
+}
diff --git a/services/shell/public/java/src/org/chromium/services/shell/InterfaceFactory.java b/services/service_manager/public/java/src/org/chromium/services/service_manager/InterfaceFactory.java
similarity index 90%
rename from services/shell/public/java/src/org/chromium/services/shell/InterfaceFactory.java
rename to services/service_manager/public/java/src/org/chromium/services/service_manager/InterfaceFactory.java
index 8dcf260..f5b919a 100644
--- a/services/shell/public/java/src/org/chromium/services/shell/InterfaceFactory.java
+++ b/services/service_manager/public/java/src/org/chromium/services/service_manager/InterfaceFactory.java
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-package org.chromium.services.shell;
+package org.chromium.services.service_manager;
 
 import org.chromium.mojo.bindings.Interface;
 
diff --git a/services/shell/public/java/src/org/chromium/services/shell/InterfaceRegistry.java b/services/service_manager/public/java/src/org/chromium/services/service_manager/InterfaceRegistry.java
similarity index 95%
rename from services/shell/public/java/src/org/chromium/services/shell/InterfaceRegistry.java
rename to services/service_manager/public/java/src/org/chromium/services/service_manager/InterfaceRegistry.java
index 5838a64..af439ef 100644
--- a/services/shell/public/java/src/org/chromium/services/shell/InterfaceRegistry.java
+++ b/services/service_manager/public/java/src/org/chromium/services/service_manager/InterfaceRegistry.java
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-package org.chromium.services.shell;
+package org.chromium.services.service_manager;
 
 import org.chromium.mojo.bindings.Interface;
 import org.chromium.mojo.system.MessagePipeHandle;
 import org.chromium.mojo.system.MojoException;
-import org.chromium.shell.mojom.InterfaceProvider;
+import org.chromium.service_manager.mojom.InterfaceProvider;
 
 import java.util.HashMap;
 import java.util.Map;
diff --git a/services/shell/public/service_manifest.gni b/services/service_manager/public/service_manifest.gni
similarity index 96%
rename from services/shell/public/service_manifest.gni
rename to services/service_manager/public/service_manifest.gni
index fab0dafe..58e38d48 100644
--- a/services/shell/public/service_manifest.gni
+++ b/services/service_manager/public/service_manifest.gni
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/constants.gni")
+import("//services/service_manager/public/constants.gni")
 
 # Used to produce a Service Manifest for a Service.
 #
@@ -66,7 +66,8 @@
   }
 
   action(target_name) {
-    script = "//services/shell/public/tools/manifest/manifest_collator.py"
+    script =
+        "//services/service_manager/public/tools/manifest/manifest_collator.py"
 
     type = "mojo"
     if (defined(invoker.type)) {
diff --git a/services/shell/public/tools/manifest/manifest_collator.py b/services/service_manager/public/tools/manifest/manifest_collator.py
similarity index 100%
rename from services/shell/public/tools/manifest/manifest_collator.py
rename to services/service_manager/public/tools/manifest/manifest_collator.py
diff --git a/services/shell/runner/BUILD.gn b/services/service_manager/runner/BUILD.gn
similarity index 71%
rename from services/shell/runner/BUILD.gn
rename to services/service_manager/runner/BUILD.gn
index 6552005..83317470 100644
--- a/services/shell/runner/BUILD.gn
+++ b/services/service_manager/runner/BUILD.gn
@@ -5,8 +5,8 @@
 group("runner") {
   testonly = true
   deps = [
-    "//services/shell/runner/child",
-    "//services/shell/runner/host",
+    "//services/service_manager/runner/child",
+    "//services/service_manager/runner/host",
   ]
 }
 
@@ -20,6 +20,6 @@
     "//base",
     "//base:base_static",
     "//base:i18n",
-    "//services/shell/runner/common",
+    "//services/service_manager/runner/common",
   ]
 }
diff --git a/services/shell/runner/child/BUILD.gn b/services/service_manager/runner/child/BUILD.gn
similarity index 64%
rename from services/shell/runner/child/BUILD.gn
rename to services/service_manager/runner/child/BUILD.gn
index 38c216c9..fc73aa6 100644
--- a/services/shell/runner/child/BUILD.gn
+++ b/services/service_manager/runner/child/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 
 group("child") {
@@ -20,13 +20,13 @@
   ]
 
   public_deps = [
-    "//services/shell/runner:init",
+    "//services/service_manager/runner:init",
   ]
 
   deps = [
     "//base",
     "//mojo/edk/system",
-    "//services/shell/public/cpp",
-    "//services/shell/runner/common",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/runner/common",
   ]
 }
diff --git a/services/shell/runner/child/manifest.json b/services/service_manager/runner/child/manifest.json
similarity index 82%
rename from services/shell/runner/child/manifest.json
rename to services/service_manager/runner/child/manifest.json
index fc0e1c1..ff415678 100644
--- a/services/shell/runner/child/manifest.json
+++ b/services/service_manager/runner/child/manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Runner Child Apptest",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/services/shell/runner/child/test_native_main.cc b/services/service_manager/runner/child/test_native_main.cc
similarity index 70%
rename from services/shell/runner/child/test_native_main.cc
rename to services/service_manager/runner/child/test_native_main.cc
index 4de42ff..4bac06c 100644
--- a/services/shell/runner/child/test_native_main.cc
+++ b/services/service_manager/runner/child/test_native_main.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/child/test_native_main.h"
+#include "services/service_manager/runner/child/test_native_main.h"
 
 #include <utility>
 
@@ -15,12 +15,12 @@
 #include "build/build_config.h"
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/embedder/process_delegate.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/runner/common/client_util.h"
-#include "services/shell/runner/init.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/runner/common/client_util.h"
+#include "services/service_manager/runner/init.h"
 
-namespace shell {
+namespace service_manager {
 namespace {
 
 class ProcessDelegate : public mojo::edk::ProcessDelegate {
@@ -36,8 +36,8 @@
 
 }  // namespace
 
-int TestNativeMain(shell::Service* service) {
-  shell::WaitForDebuggerIfNecessary();
+int TestNativeMain(service_manager::Service* service) {
+  service_manager::WaitForDebuggerIfNecessary();
 
 #if !defined(OFFICIAL_BUILD)
   base::debug::EnableInProcessStackDumping();
@@ -58,8 +58,8 @@
     mojo::edk::SetParentPipeHandleFromCommandLine();
 
     base::MessageLoop loop;
-    service->set_context(base::MakeUnique<shell::ServiceContext>(
-        service, shell::GetServiceRequestFromCommandLine()));
+    service->set_context(base::MakeUnique<service_manager::ServiceContext>(
+        service, service_manager::GetServiceRequestFromCommandLine()));
     base::RunLoop().Run();
 
     mojo::edk::ShutdownIPCSupport();
@@ -70,4 +70,4 @@
   return 0;
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/service_manager/runner/child/test_native_main.h b/services/service_manager/runner/child/test_native_main.h
new file mode 100644
index 0000000..d9ff71c
--- /dev/null
+++ b/services/service_manager/runner/child/test_native_main.h
@@ -0,0 +1,16 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_CHILD_TEST_NATIVE_MAIN_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_CHILD_TEST_NATIVE_MAIN_H_
+
+namespace service_manager {
+
+class Service;
+
+int TestNativeMain(Service* service);
+
+}  // namespace service_manager
+
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_CHILD_TEST_NATIVE_MAIN_H_
diff --git a/services/shell/runner/common/BUILD.gn b/services/service_manager/runner/common/BUILD.gn
similarity index 88%
rename from services/shell/runner/common/BUILD.gn
rename to services/service_manager/runner/common/BUILD.gn
index 4bb5387f..be0442a 100644
--- a/services/shell/runner/common/BUILD.gn
+++ b/services/service_manager/runner/common/BUILD.gn
@@ -18,6 +18,6 @@
   ]
 
   public_deps = [
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
   ]
 }
diff --git a/services/shell/runner/common/client_util.cc b/services/service_manager/runner/common/client_util.cc
similarity index 83%
rename from services/shell/runner/common/client_util.cc
rename to services/service_manager/runner/common/client_util.cc
index c2dd7bd..082d306 100644
--- a/services/shell/runner/common/client_util.cc
+++ b/services/service_manager/runner/common/client_util.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/common/client_util.h"
+#include "services/service_manager/runner/common/client_util.h"
 
 #include <string>
 
 #include "base/command_line.h"
 #include "mojo/edk/embedder/embedder.h"
-#include "services/shell/runner/common/switches.h"
+#include "services/service_manager/runner/common/switches.h"
 
-namespace shell {
+namespace service_manager {
 
 mojom::ServicePtr PassServiceRequestOnCommandLine(
     base::CommandLine* command_line, const std::string& child_token) {
@@ -34,9 +34,9 @@
   return request;
 }
 
-bool ShellIsRemote() {
+bool ServiceManagerIsRemote() {
   return base::CommandLine::ForCurrentProcess()->HasSwitch(
       switches::kPrimordialPipeToken);
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/common/client_util.h b/services/service_manager/runner/common/client_util.h
similarity index 72%
rename from services/shell/runner/common/client_util.h
rename to services/service_manager/runner/common/client_util.h
index 04ad29d..4ed4e19 100644
--- a/services/shell/runner/common/client_util.h
+++ b/services/service_manager/runner/common/client_util.h
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_COMMON_CLIENT_UTIL_H_
-#define SERVICES_SHELL_RUNNER_COMMON_CLIENT_UTIL_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_COMMON_CLIENT_UTIL_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_COMMON_CLIENT_UTIL_H_
 
 #include <string>
 
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace base {
 class CommandLine;
 }
 
-namespace shell {
+namespace service_manager {
 
 // Creates a new Service pipe and returns one end of it. The other end is
 // passed via a token in |command_line|. A child of the calling process may
@@ -29,8 +29,8 @@
 
 // Returns true if the ServiceRequest came via the command line from a shell
 // instance in another process.
-bool ShellIsRemote();
+bool ServiceManagerIsRemote();
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_COMMON_CLIENT_UTIL_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_COMMON_CLIENT_UTIL_H_
diff --git a/services/shell/runner/common/switches.cc b/services/service_manager/runner/common/switches.cc
similarity index 93%
rename from services/shell/runner/common/switches.cc
rename to services/service_manager/runner/common/switches.cc
index 16024a7c..1f4a9a9 100644
--- a/services/shell/runner/common/switches.cc
+++ b/services/service_manager/runner/common/switches.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/common/switches.h"
+#include "services/service_manager/runner/common/switches.h"
 
 namespace switches {
 
diff --git a/services/shell/runner/common/switches.h b/services/service_manager/runner/common/switches.h
similarity index 73%
rename from services/shell/runner/common/switches.h
rename to services/service_manager/runner/common/switches.h
index 784a447..d36cfda 100644
--- a/services/shell/runner/common/switches.h
+++ b/services/service_manager/runner/common/switches.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_COMMON_SWITCHES_H_
-#define SERVICES_SHELL_RUNNER_COMMON_SWITCHES_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_COMMON_SWITCHES_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_COMMON_SWITCHES_H_
 
 namespace switches {
 
@@ -16,4 +16,4 @@
 
 }  // namespace switches
 
-#endif  // SERVICES_SHELL_RUNNER_COMMON_SWITCHES_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_COMMON_SWITCHES_H_
diff --git a/services/shell/runner/host/BUILD.gn b/services/service_manager/runner/host/BUILD.gn
similarity index 78%
rename from services/shell/runner/host/BUILD.gn
rename to services/service_manager/runner/host/BUILD.gn
index c07a3eb8..e110ccb236 100644
--- a/services/shell/runner/host/BUILD.gn
+++ b/services/service_manager/runner/host/BUILD.gn
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
+import("//services/service_manager/public/cpp/service.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//testing/test.gni")
 
@@ -24,7 +24,7 @@
   deps = [
     "//base",
     "//mojo/edk/system",
-    "//services/shell",
+    "//services/service_manager",
   ]
 
   # This target has to include the public thunk headers, which generally
@@ -45,10 +45,10 @@
   deps = [
     "//base",
     "//mojo/edk/system",
-    "//services/shell",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner:init",
-    "//services/shell/runner/common",
+    "//services/service_manager",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner:init",
+    "//services/service_manager/runner/common",
   ]
 
   if (is_linux && !is_android) {
@@ -89,17 +89,17 @@
     ":native_library_runner",
     "//base:base_static",
     "//base:i18n",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/runner:init",
-    "//services/shell/runner/common",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/runner:init",
+    "//services/service_manager/runner/common",
   ]
 
   public_deps = [
     "//base",
     "//mojo/edk/system",
     "//mojo/public/cpp/system",
-    "//services/shell",
-    "//services/shell/public/interfaces",
+    "//services/service_manager",
+    "//services/service_manager/public/interfaces",
   ]
 
   if (is_linux && !is_android) {
@@ -119,9 +119,9 @@
     "//base",
     "//base/test:test_support",
     "//mojo/edk/system",
-    "//services/shell",
-    "//services/shell/runner:init",
-    "//services/shell/runner/common",
+    "//services/service_manager",
+    "//services/service_manager/runner:init",
+    "//services/service_manager/runner/common",
     "//testing/gtest",
   ]
 }
diff --git a/services/shell/runner/host/DEPS b/services/service_manager/runner/host/DEPS
similarity index 100%
rename from services/shell/runner/host/DEPS
rename to services/service_manager/runner/host/DEPS
diff --git a/services/shell/runner/host/OWNERS b/services/service_manager/runner/host/OWNERS
similarity index 100%
rename from services/shell/runner/host/OWNERS
rename to services/service_manager/runner/host/OWNERS
diff --git a/services/shell/runner/host/child_process.cc b/services/service_manager/runner/host/child_process.cc
similarity index 83%
rename from services/shell/runner/host/child_process.cc
rename to services/service_manager/runner/host/child_process.cc
index ad48fe6..06a7339 100644
--- a/services/shell/runner/host/child_process.cc
+++ b/services/service_manager/runner/host/child_process.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/child_process.h"
+#include "services/service_manager/runner/host/child_process.h"
 
 #include <stdint.h>
 
@@ -31,12 +31,12 @@
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/core.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/host/child_process_base.h"
-#include "services/shell/runner/host/native_library_runner.h"
-#include "services/shell/runner/init.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/host/child_process_base.h"
+#include "services/service_manager/runner/host/native_library_runner.h"
+#include "services/service_manager/runner/init.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -69,4 +69,4 @@
   return 0;
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/service_manager/runner/host/child_process.h b/services/service_manager/runner/host/child_process.h
new file mode 100644
index 0000000..3f903d2
--- /dev/null
+++ b/services/service_manager/runner/host/child_process.h
@@ -0,0 +1,15 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_H_
+
+namespace service_manager {
+
+// Main method for a child process.
+int ChildProcessMain();
+
+}  // namespace service_manager
+
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_H_
diff --git a/services/shell/runner/host/child_process_base.cc b/services/service_manager/runner/host/child_process_base.cc
similarity index 90%
rename from services/shell/runner/host/child_process_base.cc
rename to services/service_manager/runner/host/child_process_base.cc
index c085e2d..6341ecc 100644
--- a/services/shell/runner/host/child_process_base.cc
+++ b/services/service_manager/runner/host/child_process_base.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/child_process_base.h"
+#include "services/service_manager/runner/host/child_process_base.h"
 
 #include "base/command_line.h"
 #include "base/debug/stack_trace.h"
@@ -15,20 +15,20 @@
 #include "base/threading/thread.h"
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/embedder/process_delegate.h"
-#include "services/shell/runner/common/client_util.h"
-#include "services/shell/runner/common/switches.h"
+#include "services/service_manager/runner/common/client_util.h"
+#include "services/service_manager/runner/common/switches.h"
 
 #if defined(OS_LINUX)
 #include "base/rand_util.h"
 #include "base/sys_info.h"
-#include "services/shell/runner/host/linux_sandbox.h"
+#include "services/service_manager/runner/host/linux_sandbox.h"
 #endif
 
 #if defined(OS_MACOSX)
-#include "services/shell/runner/host/mach_broker.h"
+#include "services/service_manager/runner/host/mach_broker.h"
 #endif
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -125,4 +125,4 @@
   callback.Run(GetServiceRequestFromCommandLine());
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/child_process_base.h b/services/service_manager/runner/host/child_process_base.h
similarity index 63%
rename from services/shell/runner/host/child_process_base.h
rename to services/service_manager/runner/host/child_process_base.h
index cabe612..9495790 100644
--- a/services/shell/runner/host/child_process_base.h
+++ b/services/service_manager/runner/host/child_process_base.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_BASE_H_
-#define SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_BASE_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_BASE_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_BASE_H_
 
 #include "base/callback.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 // Child processes call this to establish the connection to the shell and obtain
 // the ServiceRequest. Once the connection has been established |callback|
@@ -17,6 +17,6 @@
 using RunCallback = base::Callback<void(mojom::ServiceRequest)>;
 void ChildProcessMainWithCallback(const RunCallback& callback);
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_BASE_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_BASE_H_
diff --git a/services/shell/runner/host/child_process_host.cc b/services/service_manager/runner/host/child_process_host.cc
similarity index 94%
rename from services/shell/runner/host/child_process_host.cc
rename to services/service_manager/runner/host/child_process_host.cc
index d8ee288..4f1de53 100644
--- a/services/shell/runner/host/child_process_host.cc
+++ b/services/service_manager/runner/host/child_process_host.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/child_process_host.h"
+#include "services/service_manager/runner/host/child_process_host.h"
 
 #include <stdint.h>
 
@@ -22,9 +22,9 @@
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/public/cpp/bindings/interface_ptr_info.h"
 #include "mojo/public/cpp/system/core.h"
-#include "services/shell/native_runner_delegate.h"
-#include "services/shell/runner/common/client_util.h"
-#include "services/shell/runner/common/switches.h"
+#include "services/service_manager/native_runner_delegate.h"
+#include "services/service_manager/runner/common/client_util.h"
+#include "services/service_manager/runner/common/switches.h"
 
 #if defined(OS_LINUX)
 #include "sandbox/linux/services/namespace_sandbox.h"
@@ -35,10 +35,10 @@
 #endif
 
 #if defined(OS_MACOSX)
-#include "services/shell/runner/host/mach_broker.h"
+#include "services/service_manager/runner/host/mach_broker.h"
 #endif
 
-namespace shell {
+namespace service_manager {
 
 ChildProcessHost::ChildProcessHost(base::TaskRunner* launch_process_runner,
                                    NativeRunnerDelegate* delegate,
@@ -216,4 +216,4 @@
   start_child_process_event_.Signal();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/child_process_host.h b/services/service_manager/runner/host/child_process_host.h
similarity index 86%
rename from services/shell/runner/host/child_process_host.h
rename to services/service_manager/runner/host/child_process_host.h
index 3ecf4fa..eb14adb 100644
--- a/services/shell/runner/host/child_process_host.h
+++ b/services/service_manager/runner/host/child_process_host.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_HOST_H_
-#define SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_HOST_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_HOST_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_HOST_H_
 
 #include <stdint.h>
 
@@ -21,15 +21,15 @@
 #include "base/synchronization/waitable_event.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
-#include "services/shell/runner/host/child_process_host.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/runner/host/child_process_host.h"
 
 namespace base {
 class TaskRunner;
 }
 
-namespace shell {
+namespace service_manager {
 
 class Identity;
 class NativeRunnerDelegate;
@@ -94,6 +94,6 @@
   DISALLOW_COPY_AND_ASSIGN(ChildProcessHost);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_HOST_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_CHILD_PROCESS_HOST_H_
diff --git a/services/shell/runner/host/child_process_host_unittest.cc b/services/service_manager/runner/host/child_process_host_unittest.cc
similarity index 93%
rename from services/shell/runner/host/child_process_host_unittest.cc
rename to services/service_manager/runner/host/child_process_host_unittest.cc
index cd84ba7..9a38b8c 100644
--- a/services/shell/runner/host/child_process_host_unittest.cc
+++ b/services/service_manager/runner/host/child_process_host_unittest.cc
@@ -4,7 +4,7 @@
 
 // Note: This file also tests child_process.*.
 
-#include "services/shell/runner/host/child_process_host.h"
+#include "services/service_manager/runner/host/child_process_host.h"
 
 #include <memory>
 #include <utility>
@@ -20,10 +20,10 @@
 #include "base/threading/thread.h"
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/embedder/process_delegate.h"
-#include "services/shell/native_runner_delegate.h"
+#include "services/service_manager/native_runner_delegate.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-namespace shell {
+namespace service_manager {
 namespace {
 
 void ProcessReadyCallbackAdapater(const base::Closure& callback,
@@ -107,4 +107,4 @@
 }
 
 }  // namespace
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/host_unittests.cc b/services/service_manager/runner/host/host_unittests.cc
similarity index 76%
rename from services/shell/runner/host/host_unittests.cc
rename to services/service_manager/runner/host/host_unittests.cc
index 37192107..2e91efc 100644
--- a/services/shell/runner/host/host_unittests.cc
+++ b/services/service_manager/runner/host/host_unittests.cc
@@ -9,9 +9,9 @@
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
 #include "mojo/edk/embedder/embedder.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/host/child_process.h"
-#include "services/shell/runner/init.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/host/child_process.h"
+#include "services/service_manager/runner/init.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 int main(int argc, char** argv) {
@@ -19,12 +19,12 @@
   const base::CommandLine& command_line =
       *base::CommandLine::ForCurrentProcess();
 
-  shell::WaitForDebuggerIfNecessary();
+  service_manager::WaitForDebuggerIfNecessary();
 
   if (command_line.HasSwitch(switches::kChildProcess)) {
     base::AtExitManager at_exit;
 
-    return shell::ChildProcessMain();
+    return service_manager::ChildProcessMain();
   }
 
   mojo::edk::Init();
diff --git a/services/shell/runner/host/in_process_native_runner.cc b/services/service_manager/runner/host/in_process_native_runner.cc
similarity index 90%
rename from services/shell/runner/host/in_process_native_runner.cc
rename to services/service_manager/runner/host/in_process_native_runner.cc
index 8389dfa..156c233c 100644
--- a/services/shell/runner/host/in_process_native_runner.cc
+++ b/services/service_manager/runner/host/in_process_native_runner.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/in_process_native_runner.h"
+#include "services/service_manager/runner/host/in_process_native_runner.h"
 
 #include <utility>
 
@@ -16,11 +16,11 @@
 #include "base/threading/platform_thread.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/runner/host/native_library_runner.h"
-#include "services/shell/runner/host/out_of_process_native_runner.h"
-#include "services/shell/runner/init.h"
+#include "services/service_manager/runner/host/native_library_runner.h"
+#include "services/service_manager/runner/host/out_of_process_native_runner.h"
+#include "services/service_manager/runner/init.h"
 
-namespace shell {
+namespace service_manager {
 
 InProcessNativeRunner::InProcessNativeRunner() : library_(nullptr) {}
 
@@ -92,4 +92,4 @@
   return base::WrapUnique(new InProcessNativeRunner);
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/in_process_native_runner.h b/services/service_manager/runner/host/in_process_native_runner.h
similarity index 84%
rename from services/shell/runner/host/in_process_native_runner.h
rename to services/service_manager/runner/host/in_process_native_runner.h
index 91056a3e..9da7beca 100644
--- a/services/shell/runner/host/in_process_native_runner.h
+++ b/services/service_manager/runner/host/in_process_native_runner.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
-#define SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
 
 #include <memory>
 
@@ -12,13 +12,13 @@
 #include "base/macros.h"
 #include "base/scoped_native_library.h"
 #include "base/threading/simple_thread.h"
-#include "services/shell/native_runner.h"
+#include "services/service_manager/native_runner.h"
 
 namespace base {
 class TaskRunner;
 }
 
-namespace shell {
+namespace service_manager {
 
 // An implementation of |NativeRunner| that loads/runs the given service (from
 // the file system) on a separate thread (in the current process).
@@ -65,6 +65,6 @@
   DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
diff --git a/services/shell/runner/host/in_process_native_runner_unittest.cc b/services/service_manager/runner/host/in_process_native_runner_unittest.cc
similarity index 71%
rename from services/shell/runner/host/in_process_native_runner_unittest.cc
rename to services/service_manager/runner/host/in_process_native_runner_unittest.cc
index 8f67967..76596fa 100644
--- a/services/shell/runner/host/in_process_native_runner_unittest.cc
+++ b/services/service_manager/runner/host/in_process_native_runner_unittest.cc
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/in_process_native_runner.h"
+#include "services/service_manager/runner/host/in_process_native_runner.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
 
-namespace shell {
+namespace service_manager {
 
 TEST(InProcessNativeRunnerTest, NotStarted) {
   InProcessNativeRunner runner;
   // Shouldn't crash or DCHECK on destruction.
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/linux_sandbox.cc b/services/service_manager/runner/host/linux_sandbox.cc
similarity index 97%
rename from services/shell/runner/host/linux_sandbox.cc
rename to services/service_manager/runner/host/linux_sandbox.cc
index 33822bd..46fc62f 100644
--- a/services/shell/runner/host/linux_sandbox.cc
+++ b/services/service_manager/runner/host/linux_sandbox.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/linux_sandbox.h"
+#include "services/service_manager/runner/host/linux_sandbox.h"
 
 #include <fcntl.h>
 #include <sys/syscall.h>
@@ -28,7 +28,7 @@
 
 using sandbox::syscall_broker::BrokerFilePermission;
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -166,4 +166,4 @@
   proc_fd_.reset();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/linux_sandbox.h b/services/service_manager/runner/host/linux_sandbox.h
similarity index 83%
rename from services/shell/runner/host/linux_sandbox.h
rename to services/service_manager/runner/host/linux_sandbox.h
index bd1880a5..a9e48045 100644
--- a/services/shell/runner/host/linux_sandbox.h
+++ b/services/service_manager/runner/host/linux_sandbox.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_HOST_LINUX_SANDBOX_H_
-#define SERVICES_SHELL_RUNNER_HOST_LINUX_SANDBOX_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_LINUX_SANDBOX_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_LINUX_SANDBOX_H_
 
 #include <memory>
 
@@ -13,7 +13,7 @@
 #include "sandbox/linux/bpf_dsl/policy.h"
 #include "sandbox/linux/syscall_broker/broker_process.h"
 
-namespace shell {
+namespace service_manager {
 
 // Encapsulates all tasks related to raising the sandbox for mojo runner.
 class LinuxSandbox {
@@ -46,6 +46,6 @@
   DISALLOW_COPY_AND_ASSIGN(LinuxSandbox);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_HOST_LINUX_SANDBOX_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_LINUX_SANDBOX_H_
diff --git a/services/shell/runner/host/mach_broker.cc b/services/service_manager/runner/host/mach_broker.cc
similarity index 87%
rename from services/shell/runner/host/mach_broker.cc
rename to services/service_manager/runner/host/mach_broker.cc
index 7f1cd45..1b989035 100644
--- a/services/shell/runner/host/mach_broker.cc
+++ b/services/service_manager/runner/host/mach_broker.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/mach_broker.h"
+#include "services/service_manager/runner/host/mach_broker.h"
 
 #include "base/logging.h"
 #include "base/memory/singleton.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 const char kBootstrapPortName[] = "mojo_shell";
@@ -40,4 +40,4 @@
   broker_.InvalidatePid(pid);
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/mach_broker.h b/services/service_manager/runner/host/mach_broker.h
similarity index 85%
rename from services/shell/runner/host/mach_broker.h
rename to services/service_manager/runner/host/mach_broker.h
index 64fa63a..4325842 100644
--- a/services/shell/runner/host/mach_broker.h
+++ b/services/service_manager/runner/host/mach_broker.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_HOST_MACH_BROKER_H_
-#define SERVICES_SHELL_RUNNER_HOST_MACH_BROKER_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_MACH_BROKER_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_MACH_BROKER_H_
 
 #include "base/mac/mach_port_broker.h"
 
@@ -11,7 +11,7 @@
 template <typename T> struct DefaultSingletonTraits;
 }
 
-namespace shell {
+namespace service_manager {
 
 // A global singleton |MachBroker| is used by the shell to provide access to
 // Mach task ports for shell out-of-process applications.
@@ -47,6 +47,6 @@
   base::MachPortBroker broker_;
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_HOST_MACH_BROKER_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_MACH_BROKER_H_
diff --git a/services/shell/runner/host/native_library_runner.cc b/services/service_manager/runner/host/native_library_runner.cc
similarity index 96%
rename from services/shell/runner/host/native_library_runner.cc
rename to services/service_manager/runner/host/native_library_runner.cc
index 639a3ff7..fbb86644 100644
--- a/services/shell/runner/host/native_library_runner.cc
+++ b/services/service_manager/runner/host/native_library_runner.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/native_library_runner.h"
+#include "services/service_manager/runner/host/native_library_runner.h"
 
 #include <stddef.h>
 
@@ -13,7 +13,7 @@
 #include "mojo/edk/embedder/entrypoints.h"
 #include "mojo/public/c/system/thunks.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -102,4 +102,4 @@
   return true;
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/native_library_runner.h b/services/service_manager/runner/host/native_library_runner.h
similarity index 77%
rename from services/shell/runner/host/native_library_runner.h
rename to services/service_manager/runner/host/native_library_runner.h
index 07ca2ac..9e19caa 100644
--- a/services/shell/runner/host/native_library_runner.h
+++ b/services/service_manager/runner/host/native_library_runner.h
@@ -2,18 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
-#define SERVICES_SHELL_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
 
 #include "base/native_library.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
 
 namespace base {
 class FilePath;
 }
 
-namespace shell {
+namespace service_manager {
 
 // Loads the native Service from the DSO specified by |app_path|.
 // Returns the |base::NativeLibrary| for the service on success (or null on
@@ -33,6 +33,6 @@
 bool RunServiceInNativeLibrary(base::NativeLibrary library,
                                mojom::ServiceRequest request);
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_NATIVE_LIBRARY_RUNNER_H_
diff --git a/services/shell/runner/host/out_of_process_native_runner.cc b/services/service_manager/runner/host/out_of_process_native_runner.cc
similarity index 86%
rename from services/shell/runner/host/out_of_process_native_runner.cc
rename to services/service_manager/runner/host/out_of_process_native_runner.cc
index dc4056d..9edd59d 100644
--- a/services/shell/runner/host/out_of_process_native_runner.cc
+++ b/services/service_manager/runner/host/out_of_process_native_runner.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/host/out_of_process_native_runner.h"
+#include "services/service_manager/runner/host/out_of_process_native_runner.h"
 
 #include <stdint.h>
 
@@ -14,11 +14,11 @@
 #include "base/logging.h"
 #include "base/memory/ptr_util.h"
 #include "base/task_runner.h"
-#include "services/shell/runner/common/client_util.h"
-#include "services/shell/runner/host/child_process_host.h"
-#include "services/shell/runner/host/in_process_native_runner.h"
+#include "services/service_manager/runner/common/client_util.h"
+#include "services/service_manager/runner/host/child_process_host.h"
+#include "services/service_manager/runner/host/in_process_native_runner.h"
 
-namespace shell {
+namespace service_manager {
 
 OutOfProcessNativeRunner::OutOfProcessNativeRunner(
     base::TaskRunner* launch_process_runner,
@@ -72,4 +72,4 @@
                                                     delegate_);
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/host/out_of_process_native_runner.h b/services/service_manager/runner/host/out_of_process_native_runner.h
similarity index 84%
rename from services/shell/runner/host/out_of_process_native_runner.h
rename to services/service_manager/runner/host/out_of_process_native_runner.h
index 7bd31ec..df61565b 100644
--- a/services/shell/runner/host/out_of_process_native_runner.h
+++ b/services/service_manager/runner/host/out_of_process_native_runner.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_HOST_OUT_OF_PROCESS_NATIVE_RUNNER_H_
-#define SERVICES_SHELL_RUNNER_HOST_OUT_OF_PROCESS_NATIVE_RUNNER_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_HOST_OUT_OF_PROCESS_NATIVE_RUNNER_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_HOST_OUT_OF_PROCESS_NATIVE_RUNNER_H_
 
 #include <stdint.h>
 
@@ -13,13 +13,13 @@
 #include "base/callback.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
-#include "services/shell/native_runner.h"
+#include "services/service_manager/native_runner.h"
 
 namespace base {
 class TaskRunner;
 }
 
-namespace shell {
+namespace service_manager {
 
 class ChildProcessHost;
 class NativeRunnerDelegate;
@@ -69,6 +69,6 @@
   DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_HOST_OUT_OF_PROCESS_NATIVE_RUNNER_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_HOST_OUT_OF_PROCESS_NATIVE_RUNNER_H_
diff --git a/services/shell/runner/init.cc b/services/service_manager/runner/init.cc
similarity index 94%
rename from services/shell/runner/init.cc
rename to services/service_manager/runner/init.cc
index 310e80c..20f6a0e9 100644
--- a/services/shell/runner/init.cc
+++ b/services/service_manager/runner/init.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/runner/init.h"
+#include "services/service_manager/runner/init.h"
 
 #include <stdint.h>
 
@@ -16,7 +16,7 @@
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
-#include "services/shell/runner/common/switches.h"
+#include "services/service_manager/runner/common/switches.h"
 
 #if defined(OS_WIN)
 #include <windows.h>
@@ -24,7 +24,7 @@
 #include <unistd.h>
 #endif
 
-namespace shell {
+namespace service_manager {
 
 void InitializeLogging() {
   logging::LoggingSettings settings;
@@ -94,4 +94,4 @@
   // general system for other people.
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/runner/init.h b/services/service_manager/runner/init.h
similarity index 71%
rename from services/shell/runner/init.h
rename to services/service_manager/runner/init.h
index dced60d..a437c8f 100644
--- a/services/shell/runner/init.h
+++ b/services/service_manager/runner/init.h
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_RUNNER_INIT_H_
-#define SERVICES_SHELL_RUNNER_INIT_H_
+#ifndef SERVICES_SERVICE_MANAGER_RUNNER_INIT_H_
+#define SERVICES_SERVICE_MANAGER_RUNNER_INIT_H_
 
 #include "base/native_library.h"
 
-namespace shell {
+namespace service_manager {
 
 // Initialization routines shared by desktop and Android main functions.
 void InitializeLogging();
@@ -18,6 +18,6 @@
 // common initialization there now.
 void CallLibraryEarlyInitialization(base::NativeLibrary app_library);
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_RUNNER_INIT_H_
+#endif  // SERVICES_SERVICE_MANAGER_RUNNER_INIT_H_
diff --git a/services/shell/service_manager.cc b/services/service_manager/service_manager.cc
similarity index 90%
rename from services/shell/service_manager.cc
rename to services/service_manager/service_manager.cc
index 65d69d33b..3252f14cc 100644
--- a/services/shell/service_manager.cc
+++ b/services/service_manager/service_manager.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/service_manager.h"
+#include "services/service_manager/service_manager.h"
 
 #include <stdint.h>
 
@@ -21,15 +21,15 @@
 #include "base/trace_event/trace_event.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/connect_util.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/names.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/connect_util.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/names.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -54,58 +54,56 @@
 
 CapabilitySpec GetPermissiveCapabilities() {
   CapabilitySpec capabilities;
-  CapabilityRequest spec;
-  spec.interfaces.insert("*");
-  capabilities.required["*"] = spec;
+  Interfaces interfaces;
+  interfaces.insert("*");
+  capabilities.required["*"] = interfaces;
   return capabilities;
 }
 
-CapabilityRequest GetCapabilityRequest(const CapabilitySpec& source_spec,
-                                       const Identity& target) {
-  CapabilityRequest request;
+Classes GetRequestedClasses(const CapabilitySpec& source_spec,
+                            const Identity& target) {
+  Classes classes;
 
   // Start by looking for specs specific to the supplied identity.
   auto it = source_spec.required.find(target.name());
   if (it != source_spec.required.end()) {
-    std::copy(it->second.classes.begin(), it->second.classes.end(),
-              std::inserter(request.classes, request.classes.begin()));
-    std::copy(it->second.interfaces.begin(), it->second.interfaces.end(),
-              std::inserter(request.interfaces, request.interfaces.begin()));
+    std::copy(it->second.begin(), it->second.end(),
+              std::inserter(classes, classes.begin()));
   }
 
   // Apply wild card rules too.
   it = source_spec.required.find("*");
   if (it != source_spec.required.end()) {
-    std::copy(it->second.classes.begin(), it->second.classes.end(),
-              std::inserter(request.classes, request.classes.begin()));
-    std::copy(it->second.interfaces.begin(), it->second.interfaces.end(),
-              std::inserter(request.interfaces, request.interfaces.begin()));
+    std::copy(it->second.begin(), it->second.end(),
+              std::inserter(classes, classes.begin()));
   }
-  return request;
+  return classes;
 }
 
-CapabilityRequest GenerateCapabilityRequestForConnection(
+void GetClassesAndInterfacesForConnection(
     const CapabilitySpec& source_spec,
     const Identity& target,
-    const CapabilitySpec& target_spec) {
-  CapabilityRequest request = GetCapabilityRequest(source_spec, target);
+    const CapabilitySpec& target_spec,
+    Classes* classes,
+    Interfaces* interfaces) {
+  DCHECK(classes && interfaces);
+  *classes = GetRequestedClasses(source_spec, target);
   // Flatten all interfaces from classes requested by the source into the
   // allowed interface set in the request.
-  for (const auto& class_name : request.classes) {
+  for (const auto& class_name : *classes) {
     auto it = target_spec.provided.find(class_name);
     if (it != target_spec.provided.end()) {
       for (const auto& interface_name : it->second)
-        request.interfaces.insert(interface_name);
+        interfaces->insert(interface_name);
     }
   }
-  return request;
 }
 
 bool HasClass(const CapabilitySpec& spec, const std::string& class_name) {
   auto it = spec.required.find(kServiceManagerName);
   if (it == spec.required.end())
     return false;
-  return it->second.classes.find(class_name) != it->second.classes.end();
+  return it->second.find(class_name) != it->second.end();
 }
 
 // Encapsulates a connection to an instance of a service, tracked by the
@@ -117,7 +115,7 @@
       public InterfaceFactory<mojom::ServiceManager>,
       public mojom::ServiceManager {
  public:
-  Instance(shell::ServiceManager* service_manager,
+  Instance(service_manager::ServiceManager* service_manager,
            const Identity& identity,
            const CapabilitySpec& capability_spec)
       : service_manager_(service_manager),
@@ -177,23 +175,27 @@
         params->connect_callback().Run(mojom::ConnectResult::SUCCEEDED,
                                        identity_.user_id());
     }
-    CapabilityRequest request;
-    request.interfaces.insert("*");
+
+    Classes classes;
+    Interfaces interfaces;
     Instance* source = service_manager_->GetExistingInstance(params->source());
     if (source) {
-      request = GenerateCapabilityRequestForConnection(
-          source->capability_spec_, identity_, capability_spec_);
+      GetClassesAndInterfacesForConnection(source->capability_spec_,
+                                           identity_, capability_spec_,
+                                           &classes, &interfaces);
+    } else {
+      interfaces.insert("*");
     }
 
     // The target has specified that sources must request one of its provided
     // classes instead of specifying a wild-card for interfaces.
     if (HasClass(capability_spec_, kCapabilityClass_ExplicitClass) &&
-        (request.interfaces.count("*") != 0)) {
-      request.interfaces.erase("*");
+        (interfaces.count("*") != 0)) {
+      interfaces.erase("*");
     }
 
     service_->OnConnect(params->source(), params->TakeRemoteInterfaces(),
-                        request);
+                        interfaces, classes);
     return true;
   }
 
@@ -257,7 +259,7 @@
 
  private:
   // mojom::Connector implementation:
-  void Connect(const shell::Identity& in_target,
+  void Connect(const service_manager::Identity& in_target,
                mojom::InterfaceProviderRequest remote_interfaces,
                mojom::ClientProcessConnectionPtr client_process_connection,
                const ConnectCallback& callback) override {
@@ -414,12 +416,14 @@
     service_manager_->NotifyPIDAvailable(identity_, pid_);
   }
 
-  void OnServiceLost(base::WeakPtr<shell::ServiceManager> service_manager) {
+  void OnServiceLost(
+      base::WeakPtr<service_manager::ServiceManager> service_manager) {
     service_.reset();
     OnConnectionLost(service_manager);
   }
 
-  void OnConnectionLost(base::WeakPtr<shell::ServiceManager> service_manager) {
+  void OnConnectionLost(
+      base::WeakPtr<service_manager::ServiceManager> service_manager) {
     // Any time a Connector is lost or we lose the Service connection, it
     // may have been the last pipe using this Instance. If so, clean up.
     if (service_manager && !service_) {
@@ -447,7 +451,7 @@
     service_manager_->OnInstanceError(this);
   }
 
-  shell::ServiceManager* const service_manager_;
+  service_manager::ServiceManager* const service_manager_;
 
   // An id that identifies this instance. Distinct from pid, as a single process
   // may vend multiple application instances, and this object may exist before a
@@ -496,9 +500,9 @@
 
   CapabilitySpec spec;
   spec.provided[kCapabilityClass_ServiceManager].insert(
-      "shell::mojom::ServiceManager");
-  spec.required["*"].classes.insert("shell:service_factory");
-  spec.required["service:catalog"].classes.insert("shell:resolver");
+      "service_manager::mojom::ServiceManager");
+  spec.required["*"].insert("shell:service_factory");
+  spec.required["service:catalog"].insert("shell:resolver");
 
   service_manager_instance_ =
       CreateInstance(Identity(), CreateServiceManagerIdentity(), spec);
@@ -580,7 +584,7 @@
   CapabilitySpec spec;
   spec.provided["app"].insert("filesystem::mojom::Directory");
   spec.provided["catalog:catalog"].insert("catalog::mojom::Catalog");
-  spec.provided["shell:resolver"].insert("shell::mojom::Resolver");
+  spec.provided["shell:resolver"].insert("service_manager::mojom::Resolver");
   spec.provided["control"].insert("catalog::mojom::CatalogControl");
   Instance* instance = CreateInstance(
       CreateServiceManagerIdentity(), CreateCatalogIdentity(), spec);
@@ -659,10 +663,10 @@
 
   std::string name = params->target().name();
   resolver->ResolveMojoName(
-      name, base::Bind(&shell::ServiceManager::OnGotResolvedName,
-                       weak_ptr_factory_.GetWeakPtr(), base::Passed(&params),
-                       base::Passed(&service), !!source_instance,
-                       source_instance));
+      name,
+      base::Bind(&service_manager::ServiceManager::OnGotResolvedName,
+                 weak_ptr_factory_.GetWeakPtr(), base::Passed(&params),
+                 base::Passed(&service), !!source_instance, source_instance));
 }
 
 ServiceManager::Instance* ServiceManager::GetExistingInstance(
@@ -756,9 +760,9 @@
   ConnectToInterface(this, source_identity, service_factory_identity,
                      &factory);
   mojom::ServiceFactory* factory_interface = factory.get();
-  factory.set_connection_error_handler(base::Bind(
-      &shell::ServiceManager::OnServiceFactoryLost,
-      weak_ptr_factory_.GetWeakPtr(), service_factory_identity));
+  factory.set_connection_error_handler(
+      base::Bind(&service_manager::ServiceManager::OnServiceFactoryLost,
+                 weak_ptr_factory_.GetWeakPtr(), service_factory_identity));
   service_factories_[service_factory_identity] = std::move(factory);
   return factory_interface;
 }
@@ -878,4 +882,4 @@
   return weak_ptr_factory_.GetWeakPtr();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/service_manager.h b/services/service_manager/service_manager.h
similarity index 87%
rename from services/shell/service_manager.h
rename to services/service_manager/service_manager.h
index 3500e462..7d0edff 100644
--- a/services/shell/service_manager.h
+++ b/services/service_manager/service_manager.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_SERVICE_MANAGER_H_
-#define SERVICES_SHELL_SERVICE_MANAGER_H_
+#ifndef SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_
+#define SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_
 
 #include <map>
 #include <memory>
@@ -13,21 +13,21 @@
 #include "base/memory/weak_ptr.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
-#include "services/shell/connect_params.h"
-#include "services/shell/native_runner.h"
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
-#include "services/shell/public/interfaces/resolver.mojom.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
-#include "services/shell/service_overrides.h"
+#include "services/service_manager/connect_params.h"
+#include "services/service_manager/native_runner.h"
+#include "services/service_manager/public/cpp/capabilities.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/resolver.mojom.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/service_overrides.h"
 
-namespace shell {
+namespace service_manager {
 class ServiceContext;
 
 // Creates an identity for the Service Manager, used when the Service Manager
@@ -190,6 +190,6 @@
 
 mojom::Connector::ConnectCallback EmptyConnectCallback();
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_SERVICE_MANAGER_H_
+#endif  // SERVICES_SERVICE_MANAGER_SERVICE_MANAGER_H_
diff --git a/services/shell/service_overrides.cc b/services/service_manager/service_overrides.cc
similarity index 94%
rename from services/shell/service_overrides.cc
rename to services/service_manager/service_overrides.cc
index 7c7dc807..90452c0 100644
--- a/services/shell/service_overrides.cc
+++ b/services/service_manager/service_overrides.cc
@@ -2,14 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/service_overrides.h"
+#include "services/service_manager/service_overrides.h"
 
 #include "base/base_paths.h"
 #include "base/path_service.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -75,4 +75,4 @@
   return true;
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/service_overrides.h b/services/service_manager/service_overrides.h
similarity index 79%
rename from services/shell/service_overrides.h
rename to services/service_manager/service_overrides.h
index 7989dc5..1478ef76 100644
--- a/services/shell/service_overrides.h
+++ b/services/service_manager/service_overrides.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_SERVICE_OVERRIDES_H_
-#define SERVICES_SHELL_SERVICE_OVERRIDES_H_
+#ifndef SERVICES_SERVICE_MANAGER_SERVICE_OVERRIDES_H_
+#define SERVICES_SERVICE_MANAGER_SERVICE_OVERRIDES_H_
 
 #include <map>
 #include <memory>
@@ -13,7 +13,7 @@
 #include "base/macros.h"
 #include "base/values.h"
 
-namespace shell {
+namespace service_manager {
 
 class ServiceOverrides {
  public:
@@ -39,6 +39,6 @@
   DISALLOW_COPY_AND_ASSIGN(ServiceOverrides);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_SERVICE_OVERRIDES_H_
+#endif  // SERVICES_SERVICE_MANAGER_SERVICE_OVERRIDES_H_
diff --git a/services/shell/standalone/BUILD.gn b/services/service_manager/standalone/BUILD.gn
similarity index 89%
rename from services/shell/standalone/BUILD.gn
rename to services/service_manager/standalone/BUILD.gn
index fb55a65..f7633aff 100644
--- a/services/shell/standalone/BUILD.gn
+++ b/services/service_manager/standalone/BUILD.gn
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
+import("//services/service_manager/public/cpp/service.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//testing/test.gni")
 
@@ -36,9 +36,9 @@
     "//components/tracing:startup_tracing",
     "//mojo/edk/system",
     "//services/catalog:lib",
-    "//services/shell",
-    "//services/shell/public/cpp",
-    "//services/shell/runner/host:lib",
+    "//services/service_manager",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/runner/host:lib",
     "//services/tracing/public/cpp",
     "//services/tracing/public/interfaces",
     "//url",
diff --git a/services/shell/standalone/DEPS b/services/service_manager/standalone/DEPS
similarity index 100%
rename from services/shell/standalone/DEPS
rename to services/service_manager/standalone/DEPS
diff --git a/services/shell/standalone/context.cc b/services/service_manager/standalone/context.cc
similarity index 94%
rename from services/shell/standalone/context.cc
rename to services/service_manager/standalone/context.cc
index 0c30797..724eb11 100644
--- a/services/shell/standalone/context.cc
+++ b/services/service_manager/standalone/context.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/standalone/context.h"
+#include "services/service_manager/standalone/context.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -35,22 +35,22 @@
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "services/catalog/catalog.h"
 #include "services/catalog/store.h"
-#include "services/shell/connect_params.h"
-#include "services/shell/public/cpp/names.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/host/in_process_native_runner.h"
-#include "services/shell/runner/host/out_of_process_native_runner.h"
-#include "services/shell/standalone/tracer.h"
-#include "services/shell/switches.h"
+#include "services/service_manager/connect_params.h"
+#include "services/service_manager/public/cpp/names.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/host/in_process_native_runner.h"
+#include "services/service_manager/runner/host/out_of_process_native_runner.h"
+#include "services/service_manager/standalone/tracer.h"
+#include "services/service_manager/switches.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/tracing/public/cpp/switches.h"
 #include "services/tracing/public/interfaces/tracing.mojom.h"
 
 #if defined(OS_MACOSX)
-#include "services/shell/runner/host/mach_broker.h"
+#include "services/service_manager/runner/host/mach_broker.h"
 #endif
 
-namespace shell {
+namespace service_manager {
 namespace {
 
 base::FilePath::StringType GetPathFromCommandLineSwitch(
@@ -292,4 +292,4 @@
   service_manager_->Connect(std::move(params));
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/standalone/context.h b/services/service_manager/standalone/context.h
similarity index 85%
rename from services/shell/standalone/context.h
rename to services/service_manager/standalone/context.h
index 4105956..4186908 100644
--- a/services/shell/standalone/context.h
+++ b/services/service_manager/standalone/context.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_STANDALONE_CONTEXT_H_
-#define SERVICES_SHELL_STANDALONE_CONTEXT_H_
+#ifndef SERVICES_SERVICE_MANAGER_STANDALONE_CONTEXT_H_
+#define SERVICES_SERVICE_MANAGER_STANDALONE_CONTEXT_H_
 
 #include <memory>
 
@@ -13,8 +13,8 @@
 #include "base/threading/thread.h"
 #include "base/time/time.h"
 #include "mojo/edk/embedder/process_delegate.h"
-#include "services/shell/service_manager.h"
-#include "services/shell/standalone/tracer.h"
+#include "services/service_manager/service_manager.h"
+#include "services/service_manager/standalone/tracer.h"
 
 namespace base {
 class SingleThreadTaskRunner;
@@ -25,7 +25,7 @@
 class Store;
 }
 
-namespace shell {
+namespace service_manager {
 class NativeRunnerDelegate;
 
 // The "global" context for the shell's main process.
@@ -80,6 +80,6 @@
   DISALLOW_COPY_AND_ASSIGN(Context);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_STANDALONE_CONTEXT_H_
+#endif  // SERVICES_SERVICE_MANAGER_STANDALONE_CONTEXT_H_
diff --git a/services/shell/standalone/desktop/launcher_process.cc b/services/service_manager/standalone/desktop/launcher_process.cc
similarity index 90%
rename from services/shell/standalone/desktop/launcher_process.cc
rename to services/service_manager/standalone/desktop/launcher_process.cc
index b2fcdd5..03dc41fe 100644
--- a/services/shell/standalone/desktop/launcher_process.cc
+++ b/services/service_manager/standalone/desktop/launcher_process.cc
@@ -19,10 +19,10 @@
 #include "base/single_thread_task_runner.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/platform_thread.h"
-#include "services/shell/standalone/context.h"
-#include "services/shell/switches.h"
+#include "services/service_manager/standalone/context.h"
+#include "services/service_manager/switches.h"
 
-namespace shell {
+namespace service_manager {
 
 int LauncherProcessMain() {
 #if !defined(OFFICIAL_BUILD)
@@ -55,4 +55,4 @@
   return 0;
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/standalone/desktop/launcher_process.h b/services/service_manager/standalone/desktop/launcher_process.h
similarity index 87%
rename from services/shell/standalone/desktop/launcher_process.h
rename to services/service_manager/standalone/desktop/launcher_process.h
index 13cdf51..96664c1 100644
--- a/services/shell/standalone/desktop/launcher_process.h
+++ b/services/service_manager/standalone/desktop/launcher_process.h
@@ -7,11 +7,11 @@
 
 #include "base/callback_forward.h"
 
-namespace shell {
+namespace service_manager {
 
 // Main method for the launcher process.
 int LauncherProcessMain();
 
-}  // namespace shell
+}  // namespace service_manager
 
 #endif  // SERVICES_SHELL_STANDALONE_LAUNCHER_PROCESS_H_
diff --git a/services/shell/standalone/desktop/main.cc b/services/service_manager/standalone/desktop/main.cc
similarity index 61%
rename from services/shell/standalone/desktop/main.cc
rename to services/service_manager/standalone/desktop/main.cc
index 9a27ab2..d5e3e56 100644
--- a/services/shell/standalone/desktop/main.cc
+++ b/services/service_manager/standalone/desktop/main.cc
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/standalone/desktop/main_helper.h"
+#include "services/service_manager/standalone/desktop/main_helper.h"
 
 int main(int argc, char** argv) {
-  return shell::StandaloneShellMain(argc, argv);
+  return service_manager::StandaloneShellMain(argc, argv);
 }
diff --git a/services/shell/standalone/desktop/main_helper.cc b/services/service_manager/standalone/desktop/main_helper.cc
similarity index 73%
rename from services/shell/standalone/desktop/main_helper.cc
rename to services/service_manager/standalone/desktop/main_helper.cc
index d51f421..23c64a4 100644
--- a/services/shell/standalone/desktop/main_helper.cc
+++ b/services/service_manager/standalone/desktop/main_helper.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/standalone/desktop/main_helper.h"
+#include "services/service_manager/standalone/desktop/main_helper.h"
 
 #include "base/at_exit.h"
 #include "base/base_switches.h"
@@ -14,10 +14,10 @@
 #include "base/stl_util.h"
 #include "base/strings/string_split.h"
 #include "base/strings/utf_string_conversions.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/host/child_process.h"
-#include "services/shell/runner/init.h"
-#include "services/shell/standalone/desktop/launcher_process.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/host/child_process.h"
+#include "services/service_manager/runner/init.h"
+#include "services/service_manager/standalone/desktop/launcher_process.h"
 
 #if defined(OS_WIN)
 #include <windows.h>
@@ -25,7 +25,7 @@
 #include <unistd.h>
 #endif
 
-namespace shell {
+namespace service_manager {
 
 int StandaloneShellMain(int argc, char** argv) {
   base::CommandLine::Init(argc, argv);
@@ -46,4 +46,4 @@
   return LauncherProcessMain();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/standalone/desktop/main_helper.h b/services/service_manager/standalone/desktop/main_helper.h
similarity index 87%
rename from services/shell/standalone/desktop/main_helper.h
rename to services/service_manager/standalone/desktop/main_helper.h
index f326957..b850593d 100644
--- a/services/shell/standalone/desktop/main_helper.h
+++ b/services/service_manager/standalone/desktop/main_helper.h
@@ -5,11 +5,11 @@
 #ifndef SERVICES_SHELL_STANDALONE_DESKTOP_MAIN_HELPER_H
 #define SERVICES_SHELL_STANDALONE_DESKTOP_MAIN_HELPER_H
 
-namespace shell {
+namespace service_manager {
 
 // Helper method to start Mojo standalone shell code.
 int StandaloneShellMain(int argc, char** argv);
 
-}  // namespace shell
+}  // namespace service_manager
 
 #endif  // SERVICES_SHELL_STANDALONE_DESKTOP_MAIN_HELPER_H
diff --git a/services/shell/standalone/tracer.cc b/services/service_manager/standalone/tracer.cc
similarity index 97%
rename from services/shell/standalone/tracer.cc
rename to services/service_manager/standalone/tracer.cc
index 84564b40..0fa74a3 100644
--- a/services/shell/standalone/tracer.cc
+++ b/services/service_manager/standalone/tracer.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/standalone/tracer.h"
+#include "services/service_manager/standalone/tracer.h"
 
 #include <stddef.h>
 #include <stdio.h>
@@ -18,7 +18,7 @@
 #include "base/trace_event/trace_config.h"
 #include "base/trace_event/trace_event.h"
 
-namespace shell {
+namespace service_manager {
 
 Tracer::Tracer()
     : tracing_(false), first_chunk_written_(false), trace_file_(nullptr) {}
@@ -162,4 +162,4 @@
   first_chunk_written_ = true;
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/standalone/tracer.h b/services/service_manager/standalone/tracer.h
similarity index 92%
rename from services/shell/standalone/tracer.h
rename to services/service_manager/standalone/tracer.h
index d330779..10bc60bf 100644
--- a/services/shell/standalone/tracer.h
+++ b/services/service_manager/standalone/tracer.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_STANDALONE_TRACER_H_
-#define SERVICES_SHELL_STANDALONE_TRACER_H_
+#ifndef SERVICES_SERVICE_MANAGER_STANDALONE_TRACER_H_
+#define SERVICES_SERVICE_MANAGER_STANDALONE_TRACER_H_
 
 #include <stddef.h>
 #include <stdio.h>
@@ -18,7 +18,7 @@
 #include "services/tracing/public/cpp/provider.h"
 #include "services/tracing/public/interfaces/tracing.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 // Tracer collects tracing data from base/trace_event and from externally
 // configured sources, aggregates it into a single stream, and writes it out to
@@ -95,6 +95,6 @@
   DISALLOW_COPY_AND_ASSIGN(Tracer);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_STANDALONE_TRACER_H_
+#endif  // SERVICES_SERVICE_MANAGER_STANDALONE_TRACER_H_
diff --git a/services/shell/switches.cc b/services/service_manager/switches.cc
similarity index 77%
rename from services/shell/switches.cc
rename to services/service_manager/switches.cc
index 10dc430..a96b6ae1 100644
--- a/services/shell/switches.cc
+++ b/services/service_manager/switches.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/switches.h"
+#include "services/service_manager/switches.h"
 
-namespace shell {
+namespace service_manager {
 namespace switches {
 
 // Disables the sandbox for debugging.
@@ -14,4 +14,4 @@
 const char kSingleProcess[] = "single-process";
 
 }  // namespace switches
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/switches.h b/services/service_manager/switches.h
similarity index 69%
rename from services/shell/switches.h
rename to services/service_manager/switches.h
index 1a442e1..04fbc329 100644
--- a/services/shell/switches.h
+++ b/services/service_manager/switches.h
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_SWITCHES_H_
-#define SERVICES_SHELL_SWITCHES_H_
+#ifndef SERVICES_SERVICE_MANAGER_SWITCHES_H_
+#define SERVICES_SERVICE_MANAGER_SWITCHES_H_
 
 #include <set>
 #include <string>
 
-namespace shell {
+namespace service_manager {
 namespace switches {
 
 // All switches in alphabetical order. The switches should be documented
@@ -17,6 +17,6 @@
 extern const char kSingleProcess[];
 
 }  // namespace switches
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_SWITCHES_H_
+#endif  // SERVICES_SERVICE_MANAGER_SWITCHES_H_
diff --git a/services/service_manager/tests/BUILD.gn b/services/service_manager/tests/BUILD.gn
new file mode 100644
index 0000000..6377bc09
--- /dev/null
+++ b/services/service_manager/tests/BUILD.gn
@@ -0,0 +1,60 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//services/service_manager/public/cpp/service.gni")
+import("//mojo/public/tools/bindings/mojom.gni")
+import("//testing/test.gni")
+
+group("tests") {
+  testonly = true
+  deps = [
+    ":service_manager_unittests",
+  ]
+}
+
+test("service_manager_unittests") {
+  deps = [
+    ":interfaces",
+    "//base",
+    "//base/test:test_support",
+    "//mojo/public/cpp/bindings",
+    "//mojo/public/cpp/system",
+    "//services/catalog:unittests",
+    "//services/service_manager",
+    "//services/service_manager/background:lib",
+    "//services/service_manager/background:main",
+    "//services/service_manager/background/tests:unittests",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/tests/connect",
+    "//services/service_manager/tests/lifecycle",
+    "//services/service_manager/tests/shell",
+    "//services/service_manager/tests/shutdown",
+    "//testing/gtest",
+  ]
+}
+
+mojom("interfaces") {
+  sources = [
+    "test.mojom",
+  ]
+
+  use_new_wrapper_types = false
+}
+
+source_set("util") {
+  sources = [
+    "util.cc",
+    "util.h",
+  ]
+  deps = [
+    "//base",
+    "//base:base_static",
+    "//mojo/edk/system",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner/common",
+  ]
+}
diff --git a/services/shell/tests/DEPS b/services/service_manager/tests/DEPS
similarity index 100%
rename from services/shell/tests/DEPS
rename to services/service_manager/tests/DEPS
diff --git a/services/shell/tests/connect/BUILD.gn b/services/service_manager/tests/connect/BUILD.gn
similarity index 78%
rename from services/shell/tests/connect/BUILD.gn
rename to services/service_manager/tests/connect/BUILD.gn
index c981167..5970a2b 100644
--- a/services/shell/tests/connect/BUILD.gn
+++ b/services/service_manager/tests/connect/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//testing/test.gni")
 
@@ -16,9 +16,9 @@
     ":interfaces",
     "//base",
     "//base/test:test_support",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
 
   data_deps = [
@@ -37,7 +37,7 @@
     "connect_test.mojom",
   ]
   deps = [
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
   ]
 }
 
@@ -65,8 +65,8 @@
     ":interfaces",
     "//base",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
   data_deps = [
     ":connect_test_package_manifest",
@@ -95,8 +95,8 @@
     ":interfaces",
     "//base",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
   data_deps = [
     ":connect_test_app_manifest",
@@ -117,8 +117,8 @@
     ":interfaces",
     "//base",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
   data_deps = [
     ":connect_test_class_app_manifest",
@@ -138,7 +138,7 @@
   deps = [
     "//base",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:sources",
   ]
   data_deps = [
     ":connect_test_singleton_app_manifest",
@@ -161,9 +161,9 @@
     ":interfaces",
     "//base",
     "//build/win:default_exe_manifest",
-    "//services/shell/public/cpp",
-    "//services/shell/runner/child:test_native_main",
-    "//services/shell/tests:util",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/runner/child:test_native_main",
+    "//services/service_manager/tests:util",
   ]
 
   data_deps = [
@@ -188,8 +188,8 @@
     ":interfaces",
     "//base",
     "//build/win:default_exe_manifest",
-    "//services/shell/public/cpp",
-    "//services/shell/runner/child:test_native_main",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/runner/child:test_native_main",
   ]
 
   data_deps = [
diff --git a/services/shell/tests/connect/OWNERS b/services/service_manager/tests/connect/OWNERS
similarity index 100%
rename from services/shell/tests/connect/OWNERS
rename to services/service_manager/tests/connect/OWNERS
diff --git a/services/shell/tests/connect/connect_test.mojom b/services/service_manager/tests/connect/connect_test.mojom
similarity index 86%
rename from services/shell/tests/connect/connect_test.mojom
rename to services/service_manager/tests/connect/connect_test.mojom
index a8af94c..bedc074e 100644
--- a/services/shell/tests/connect/connect_test.mojom
+++ b/services/service_manager/tests/connect/connect_test.mojom
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.test.mojom;
+module service_manager.test.mojom;
 
-import "services/shell/public/interfaces/connector.mojom";
+import "services/service_manager/public/interfaces/connector.mojom";
 
 interface ConnectTestService {
   GetTitle() => (string title);
@@ -36,8 +36,8 @@
   // Attempts to connect to mojo:connect_test_class_app as |user_id|.
   // The callback takes the connection response result, and the identity
   // mojo:connect_test_class_app was run as, which should match |user_id|.
-  ConnectToClassAppAsDifferentUser(shell.mojom.Identity target) =>
-      (int32 connection_result, shell.mojom.Identity target);
+  ConnectToClassAppAsDifferentUser(service_manager.mojom.Identity target) =>
+      (int32 connection_result, service_manager.mojom.Identity target);
 };
 
 interface ClientProcessTest {
@@ -46,7 +46,7 @@
   // the result of the connection, and the identity of the app that the caller
   // can use to connect to this app as well.
   LaunchAndConnectToProcess() =>
-      (int32 connection_result, shell.mojom.Identity target);
+      (int32 connection_result, service_manager.mojom.Identity target);
 };
 
 struct ConnectionState {
diff --git a/services/shell/tests/connect/connect_test_app.cc b/services/service_manager/tests/connect/connect_test_app.cc
similarity index 90%
rename from services/shell/tests/connect/connect_test_app.cc
rename to services/service_manager/tests/connect/connect_test_app.cc
index 50b7887..b8f469c 100644
--- a/services/shell/tests/connect/connect_test_app.cc
+++ b/services/service_manager/tests/connect/connect_test_app.cc
@@ -10,16 +10,16 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/tests/connect/connect_test.mojom.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/tests/connect/connect_test.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -52,7 +52,7 @@
   ~ConnectTestApp() override {}
 
  private:
-  // shell::Service:
+  // service_manager::Service:
   void OnStart(const Identity& identity) override {
     identity_ = identity;
     bindings_.set_connection_error_handler(
@@ -169,7 +169,7 @@
 
   // test::mojom::UserIdTest:
   void ConnectToClassAppAsDifferentUser(
-      const shell::Identity& target,
+      const service_manager::Identity& target,
       const ConnectToClassAppAsDifferentUserCallback& callback) override {
     Connector::ConnectParams params(target);
     std::unique_ptr<Connection> connection =
@@ -215,9 +215,9 @@
   DISALLOW_COPY_AND_ASSIGN(ConnectTestApp);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new shell::ConnectTestApp);
+  service_manager::ServiceRunner runner(new service_manager::ConnectTestApp);
   return runner.Run(service_request_handle);
 }
diff --git a/services/service_manager/tests/connect/connect_test_app_a_manifest.json b/services/service_manager/tests/connect/connect_test_app_a_manifest.json
new file mode 100644
index 0000000..d56a817
--- /dev/null
+++ b/services/service_manager/tests/connect/connect_test_app_a_manifest.json
@@ -0,0 +1,20 @@
+{
+  "manifest_version": 1,
+  "name": "service:connect_test_a",
+  "display_name": "Connect Test A",
+  "capabilities": {
+    "provided": {
+      "connect_unittests:connect_test_service": [
+        "service_manager::test::mojom::ConnectTestService"
+      ],
+      "connect_unittests:standalone_app": [
+        "service_manager::test::mojom::StandaloneApp"
+      ],
+      "connect_unittests:user_id_test": [ "service_manager::test::mojom::UserIdTest" ]
+    },
+    "required": {
+      "service:connect_unittests": [ "connect_unittests:exposed_interface" ],
+      "service:connect_test_class_app": [ "connect_unittests:class" ]
+    }
+  }
+}
diff --git a/services/shell/tests/connect/connect_test_app_b_manifest.json b/services/service_manager/tests/connect/connect_test_app_b_manifest.json
similarity index 100%
rename from services/shell/tests/connect/connect_test_app_b_manifest.json
rename to services/service_manager/tests/connect/connect_test_app_b_manifest.json
diff --git a/services/service_manager/tests/connect/connect_test_app_manifest.json b/services/service_manager/tests/connect/connect_test_app_manifest.json
new file mode 100644
index 0000000..9f510ee
--- /dev/null
+++ b/services/service_manager/tests/connect/connect_test_app_manifest.json
@@ -0,0 +1,25 @@
+{
+  "manifest_version": 1,
+  "name": "service:connect_test_app",
+  "display_name": "Connect Test App",
+  "capabilities": {
+    "provided": {
+      "connect_unittests:connect_test_service": [
+        "service_manager::test::mojom::ConnectTestService"
+      ],
+      "connect_unittests:standalone_app": [
+        "service_manager::test::mojom::StandaloneApp"
+      ],
+      "connect_unittests:user_id_test": [ "service_manager::test::mojom::UserIdTest" ]
+    },
+    "required": {
+      "service:connect_unittests": [ "connect_unittests:exposed_interface" ],
+      "service:connect_test_a": [ "connect_unittests:connect_test_service" ],
+      "service:connect_test_class_app": [
+        "connect_unittests:class",
+        "connect_unittests:connect_test_service"
+      ],
+      "service:shell": [ "shell:user_id" ]
+    }
+  }
+}
diff --git a/services/shell/tests/connect/connect_test_class_app.cc b/services/service_manager/tests/connect/connect_test_class_app.cc
similarity index 80%
rename from services/shell/tests/connect/connect_test_class_app.cc
rename to services/service_manager/tests/connect/connect_test_class_app.cc
index 1431e5f..d4644cf0 100644
--- a/services/shell/tests/connect/connect_test_class_app.cc
+++ b/services/service_manager/tests/connect/connect_test_class_app.cc
@@ -7,16 +7,16 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/tests/connect/connect_test.mojom.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/tests/connect/connect_test.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 using GetTitleCallback = test::mojom::ConnectTestService::GetTitleCallback;
 
@@ -31,7 +31,7 @@
   ~ConnectTestClassApp() override {}
 
  private:
-  // shell::Service:
+  // service_manager::Service:
   void OnStart(const Identity& identity) override {
     identity_ = identity;
   }
@@ -87,10 +87,10 @@
   DISALLOW_COPY_AND_ASSIGN(ConnectTestClassApp);
 };
 
-}  // namespace shell
-
+}  // namespace service_manager
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new shell::ConnectTestClassApp);
+  service_manager::ServiceRunner runner(
+      new service_manager::ConnectTestClassApp);
   return runner.Run(service_request_handle);
 }
diff --git a/services/service_manager/tests/connect/connect_test_class_app_manifest.json b/services/service_manager/tests/connect/connect_test_class_app_manifest.json
new file mode 100644
index 0000000..3ae5629
--- /dev/null
+++ b/services/service_manager/tests/connect/connect_test_class_app_manifest.json
@@ -0,0 +1,16 @@
+{
+  "manifest_version": 1,
+  "name": "service:connect_test_class_app",
+  "display_name": "Connect Test Class App",
+  "capabilities": {
+    "provided": {
+      "connect_unittests:class": [ "service_manager::test::mojom::ClassInterface" ],
+      "connect_unittests:connect_test_service": [
+        "service_manager::test::mojom::ConnectTestService"
+      ]
+    },
+    "required": {
+      "service:shell": [ "shell:explicit_class" ]
+    }
+  }
+}
diff --git a/services/service_manager/tests/connect/connect_test_driver.cc b/services/service_manager/tests/connect/connect_test_driver.cc
new file mode 100644
index 0000000..61a4c40
--- /dev/null
+++ b/services/service_manager/tests/connect/connect_test_driver.cc
@@ -0,0 +1,84 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <memory>
+
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/macros.h"
+#include "base/process/process.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/runner/child/test_native_main.h"
+#include "services/service_manager/runner/init.h"
+#include "services/service_manager/tests/connect/connect_test.mojom.h"
+#include "services/service_manager/tests/util.h"
+
+using service_manager::test::mojom::ClientProcessTest;
+using service_manager::test::mojom::ClientProcessTestRequest;
+
+namespace {
+
+class Driver : public service_manager::Service,
+               public service_manager::InterfaceFactory<ClientProcessTest>,
+               public ClientProcessTest {
+ public:
+  Driver() {}
+  ~Driver() override {}
+
+ private:
+  // service_manager::Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
+    registry->AddInterface<ClientProcessTest>(this);
+    return true;
+  }
+  bool OnStop() override {
+    // TODO(rockot): http://crbug.com/596621. Should be able to remove this
+    // override entirely.
+    _exit(1);
+  }
+
+  // service_manager::InterfaceFactory<ConnectTestService>:
+  void Create(const service_manager::Identity& remote_identity,
+              ClientProcessTestRequest request) override {
+    bindings_.AddBinding(this, std::move(request));
+  }
+
+  // test::mojom::ClientProcessTest:
+  void LaunchAndConnectToProcess(
+      const LaunchAndConnectToProcessCallback& callback) override {
+    base::Process process;
+    std::unique_ptr<service_manager::Connection> connection =
+        service_manager::test::LaunchAndConnectToProcess(
+#if defined(OS_WIN)
+            "connect_test_exe.exe",
+#else
+            "connect_test_exe",
+#endif
+            service_manager::Identity("exe:connect_test_exe",
+                                      service_manager::mojom::kInheritUserID),
+            connector(), &process);
+    callback.Run(static_cast<int32_t>(connection->GetResult()),
+                 connection->GetRemoteIdentity());
+  }
+
+  mojo::BindingSet<ClientProcessTest> bindings_;
+
+  DISALLOW_COPY_AND_ASSIGN(Driver);
+};
+
+}  // namespace
+
+int main(int argc, char** argv) {
+  base::AtExitManager at_exit;
+  base::CommandLine::Init(argc, argv);
+
+  service_manager::InitializeLogging();
+
+  Driver driver;
+  return service_manager::TestNativeMain(&driver);
+}
diff --git a/services/shell/tests/connect/connect_test_driver_manifest.json b/services/service_manager/tests/connect/connect_test_driver_manifest.json
similarity index 78%
rename from services/shell/tests/connect/connect_test_driver_manifest.json
rename to services/service_manager/tests/connect/connect_test_driver_manifest.json
index c017c23..1efe918 100644
--- a/services/shell/tests/connect/connect_test_driver_manifest.json
+++ b/services/service_manager/tests/connect/connect_test_driver_manifest.json
@@ -5,7 +5,7 @@
   "capabilities": {
     "provided": {
       "connect_unittests:client_process_test": [
-        "shell::test::mojom::ClientProcessTest"
+        "service_manager::test::mojom::ClientProcessTest"
       ]
     }
   }
diff --git a/services/service_manager/tests/connect/connect_test_exe.cc b/services/service_manager/tests/connect/connect_test_exe.cc
new file mode 100644
index 0000000..f76ae3bb
--- /dev/null
+++ b/services/service_manager/tests/connect/connect_test_exe.cc
@@ -0,0 +1,71 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/runner/child/test_native_main.h"
+#include "services/service_manager/runner/init.h"
+#include "services/service_manager/tests/connect/connect_test.mojom.h"
+
+using service_manager::test::mojom::ConnectTestService;
+using service_manager::test::mojom::ConnectTestServiceRequest;
+
+namespace {
+
+class Target : public service_manager::Service,
+               public service_manager::InterfaceFactory<ConnectTestService>,
+               public ConnectTestService {
+ public:
+  Target() {}
+  ~Target() override {}
+
+ private:
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override {
+    identity_ = identity;
+  }
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
+    registry->AddInterface<ConnectTestService>(this);
+    return true;
+  }
+
+  // service_manager::InterfaceFactory<ConnectTestService>:
+  void Create(const service_manager::Identity& remote_identity,
+              ConnectTestServiceRequest request) override {
+    bindings_.AddBinding(this, std::move(request));
+  }
+
+  // ConnectTestService:
+  void GetTitle(const GetTitleCallback& callback) override {
+    callback.Run("connect_test_exe");
+  }
+  void GetInstance(const GetInstanceCallback& callback) override {
+    callback.Run(identity_.instance());
+  }
+
+  service_manager::Identity identity_;
+  mojo::BindingSet<ConnectTestService> bindings_;
+
+  DISALLOW_COPY_AND_ASSIGN(Target);
+};
+
+}  // namespace
+
+int main(int argc, char** argv) {
+  base::AtExitManager at_exit;
+  base::CommandLine::Init(argc, argv);
+
+  service_manager::InitializeLogging();
+
+  Target target;
+  return service_manager::TestNativeMain(&target);
+}
diff --git a/services/shell/tests/connect/connect_test_exe_manifest.json b/services/service_manager/tests/connect/connect_test_exe_manifest.json
similarity index 100%
rename from services/shell/tests/connect/connect_test_exe_manifest.json
rename to services/service_manager/tests/connect/connect_test_exe_manifest.json
diff --git a/services/shell/tests/connect/connect_test_package.cc b/services/service_manager/tests/connect/connect_test_package.cc
similarity index 90%
rename from services/shell/tests/connect/connect_test_package.cc
rename to services/service_manager/tests/connect/connect_test_package.cc
index 564614ef02..4ed5153 100644
--- a/services/shell/tests/connect/connect_test_package.cc
+++ b/services/service_manager/tests/connect/connect_test_package.cc
@@ -14,19 +14,19 @@
 #include "base/run_loop.h"
 #include "base/threading/simple_thread.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
-#include "services/shell/tests/connect/connect_test.mojom.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/tests/connect/connect_test.mojom.h"
 
 // Tests that multiple services can be packaged in a single service by
 // implementing ServiceFactory; that these services can be specified by
 // the package's manifest and are thus registered with the PackageManager.
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -60,7 +60,7 @@
   }
 
  private:
-  // shell::Service:
+  // service_manager::Service:
   void OnStart(const Identity& identity) override {
     identity_ = identity;
     bindings_.set_connection_error_handler(
@@ -118,7 +118,7 @@
 
   // test::mojom::UserIdTest:
   void ConnectToClassAppAsDifferentUser(
-      const shell::Identity& target,
+      const service_manager::Identity& target,
       const ConnectToClassAppAsDifferentUserCallback& callback) override {
     Connector::ConnectParams params(target);
     std::unique_ptr<Connection> connection =
@@ -168,7 +168,7 @@
   ~ConnectTestService() override {}
 
  private:
-  // shell::Service:
+  // service_manager::Service:
   void OnStart(const Identity& identity) override {
     identity_ = identity;
     bindings_.set_connection_error_handler(
@@ -224,9 +224,10 @@
   DISALLOW_COPY_AND_ASSIGN(ConnectTestService);
 };
 
-}  // namespace shell
+}  // namespace service_manager
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new shell::ConnectTestService);
+  service_manager::ServiceRunner runner(
+      new service_manager::ConnectTestService);
   return runner.Run(service_request_handle);
 }
diff --git a/services/shell/tests/connect/connect_test_package_manifest.json b/services/service_manager/tests/connect/connect_test_package_manifest.json
similarity index 70%
rename from services/shell/tests/connect/connect_test_package_manifest.json
rename to services/service_manager/tests/connect/connect_test_package_manifest.json
index d1d4680c..59469ce 100644
--- a/services/shell/tests/connect/connect_test_package_manifest.json
+++ b/services/service_manager/tests/connect/connect_test_package_manifest.json
@@ -5,10 +5,10 @@
   "capabilities": {
     "provided": {
       "connect_unittests:connect_test_service": [
-        "shell::test::mojom::ConnectTestService"
+        "service_manager::test::mojom::ConnectTestService"
       ],
       "shell:service_factory": [
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ]
     }
   }
diff --git a/services/shell/tests/connect/connect_test_singleton_app.cc b/services/service_manager/tests/connect/connect_test_singleton_app.cc
similarity index 63%
rename from services/shell/tests/connect/connect_test_singleton_app.cc
rename to services/service_manager/tests/connect/connect_test_singleton_app.cc
index c4da059..96f2f58 100644
--- a/services/shell/tests/connect/connect_test_singleton_app.cc
+++ b/services/service_manager/tests/connect/connect_test_singleton_app.cc
@@ -3,11 +3,11 @@
 // found in the LICENSE file.
 
 #include "base/macros.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 
-namespace shell {
+namespace service_manager {
 
 class ConnectTestSingletonApp : public Service {
  public:
@@ -15,7 +15,7 @@
   ~ConnectTestSingletonApp() override {}
 
  private:
-  // shell::Service:
+  // service_manager::Service:
   bool OnConnect(const Identity& remote_identity,
                  InterfaceRegistry* registry) override {
     return true;
@@ -24,10 +24,10 @@
   DISALLOW_COPY_AND_ASSIGN(ConnectTestSingletonApp);
 };
 
-}  // namespace shell
-
+}  // namespace service_manager
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new shell::ConnectTestSingletonApp);
+  service_manager::ServiceRunner runner(
+      new service_manager::ConnectTestSingletonApp);
   return runner.Run(service_request_handle);
 }
diff --git a/services/shell/tests/connect/connect_test_singleton_app_manifest.json b/services/service_manager/tests/connect/connect_test_singleton_app_manifest.json
similarity index 74%
rename from services/shell/tests/connect/connect_test_singleton_app_manifest.json
rename to services/service_manager/tests/connect/connect_test_singleton_app_manifest.json
index 6286b88..48171bc 100644
--- a/services/shell/tests/connect/connect_test_singleton_app_manifest.json
+++ b/services/service_manager/tests/connect/connect_test_singleton_app_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Connect Test Singleton App",
   "capabilities": {
     "required": {
-      "service:shell": { "classes": [ "shell:all_users" ] }
+      "service:shell": [ "shell:all_users" ]
     }
   }
 }
diff --git a/services/shell/tests/connect/connect_unittest.cc b/services/service_manager/tests/connect/connect_unittest.cc
similarity index 97%
rename from services/shell/tests/connect/connect_unittest.cc
rename to services/service_manager/tests/connect/connect_unittest.cc
index bf9814b..77261e6 100644
--- a/services/shell/tests/connect/connect_unittest.cc
+++ b/services/service_manager/tests/connect/connect_unittest.cc
@@ -14,16 +14,16 @@
 #include "base/run_loop.h"
 #include "base/test/test_suite.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/names.h"
-#include "services/shell/public/cpp/service_test.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
-#include "services/shell/tests/connect/connect_test.mojom.h"
+#include "services/service_manager/public/cpp/names.h"
+#include "services/service_manager/public/cpp/service_test.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/tests/connect/connect_test.mojom.h"
 
 // Tests that multiple services can be packaged in a single service by
 // implementing ServiceFactory; that these services can be specified by
 // the package's manifest and are thus registered with the PackageManager.
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -56,7 +56,7 @@
                              Identity* out_target,
                              base::RunLoop* loop,
                              int32_t in_result,
-                             const shell::Identity& in_identity) {
+                             const service_manager::Identity& in_identity) {
   *out_result = static_cast<mojom::ConnectResult>(in_result);
   *out_target = in_identity;
   loop->Quit();
@@ -412,4 +412,4 @@
   }
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/service_manager/tests/connect/connect_unittests_manifest.json b/services/service_manager/tests/connect/connect_unittests_manifest.json
new file mode 100644
index 0000000..4910d2c
--- /dev/null
+++ b/services/service_manager/tests/connect/connect_unittests_manifest.json
@@ -0,0 +1,31 @@
+{
+  "manifest_version": 1,
+  "name": "service:connect_unittests",
+  "display_name": "Connect Unittests",
+  "capabilities": {
+    "provided": {
+      "connect_unittests:exposed_interface": [
+        "service_manager::test::mojom::ExposedInterface"
+      ]
+    },
+    "required": {
+      "service:connect_test_package": [
+        "connect_unittests:connect_test_service"
+      ],
+      "service:connect_test_app": [
+        "connect_unittests:connect_test_service",
+        "connect_unittests:standalone_app",
+        "connect_unittests:user_id_test"
+      ],
+      "exe:connect_test_driver": [
+        "connect_unittests:client_process_test"
+      ],
+      "service:connect_test_a": [
+        "connect_unittests:connect_test_service",
+        "connect_unittests:standalone_app",
+        "connect_unittests:user_id_test"
+      ],
+      "service:shell": [ "shell:instance_name", "shell:user_id" ]
+    }
+  }
+}
diff --git a/services/shell/tests/lifecycle/BUILD.gn b/services/service_manager/tests/lifecycle/BUILD.gn
similarity index 77%
rename from services/shell/tests/lifecycle/BUILD.gn
rename to services/service_manager/tests/lifecycle/BUILD.gn
index 2807bb6..38575e2 100644
--- a/services/shell/tests/lifecycle/BUILD.gn
+++ b/services/service_manager/tests/lifecycle/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//testing/test.gni")
 
@@ -16,11 +16,11 @@
     ":interfaces",
     "//base",
     "//base/test:test_support",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner/common",
-    "//services/shell/tests:util",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner/common",
+    "//services/service_manager/tests:util",
   ]
 
   data_deps = [
@@ -61,8 +61,8 @@
   deps = [
     ":interfaces",
     "//base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
 }
 
@@ -75,8 +75,8 @@
     ":app_client",
     ":interfaces",
     "//base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
   data_deps = [
     ":lifecycle_unittest_package_manifest",
@@ -105,7 +105,7 @@
     ":app_client",
     ":interfaces",
     "//base",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:sources",
   ]
 
   data_deps = [
@@ -126,7 +126,7 @@
   deps = [
     ":interfaces",
     "//base",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:sources",
   ]
 
   data_deps = [
@@ -148,8 +148,8 @@
     ":app_client",
     "//base",
     "//build/win:default_exe_manifest",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/runner/child:test_native_main",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/runner/child:test_native_main",
   ]
 
   data_deps = [
diff --git a/services/service_manager/tests/lifecycle/app.cc b/services/service_manager/tests/lifecycle/app.cc
new file mode 100644
index 0000000..86280d1
--- /dev/null
+++ b/services/service_manager/tests/lifecycle/app.cc
@@ -0,0 +1,14 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/tests/lifecycle/app_client.h"
+
+MojoResult ServiceMain(MojoHandle service_request_handle) {
+  service_manager::test::AppClient* app = new service_manager::test::AppClient;
+  service_manager::ServiceRunner runner(app);
+  app->set_runner(&runner);
+  return runner.Run(service_request_handle);
+}
diff --git a/services/shell/tests/lifecycle/app_client.cc b/services/service_manager/tests/lifecycle/app_client.cc
similarity index 80%
rename from services/shell/tests/lifecycle/app_client.cc
rename to services/service_manager/tests/lifecycle/app_client.cc
index 59502d31..a8c3dc0 100644
--- a/services/shell/tests/lifecycle/app_client.cc
+++ b/services/service_manager/tests/lifecycle/app_client.cc
@@ -2,16 +2,16 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/tests/lifecycle/app_client.h"
+#include "services/service_manager/tests/lifecycle/app_client.h"
 
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service_context.h"
 
-namespace shell {
+namespace service_manager {
 namespace test {
 
 AppClient::AppClient() {}
-AppClient::AppClient(shell::mojom::ServiceRequest request)
+AppClient::AppClient(service_manager::mojom::ServiceRequest request)
     : context_(new ServiceContext(this, std::move(request))) {}
 AppClient::~AppClient() {}
 
@@ -55,6 +55,4 @@
 }
 
 }  // namespace test
-}  // namespace shell
-
-
+}  // namespace service_manager
diff --git a/services/shell/tests/lifecycle/app_client.h b/services/service_manager/tests/lifecycle/app_client.h
similarity index 60%
rename from services/shell/tests/lifecycle/app_client.h
rename to services/service_manager/tests/lifecycle/app_client.h
index 55c6a86..bc47df2 100644
--- a/services/shell/tests/lifecycle/app_client.h
+++ b/services/service_manager/tests/lifecycle/app_client.h
@@ -2,24 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_TESTS_LIFECYCLE_APP_CLIENT_H_
-#define SERVICES_SHELL_TESTS_LIFECYCLE_APP_CLIENT_H_
+#ifndef SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_
+#define SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_
 
 #include <memory>
 
 #include "base/bind.h"
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-#include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/public/interfaces/service.mojom.h"
+#include "services/service_manager/tests/lifecycle/lifecycle_unittest.mojom.h"
 
-using LifecycleControl = shell::test::mojom::LifecycleControl;
-using LifecycleControlRequest = shell::test::mojom::LifecycleControlRequest;
+using LifecycleControl = service_manager::test::mojom::LifecycleControl;
+using LifecycleControlRequest =
+    service_manager::test::mojom::LifecycleControlRequest;
 
-namespace shell {
+namespace service_manager {
 class ServiceContext;
 
 namespace test {
@@ -29,7 +30,7 @@
                   public LifecycleControl {
  public:
   AppClient();
-  explicit AppClient(shell::mojom::ServiceRequest request);
+  explicit AppClient(service_manager::mojom::ServiceRequest request);
   ~AppClient() override;
 
   void set_runner(ServiceRunner* runner) {
@@ -61,6 +62,6 @@
 };
 
 }  // namespace test
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_TESTS_LIFECYCLE_APP_CLIENT_H_
+#endif  // SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_
diff --git a/services/shell/tests/lifecycle/app_manifest.json b/services/service_manager/tests/lifecycle/app_manifest.json
similarity index 79%
rename from services/shell/tests/lifecycle/app_manifest.json
rename to services/service_manager/tests/lifecycle/app_manifest.json
index 29a19f11..21c3ef3d 100644
--- a/services/shell/tests/lifecycle/app_manifest.json
+++ b/services/service_manager/tests/lifecycle/app_manifest.json
@@ -5,7 +5,7 @@
   "capabilities": {
     "provided": {
       "lifecycle_unittest:lifecycle_control": [
-        "shell::test::mojom::LifecycleControl"
+        "service_manager::test::mojom::LifecycleControl"
       ]
     }
   }
diff --git a/services/shell/tests/lifecycle/exe_manifest.json b/services/service_manager/tests/lifecycle/exe_manifest.json
similarity index 79%
rename from services/shell/tests/lifecycle/exe_manifest.json
rename to services/service_manager/tests/lifecycle/exe_manifest.json
index 8271b22e..1ed65dd 100644
--- a/services/shell/tests/lifecycle/exe_manifest.json
+++ b/services/service_manager/tests/lifecycle/exe_manifest.json
@@ -5,7 +5,7 @@
   "capabilities": {
     "provided": {
       "lifecycle_unittest:lifecycle_control": [
-        "shell::test::mojom::LifecycleControl"
+        "service_manager::test::mojom::LifecycleControl"
       ]
     }
   }
diff --git a/services/service_manager/tests/lifecycle/lifecycle_exe.cc b/services/service_manager/tests/lifecycle/lifecycle_exe.cc
new file mode 100644
index 0000000..2ebfdfc
--- /dev/null
+++ b/services/service_manager/tests/lifecycle/lifecycle_exe.cc
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/macros.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/runner/child/test_native_main.h"
+#include "services/service_manager/runner/init.h"
+#include "services/service_manager/tests/lifecycle/app_client.h"
+
+int main(int argc, char** argv) {
+  base::AtExitManager at_exit;
+  base::CommandLine::Init(argc, argv);
+
+  service_manager::InitializeLogging();
+
+  service_manager::test::AppClient client;
+  return service_manager::TestNativeMain(&client);
+}
diff --git a/services/shell/tests/lifecycle/lifecycle_unittest.cc b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc
similarity index 96%
rename from services/shell/tests/lifecycle/lifecycle_unittest.cc
rename to services/service_manager/tests/lifecycle/lifecycle_unittest.cc
index 1bd71b1..0febe6d6 100644
--- a/services/shell/tests/lifecycle/lifecycle_unittest.cc
+++ b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc
@@ -10,13 +10,13 @@
 #include "base/memory/ptr_util.h"
 #include "base/process/process.h"
 #include "base/run_loop.h"
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/cpp/service_test.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
-#include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h"
-#include "services/shell/tests/util.h"
+#include "services/service_manager/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/service_test.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/tests/lifecycle/lifecycle_unittest.mojom.h"
+#include "services/service_manager/tests/util.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -81,7 +81,7 @@
     instances_[instance->identity.name()] =
         Instance(instance->identity, instance->pid);
   }
-  void OnServiceStarted(const shell::Identity& identity,
+  void OnServiceStarted(const service_manager::Identity& identity,
                         uint32_t pid) override {
     for (auto& instance : instances_) {
       if (instance.second.identity == identity) {
@@ -90,7 +90,7 @@
       }
     }
   }
-  void OnServiceStopped(const shell::Identity& identity) override {
+  void OnServiceStopped(const service_manager::Identity& identity) override {
     for (auto it = instances_.begin(); it != instances_.end(); ++it) {
       if (it->second.identity == identity) {
         instances_.erase(it);
@@ -449,4 +449,4 @@
   EXPECT_FALSE(instances()->HasInstanceForName(kTestAppName));
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/tests/lifecycle/lifecycle_unittest.mojom b/services/service_manager/tests/lifecycle/lifecycle_unittest.mojom
similarity index 96%
rename from services/shell/tests/lifecycle/lifecycle_unittest.mojom
rename to services/service_manager/tests/lifecycle/lifecycle_unittest.mojom
index 212398c..1a18c69 100644
--- a/services/shell/tests/lifecycle/lifecycle_unittest.mojom
+++ b/services/service_manager/tests/lifecycle/lifecycle_unittest.mojom
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.test.mojom;
+module service_manager.test.mojom;
 
 // An interface implemented by an application exposing different ways for the
 // application to "shut down" from the caller and shell's perspective.
diff --git a/services/service_manager/tests/lifecycle/lifecycle_unittest_manifest.json b/services/service_manager/tests/lifecycle/lifecycle_unittest_manifest.json
new file mode 100644
index 0000000..82522dd
--- /dev/null
+++ b/services/service_manager/tests/lifecycle/lifecycle_unittest_manifest.json
@@ -0,0 +1,16 @@
+{
+  "manifest_version": 1,
+  "name": "service:lifecycle_unittest",
+  "display_name": "Lifecycle Unittest",
+  "capabilities": {
+    "required": {
+      "*": [ "lifecycle_unittest:lifecycle_control" ],
+      "service:lifecycle_unittest_parent": [ "lifecycle_unittest:parent" ],
+      "service:shell": [
+        "shell:service_manager",
+        "shell:instance_name",
+        "shell:client_process"
+      ]
+    }
+  }
+}
diff --git a/services/service_manager/tests/lifecycle/package.cc b/services/service_manager/tests/lifecycle/package.cc
new file mode 100644
index 0000000..29b305be
--- /dev/null
+++ b/services/service_manager/tests/lifecycle/package.cc
@@ -0,0 +1,158 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <algorithm>
+#include <memory>
+
+#include "base/bind.h"
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/tests/lifecycle/app_client.h"
+#include "services/service_manager/tests/lifecycle/lifecycle_unittest.mojom.h"
+
+namespace {
+
+class PackagedApp : public service_manager::Service,
+                    public service_manager::InterfaceFactory<LifecycleControl>,
+                    public LifecycleControl {
+ public:
+  using DestructCallback = base::Callback<void(PackagedApp*)>;
+
+  PackagedApp(
+      service_manager::mojom::ServiceRequest request,
+      const DestructCallback& service_manager_connection_closed_callback,
+      const DestructCallback& destruct_callback)
+      : connection_(
+            new service_manager::ServiceContext(this, std::move(request))),
+        service_manager_connection_closed_callback_(
+            service_manager_connection_closed_callback),
+        destruct_callback_(destruct_callback) {
+    bindings_.set_connection_error_handler(base::Bind(&PackagedApp::BindingLost,
+                                                      base::Unretained(this)));
+  }
+  ~PackagedApp() override {
+    destruct_callback_.Run(this);
+  }
+
+ private:
+  // service_manager::Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
+    registry->AddInterface<LifecycleControl>(this);
+    return true;
+  }
+
+  // service_manager::InterfaceFactory<LifecycleControl>
+  void Create(const service_manager::Identity& remote_identity,
+              LifecycleControlRequest request) override {
+    bindings_.AddBinding(this, std::move(request));
+  }
+
+  // LifecycleControl:
+  void Ping(const PingCallback& callback) override {
+    callback.Run();
+  }
+  void GracefulQuit() override {
+    service_manager_connection_closed_callback_.Run(this);
+    delete this;
+    // This will have closed all |bindings_|.
+  }
+  void Crash() override {
+    // When multiple instances are vended from the same package instance, this
+    // will cause all instances to be quit.
+    exit(1);
+  }
+  void CloseShellConnection() override {
+    service_manager_connection_closed_callback_.Run(this);
+    connection_.reset();
+    // This only closed our relationship with the shell, existing |bindings_|
+    // remain active.
+  }
+
+  void BindingLost() {
+    if (bindings_.empty())
+      delete this;
+  }
+
+  std::unique_ptr<service_manager::ServiceContext> connection_;
+  mojo::BindingSet<LifecycleControl> bindings_;
+  // Run when this object's connection to the shell is closed.
+  DestructCallback service_manager_connection_closed_callback_;
+  // Run when this object is destructed.
+  DestructCallback destruct_callback_;
+
+  DISALLOW_COPY_AND_ASSIGN(PackagedApp);
+};
+
+class Package : public service_manager::Service,
+                public service_manager::InterfaceFactory<
+                    service_manager::mojom::ServiceFactory>,
+                public service_manager::mojom::ServiceFactory {
+ public:
+  Package() {}
+  ~Package() override {}
+
+  void set_runner(service_manager::ServiceRunner* runner) {
+    app_client_.set_runner(runner);
+  }
+
+ private:
+  // service_manager::test::AppClient:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
+    registry->AddInterface<service_manager::mojom::ServiceFactory>(this);
+    return app_client_.OnConnect(remote_identity, registry);
+  }
+
+  // service_manager::InterfaceFactory<service_manager::mojom::ServiceFactory>:
+  void Create(const service_manager::Identity& remote_identity,
+              service_manager::mojom::ServiceFactoryRequest request) override {
+    bindings_.AddBinding(this, std::move(request));
+  }
+
+  // service_manager::mojom::ServiceFactory:
+  void CreateService(service_manager::mojom::ServiceRequest request,
+                     const std::string& name) override {
+    ++service_manager_connection_refcount_;
+    apps_.push_back(
+        new PackagedApp(std::move(request),
+                        base::Bind(&Package::AppShellConnectionClosed,
+                                   base::Unretained(this)),
+                        base::Bind(&Package::AppDestructed,
+                                   base::Unretained(this))));
+  }
+
+  void AppShellConnectionClosed(PackagedApp* app) {
+    if (!--service_manager_connection_refcount_)
+      app_client_.CloseShellConnection();
+  }
+
+  void AppDestructed(PackagedApp* app) {
+    auto it = std::find(apps_.begin(), apps_.end(), app);
+    DCHECK(it != apps_.end());
+    apps_.erase(it);
+    if (apps_.empty() && base::MessageLoop::current()->is_running())
+      base::MessageLoop::current()->QuitWhenIdle();
+  }
+
+  service_manager::test::AppClient app_client_;
+  int service_manager_connection_refcount_ = 0;
+  mojo::BindingSet<service_manager::mojom::ServiceFactory> bindings_;
+  std::vector<PackagedApp*> apps_;
+
+  DISALLOW_COPY_AND_ASSIGN(Package);
+};
+
+}  // namespace
+
+MojoResult ServiceMain(MojoHandle service_request_handle) {
+  Package* package = new Package;
+  service_manager::ServiceRunner runner(package);
+  package->set_runner(&runner);
+  return runner.Run(service_request_handle);
+}
diff --git a/services/shell/tests/lifecycle/package_app_a_manifest.json b/services/service_manager/tests/lifecycle/package_app_a_manifest.json
similarity index 82%
rename from services/shell/tests/lifecycle/package_app_a_manifest.json
rename to services/service_manager/tests/lifecycle/package_app_a_manifest.json
index bcc1b73..5c035980 100644
--- a/services/shell/tests/lifecycle/package_app_a_manifest.json
+++ b/services/service_manager/tests/lifecycle/package_app_a_manifest.json
@@ -6,7 +6,7 @@
   "capabilities": {
     "provided": {
       "lifecycle_unittest:lifecycle_control": [
-        "shell::test::mojom::LifecycleControl"
+        "service_manager::test::mojom::LifecycleControl"
       ]
     }
   }
diff --git a/services/shell/tests/lifecycle/package_app_b_manifest.json b/services/service_manager/tests/lifecycle/package_app_b_manifest.json
similarity index 82%
rename from services/shell/tests/lifecycle/package_app_b_manifest.json
rename to services/service_manager/tests/lifecycle/package_app_b_manifest.json
index bff0fdc..6ecfe07 100644
--- a/services/shell/tests/lifecycle/package_app_b_manifest.json
+++ b/services/service_manager/tests/lifecycle/package_app_b_manifest.json
@@ -6,7 +6,7 @@
   "capabilities": {
     "provided": {
       "lifecycle_unittest:lifecycle_control": [
-        "shell::test::mojom::LifecycleControl"
+        "service_manager::test::mojom::LifecycleControl"
       ]
     }
   }
diff --git a/services/shell/tests/lifecycle/package_manifest.json b/services/service_manager/tests/lifecycle/package_manifest.json
similarity index 73%
rename from services/shell/tests/lifecycle/package_manifest.json
rename to services/service_manager/tests/lifecycle/package_manifest.json
index c30e858a5..e839d98 100644
--- a/services/shell/tests/lifecycle/package_manifest.json
+++ b/services/service_manager/tests/lifecycle/package_manifest.json
@@ -6,10 +6,10 @@
   "capabilities": {
     "provided": {
       "lifecycle_unittest:lifecycle_control": [
-        "shell::test::mojom::LifecycleControl"
+        "service_manager::test::mojom::LifecycleControl"
       ],
       "shell:service_factory": [
-        "shell::mojom::ServiceFactory"
+        "service_manager::mojom::ServiceFactory"
       ]
     }
   }
diff --git a/services/service_manager/tests/lifecycle/parent.cc b/services/service_manager/tests/lifecycle/parent.cc
new file mode 100644
index 0000000..25e1852
--- /dev/null
+++ b/services/service_manager/tests/lifecycle/parent.cc
@@ -0,0 +1,79 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <memory>
+
+#include "base/bind.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/tests/lifecycle/lifecycle_unittest.mojom.h"
+
+namespace {
+
+void QuitLoop(base::RunLoop* loop) {
+  loop->Quit();
+}
+
+class Parent : public service_manager::Service,
+               public service_manager::InterfaceFactory<
+                   service_manager::test::mojom::Parent>,
+               public service_manager::test::mojom::Parent {
+ public:
+  Parent() {}
+  ~Parent() override {
+    child_connection_.reset();
+    parent_bindings_.CloseAllBindings();
+  }
+
+ private:
+  // Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
+    registry->AddInterface<service_manager::test::mojom::Parent>(this);
+    return true;
+  }
+
+  // InterfaceFactory<service_manager::test::mojom::Parent>:
+  void Create(const service_manager::Identity& remote_identity,
+              service_manager::test::mojom::ParentRequest request) override {
+    parent_bindings_.AddBinding(this, std::move(request));
+  }
+
+  // Parent:
+  void ConnectToChild(const ConnectToChildCallback& callback) override {
+    child_connection_ = connector()->Connect("service:lifecycle_unittest_app");
+    service_manager::test::mojom::LifecycleControlPtr lifecycle;
+    child_connection_->GetInterface(&lifecycle);
+    {
+      base::RunLoop loop;
+      lifecycle->Ping(base::Bind(&QuitLoop, &loop));
+      base::MessageLoop::ScopedNestableTaskAllower allow(
+          base::MessageLoop::current());
+      loop.Run();
+    }
+    callback.Run();
+  }
+  void Quit() override {
+    base::MessageLoop::current()->QuitWhenIdle();
+  }
+
+  std::unique_ptr<service_manager::Connection> child_connection_;
+  mojo::BindingSet<service_manager::test::mojom::Parent> parent_bindings_;
+
+  DISALLOW_COPY_AND_ASSIGN(Parent);
+};
+
+}  // namespace
+
+MojoResult ServiceMain(MojoHandle service_request_handle) {
+  Parent* parent = new Parent;
+  return service_manager::ServiceRunner(parent).Run(service_request_handle);
+}
diff --git a/services/service_manager/tests/lifecycle/parent_manifest.json b/services/service_manager/tests/lifecycle/parent_manifest.json
new file mode 100644
index 0000000..b0fe2be
--- /dev/null
+++ b/services/service_manager/tests/lifecycle/parent_manifest.json
@@ -0,0 +1,15 @@
+{
+  "manifest_version":  1,
+  "name": "service:lifecycle_unittest_parent",
+  "display_name": "Lifecycle Unittest Parent",
+  "capabilities": {
+    "provided": {
+      "lifecycle_unittest:parent": [ "service_manager::test::mojom::Parent" ]
+    },
+    "required": {
+      "service:lifecycle_unittest_app": [
+        "lifecycle_unittest:lifecycle_control"
+      ]
+    }
+  }
+}
diff --git a/services/shell/tests/shell/BUILD.gn b/services/service_manager/tests/shell/BUILD.gn
similarity index 67%
rename from services/shell/tests/shell/BUILD.gn
rename to services/service_manager/tests/shell/BUILD.gn
index 7d702746..9d4602f 100644
--- a/services/shell/tests/shell/BUILD.gn
+++ b/services/service_manager/tests/shell/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//testing/test.gni")
 
@@ -18,9 +18,9 @@
     "//base",
     "//base/test:test_config",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
 
   data_deps = [
@@ -36,7 +36,7 @@
   ]
 
   deps = [
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
   ]
 }
 
@@ -57,11 +57,11 @@
     "//base",
     "//build/win:default_exe_manifest",
     "//mojo/edk/system",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner:init",
-    "//services/shell/runner/child:test_native_main",
-    "//services/shell/runner/common",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
+    "//services/service_manager/runner:init",
+    "//services/service_manager/runner/child:test_native_main",
+    "//services/service_manager/runner/common",
   ]
 
   data_deps = [
@@ -86,8 +86,8 @@
     ":interfaces",
     "//base",
     "//build/win:default_exe_manifest",
-    "//services/shell/public/cpp",
-    "//services/shell/runner/child:test_native_main",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/runner/child:test_native_main",
   ]
 
   data_deps = [
diff --git a/services/shell/tests/shell/OWNERS b/services/service_manager/tests/shell/OWNERS
similarity index 100%
rename from services/shell/tests/shell/OWNERS
rename to services/service_manager/tests/shell/OWNERS
diff --git a/services/shell/tests/shell/driver.cc b/services/service_manager/tests/shell/driver.cc
similarity index 60%
rename from services/shell/tests/shell/driver.cc
rename to services/service_manager/tests/shell/driver.cc
index 1f737b2..949b8dfc 100644
--- a/services/shell/tests/shell/driver.cc
+++ b/services/service_manager/tests/shell/driver.cc
@@ -22,30 +22,31 @@
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
-#include "services/shell/runner/child/test_native_main.h"
-#include "services/shell/runner/common/client_util.h"
-#include "services/shell/runner/common/switches.h"
-#include "services/shell/runner/init.h"
-#include "services/shell/tests/shell/shell_unittest.mojom.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/runner/child/test_native_main.h"
+#include "services/service_manager/runner/common/client_util.h"
+#include "services/service_manager/runner/common/switches.h"
+#include "services/service_manager/runner/init.h"
+#include "services/service_manager/tests/shell/shell_unittest.mojom.h"
 
 namespace {
 
-class Driver : public shell::Service,
-               public shell::InterfaceFactory<shell::test::mojom::Driver>,
-               public shell::test::mojom::Driver {
+class Driver : public service_manager::Service,
+               public service_manager::InterfaceFactory<
+                   service_manager::test::mojom::Driver>,
+               public service_manager::test::mojom::Driver {
  public:
   Driver() : weak_factory_(this) {}
   ~Driver() override {}
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override {
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override {
     base::FilePath target_path;
     CHECK(base::PathService::Get(base::DIR_EXE, &target_path));
   #if defined(OS_WIN)
@@ -72,17 +73,17 @@
         &child_command_line, &handle_passing_info);
 
     std::string child_token = mojo::edk::GenerateRandomToken();
-    shell::mojom::ServicePtr client =
-        shell::PassServiceRequestOnCommandLine(&child_command_line,
-                                                   child_token);
-    shell::mojom::PIDReceiverPtr receiver;
+    service_manager::mojom::ServicePtr client =
+        service_manager::PassServiceRequestOnCommandLine(&child_command_line,
+                                                         child_token);
+    service_manager::mojom::PIDReceiverPtr receiver;
 
-    shell::Identity target("exe:shell_unittest_target",
-                           shell::mojom::kInheritUserID);
-    shell::Connector::ConnectParams params(target);
+    service_manager::Identity target("exe:shell_unittest_target",
+                                     service_manager::mojom::kInheritUserID);
+    service_manager::Connector::ConnectParams params(target);
     params.set_client_process_connection(std::move(client),
                                          GetProxy(&receiver));
-    std::unique_ptr<shell::Connection> connection =
+    std::unique_ptr<service_manager::Connection> connection =
         connector()->Connect(&params);
     connection->AddConnectionCompletedClosure(
         base::Bind(&Driver::OnConnectionCompleted, base::Unretained(this)));
@@ -101,15 +102,15 @@
                                     child_token);
   }
 
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
-    registry->AddInterface<shell::test::mojom::Driver>(this);
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
+    registry->AddInterface<service_manager::test::mojom::Driver>(this);
     return true;
   }
 
-  // shell::InterfaceFactory<Driver>:
-  void Create(const shell::Identity& remote_identity,
-              shell::test::mojom::DriverRequest request) override {
+  // service_manager::InterfaceFactory<Driver>:
+  void Create(const service_manager::Identity& remote_identity,
+              service_manager::test::mojom::DriverRequest request) override {
     bindings_.AddBinding(this, std::move(request));
   }
 
@@ -122,7 +123,7 @@
   void OnConnectionCompleted() {}
 
   base::Process target_;
-  mojo::BindingSet<shell::test::mojom::Driver> bindings_;
+  mojo::BindingSet<service_manager::test::mojom::Driver> bindings_;
   base::WeakPtrFactory<Driver> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(Driver);
@@ -134,8 +135,8 @@
   base::AtExitManager at_exit;
   base::CommandLine::Init(argc, argv);
 
-  shell::InitializeLogging();
+  service_manager::InitializeLogging();
 
   Driver driver;
-  return shell::TestNativeMain(&driver);
+  return service_manager::TestNativeMain(&driver);
 }
diff --git a/services/service_manager/tests/shell/driver_manifest.json b/services/service_manager/tests/shell/driver_manifest.json
new file mode 100644
index 0000000..33b1a64c
--- /dev/null
+++ b/services/service_manager/tests/shell/driver_manifest.json
@@ -0,0 +1,14 @@
+{
+  "manifest_version": 1,
+  "name": "exe:shell_unittest_driver",
+  "display_name": "Shell Unittest: Driver",
+  "capabilities": {
+    "provided": {
+      "shell_unittest:driver": [ "service_manager::test::mojom::Driver" ]
+    },
+    "required": {
+      "exe:shell_unittest_target": [ ],
+      "service:shell": [ "shell:client_process" ]
+    }
+  }
+}
diff --git a/services/shell/tests/shell/shell_unittest.cc b/services/service_manager/tests/shell/shell_unittest.cc
similarity index 89%
rename from services/shell/tests/shell/shell_unittest.cc
rename to services/service_manager/tests/shell/shell_unittest.cc
index ed820f9..6c2e76557 100644
--- a/services/shell/tests/shell/shell_unittest.cc
+++ b/services/service_manager/tests/shell/shell_unittest.cc
@@ -15,13 +15,13 @@
 #include "base/process/process_handle.h"
 #include "base/run_loop.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_test.h"
-#include "services/shell/public/interfaces/service_manager.mojom.h"
-#include "services/shell/tests/shell/shell_unittest.mojom.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_test.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
+#include "services/service_manager/tests/shell/shell_unittest.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 namespace {
 
@@ -53,12 +53,12 @@
   }
 
   // test::mojom::CreateInstanceTest:
-  void SetTargetIdentity(const shell::Identity& identity) override {
+  void SetTargetIdentity(const service_manager::Identity& identity) override {
     target_identity_ = identity;
     base::MessageLoop::current()->QuitWhenIdle();
   }
 
-  shell::Identity target_identity_;
+  service_manager::Identity target_identity_;
 
   mojo::Binding<test::mojom::CreateInstanceTest> binding_;
 
@@ -138,7 +138,7 @@
   void OnServiceCreated(mojom::ServiceInfoPtr instance) override {
     instances_.push_back(InstanceInfo(instance->identity));
   }
-  void OnServiceStarted(const shell::Identity& identity,
+  void OnServiceStarted(const service_manager::Identity& identity,
                         uint32_t pid) override {
     for (auto& instance : instances_) {
       if (instance.identity == identity) {
@@ -147,7 +147,7 @@
       }
     }
   }
-  void OnServiceStopped(const shell::Identity& identity) override {
+  void OnServiceStopped(const service_manager::Identity& identity) override {
     for (auto it = instances_.begin(); it != instances_.end(); ++it) {
       auto& instance = *it;
       if (instance.identity == identity) {
@@ -212,4 +212,4 @@
   base::RunLoop().Run();
 }
 
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/service_manager/tests/shell/shell_unittest.mojom b/services/service_manager/tests/shell/shell_unittest.mojom
new file mode 100644
index 0000000..31663743
--- /dev/null
+++ b/services/service_manager/tests/shell/shell_unittest.mojom
@@ -0,0 +1,15 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module service_manager.test.mojom;
+
+import "services/service_manager/public/interfaces/connector.mojom";
+
+interface CreateInstanceTest {
+  SetTargetIdentity(service_manager.mojom.Identity identity);
+};
+
+interface Driver {
+  QuitDriver();
+};
diff --git a/services/service_manager/tests/shell/shell_unittest_manifest.json b/services/service_manager/tests/shell/shell_unittest_manifest.json
new file mode 100644
index 0000000..7ca38a6
--- /dev/null
+++ b/services/service_manager/tests/shell/shell_unittest_manifest.json
@@ -0,0 +1,16 @@
+{
+  "manifest_version":  1,
+  "name": "service:shell_unittest",
+  "display_name": "Shell Unittest",
+  "capabilities": {
+    "provided": {
+      "shell_unittest:create_instance_test": [
+        "service_manager::test::mojom::CreateInstanceTest"
+      ]
+    },
+    "required": {
+      "service:shell": [ "shell:service_manager" ],
+      "exe:shell_unittest_driver": [ "shell_unittest:driver" ]
+    }
+  }
+}
diff --git a/services/service_manager/tests/shell/target.cc b/services/service_manager/tests/shell/target.cc
new file mode 100644
index 0000000..a263199
--- /dev/null
+++ b/services/service_manager/tests/shell/target.cc
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/at_exit.h"
+#include "base/command_line.h"
+#include "base/macros.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/runner/child/test_native_main.h"
+#include "services/service_manager/runner/init.h"
+#include "services/service_manager/tests/shell/shell_unittest.mojom.h"
+
+using service_manager::test::mojom::CreateInstanceTestPtr;
+
+namespace {
+
+class Target : public service_manager::Service {
+ public:
+  Target() {}
+  ~Target() override {}
+
+ private:
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override {
+    CreateInstanceTestPtr service;
+    connector()->ConnectToInterface("service:shell_unittest", &service);
+    service->SetTargetIdentity(identity);
+  }
+
+  DISALLOW_COPY_AND_ASSIGN(Target);
+};
+
+}  // namespace
+
+int main(int argc, char** argv) {
+  base::AtExitManager at_exit;
+  base::CommandLine::Init(argc, argv);
+
+  service_manager::InitializeLogging();
+
+  Target target;
+  return service_manager::TestNativeMain(&target);
+}
diff --git a/services/shell/tests/shell/target_manifest.json b/services/service_manager/tests/shell/target_manifest.json
similarity index 61%
rename from services/shell/tests/shell/target_manifest.json
rename to services/service_manager/tests/shell/target_manifest.json
index 5a46bba..11ad345 100644
--- a/services/shell/tests/shell/target_manifest.json
+++ b/services/service_manager/tests/shell/target_manifest.json
@@ -4,9 +4,7 @@
   "display_name": "Shell Unittest: Target",
   "capabilities": {
     "required": {
-      "service:shell_unittest": {
-        "classes": [ "shell_unittest:create_instance_test" ]
-      }
+      "service:shell_unittest": [ "shell_unittest:create_instance_test" ]
     }
   }
 }
diff --git a/services/shell/tests/shutdown/BUILD.gn b/services/service_manager/tests/shutdown/BUILD.gn
similarity index 73%
rename from services/shell/tests/shutdown/BUILD.gn
rename to services/service_manager/tests/shutdown/BUILD.gn
index 10a52d5..2440497 100644
--- a/services/shell/tests/shutdown/BUILD.gn
+++ b/services/service_manager/tests/shutdown/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//mojo/public/tools/bindings/mojom.gni")
 import("//testing/test.gni")
 
@@ -19,9 +19,9 @@
     ":shutdown_service",
     "//base",
     "//base/test:test_config",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
 
   data_deps = [
@@ -55,8 +55,8 @@
   deps = [
     ":interfaces",
     "//base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
   data_deps = [
     ":shutdown_service_manifest",
@@ -76,8 +76,8 @@
   deps = [
     ":interfaces",
     "//base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/interfaces",
   ]
   data_deps = [
     ":shutdown_client_manifest",
diff --git a/services/shell/tests/shutdown/OWNERS b/services/service_manager/tests/shutdown/OWNERS
similarity index 100%
rename from services/shell/tests/shutdown/OWNERS
rename to services/service_manager/tests/shutdown/OWNERS
diff --git a/services/shell/tests/shutdown/shutdown_client_app.cc b/services/service_manager/tests/shutdown/shutdown_client_app.cc
similarity index 75%
rename from services/shell/tests/shutdown/shutdown_client_app.cc
rename to services/service_manager/tests/shutdown/shutdown_client_app.cc
index 5da8801..b9c4087 100644
--- a/services/shell/tests/shutdown/shutdown_client_app.cc
+++ b/services/service_manager/tests/shutdown/shutdown_client_app.cc
@@ -5,15 +5,15 @@
 #include "base/macros.h"
 #include "base/run_loop.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/tests/shutdown/shutdown_unittest.mojom.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/tests/shutdown/shutdown_unittest.mojom.h"
 
-namespace shell {
+namespace service_manager {
 
 class ShutdownClientApp
     : public Service,
@@ -25,7 +25,7 @@
   ~ShutdownClientApp() override {}
 
  private:
-  // shell::Service:
+  // service_manager::Service:
   bool OnConnect(const Identity& remote_identity,
                  InterfaceRegistry* registry) override {
     registry->AddInterface<mojom::ShutdownTestClientController>(this);
@@ -64,10 +64,9 @@
   DISALLOW_COPY_AND_ASSIGN(ShutdownClientApp);
 };
 
-}  // namespace shell
-
+}  // namespace service_manager
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new shell::ShutdownClientApp);
+  service_manager::ServiceRunner runner(new service_manager::ShutdownClientApp);
   return runner.Run(service_request_handle);
 }
diff --git a/services/service_manager/tests/shutdown/shutdown_client_manifest.json b/services/service_manager/tests/shutdown/shutdown_client_manifest.json
new file mode 100644
index 0000000..320a15f
--- /dev/null
+++ b/services/service_manager/tests/shutdown/shutdown_client_manifest.json
@@ -0,0 +1,16 @@
+{
+  "manifest_version":  1,
+  "name": "service:shutdown_client",
+  "display_name": "Shutdown Client",
+  "capabilities": {
+    "provided": {
+      "shutdown_unittest:shutdown_test_client_controller": [
+        "service_manager::mojom::ShutdownTestClientController"
+      ]
+    },
+    "required": {
+      "service:shell": [ "shell:service_manager" ],
+      "service:shutdown_service": [ "shutdown_unittest:shutdown_test_service" ]
+    }
+  }
+}
diff --git a/services/shell/tests/shutdown/shutdown_service_app.cc b/services/service_manager/tests/shutdown/shutdown_service_app.cc
similarity index 66%
rename from services/shell/tests/shutdown/shutdown_service_app.cc
rename to services/service_manager/tests/shutdown/shutdown_service_app.cc
index 2aa562b..257f6d7 100644
--- a/services/shell/tests/shutdown/shutdown_service_app.cc
+++ b/services/service_manager/tests/shutdown/shutdown_service_app.cc
@@ -4,17 +4,17 @@
 
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/tests/shutdown/shutdown_unittest.mojom.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
+#include "services/service_manager/tests/shutdown/shutdown_unittest.mojom.h"
 
-namespace shell {
+namespace service_manager {
 namespace {
 
-shell::ServiceRunner* g_app = nullptr;
+service_manager::ServiceRunner* g_app = nullptr;
 
 class ShutdownServiceApp
     : public Service,
@@ -25,7 +25,7 @@
   ~ShutdownServiceApp() override {}
 
  private:
-  // shell::Service:
+  // service_manager::Service:
   bool OnConnect(const Identity& remote_identity,
                  InterfaceRegistry* registry) override {
     registry->AddInterface<mojom::ShutdownTestService>(this);
@@ -48,11 +48,11 @@
 };
 
 }  // namespace
-}  // namespace shell
-
+}  // namespace service_manager
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new shell::ShutdownServiceApp);
-  shell::g_app = &runner;
+  service_manager::ServiceRunner runner(
+      new service_manager::ShutdownServiceApp);
+  service_manager::g_app = &runner;
   return runner.Run(service_request_handle);
 }
diff --git a/services/shell/tests/shutdown/shutdown_service_manifest.json b/services/service_manager/tests/shutdown/shutdown_service_manifest.json
similarity index 68%
rename from services/shell/tests/shutdown/shutdown_service_manifest.json
rename to services/service_manager/tests/shutdown/shutdown_service_manifest.json
index 9a5d77d..d1af750 100644
--- a/services/shell/tests/shutdown/shutdown_service_manifest.json
+++ b/services/service_manager/tests/shutdown/shutdown_service_manifest.json
@@ -5,11 +5,11 @@
   "capabilities": {
     "provided": {
       "shutdown_unittest:shutdown_test_service": [
-        "shell::mojom::ShutdownTestService"
+        "service_manager::mojom::ShutdownTestService"
       ]
     },
     "required": {
-      "service:shell": { "classes": [ "shell:service_manager" ] }
+      "service:shell": [ "shell:service_manager" ]
     }
   }
 }
diff --git a/services/shell/tests/shutdown/shutdown_unittest.cc b/services/service_manager/tests/shutdown/shutdown_unittest.cc
similarity index 87%
rename from services/shell/tests/shutdown/shutdown_unittest.cc
rename to services/service_manager/tests/shutdown/shutdown_unittest.cc
index 7b51376..3fbe4e3 100644
--- a/services/shell/tests/shutdown/shutdown_unittest.cc
+++ b/services/service_manager/tests/shutdown/shutdown_unittest.cc
@@ -4,10 +4,10 @@
 
 #include "base/run_loop.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service_test.h"
-#include "services/shell/tests/shutdown/shutdown_unittest.mojom.h"
+#include "services/service_manager/public/cpp/service_test.h"
+#include "services/service_manager/tests/shutdown/shutdown_unittest.mojom.h"
 
-namespace shell {
+namespace service_manager {
 namespace {
 
 class ShutdownTest : public test::ServiceTest {
@@ -42,4 +42,4 @@
 }
 
 }  // namespace
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/tests/shutdown/shutdown_unittest.mojom b/services/service_manager/tests/shutdown/shutdown_unittest.mojom
similarity index 92%
rename from services/shell/tests/shutdown/shutdown_unittest.mojom
rename to services/service_manager/tests/shutdown/shutdown_unittest.mojom
index 003fdfcc..ac15b4d 100644
--- a/services/shell/tests/shutdown/shutdown_unittest.mojom
+++ b/services/service_manager/tests/shutdown/shutdown_unittest.mojom
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell.mojom;
+module service_manager.mojom;
 
 interface ShutdownTestService {
   SetClient(ShutdownTestClient client);
diff --git a/services/service_manager/tests/shutdown/shutdown_unittest_manifest.json b/services/service_manager/tests/shutdown/shutdown_unittest_manifest.json
new file mode 100644
index 0000000..44737d4d
--- /dev/null
+++ b/services/service_manager/tests/shutdown/shutdown_unittest_manifest.json
@@ -0,0 +1,14 @@
+{
+  "manifest_version":  1,
+  "name": "service:shutdown_unittest",
+  "display_name": "Shutdown Unittest",
+  "capabilities": {
+    "required": {
+      "service:shell": [ "shell:service_manager" ],
+      "service:shutdown_client": [
+        "shutdown_unittest:shutdown_test_client_controller"
+      ],
+      "service:shutdown_service": [ "shutdown_unittest:shutdown_test_service" ]
+    }
+  }
+}
diff --git a/services/shell/tests/test.mojom b/services/service_manager/tests/test.mojom
similarity index 93%
rename from services/shell/tests/test.mojom
rename to services/service_manager/tests/test.mojom
index f5a45a8..b77e2d84 100644
--- a/services/shell/tests/test.mojom
+++ b/services/service_manager/tests/test.mojom
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module shell;
+module service_manager;
 
 interface TestService {
   Test(string test_string) => ();
diff --git a/services/shell/tests/util.cc b/services/service_manager/tests/util.cc
similarity index 78%
rename from services/shell/tests/util.cc
rename to services/service_manager/tests/util.cc
index 8cdd71b..2e51df5 100644
--- a/services/shell/tests/util.cc
+++ b/services/service_manager/tests/util.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/tests/util.h"
+#include "services/service_manager/tests/util.h"
 
 #include "base/base_paths.h"
 #include "base/base_switches.h"
@@ -17,13 +17,13 @@
 #include "mojo/edk/embedder/embedder.h"
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
-#include "services/shell/runner/common/switches.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/service_factory.mojom.h"
+#include "services/service_manager/runner/common/switches.h"
 
-namespace shell {
+namespace service_manager {
 namespace test {
 
 namespace {
@@ -37,7 +37,7 @@
 std::unique_ptr<Connection> LaunchAndConnectToProcess(
     const std::string& target_exe_name,
     const Identity target,
-    shell::Connector* connector,
+    service_manager::Connector* connector,
     base::Process* process) {
   base::FilePath target_path;
   CHECK(base::PathService::Get(base::DIR_EXE, &target_path));
@@ -69,14 +69,15 @@
   mojo::ScopedMessagePipeHandle pipe =
       mojo::edk::CreateParentMessagePipe(primordial_pipe_token, child_token);
 
-  shell::mojom::ServicePtr client;
-  client.Bind(
-      mojo::InterfacePtrInfo<shell::mojom::Service>(std::move(pipe), 0u));
-  shell::mojom::PIDReceiverPtr receiver;
+  service_manager::mojom::ServicePtr client;
+  client.Bind(mojo::InterfacePtrInfo<service_manager::mojom::Service>(
+      std::move(pipe), 0u));
+  service_manager::mojom::PIDReceiverPtr receiver;
 
-  shell::Connector::ConnectParams params(target);
+  service_manager::Connector::ConnectParams params(target);
   params.set_client_process_connection(std::move(client), GetProxy(&receiver));
-  std::unique_ptr<shell::Connection> connection = connector->Connect(&params);
+  std::unique_ptr<service_manager::Connection> connection =
+      connector->Connect(&params);
   {
     base::RunLoop loop;
     connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop));
@@ -101,4 +102,4 @@
 }
 
 }  // namespace test
-}  // namespace shell
+}  // namespace service_manager
diff --git a/services/shell/tests/util.h b/services/service_manager/tests/util.h
similarity index 73%
rename from services/shell/tests/util.h
rename to services/service_manager/tests/util.h
index cad8831..1dfc565 100644
--- a/services/shell/tests/util.h
+++ b/services/service_manager/tests/util.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SERVICES_SHELL_TESTS_UTIL_H_
-#define SERVICES_SHELL_TESTS_UTIL_H_
+#ifndef SERVICES_SERVICE_MANAGER_TESTS_UTIL_H_
+#define SERVICES_SERVICE_MANAGER_TESTS_UTIL_H_
 
 #include <memory>
 #include <string>
@@ -12,7 +12,7 @@
 class Process;
 }
 
-namespace shell {
+namespace service_manager {
 class Connection;
 class Connector;
 class Identity;
@@ -25,10 +25,10 @@
 std::unique_ptr<Connection> LaunchAndConnectToProcess(
     const std::string& target_exe_name,
     const Identity target,
-    shell::Connector* connector,
+    service_manager::Connector* connector,
     base::Process* process);
 
 }  // namespace test
-}  // namespace shell
+}  // namespace service_manager
 
-#endif  // SERVICES_SHELL_TESTS_UTIL_H_
+#endif  // SERVICES_SERVICE_MANAGER_TESTS_UTIL_H_
diff --git a/services/shell/background/BUILD.gn b/services/shell/background/BUILD.gn
deleted file mode 100644
index 067f6eb..0000000
--- a/services/shell/background/BUILD.gn
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-group("background") {
-  testonly = true
-  deps = [
-    ":lib",
-    ":main",
-  ]
-}
-
-source_set("lib") {
-  sources = [
-    "background_shell.cc",
-    "background_shell.h",
-  ]
-  deps = [
-    "//base",
-    "//services/catalog:lib",
-    "//services/shell",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/runner:init",
-    "//services/shell/standalone:lib",
-  ]
-}
-
-source_set("main") {
-  sources = [
-    "background_shell_main.cc",
-    "background_shell_main.h",
-  ]
-  deps = [
-    "//base",
-    "//services/shell",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/runner:init",
-    "//services/shell/runner/common",
-    "//services/shell/runner/host:lib",
-    "//services/shell/standalone:lib",
-  ]
-}
diff --git a/services/shell/background/tests/BUILD.gn b/services/shell/background/tests/BUILD.gn
deleted file mode 100644
index 0374b795..0000000
--- a/services/shell/background/tests/BUILD.gn
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//services/shell/public/cpp/service.gni")
-import("//mojo/public/tools/bindings/mojom.gni")
-import("//testing/test.gni")
-
-static_library("test_support") {
-  sources = [
-    "test_catalog_store.cc",
-    "test_catalog_store.h",
-  ]
-
-  deps = [
-    "//base",
-    "//services/catalog:lib",
-    "//url",
-  ]
-}
-
-source_set("unittests") {
-  testonly = true
-  sources = [
-    "background_shell_unittest.cc",
-  ]
-
-  deps = [
-    ":test_app_bindings",
-    ":test_support",
-    "//base",
-    "//services/shell/background:lib",
-    "//services/shell/background:main",
-    "//services/shell/public/cpp:sources",
-    "//testing/gtest",
-    "//url",
-  ]
-
-  data_deps = [
-    ":test_app",
-  ]
-}
-
-mojom("test_app_bindings") {
-  sources = [
-    "test.mojom",
-  ]
-
-  use_new_wrapper_types = false
-}
-
-service("test_app") {
-  output_name = "background_shell_test_app"
-
-  sources = [
-    "test_service.cc",
-  ]
-
-  deps = [
-    ":test_app_bindings",
-    "//base",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
-  ]
-}
diff --git a/services/shell/background/tests/background_shell_unittest.cc b/services/shell/background/tests/background_shell_unittest.cc
deleted file mode 100644
index 5b9f9ec..0000000
--- a/services/shell/background/tests/background_shell_unittest.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "services/shell/background/background_shell.h"
-
-#include <memory>
-
-#include "base/memory/ptr_util.h"
-#include "base/run_loop.h"
-#include "services/shell/background/tests/test.mojom.h"
-#include "services/shell/background/tests/test_catalog_store.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace shell {
-namespace {
-
-const char kTestName[] = "service:test-app";
-
-class ServiceImpl : public Service {
- public:
-  ServiceImpl() {}
-  ~ServiceImpl() override {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ServiceImpl);
-};
-
-std::unique_ptr<TestCatalogStore> BuildTestCatalogStore() {
-  std::unique_ptr<base::ListValue> apps(new base::ListValue);
-  apps->Append(BuildPermissiveSerializedAppInfo(kTestName, "test"));
-  return base::MakeUnique<TestCatalogStore>(std::move(apps));
-}
-
-void SetFlagAndRunClosure(bool* flag, const base::Closure& closure) {
-  *flag = true;
-  closure.Run();
-}
-
-}  // namespace
-
-// Uses BackgroundShell to start the shell in the background and connects to
-// background_shell_test_app, verifying we can send a message to the app.
-// An ApplicationCatalogStore is supplied to avoid using a manifest.
-#if defined(OS_ANDROID)
-// TODO(crbug.com/589784): This test is disabled, as it fails
-// on the Android GN bot.
-#define MAYBE_Basic DISABLED_Basic
-#else
-#define MAYBE_Basic Basic
-#endif
-TEST(BackgroundShellTest, MAYBE_Basic) {
-  base::MessageLoop message_loop;
-  BackgroundShell background_shell;
-  std::unique_ptr<BackgroundShell::InitParams> init_params(
-      new BackgroundShell::InitParams);
-  std::unique_ptr<TestCatalogStore> store_ptr = BuildTestCatalogStore();
-  TestCatalogStore* store = store_ptr.get();
-  init_params->catalog_store = std::move(store_ptr);
-  background_shell.Init(std::move(init_params));
-  ServiceImpl service;
-  ServiceContext service_context(
-      &service, background_shell.CreateServiceRequest(kTestName));
-  mojom::TestServicePtr test_service;
-  service_context.connector()->ConnectToInterface(
-      "service:background_shell_test_app", &test_service);
-  base::RunLoop run_loop;
-  bool got_result = false;
-  test_service->Test(base::Bind(&SetFlagAndRunClosure, &got_result,
-                                run_loop.QuitClosure()));
-  run_loop.Run();
-  EXPECT_TRUE(got_result);
-  EXPECT_TRUE(store->get_store_called());
-}
-
-}  // namespace shell
diff --git a/services/shell/background/tests/test_catalog_store.cc b/services/shell/background/tests/test_catalog_store.cc
deleted file mode 100644
index 57b450f4..0000000
--- a/services/shell/background/tests/test_catalog_store.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "services/shell/background/tests/test_catalog_store.h"
-
-using catalog::Store;
-
-namespace shell {
-
-TestCatalogStore::TestCatalogStore(std::unique_ptr<base::ListValue> store)
-    : store_(std::move(store)) {}
-
-TestCatalogStore::~TestCatalogStore() {}
-
-const base::ListValue* TestCatalogStore::GetStore() {
-  get_store_called_ = true;
-  return store_.get();
-}
-
-void TestCatalogStore::UpdateStore(std::unique_ptr<base::ListValue> store) {}
-
-std::unique_ptr<base::DictionaryValue> BuildPermissiveSerializedAppInfo(
-    const std::string& name,
-    const std::string& display_name) {
-  std::unique_ptr<base::DictionaryValue> app(new base::DictionaryValue);
-  app->SetString(Store::kNameKey, name);
-  app->SetString(Store::kDisplayNameKey, display_name);
-  app->SetInteger(Store::kManifestVersionKey, 1);
-
-  std::unique_ptr<base::DictionaryValue> capabilities(
-      new base::DictionaryValue);
-  std::unique_ptr<base::DictionaryValue> required_capabilities(
-      new base::DictionaryValue);
-  std::unique_ptr<base::DictionaryValue> interfaces_dictionary(
-      new base::DictionaryValue);
-  std::unique_ptr<base::ListValue> interfaces_list(new base::ListValue);
-  interfaces_list->AppendString("shell::mojom::TestService");
-  interfaces_dictionary->Set("interfaces", std::move(interfaces_list));
-  required_capabilities->Set("*", std::move(interfaces_dictionary));
-  capabilities->Set(Store::kCapabilities_RequiredKey,
-                    std::move(required_capabilities));
-  app->Set(Store::kCapabilitiesKey, std::move(capabilities));
-  return app;
-}
-
-}  // namespace shell
diff --git a/services/shell/public/cpp/capabilities.h b/services/shell/public/cpp/capabilities.h
deleted file mode 100644
index e02c44f..0000000
--- a/services/shell/public/cpp/capabilities.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SERVICES_SHELL_PUBLIC_CPP_CAPABILITIES_H_
-#define SERVICES_SHELL_PUBLIC_CPP_CAPABILITIES_H_
-
-#include <map>
-#include <set>
-#include <string>
-
-namespace shell {
-
-using Class = std::string;
-using Classes = std::set<std::string>;
-using Interface = std::string;
-using Interfaces = std::set<std::string>;
-using Name = std::string;
-
-// See comments in services/shell/public/interfaces/capabilities.mojom for a
-// description of CapabilityRequest and CapabilitySpec.
-
-struct CapabilityRequest {
-  CapabilityRequest();
-  CapabilityRequest(const CapabilityRequest& other);
-  ~CapabilityRequest();
-  bool operator==(const CapabilityRequest& other) const;
-  bool operator<(const CapabilityRequest& other) const;
-  Classes classes;
-  Interfaces interfaces;
-};
-
-struct CapabilitySpec {
-  CapabilitySpec();
-  CapabilitySpec(const CapabilitySpec& other);
-  ~CapabilitySpec();
-  bool operator==(const CapabilitySpec& other) const;
-  bool operator<(const CapabilitySpec& other) const;
-  std::map<Class, Interfaces> provided;
-  std::map<Name, CapabilityRequest> required;
-};
-
-}  // namespace shell
-
-#endif  // SERVICES_SHELL_PUBLIC_CPP_CAPABILITIES_H_
diff --git a/services/shell/public/cpp/capabilities.typemap b/services/shell/public/cpp/capabilities.typemap
deleted file mode 100644
index 95ddd90e..0000000
--- a/services/shell/public/cpp/capabilities.typemap
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-mojom = "//services/shell/public/interfaces/capabilities.mojom"
-public_headers = [ "//services/shell/public/cpp/capabilities.h" ]
-traits_headers = [ "//services/shell/public/cpp/capabilities_struct_traits.h" ]
-
-type_mappings = [
-  "shell.mojom.CapabilityRequest=::shell::CapabilityRequest",
-  "shell.mojom.CapabilitySpec=::shell::CapabilitySpec",
-]
diff --git a/services/shell/public/cpp/capabilities_struct_traits.h b/services/shell/public/cpp/capabilities_struct_traits.h
deleted file mode 100644
index 14ce68b..0000000
--- a/services/shell/public/cpp/capabilities_struct_traits.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SERVICES_SHELL_PUBLIC_CPP_CAPABILITIES_STRUCT_TRAITS_H_
-#define SERVICES_SHELL_PUBLIC_CPP_CAPABILITIES_STRUCT_TRAITS_H_
-
-#include "services/shell/public/cpp/capabilities.h"
-#include "services/shell/public/interfaces/capabilities.mojom.h"
-
-namespace mojo {
-
-template <>
-struct StructTraits<shell::mojom::CapabilityRequest::DataView,
-                    shell::CapabilityRequest> {
-  static const shell::Classes& classes(
-      const shell::CapabilityRequest& request) {
-    return request.classes;
-  }
-  static const shell::Interfaces& interfaces(
-      const shell::CapabilityRequest& request) {
-    return request.interfaces;
-  }
-  static bool Read(shell::mojom::CapabilityRequestDataView data,
-                   shell::CapabilityRequest* out) {
-    ArrayDataView<StringDataView> classes_data_view;
-    data.GetClassesDataView(&classes_data_view);
-    for (size_t i = 0; i < classes_data_view.size(); ++i) {
-      std::string clazz;
-      if (!classes_data_view.Read(i, &clazz))
-        return false;
-      out->classes.insert(std::move(clazz));
-    }
-
-    ArrayDataView<StringDataView> interfaces_data_view;
-    data.GetInterfacesDataView(&interfaces_data_view);
-    for (size_t i = 0; i < interfaces_data_view.size(); ++i) {
-      std::string interface_name;
-      if (!interfaces_data_view.Read(i, &interface_name))
-        return false;
-      out->interfaces.insert(std::move(interface_name));
-    }
-    return true;
-  }
-};
-
-template <>
-struct StructTraits<shell::mojom::CapabilitySpec::DataView,
-                    shell::CapabilitySpec> {
-  static const std::map<shell::Class, shell::Interfaces>& provided(
-      const shell::CapabilitySpec& spec) {
-    return spec.provided;
-  }
-  static const std::map<shell::Name, shell::CapabilityRequest>& required(
-      const shell::CapabilitySpec& spec) {
-    return spec.required;
-  }
-  static bool Read(shell::mojom::CapabilitySpecDataView data,
-                   shell::CapabilitySpec* out) {
-    MapDataView<StringDataView, ArrayDataView<StringDataView>>
-        provided_data_view;
-    data.GetProvidedDataView(&provided_data_view);
-
-    for (size_t i = 0; i < provided_data_view.keys().size(); ++i) {
-      std::string clazz;
-      if (!provided_data_view.keys().Read(i, &clazz))
-        return false;
-
-      std::vector<std::string> interfaces_vec;
-      if (!provided_data_view.values().Read(i, &interfaces_vec))
-        return false;
-      std::set<std::string> interfaces;
-      for (const auto& interface_name : interfaces_vec)
-        interfaces.insert(interface_name);
-
-      out->provided[clazz] = std::move(interfaces);
-    }
-
-    return data.ReadRequired(&out->required);
-  }
-};
-
-}  // namespace mojo
-
-#endif  // SERVICES_SHELL_PUBLIC_CPP_CAPABILITIES_STRUCT_TRAITS_H_
diff --git a/services/shell/public/cpp/identity.typemap b/services/shell/public/cpp/identity.typemap
deleted file mode 100644
index dd5c0d8..0000000
--- a/services/shell/public/cpp/identity.typemap
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-mojom = "//services/shell/public/interfaces/connector.mojom"
-public_headers = [ "//services/shell/public/cpp/identity.h" ]
-traits_headers = [ "//services/shell/public/cpp/identity_struct_traits.h" ]
-
-type_mappings = [ "shell.mojom.Identity=::shell::Identity" ]
diff --git a/services/shell/public/cpp/identity_struct_traits.h b/services/shell/public/cpp/identity_struct_traits.h
deleted file mode 100644
index 46d9d58..0000000
--- a/services/shell/public/cpp/identity_struct_traits.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SERVICES_SHELL_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
-#define SERVICES_SHELL_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
-
-#include "services/shell/public/cpp/identity.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-
-namespace mojo {
-
-template <>
-struct StructTraits<shell::mojom::IdentityDataView, shell::Identity> {
-  static const std::string& name(const shell::Identity& identity) {
-    return identity.name();
-  }
-  static const std::string& user_id(const shell::Identity& identity) {
-    return identity.user_id();
-  }
-  static const std::string& instance(const shell::Identity& identity) {
-    return identity.instance();
-  }
-  static bool Read(shell::mojom::IdentityDataView data, shell::Identity* out) {
-    std::string name, user_id, instance;
-    if (!data.ReadName(&name))
-      return false;
-
-    if (!data.ReadUserId(&user_id))
-      return false;
-
-    if (!data.ReadInstance(&instance))
-      return false;
-
-    *out = shell::Identity(name, user_id, instance);
-    return true;
-  }
-};
-
-}  // namespace mojo
-
-#endif  // SERVICES_SHELL_PUBLIC_CPP_IDENTITY_STRUCT_TRAITS_H_
diff --git a/services/shell/public/cpp/lib/capabilities.cc b/services/shell/public/cpp/lib/capabilities.cc
deleted file mode 100644
index 620feded..0000000
--- a/services/shell/public/cpp/lib/capabilities.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "services/shell/public/cpp/capabilities.h"
-
-#include <tuple>
-
-namespace shell {
-
-CapabilityRequest::CapabilityRequest() {}
-CapabilityRequest::CapabilityRequest(const CapabilityRequest& other) = default;
-CapabilityRequest::~CapabilityRequest() {}
-
-bool CapabilityRequest::operator==(const CapabilityRequest& other) const {
-  return other.classes == classes && other.interfaces == interfaces;
-}
-
-bool CapabilityRequest::operator<(const CapabilityRequest& other) const {
-  return std::tie(classes, interfaces) <
-      std::tie(other.classes, other.interfaces);
-}
-
-CapabilitySpec::CapabilitySpec() {}
-CapabilitySpec::CapabilitySpec(const CapabilitySpec& other) = default;
-CapabilitySpec::~CapabilitySpec() {}
-
-bool CapabilitySpec::operator==(const CapabilitySpec& other) const {
-  return other.provided == provided && other.required == required;
-}
-
-bool CapabilitySpec::operator<(const CapabilitySpec& other) const {
-  return std::tie(provided, required) <
-      std::tie(other.provided, other.required);
-}
-
-}  // namespace shell
diff --git a/services/shell/public/cpp/typemaps.gni b/services/shell/public/cpp/typemaps.gni
deleted file mode 100644
index 3bc708c..0000000
--- a/services/shell/public/cpp/typemaps.gni
+++ /dev/null
@@ -1,4 +0,0 @@
-typemaps = [
-  "//services/shell/public/cpp/capabilities.typemap",
-  "//services/shell/public/cpp/identity.typemap",
-]
diff --git a/services/shell/public/interfaces/capabilities.mojom b/services/shell/public/interfaces/capabilities.mojom
deleted file mode 100644
index 1878f22..0000000
--- a/services/shell/public/interfaces/capabilities.mojom
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module shell.mojom;
-
-// Capabilities ----------------------------------------------------------------
-//
-// Services expose interfaces and capability classes to one another.
-//
-// An interface is just a Mojo interface, defined in a mojom file like this one.
-// In a CapabilitySpec, an interface is represented by its fully qualified name,
-// which is serialized based on the interface name and module:
-// module::path::InterfaceName.
-//
-// A class is an alias to something, either a set of interface names granted
-// with that class, or some behavior specific to the application that provides
-// it.
-
-// Describes the set of classes and interfaces required by an application.
-// Note that there may be overlap between the interfaces implied by the
-// resolution of classes and those specified in |interfaces|. The set of
-// interfaces granted to the requestor is the union of these sets.
-struct CapabilityRequest {
-  // An array of class names required.
-  array<string> classes;
-  // An array of interface names required.
-  array<string> interfaces;
-};
-
-// Describes the capabilities offered and requested by an application.
-// This struct is populated from the application manifest.
-struct CapabilitySpec {
-  // The classes offered by this application, and for each class an array of
-  // interfaces. If no interfaces are granted with a class, the array will be
-  // empty.
-  // A map of class name -> array of interfaces. The array can be empty,
-  // non-empty, or ["*"], which means allow access to all interfaces.
-  map<string, array<string>> provided;
-
-  // The applications this application needs to speak to, and the classes and
-  // interfaces it requests.
-  // A map of application name -> spec. "*" is also supported as the key, which
-  // supplies a CapabilityRequest for all applications in addition to specific
-  // ones specified.
-  map<string, CapabilityRequest> required;
-};
diff --git a/services/shell/public/java/BUILD.gn b/services/shell/public/java/BUILD.gn
deleted file mode 100644
index c5066c7..0000000
--- a/services/shell/public/java/BUILD.gn
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//build/config/android/rules.gni")
-
-android_library("shell_java") {
-  java_files = [
-    "src/org/chromium/services/shell/InterfaceFactory.java",
-    "src/org/chromium/services/shell/InterfaceRegistry.java",
-  ]
-  deps = [
-    "//base:base_java",
-    "//mojo/public/java:bindings",
-    "//mojo/public/java:system",
-    "//services/shell/public/interfaces:interfaces_java",
-  ]
-}
diff --git a/services/shell/runner/child/test_native_main.h b/services/shell/runner/child/test_native_main.h
deleted file mode 100644
index b1f7f20..0000000
--- a/services/shell/runner/child/test_native_main.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SERVICES_SHELL_RUNNER_CHILD_TEST_NATIVE_MAIN_H_
-#define SERVICES_SHELL_RUNNER_CHILD_TEST_NATIVE_MAIN_H_
-
-namespace shell {
-
-class Service;
-
-int TestNativeMain(Service* service);
-
-}  // namespace shell
-
-#endif  // SERVICES_SHELL_RUNNER_CHILD_TEST_NATIVE_MAIN_H_
diff --git a/services/shell/runner/host/child_process.h b/services/shell/runner/host/child_process.h
deleted file mode 100644
index 1f70c007..0000000
--- a/services/shell/runner/host/child_process.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_H_
-#define SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_H_
-
-namespace shell {
-
-// Main method for a child process.
-int ChildProcessMain();
-
-}  // namespace shell
-
-#endif  // SERVICES_SHELL_RUNNER_HOST_CHILD_PROCESS_H_
diff --git a/services/shell/tests/BUILD.gn b/services/shell/tests/BUILD.gn
deleted file mode 100644
index 3c05b8e..0000000
--- a/services/shell/tests/BUILD.gn
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//services/shell/public/cpp/service.gni")
-import("//mojo/public/tools/bindings/mojom.gni")
-import("//testing/test.gni")
-
-group("tests") {
-  testonly = true
-  deps = [
-    ":mojo_shell_unittests",
-  ]
-}
-
-test("mojo_shell_unittests") {
-  deps = [
-    ":interfaces",
-    "//base",
-    "//base/test:test_support",
-    "//mojo/public/cpp/bindings",
-    "//mojo/public/cpp/system",
-    "//services/catalog:unittests",
-    "//services/shell",
-    "//services/shell/background:lib",
-    "//services/shell/background:main",
-    "//services/shell/background/tests:unittests",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp/test:run_all_shelltests",
-    "//services/shell/public/interfaces",
-    "//services/shell/tests/connect",
-    "//services/shell/tests/lifecycle",
-    "//services/shell/tests/shell",
-    "//services/shell/tests/shutdown",
-    "//testing/gtest",
-  ]
-}
-
-mojom("interfaces") {
-  sources = [
-    "test.mojom",
-  ]
-
-  use_new_wrapper_types = false
-}
-
-source_set("util") {
-  sources = [
-    "util.cc",
-    "util.h",
-  ]
-  deps = [
-    "//base",
-    "//base:base_static",
-    "//mojo/edk/system",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/interfaces",
-    "//services/shell/runner/common",
-  ]
-}
diff --git a/services/shell/tests/connect/connect_test_app_a_manifest.json b/services/shell/tests/connect/connect_test_app_a_manifest.json
deleted file mode 100644
index dbbcd4e7..0000000
--- a/services/shell/tests/connect/connect_test_app_a_manifest.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-  "manifest_version": 1,
-  "name": "service:connect_test_a",
-  "display_name": "Connect Test A",
-  "capabilities": {
-    "provided": {
-      "connect_unittests:connect_test_service": [
-        "shell::test::mojom::ConnectTestService"
-      ],
-      "connect_unittests:standalone_app": [
-        "shell::test::mojom::StandaloneApp"
-      ],
-      "connect_unittests:user_id_test": [ "shell::test::mojom::UserIdTest" ]
-    },
-    "required": {
-      "service:connect_unittests": {
-        "classes": [ "connect_unittests:exposed_interface" ]
-      },
-      "service:connect_test_class_app": {
-        "classes": [ "connect_unittests:class" ]
-      }
-    }
-  }
-}
diff --git a/services/shell/tests/connect/connect_test_app_manifest.json b/services/shell/tests/connect/connect_test_app_manifest.json
deleted file mode 100644
index 0235810..0000000
--- a/services/shell/tests/connect/connect_test_app_manifest.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-  "manifest_version": 1,
-  "name": "service:connect_test_app",
-  "display_name": "Connect Test App",
-  "capabilities": {
-    "provided": {
-      "connect_unittests:connect_test_service": [
-        "shell::test::mojom::ConnectTestService"
-      ],
-      "connect_unittests:standalone_app": [
-        "shell::test::mojom::StandaloneApp"
-      ],
-      "connect_unittests:user_id_test": [ "shell::test::mojom::UserIdTest" ]
-    },
-    "required": {
-      "service:connect_unittests": {
-        "classes": [ "connect_unittests:exposed_interface" ]
-      },
-      "service:connect_test_a": {
-        "classes": [ "connect_unittests:connect_test_service" ]
-      },
-      "service:connect_test_class_app": {
-        "classes": [
-          "connect_unittests:class",
-          "connect_unittests:connect_test_service"
-        ]
-      },
-      "service:shell": { "classes": [ "shell:user_id" ] }
-    }
-  }
-}
diff --git a/services/shell/tests/connect/connect_test_class_app_manifest.json b/services/shell/tests/connect/connect_test_class_app_manifest.json
deleted file mode 100644
index 95e3484b..0000000
--- a/services/shell/tests/connect/connect_test_class_app_manifest.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "manifest_version": 1,
-  "name": "service:connect_test_class_app",
-  "display_name": "Connect Test Class App",
-  "capabilities": {
-    "provided": {
-      "connect_unittests:class": [ "shell::test::mojom::ClassInterface" ],
-      "connect_unittests:connect_test_service": [
-        "shell::test::mojom::ConnectTestService"
-      ]
-    },
-    "required": {
-      "service:shell": { "classes":  [ "shell:explicit_class" ] }
-    }
-  }
-}
diff --git a/services/shell/tests/connect/connect_test_driver.cc b/services/shell/tests/connect/connect_test_driver.cc
deleted file mode 100644
index 17ecdbb..0000000
--- a/services/shell/tests/connect/connect_test_driver.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <memory>
-
-#include "base/at_exit.h"
-#include "base/command_line.h"
-#include "base/macros.h"
-#include "base/process/process.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/runner/child/test_native_main.h"
-#include "services/shell/runner/init.h"
-#include "services/shell/tests/connect/connect_test.mojom.h"
-#include "services/shell/tests/util.h"
-
-using shell::test::mojom::ClientProcessTest;
-using shell::test::mojom::ClientProcessTestRequest;
-
-namespace {
-
-class Driver : public shell::Service,
-               public shell::InterfaceFactory<ClientProcessTest>,
-               public ClientProcessTest {
- public:
-  Driver() {}
-  ~Driver() override {}
-
- private:
-  // shell::Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-    shell::InterfaceRegistry* registry) override {
-    registry->AddInterface<ClientProcessTest>(this);
-    return true;
-  }
-  bool OnStop() override {
-    // TODO(rockot): http://crbug.com/596621. Should be able to remove this
-    // override entirely.
-    _exit(1);
-  }
-
-  // shell::InterfaceFactory<ConnectTestService>:
-  void Create(const shell::Identity& remote_identity,
-              ClientProcessTestRequest request) override {
-    bindings_.AddBinding(this, std::move(request));
-  }
-
-  // test::mojom::ClientProcessTest:
-  void LaunchAndConnectToProcess(
-      const LaunchAndConnectToProcessCallback& callback) override {
-    base::Process process;
-    std::unique_ptr<shell::Connection> connection =
-        shell::test::LaunchAndConnectToProcess(
-#if defined(OS_WIN)
-            "connect_test_exe.exe",
-#else
-            "connect_test_exe",
-#endif
-            shell::Identity("exe:connect_test_exe",
-                            shell::mojom::kInheritUserID),
-            connector(), &process);
-    callback.Run(static_cast<int32_t>(connection->GetResult()),
-                 connection->GetRemoteIdentity());
-  }
-
-  mojo::BindingSet<ClientProcessTest> bindings_;
-
-  DISALLOW_COPY_AND_ASSIGN(Driver);
-};
-
-}  // namespace
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-
-  shell::InitializeLogging();
-
-  Driver driver;
-  return shell::TestNativeMain(&driver);
-}
diff --git a/services/shell/tests/connect/connect_test_exe.cc b/services/shell/tests/connect/connect_test_exe.cc
deleted file mode 100644
index 7060c8d1..0000000
--- a/services/shell/tests/connect/connect_test_exe.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/at_exit.h"
-#include "base/command_line.h"
-#include "base/macros.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/runner/child/test_native_main.h"
-#include "services/shell/runner/init.h"
-#include "services/shell/tests/connect/connect_test.mojom.h"
-
-using shell::test::mojom::ConnectTestService;
-using shell::test::mojom::ConnectTestServiceRequest;
-
-namespace {
-
-class Target : public shell::Service,
-               public shell::InterfaceFactory<ConnectTestService>,
-               public ConnectTestService {
- public:
-  Target() {}
-  ~Target() override {}
-
- private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override {
-    identity_ = identity;
-  }
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
-    registry->AddInterface<ConnectTestService>(this);
-    return true;
-  }
-
-  // shell::InterfaceFactory<ConnectTestService>:
-  void Create(const shell::Identity& remote_identity,
-              ConnectTestServiceRequest request) override {
-    bindings_.AddBinding(this, std::move(request));
-  }
-
-  // ConnectTestService:
-  void GetTitle(const GetTitleCallback& callback) override {
-    callback.Run("connect_test_exe");
-  }
-  void GetInstance(const GetInstanceCallback& callback) override {
-    callback.Run(identity_.instance());
-  }
-
-  shell::Identity identity_;
-  mojo::BindingSet<ConnectTestService> bindings_;
-
-  DISALLOW_COPY_AND_ASSIGN(Target);
-};
-
-}  // namespace
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-
-  shell::InitializeLogging();
-
-  Target target;
-  return shell::TestNativeMain(&target);
-}
diff --git a/services/shell/tests/connect/connect_unittests_manifest.json b/services/shell/tests/connect/connect_unittests_manifest.json
deleted file mode 100644
index 53412a51a..0000000
--- a/services/shell/tests/connect/connect_unittests_manifest.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
-  "manifest_version": 1,
-  "name": "service:connect_unittests",
-  "display_name": "Connect Unittests",
-  "capabilities": {
-    "provided": {
-      "connect_unittests:exposed_interface": [
-        "shell::test::mojom::ExposedInterface"
-      ]
-    },
-    "required": {
-      "service:connect_test_package": {
-        "classes": [ "connect_unittests:connect_test_service" ]
-      },
-      "service:connect_test_app": {
-        "classes": [
-          "connect_unittests:connect_test_service",
-          "connect_unittests:standalone_app",
-          "connect_unittests:user_id_test"
-        ]
-      },
-      "exe:connect_test_driver": {
-        "classes": [ "connect_unittests:client_process_test" ]
-      },
-      "service:connect_test_a": {
-        "classes": [
-          "connect_unittests:connect_test_service",
-          "connect_unittests:standalone_app",
-          "connect_unittests:user_id_test"
-        ]
-      },
-      "service:shell": { "classes": [ "shell:instance_name", "shell:user_id" ] }
-    }
-  }
-}
diff --git a/services/shell/tests/lifecycle/app.cc b/services/shell/tests/lifecycle/app.cc
deleted file mode 100644
index 2b981922..0000000
--- a/services/shell/tests/lifecycle/app.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/tests/lifecycle/app_client.h"
-
-MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::test::AppClient* app = new shell::test::AppClient;
-  shell::ServiceRunner runner(app);
-  app->set_runner(&runner);
-  return runner.Run(service_request_handle);
-}
diff --git a/services/shell/tests/lifecycle/lifecycle_exe.cc b/services/shell/tests/lifecycle/lifecycle_exe.cc
deleted file mode 100644
index 2a1e5b4..0000000
--- a/services/shell/tests/lifecycle/lifecycle_exe.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/at_exit.h"
-#include "base/command_line.h"
-#include "base/macros.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/runner/child/test_native_main.h"
-#include "services/shell/runner/init.h"
-#include "services/shell/tests/lifecycle/app_client.h"
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-
-  shell::InitializeLogging();
-
-  shell::test::AppClient client;
-  return shell::TestNativeMain(&client);
-}
diff --git a/services/shell/tests/lifecycle/lifecycle_unittest_manifest.json b/services/shell/tests/lifecycle/lifecycle_unittest_manifest.json
deleted file mode 100644
index 275955a7..0000000
--- a/services/shell/tests/lifecycle/lifecycle_unittest_manifest.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-  "manifest_version": 1,
-  "name": "service:lifecycle_unittest",
-  "display_name": "Lifecycle Unittest",
-  "capabilities": {
-    "required": {
-      "*": {
-        "classes": [ "lifecycle_unittest:lifecycle_control" ]
-      },
-      "service:lifecycle_unittest_parent": {
-        "classes":  [ "lifecycle_unittest:parent" ]
-      },
-      "service:shell": {
-        "classes": [
-          "shell:service_manager",
-          "shell:instance_name",
-          "shell:client_process"
-        ]
-      }
-    }
-  }
-}
diff --git a/services/shell/tests/lifecycle/package.cc b/services/shell/tests/lifecycle/package.cc
deleted file mode 100644
index c2a0335..0000000
--- a/services/shell/tests/lifecycle/package.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <algorithm>
-#include <memory>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/public/interfaces/service_factory.mojom.h"
-#include "services/shell/tests/lifecycle/app_client.h"
-#include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h"
-
-namespace {
-
-class PackagedApp : public shell::Service,
-                    public shell::InterfaceFactory<LifecycleControl>,
-                    public LifecycleControl {
- public:
-  using DestructCallback = base::Callback<void(PackagedApp*)>;
-
-  PackagedApp(shell::mojom::ServiceRequest request,
-              const DestructCallback& shell_connection_closed_callback,
-              const DestructCallback& destruct_callback)
-      : connection_(new shell::ServiceContext(this, std::move(request))),
-        shell_connection_closed_callback_(shell_connection_closed_callback),
-        destruct_callback_(destruct_callback) {
-    bindings_.set_connection_error_handler(base::Bind(&PackagedApp::BindingLost,
-                                                      base::Unretained(this)));
-  }
-  ~PackagedApp() override {
-    destruct_callback_.Run(this);
-  }
-
- private:
-  // shell::Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
-    registry->AddInterface<LifecycleControl>(this);
-    return true;
-  }
-
-  // shell::InterfaceFactory<LifecycleControl>
-  void Create(const shell::Identity& remote_identity,
-              LifecycleControlRequest request) override {
-    bindings_.AddBinding(this, std::move(request));
-  }
-
-  // LifecycleControl:
-  void Ping(const PingCallback& callback) override {
-    callback.Run();
-  }
-  void GracefulQuit() override {
-    shell_connection_closed_callback_.Run(this);
-    delete this;
-    // This will have closed all |bindings_|.
-  }
-  void Crash() override {
-    // When multiple instances are vended from the same package instance, this
-    // will cause all instances to be quit.
-    exit(1);
-  }
-  void CloseShellConnection() override {
-    shell_connection_closed_callback_.Run(this);
-    connection_.reset();
-    // This only closed our relationship with the shell, existing |bindings_|
-    // remain active.
-  }
-
-  void BindingLost() {
-    if (bindings_.empty())
-      delete this;
-  }
-
-  std::unique_ptr<shell::ServiceContext> connection_;
-  mojo::BindingSet<LifecycleControl> bindings_;
-  // Run when this object's connection to the shell is closed.
-  DestructCallback shell_connection_closed_callback_;
-  // Run when this object is destructed.
-  DestructCallback destruct_callback_;
-
-  DISALLOW_COPY_AND_ASSIGN(PackagedApp);
-};
-
-class Package
-    : public shell::Service,
-      public shell::InterfaceFactory<shell::mojom::ServiceFactory>,
-      public shell::mojom::ServiceFactory {
- public:
-  Package() {}
-  ~Package() override {}
-
-  void set_runner(shell::ServiceRunner* runner) {
-    app_client_.set_runner(runner);
-  }
-
- private:
-  // shell::test::AppClient:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
-    registry->AddInterface<shell::mojom::ServiceFactory>(this);
-    return app_client_.OnConnect(remote_identity, registry);
-  }
-
-  // shell::InterfaceFactory<shell::mojom::ServiceFactory>:
-  void Create(const shell::Identity& remote_identity,
-              shell::mojom::ServiceFactoryRequest request) override {
-    bindings_.AddBinding(this, std::move(request));
-  }
-
-  // shell::mojom::ServiceFactory:
-  void CreateService(shell::mojom::ServiceRequest request,
-                     const std::string& name) override {
-    ++shell_connection_refcount_;
-    apps_.push_back(
-        new PackagedApp(std::move(request),
-                        base::Bind(&Package::AppShellConnectionClosed,
-                                   base::Unretained(this)),
-                        base::Bind(&Package::AppDestructed,
-                                   base::Unretained(this))));
-  }
-
-  void AppShellConnectionClosed(PackagedApp* app) {
-    if (!--shell_connection_refcount_)
-      app_client_.CloseShellConnection();
-  }
-
-  void AppDestructed(PackagedApp* app) {
-    auto it = std::find(apps_.begin(), apps_.end(), app);
-    DCHECK(it != apps_.end());
-    apps_.erase(it);
-    if (apps_.empty() && base::MessageLoop::current()->is_running())
-      base::MessageLoop::current()->QuitWhenIdle();
-  }
-
-  shell::test::AppClient app_client_;
-  int shell_connection_refcount_ = 0;
-  mojo::BindingSet<shell::mojom::ServiceFactory> bindings_;
-  std::vector<PackagedApp*> apps_;
-
-  DISALLOW_COPY_AND_ASSIGN(Package);
-};
-
-}  // namespace
-
-MojoResult ServiceMain(MojoHandle service_request_handle) {
-  Package* package = new Package;
-  shell::ServiceRunner runner(package);
-  package->set_runner(&runner);
-  return runner.Run(service_request_handle);
-}
diff --git a/services/shell/tests/lifecycle/parent.cc b/services/shell/tests/lifecycle/parent.cc
deleted file mode 100644
index a7bd55a..0000000
--- a/services/shell/tests/lifecycle/parent.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <memory>
-
-#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
-#include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h"
-
-namespace {
-
-void QuitLoop(base::RunLoop* loop) {
-  loop->Quit();
-}
-
-class Parent : public shell::Service,
-               public shell::InterfaceFactory<shell::test::mojom::Parent>,
-               public shell::test::mojom::Parent {
- public:
-  Parent() {}
-  ~Parent() override {
-    child_connection_.reset();
-    parent_bindings_.CloseAllBindings();
-  }
-
- private:
-  // Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
-    registry->AddInterface<shell::test::mojom::Parent>(this);
-    return true;
-  }
-
-  // InterfaceFactory<shell::test::mojom::Parent>:
-  void Create(const shell::Identity& remote_identity,
-              shell::test::mojom::ParentRequest request) override {
-    parent_bindings_.AddBinding(this, std::move(request));
-  }
-
-  // Parent:
-  void ConnectToChild(const ConnectToChildCallback& callback) override {
-    child_connection_ = connector()->Connect("service:lifecycle_unittest_app");
-    shell::test::mojom::LifecycleControlPtr lifecycle;
-    child_connection_->GetInterface(&lifecycle);
-    {
-      base::RunLoop loop;
-      lifecycle->Ping(base::Bind(&QuitLoop, &loop));
-      base::MessageLoop::ScopedNestableTaskAllower allow(
-          base::MessageLoop::current());
-      loop.Run();
-    }
-    callback.Run();
-  }
-  void Quit() override {
-    base::MessageLoop::current()->QuitWhenIdle();
-  }
-
-  std::unique_ptr<shell::Connection> child_connection_;
-  mojo::BindingSet<shell::test::mojom::Parent> parent_bindings_;
-
-  DISALLOW_COPY_AND_ASSIGN(Parent);
-};
-
-}  // namespace
-
-MojoResult ServiceMain(MojoHandle service_request_handle) {
-  Parent* parent = new Parent;
-  return shell::ServiceRunner(parent).Run(service_request_handle);
-}
diff --git a/services/shell/tests/lifecycle/parent_manifest.json b/services/shell/tests/lifecycle/parent_manifest.json
deleted file mode 100644
index 173d257..0000000
--- a/services/shell/tests/lifecycle/parent_manifest.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "manifest_version":  1,
-  "name": "service:lifecycle_unittest_parent",
-  "display_name": "Lifecycle Unittest Parent",
-  "capabilities": {
-    "provided": {
-      "lifecycle_unittest:parent": [ "shell::test::mojom::Parent" ]
-    },
-    "required": {
-      "service:lifecycle_unittest_app": {
-        "classes": [ "lifecycle_unittest:lifecycle_control" ]
-      }
-    }
-  }
-}
diff --git a/services/shell/tests/placeholder_unittest.cc b/services/shell/tests/placeholder_unittest.cc
deleted file mode 100644
index df9d827a..0000000
--- a/services/shell/tests/placeholder_unittest.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-// Dummy test to keep mojo_shell_unittests building and linking in GYP builds.
-TEST(PlaceholderTest, Empty) {}
diff --git a/services/shell/tests/shell/driver_manifest.json b/services/shell/tests/shell/driver_manifest.json
deleted file mode 100644
index 7a3c1f2..0000000
--- a/services/shell/tests/shell/driver_manifest.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-  "manifest_version": 1,
-  "name": "exe:shell_unittest_driver",
-  "display_name": "Shell Unittest: Driver",
-  "capabilities": {
-    "provided": {
-      "shell_unittest:driver": [ "shell::test::mojom::Driver" ]
-    },
-    "required": {
-      "exe:shell_unittest_target": { },
-      "service:shell": { "classes": [ "shell:client_process" ] }
-    }
-  }
-}
diff --git a/services/shell/tests/shell/shell_unittest.mojom b/services/shell/tests/shell/shell_unittest.mojom
deleted file mode 100644
index 62d7b4c..0000000
--- a/services/shell/tests/shell/shell_unittest.mojom
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module shell.test.mojom;
-
-import "services/shell/public/interfaces/connector.mojom";
-
-interface CreateInstanceTest {
-  SetTargetIdentity(shell.mojom.Identity identity);
-};
-
-interface Driver {
-  QuitDriver();
-};
diff --git a/services/shell/tests/shell/shell_unittest_manifest.json b/services/shell/tests/shell/shell_unittest_manifest.json
deleted file mode 100644
index 71abbf4..0000000
--- a/services/shell/tests/shell/shell_unittest_manifest.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "manifest_version":  1,
-  "name": "service:shell_unittest",
-  "display_name": "Shell Unittest",
-  "capabilities": {
-    "provided": {
-      "shell_unittest:create_instance_test": [
-        "shell::test::mojom::CreateInstanceTest"
-      ]
-    },
-    "required": {
-      "service:shell": { "classes": [ "shell:service_manager" ] },
-      "exe:shell_unittest_driver": { "classes":  [ "shell_unittest:driver" ] }
-    }
-  }
-}
diff --git a/services/shell/tests/shell/target.cc b/services/shell/tests/shell/target.cc
deleted file mode 100644
index 0abf65d..0000000
--- a/services/shell/tests/shell/target.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/at_exit.h"
-#include "base/command_line.h"
-#include "base/macros.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/runner/child/test_native_main.h"
-#include "services/shell/runner/init.h"
-#include "services/shell/tests/shell/shell_unittest.mojom.h"
-
-using shell::test::mojom::CreateInstanceTestPtr;
-
-namespace {
-
-class Target : public shell::Service {
- public:
-  Target() {}
-  ~Target() override {}
-
- private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override {
-    CreateInstanceTestPtr service;
-    connector()->ConnectToInterface("service:shell_unittest", &service);
-    service->SetTargetIdentity(identity);
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(Target);
-};
-
-}  // namespace
-
-int main(int argc, char** argv) {
-  base::AtExitManager at_exit;
-  base::CommandLine::Init(argc, argv);
-
-  shell::InitializeLogging();
-
-  Target target;
-  return shell::TestNativeMain(&target);
-}
diff --git a/services/shell/tests/shutdown/shutdown_client_manifest.json b/services/shell/tests/shutdown/shutdown_client_manifest.json
deleted file mode 100644
index 1ad9588b..0000000
--- a/services/shell/tests/shutdown/shutdown_client_manifest.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
-  "manifest_version":  1,
-  "name": "service:shutdown_client",
-  "display_name": "Shutdown Client",
-  "capabilities": {
-    "provided": {
-      "shutdown_unittest:shutdown_test_client_controller": [
-        "shell::mojom::ShutdownTestClientController"
-      ]
-    },
-    "required": {
-      "service:shell": { "classes": [ "shell:service_manager" ] },
-      "service:shutdown_service": {
-        "classes": [ "shutdown_unittest:shutdown_test_service" ]
-      }
-    }
-  }
-}
diff --git a/services/shell/tests/shutdown/shutdown_unittest_manifest.json b/services/shell/tests/shutdown/shutdown_unittest_manifest.json
deleted file mode 100644
index 131e8c6a..0000000
--- a/services/shell/tests/shutdown/shutdown_unittest_manifest.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "manifest_version":  1,
-  "name": "service:shutdown_unittest",
-  "display_name": "Shutdown Unittest",
-  "capabilities": {
-    "required": {
-      "service:shell": { "classes": [ "shell:service_manager" ] },
-      "service:shutdown_client": {
-        "classes":  [ "shutdown_unittest:shutdown_test_client_controller" ]
-      },
-      "service:shutdown_service": {
-        "classes": [ "shutdown_unittest:shutdown_test_service" ]
-      }
-    }
-  }
-}
diff --git a/services/tracing/BUILD.gn b/services/tracing/BUILD.gn
index f002ab6..cb51c87 100644
--- a/services/tracing/BUILD.gn
+++ b/services/tracing/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 
 service("tracing") {
   sources = [
@@ -15,7 +15,7 @@
   deps = [
     ":lib",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
   ]
 
   data_deps = [
@@ -41,7 +41,7 @@
   deps = [
     "//base",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/interfaces",
   ]
 }
diff --git a/services/tracing/main.cc b/services/tracing/main.cc
index bda2bad0..c3ef71a 100644
--- a/services/tracing/main.cc
+++ b/services/tracing/main.cc
@@ -2,10 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/tracing/service.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  return shell::ServiceRunner(new tracing::Service).Run(service_request_handle);
+  return service_manager::ServiceRunner(new tracing::Service)
+      .Run(service_request_handle);
 }
diff --git a/services/tracing/manifest.json b/services/tracing/manifest.json
index c407a44..c596110 100644
--- a/services/tracing/manifest.json
+++ b/services/tracing/manifest.json
@@ -11,7 +11,7 @@
       ]
     },
     "required": {
-      "service:shell": { "classes": [ "shell:all_users" ] }
+      "service:shell": [ "shell:all_users" ]
     }
   }
 }
diff --git a/services/tracing/public/cpp/BUILD.gn b/services/tracing/public/cpp/BUILD.gn
index 75d0cf2..a3f8cc13 100644
--- a/services/tracing/public/cpp/BUILD.gn
+++ b/services/tracing/public/cpp/BUILD.gn
@@ -13,7 +13,7 @@
   deps = [
     "//base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/interfaces",
   ]
 }
diff --git a/services/tracing/public/cpp/provider.cc b/services/tracing/public/cpp/provider.cc
index 92df055..47e0ab0c 100644
--- a/services/tracing/public/cpp/provider.cc
+++ b/services/tracing/public/cpp/provider.cc
@@ -17,8 +17,8 @@
 #include "base/time/time.h"
 #include "base/trace_event/trace_config.h"
 #include "base/trace_event/trace_event.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/tracing/public/cpp/switches.h"
 
 namespace tracing {
@@ -42,7 +42,8 @@
   StopTracing();
 }
 
-void Provider::Initialize(shell::Connector* connector, const std::string& url) {
+void Provider::Initialize(service_manager::Connector* connector,
+                          const std::string& url) {
   {
     base::AutoLock lock(g_singleton_lock.Get());
     if (g_tracing_singleton_created)
diff --git a/services/tracing/public/cpp/provider.h b/services/tracing/public/cpp/provider.h
index 28b2905..4b305d4 100644
--- a/services/tracing/public/cpp/provider.h
+++ b/services/tracing/public/cpp/provider.h
@@ -13,7 +13,7 @@
 #include "mojo/public/cpp/bindings/interface_request.h"
 #include "services/tracing/public/interfaces/tracing.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -24,7 +24,8 @@
   Provider();
   ~Provider() override;
 
-  void Initialize(shell::Connector* connector, const std::string& url);
+  void Initialize(service_manager::Connector* connector,
+                  const std::string& url);
 
   void Bind(mojom::ProviderRequest request);
 
diff --git a/services/tracing/service.cc b/services/tracing/service.cc
index 2d61ff42..a12a406 100644
--- a/services/tracing/service.cc
+++ b/services/tracing/service.cc
@@ -12,15 +12,15 @@
 #include "base/bind.h"
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 
 namespace tracing {
 
 Service::Service() : collector_binding_(this), tracing_active_(false) {}
 Service::~Service() {}
 
-bool Service::OnConnect(const shell::Identity& remote_identity,
-                        shell::InterfaceRegistry* registry) {
+bool Service::OnConnect(const service_manager::Identity& remote_identity,
+                        service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::Factory>(this);
   registry->AddInterface<mojom::Collector>(this);
   registry->AddInterface<mojom::StartupPerformanceDataCollector>(this);
@@ -35,19 +35,18 @@
   return false;
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::FactoryRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::CollectorRequest request) {
   collector_binding_.Bind(std::move(request));
 }
 
-void Service::Create(
-    const shell::Identity& remote_identity,
-    mojom::StartupPerformanceDataCollectorRequest request) {
+void Service::Create(const service_manager::Identity& remote_identity,
+                     mojom::StartupPerformanceDataCollectorRequest request) {
   startup_performance_data_collector_bindings_.AddBinding(this,
                                                           std::move(request));
 }
diff --git a/services/tracing/service.h b/services/tracing/service.h
index c80a732..022214b 100644
--- a/services/tracing/service.h
+++ b/services/tracing/service.h
@@ -14,44 +14,43 @@
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/tracing/data_sink.h"
 #include "services/tracing/public/interfaces/tracing.mojom.h"
 #include "services/tracing/recorder.h"
 
 namespace tracing {
 
-class Service
-    : public shell::Service,
-      public shell::InterfaceFactory<mojom::Factory>,
-      public shell::InterfaceFactory<mojom::Collector>,
-      public shell::InterfaceFactory<mojom::StartupPerformanceDataCollector>,
-      public mojom::Factory,
-      public mojom::Collector,
-      public mojom::StartupPerformanceDataCollector {
+class Service : public service_manager::Service,
+                public service_manager::InterfaceFactory<mojom::Factory>,
+                public service_manager::InterfaceFactory<mojom::Collector>,
+                public service_manager::InterfaceFactory<
+                    mojom::StartupPerformanceDataCollector>,
+                public mojom::Factory,
+                public mojom::Collector,
+                public mojom::StartupPerformanceDataCollector {
  public:
   Service();
   ~Service() override;
 
  private:
-  // shell::Service implementation.
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service implementation.
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
   bool OnStop() override;
 
-  // shell::InterfaceFactory<mojom::Factory>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Factory>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::FactoryRequest request) override;
 
-  // shell::InterfaceFactory<mojom::Collector>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Collector>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::CollectorRequest request) override;
 
-  // shell::InterfaceFactory<mojom::StartupPerformanceDataCollector>:
-  void Create(
-      const shell::Identity& remote_identity,
-      mojom::StartupPerformanceDataCollectorRequest request) override;
+  // service_manager::InterfaceFactory<mojom::StartupPerformanceDataCollector>:
+  void Create(const service_manager::Identity& remote_identity,
+              mojom::StartupPerformanceDataCollectorRequest request) override;
 
   // mojom::Factory:
   void CreateRecorder(mojom::ProviderPtr provider) override;
diff --git a/services/ui/BUILD.gn b/services/ui/BUILD.gn
index d23aa616..005916b 100644
--- a/services/ui/BUILD.gn
+++ b/services/ui/BUILD.gn
@@ -4,9 +4,9 @@
 
 import("//build/config/ui.gni")
 import("//testing/test.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
-import("//services/shell/public/constants.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
+import("//services/service_manager/public/constants.gni")
 import("//tools/grit/repack.gni")
 
 group("all") {
@@ -28,7 +28,7 @@
     ":resources_100",
     ":resources_200",
     ":resources_strings",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:sources",
     "//services/tracing/public/interfaces",
   ]
 
@@ -86,7 +86,7 @@
     "//cc/surfaces",
     "//mojo/common:common_base",
     "//services/catalog/public/cpp",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
     "//services/ui/clipboard:lib",
     "//services/ui/ime:lib",
diff --git a/services/ui/DEPS b/services/ui/DEPS
index d8f9756..555506d 100644
--- a/services/ui/DEPS
+++ b/services/ui/DEPS
@@ -5,7 +5,7 @@
   "+mojo/converters",
   "+mojo/public",
   "+services/catalog/public",
-  "+services/shell",
+  "+services/service_manager",
   "+services/tracing/public",
   "-services/ui/gpu",
   "+third_party/skia/include",
diff --git a/services/ui/clipboard/BUILD.gn b/services/ui/clipboard/BUILD.gn
index f2296f3..4d106b6 100644
--- a/services/ui/clipboard/BUILD.gn
+++ b/services/ui/clipboard/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 source_set("lib") {
@@ -16,7 +16,7 @@
     "//base",
     "//mojo/common",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
     "//services/ui/public/interfaces",
   ]
@@ -37,9 +37,9 @@
   deps = [
     "//base",
     "//mojo/common",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
     "//services/ui/public/interfaces",
   ]
 
diff --git a/services/ui/clipboard/clipboard_unittest.cc b/services/ui/clipboard/clipboard_unittest.cc
index c2fde4e..5566fe8 100644
--- a/services/ui/clipboard/clipboard_unittest.cc
+++ b/services/ui/clipboard/clipboard_unittest.cc
@@ -9,8 +9,8 @@
 #include "base/macros.h"
 #include "base/run_loop.h"
 #include "mojo/common/common_type_converters.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/public/interfaces/clipboard.mojom.h"
 
 using mojo::Array;
@@ -28,12 +28,12 @@
 
 }  // namespace
 
-class ClipboardAppTest : public shell::test::ServiceTest {
+class ClipboardAppTest : public service_manager::test::ServiceTest {
  public:
   ClipboardAppTest() : ServiceTest("exe:mus_clipboard_unittests") {}
   ~ClipboardAppTest() override {}
 
-  // Overridden from shell::test::ServiceTest:
+  // Overridden from service_manager::test::ServiceTest:
   void SetUp() override {
     ServiceTest::SetUp();
 
diff --git a/services/ui/clipboard/test_manifest.json b/services/ui/clipboard/test_manifest.json
index c628843..b5324e1 100644
--- a/services/ui/clipboard/test_manifest.json
+++ b/services/ui/clipboard/test_manifest.json
@@ -3,6 +3,6 @@
   "name": "exe:mus_clipboard_unittests",
   "display_name": "Clipboard Service Unittests",
   "capabilities": {
-    "required": { "service:ui": { "classes": [ "app" ] } }
+    "required": { "service:ui": [ "app" ] }
   }
 }
diff --git a/services/ui/common/BUILD.gn b/services/ui/common/BUILD.gn
index ad45ef7..0022d9e6 100644
--- a/services/ui/common/BUILD.gn
+++ b/services/ui/common/BUILD.gn
@@ -3,7 +3,7 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 source_set("mus_common") {
@@ -25,7 +25,7 @@
     "//gpu/ipc/client",
     "//gpu/ipc/common:command_buffer_traits",
     "//ipc:ipc",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/events:events",
     "//ui/gfx/ipc/geometry",
   ]
@@ -48,7 +48,7 @@
   deps = [
     "//base/test:test_support",
     "//mojo/edk/system",
-    "//services/shell/background:main",
+    "//services/service_manager/background:main",
   ]
 
   if (use_ozone) {
diff --git a/services/ui/common/run_all_shelltests.cc b/services/ui/common/run_all_shelltests.cc
index 070c7251..f99e6b2 100644
--- a/services/ui/common/run_all_shelltests.cc
+++ b/services/ui/common/run_all_shelltests.cc
@@ -6,7 +6,7 @@
 #include "base/test/test_suite.h"
 #include "build/build_config.h"
 #include "mojo/edk/embedder/embedder.h"
-#include "services/shell/background/background_shell_main.h"
+#include "services/service_manager/background/background_shell_main.h"
 
 #if defined(USE_OZONE)
 #include "ui/ozone/public/ozone_platform.h"
diff --git a/services/ui/demo/BUILD.gn b/services/ui/demo/BUILD.gn
index 4b8d6ac..4aa6581 100644
--- a/services/ui/demo/BUILD.gn
+++ b/services/ui/demo/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 service("mus_demo") {
@@ -18,8 +18,8 @@
   deps = [
     "//base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:sources",
     "//services/ui/public/cpp",
     "//services/ui/public/cpp:internal",
     "//services/ui/public/interfaces",
@@ -54,8 +54,8 @@
   deps = [
     ":demo",
     "//base",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:service_test_support",
     "//services/ui/common:run_all_shelltests",
     "//services/ui/public/interfaces",
     "//testing/gtest",
diff --git a/services/ui/demo/main.cc b/services/ui/demo/main.cc
index a4ec3063..ecf56bd 100644
--- a/services/ui/demo/main.cc
+++ b/services/ui/demo/main.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/ui/demo/mus_demo.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new ui::demo::MusDemo);
+  service_manager::ServiceRunner runner(new ui::demo::MusDemo);
   return runner.Run(service_request_handle);
 }
diff --git a/services/ui/demo/manifest.json b/services/ui/demo/manifest.json
index 858c368..1d4fe74 100644
--- a/services/ui/demo/manifest.json
+++ b/services/ui/demo/manifest.json
@@ -4,9 +4,7 @@
   "display_name": "MUS Demo",
   "capabilities": {
     "required": {
-      "service:ui": {
-        "classes": [ "app", "ui:window_manager" ]
-      }
+      "service:ui": [ "app", "ui:window_manager" ]
     }
   }
 }
diff --git a/services/ui/demo/mus_demo.cc b/services/ui/demo/mus_demo.cc
index 136ad7a8..d528244a 100644
--- a/services/ui/demo/mus_demo.cc
+++ b/services/ui/demo/mus_demo.cc
@@ -6,7 +6,7 @@
 
 #include "base/memory/ptr_util.h"
 #include "base/time/time.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/demo/bitmap_uploader.h"
 #include "services/ui/public/cpp/gpu_service.h"
 #include "services/ui/public/cpp/window.h"
@@ -63,14 +63,14 @@
 
 MusDemo::~MusDemo() {}
 
-void MusDemo::OnStart(const shell::Identity& identity) {
+void MusDemo::OnStart(const service_manager::Identity& identity) {
   gpu_service_ = GpuService::Create(connector());
   window_tree_client_ = base::MakeUnique<WindowTreeClient>(this, this);
   window_tree_client_->ConnectAsWindowManager(connector());
 }
 
-bool MusDemo::OnConnect(const shell::Identity& remote_identity,
-                        shell::InterfaceRegistry* registry) {
+bool MusDemo::OnConnect(const service_manager::Identity& remote_identity,
+                        service_manager::InterfaceRegistry* registry) {
   return true;
 }
 
diff --git a/services/ui/demo/mus_demo.h b/services/ui/demo/mus_demo.h
index 70a06dc..781fcb0ff 100644
--- a/services/ui/demo/mus_demo.h
+++ b/services/ui/demo/mus_demo.h
@@ -14,7 +14,7 @@
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/timer/timer.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/ui/public/cpp/window_manager_delegate.h"
 #include "services/ui/public/cpp/window_tree_client_delegate.h"
 #include "third_party/skia/include/core/SkBitmap.h"
@@ -28,7 +28,7 @@
 // A simple MUS Demo service. This service connects to the mojo:ui, creates a
 // new window and draws a spinning square in the center of the window. Provides
 // a simple way to demonstrate that the graphic stack works as intended.
-class MusDemo : public shell::Service,
+class MusDemo : public service_manager::Service,
                 public WindowTreeClientDelegate,
                 public WindowManagerDelegate {
  public:
@@ -36,10 +36,10 @@
   ~MusDemo() override;
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // WindowTreeClientDelegate:
   void OnEmbed(Window* root) override;
diff --git a/services/ui/demo/mus_demo_unittests.cc b/services/ui/demo/mus_demo_unittests.cc
index 698b8e6..7385175 100644
--- a/services/ui/demo/mus_demo_unittests.cc
+++ b/services/ui/demo/mus_demo_unittests.cc
@@ -6,7 +6,7 @@
 #include "base/command_line.h"
 #include "base/macros.h"
 #include "base/run_loop.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/public/interfaces/window_server_test.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -22,9 +22,9 @@
   callback.Run();
 }
 
-class MusDemoTest : public shell::test::ServiceTest {
+class MusDemoTest : public service_manager::test::ServiceTest {
  public:
-  MusDemoTest() : shell::test::ServiceTest(kTestAppName) {}
+  MusDemoTest() : service_manager::test::ServiceTest(kTestAppName) {}
   ~MusDemoTest() override {}
 
   void SetUp() override {
diff --git a/services/ui/demo/test_manifest.json b/services/ui/demo/test_manifest.json
index 686155c8..011a85bf 100644
--- a/services/ui/demo/test_manifest.json
+++ b/services/ui/demo/test_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "MUS Demo Unittests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app", "test" ] }
+      "*": [ "app", "test" ]
     }
   }
 }
diff --git a/services/ui/display/BUILD.gn b/services/ui/display/BUILD.gn
index d890425..4fbef06 100644
--- a/services/ui/display/BUILD.gn
+++ b/services/ui/display/BUILD.gn
@@ -14,7 +14,7 @@
 
   deps = [
     "//base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/display",
     "//ui/gfx",
   ]
diff --git a/services/ui/display/platform_screen.h b/services/ui/display/platform_screen.h
index f992656..c266a57 100644
--- a/services/ui/display/platform_screen.h
+++ b/services/ui/display/platform_screen.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "services/ui/display/platform_screen_delegate.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
@@ -28,7 +28,7 @@
   static PlatformScreen* GetInstance();
 
   // Registers Mojo interfaces provided.
-  virtual void AddInterfaces(shell::InterfaceRegistry* registry) = 0;
+  virtual void AddInterfaces(service_manager::InterfaceRegistry* registry) = 0;
 
   // Triggers initial display configuration to start. On device this will
   // configuration the connected displays. Off device this will create one or
diff --git a/services/ui/display/platform_screen_ozone.cc b/services/ui/display/platform_screen_ozone.cc
index 7032ed2..0660e2d7 100644
--- a/services/ui/display/platform_screen_ozone.cc
+++ b/services/ui/display/platform_screen_ozone.cc
@@ -11,7 +11,7 @@
 #include "base/memory/ptr_util.h"
 #include "base/sys_info.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "third_party/skia/include/core/SkColor.h"
 #include "ui/display/types/display_constants.h"
 #include "ui/display/types/display_snapshot.h"
@@ -62,7 +62,8 @@
   display_configurator_.RemoveObserver(this);
 }
 
-void PlatformScreenOzone::AddInterfaces(shell::InterfaceRegistry* registry) {
+void PlatformScreenOzone::AddInterfaces(
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::DisplayController>(this);
 }
 
@@ -262,8 +263,9 @@
   wait_for_display_config_update_ = false;
 }
 
-void PlatformScreenOzone::Create(const shell::Identity& remote_identity,
-                                 mojom::DisplayControllerRequest request) {
+void PlatformScreenOzone::Create(
+    const service_manager::Identity& remote_identity,
+    mojom::DisplayControllerRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
diff --git a/services/ui/display/platform_screen_ozone.h b/services/ui/display/platform_screen_ozone.h
index 5b712bc..bcdbdcb4 100644
--- a/services/ui/display/platform_screen_ozone.h
+++ b/services/ui/display/platform_screen_ozone.h
@@ -13,8 +13,8 @@
 #include "base/callback.h"
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
 #include "services/ui/display/platform_screen.h"
 #include "services/ui/public/interfaces/display/display_controller.mojom.h"
 #include "ui/display/chromeos/display_configurator.h"
@@ -28,14 +28,14 @@
 class PlatformScreenOzone
     : public PlatformScreen,
       public ui::DisplayConfigurator::Observer,
-      public shell::InterfaceFactory<mojom::DisplayController>,
+      public service_manager::InterfaceFactory<mojom::DisplayController>,
       public mojom::DisplayController {
  public:
   PlatformScreenOzone();
   ~PlatformScreenOzone() override;
 
   // PlatformScreen:
-  void AddInterfaces(shell::InterfaceRegistry* registry) override;
+  void AddInterfaces(service_manager::InterfaceRegistry* registry) override;
   void Init(PlatformScreenDelegate* delegate) override;
   void RequestCloseDisplay(int64_t display_id) override;
   int64_t GetPrimaryDisplayId() const override;
@@ -102,7 +102,7 @@
       ui::MultipleDisplayState failed_new_state) override;
 
   // mojo::InterfaceFactory<mojom::DisplayController>:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               mojom::DisplayControllerRequest request) override;
 
   ui::DisplayConfigurator display_configurator_;
diff --git a/services/ui/display/platform_screen_stub.cc b/services/ui/display/platform_screen_stub.cc
index b10be9e..13e53f7a 100644
--- a/services/ui/display/platform_screen_stub.cc
+++ b/services/ui/display/platform_screen_stub.cc
@@ -10,7 +10,7 @@
 #include "base/location.h"
 #include "base/memory/ptr_util.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/display/display.h"
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/geometry/size.h"
@@ -43,7 +43,8 @@
                             device_scale_factor);
 }
 
-void PlatformScreenStub::AddInterfaces(shell::InterfaceRegistry* registry) {}
+void PlatformScreenStub::AddInterfaces(
+    service_manager::InterfaceRegistry* registry) {}
 
 void PlatformScreenStub::Init(PlatformScreenDelegate* delegate) {
   DCHECK(delegate);
diff --git a/services/ui/display/platform_screen_stub.h b/services/ui/display/platform_screen_stub.h
index c196b77..4ce23038 100644
--- a/services/ui/display/platform_screen_stub.h
+++ b/services/ui/display/platform_screen_stub.h
@@ -25,7 +25,7 @@
   void FixedSizeScreenConfiguration();
 
   // PlatformScreen.
-  void AddInterfaces(shell::InterfaceRegistry* registry) override;
+  void AddInterfaces(service_manager::InterfaceRegistry* registry) override;
   void Init(PlatformScreenDelegate* delegate) override;
   void RequestCloseDisplay(int64_t display_id) override;
   int64_t GetPrimaryDisplayId() const override;
diff --git a/services/ui/gpu/BUILD.gn b/services/ui/gpu/BUILD.gn
index f555e3e..23e5bc8 100644
--- a/services/ui/gpu/BUILD.gn
+++ b/services/ui/gpu/BUILD.gn
@@ -3,7 +3,7 @@
 # found in the LICENSE file.
 
 import("//build/config/ui.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 source_set("gpu") {
@@ -24,7 +24,7 @@
     "//ipc",
     "//media/gpu/ipc/service",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/common:mus_common",
     "//services/ui/gpu/interfaces",
     "//services/ui/public/interfaces",
diff --git a/services/ui/gpu/gpu_service_internal.cc b/services/ui/gpu/gpu_service_internal.cc
index f66c20f..adfc88fda 100644
--- a/services/ui/gpu/gpu_service_internal.cc
+++ b/services/ui/gpu/gpu_service_internal.cc
@@ -21,7 +21,7 @@
 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h"
 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
-#include "media/gpu/ipc/service/media_service.h"
+#include "media/gpu/ipc/service/media_gpu_channel_manager.h"
 #include "ui/gl/gl_implementation.h"
 #include "ui/gl/gl_switches.h"
 #include "ui/gl/gpu_switching_manager.h"
@@ -45,7 +45,7 @@
 
 GpuServiceInternal::~GpuServiceInternal() {
   binding_.Close();
-  media_service_.reset();
+  media_gpu_channel_manager_.reset();
   gpu_channel_manager_.reset();
   owned_sync_point_manager_.reset();
 
@@ -88,7 +88,7 @@
 }
 
 void GpuServiceInternal::DidDestroyChannel(int client_id) {
-  media_service_->RemoveChannel(client_id);
+  media_gpu_channel_manager_->RemoveChannel(client_id);
   NOTIMPLEMENTED();
 }
 
@@ -143,7 +143,8 @@
       &shutdown_event_, owned_sync_point_manager_.get(),
       gpu_memory_buffer_factory_));
 
-  media_service_.reset(new media::MediaService(gpu_channel_manager_.get()));
+  media_gpu_channel_manager_.reset(
+      new media::MediaGpuChannelManager(gpu_channel_manager_.get()));
   callback.Run(gpu_info_);
 }
 
@@ -167,7 +168,7 @@
       client_id, client_tracing_id, preempts, allow_view_command_buffers,
       allow_real_time_streams);
   channel_handle.reset(handle.mojo_handle);
-  media_service_->AddChannel(client_id);
+  media_gpu_channel_manager_->AddChannel(client_id);
   callback.Run(std::move(channel_handle));
 }
 
diff --git a/services/ui/gpu/gpu_service_internal.h b/services/ui/gpu/gpu_service_internal.h
index 43c87645..e4248c9 100644
--- a/services/ui/gpu/gpu_service_internal.h
+++ b/services/ui/gpu/gpu_service_internal.h
@@ -29,7 +29,7 @@
 }
 
 namespace media {
-class MediaService;
+class MediaGpuChannelManager;
 }
 
 namespace ui {
@@ -114,7 +114,7 @@
 
   std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_;
   std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
-  std::unique_ptr<media::MediaService> media_service_;
+  std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_;
   mojo::Binding<mojom::GpuServiceInternal> binding_;
 
   DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal);
diff --git a/services/ui/gpu/mus_gpu_unittests_app_manifest.json b/services/ui/gpu/mus_gpu_unittests_app_manifest.json
index c84f3235c..3fd471c 100644
--- a/services/ui/gpu/mus_gpu_unittests_app_manifest.json
+++ b/services/ui/gpu/mus_gpu_unittests_app_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Mus GPU Unittests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/services/ui/ime/BUILD.gn b/services/ui/ime/BUILD.gn
index a9aac00..807302fa 100644
--- a/services/ui/ime/BUILD.gn
+++ b/services/ui/ime/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 source_set("lib") {
@@ -18,7 +18,7 @@
     "//base",
     "//mojo/common",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
     "//services/ui/public/interfaces",
   ]
@@ -39,9 +39,9 @@
   deps = [
     "//base",
     "//mojo/common",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
     "//services/ui/public/interfaces",
   ]
 
diff --git a/services/ui/ime/ime_server_impl.cc b/services/ui/ime/ime_server_impl.cc
index b405721..ee3de92 100644
--- a/services/ui/ime/ime_server_impl.cc
+++ b/services/ui/ime/ime_server_impl.cc
@@ -4,7 +4,7 @@
 
 #include "services/ui/ime/ime_server_impl.h"
 
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/ime/ime_registrar_impl.h"
 
 namespace ui {
@@ -13,7 +13,7 @@
 
 IMEServerImpl::~IMEServerImpl() {}
 
-void IMEServerImpl::Init(shell::Connector* connector) {
+void IMEServerImpl::Init(service_manager::Connector* connector) {
   // TODO(moshayedi): crbug.com/641041. Look up the driver from the mojo:catalog
   // service.
   connector->Connect("service:test_ime_driver");
diff --git a/services/ui/ime/ime_server_impl.h b/services/ui/ime/ime_server_impl.h
index 5f3c854..360f37f 100644
--- a/services/ui/ime/ime_server_impl.h
+++ b/services/ui/ime/ime_server_impl.h
@@ -10,7 +10,7 @@
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "services/ui/public/interfaces/ime.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -21,7 +21,7 @@
   IMEServerImpl();
   ~IMEServerImpl() override;
 
-  void Init(shell::Connector* connector);
+  void Init(service_manager::Connector* connector);
   void AddBinding(mojom::IMEServerRequest request);
   void OnDriverChanged(mojom::IMEDriverPtr driver);
 
diff --git a/services/ui/ime/ime_unittest.cc b/services/ui/ime/ime_unittest.cc
index 55aa81c..9c23549 100644
--- a/services/ui/ime/ime_unittest.cc
+++ b/services/ui/ime/ime_unittest.cc
@@ -8,8 +8,8 @@
 #include "base/macros.h"
 #include "base/run_loop.h"
 #include "mojo/public/cpp/bindings/interface_request.h"
-#include "services/shell/public/cpp/service_context.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_context.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/public/interfaces/ime.mojom.h"
 #include "ui/events/event.h"
 
@@ -52,12 +52,12 @@
   DISALLOW_COPY_AND_ASSIGN(TestTextInputClient);
 };
 
-class IMEAppTest : public shell::test::ServiceTest {
+class IMEAppTest : public service_manager::test::ServiceTest {
  public:
   IMEAppTest() : ServiceTest("exe:mus_ime_unittests") {}
   ~IMEAppTest() override {}
 
-  // shell::test::ServiceTest:
+  // service_manager::test::ServiceTest:
   void SetUp() override {
     ServiceTest::SetUp();
     // test_ime_driver will register itself as the current IMEDriver.
diff --git a/services/ui/ime/test_ime_driver/BUILD.gn b/services/ui/ime/test_ime_driver/BUILD.gn
index ebaf890..30736cc 100644
--- a/services/ui/ime/test_ime_driver/BUILD.gn
+++ b/services/ui/ime/test_ime_driver/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 source_set("lib") {
@@ -16,7 +16,7 @@
 
   deps = [
     "//base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/public/interfaces",
   ]
 }
@@ -29,7 +29,7 @@
   deps = [
     ":lib",
     "//base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/public/interfaces",
   ]
 
diff --git a/services/ui/ime/test_ime_driver/main.cc b/services/ui/ime/test_ime_driver/main.cc
index 67a3812..e84860f 100644
--- a/services/ui/ime/test_ime_driver/main.cc
+++ b/services/ui/ime/test_ime_driver/main.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/ui/ime/test_ime_driver/test_ime_application.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new ui::test::TestIMEApplication);
+  service_manager::ServiceRunner runner(new ui::test::TestIMEApplication);
   return runner.Run(service_request_handle);
 }
diff --git a/services/ui/ime/test_ime_driver/manifest.json b/services/ui/ime/test_ime_driver/manifest.json
index 958ec39..7a18f0b3 100644
--- a/services/ui/ime/test_ime_driver/manifest.json
+++ b/services/ui/ime/test_ime_driver/manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Test IME Driver",
   "capabilities": {
     "required": {
-      "service:ui": { "classes": [ "ui:ime_registrar" ] }
+      "service:ui": [ "ui:ime_registrar" ]
     }
   }
 }
diff --git a/services/ui/ime/test_ime_driver/test_ime_application.cc b/services/ui/ime/test_ime_driver/test_ime_application.cc
index 4b92518..9072518 100644
--- a/services/ui/ime/test_ime_driver/test_ime_application.cc
+++ b/services/ui/ime/test_ime_driver/test_ime_application.cc
@@ -5,7 +5,7 @@
 #include "services/ui/ime/test_ime_driver/test_ime_application.h"
 
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/ime/test_ime_driver/test_ime_driver.h"
 #include "services/ui/public/interfaces/ime.mojom.h"
 
@@ -16,12 +16,13 @@
 
 TestIMEApplication::~TestIMEApplication() {}
 
-bool TestIMEApplication::OnConnect(const shell::Identity& remote_identity,
-                                   shell::InterfaceRegistry* registry) {
+bool TestIMEApplication::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   return true;
 }
 
-void TestIMEApplication::OnStart(const shell::Identity& identity) {
+void TestIMEApplication::OnStart(const service_manager::Identity& identity) {
   mojom::IMEDriverPtr ime_driver_ptr;
   mojo::MakeStrongBinding(base::MakeUnique<TestIMEDriver>(),
                           GetProxy(&ime_driver_ptr));
diff --git a/services/ui/ime/test_ime_driver/test_ime_application.h b/services/ui/ime/test_ime_driver/test_ime_application.h
index 6c8b970..8a1e2b7 100644
--- a/services/ui/ime/test_ime_driver/test_ime_application.h
+++ b/services/ui/ime/test_ime_driver/test_ime_application.h
@@ -5,21 +5,21 @@
 #ifndef SERVICES_UI_IME_TEST_IME_DRIVER_TEST_IME_APPLICATION_H_
 #define SERVICES_UI_IME_TEST_IME_DRIVER_TEST_IME_APPLICATION_H_
 
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 
 namespace ui {
 namespace test {
 
-class TestIMEApplication : public shell::Service {
+class TestIMEApplication : public service_manager::Service {
  public:
   TestIMEApplication();
   ~TestIMEApplication() override;
 
  private:
-  // shell::Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
-  void OnStart(const shell::Identity& identity) override;
+  // service_manager::Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
+  void OnStart(const service_manager::Identity& identity) override;
 
   DISALLOW_COPY_AND_ASSIGN(TestIMEApplication);
 };
diff --git a/services/ui/ime/test_manifest.json b/services/ui/ime/test_manifest.json
index c9d02a5..774e3fd2 100644
--- a/services/ui/ime/test_manifest.json
+++ b/services/ui/ime/test_manifest.json
@@ -4,8 +4,8 @@
   "display_name": "IME Service Unittests",
   "capabilities": {
     "required": {
-      "service:ui": { "classes": [ "app" ] },
-      "service:test_ime_driver": {}
+      "service:ui": [ "app" ],
+      "service:test_ime_driver": []
     }
   }
 }
diff --git a/services/ui/input_devices/BUILD.gn b/services/ui/input_devices/BUILD.gn
index bd9e5a2a..bf7b4f8d 100644
--- a/services/ui/input_devices/BUILD.gn
+++ b/services/ui/input_devices/BUILD.gn
@@ -12,7 +12,7 @@
 
   deps = [
     "//base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/events/devices",
   ]
 
@@ -33,8 +33,8 @@
     "//base",
     "//base/test:test_support",
     "//mojo/edk/test:run_all_unittests",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:service_test_support",
     "//services/ui/public/cpp/input_devices",
     "//services/ui/public/interfaces/input_devices",
     "//testing/gtest",
diff --git a/services/ui/input_devices/input_device_server.cc b/services/ui/input_devices/input_device_server.cc
index a3a343f..cbd17af1 100644
--- a/services/ui/input_devices/input_device_server.cc
+++ b/services/ui/input_devices/input_device_server.cc
@@ -8,7 +8,7 @@
 #include <vector>
 
 #include "mojo/public/cpp/bindings/array.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/events/devices/input_device.h"
 #include "ui/events/devices/touchscreen_device.h"
 
@@ -34,7 +34,8 @@
   return manager_ != nullptr;
 }
 
-void InputDeviceServer::AddInterface(shell::InterfaceRegistry* registry) {
+void InputDeviceServer::AddInterface(
+    service_manager::InterfaceRegistry* registry) {
   DCHECK(IsRegisteredAsObserver());
   registry->AddInterface<mojom::InputDeviceServer>(this);
 }
@@ -109,7 +110,7 @@
       manager_->GetMouseDevices(), manager_->GetTouchpadDevices());
 }
 
-void InputDeviceServer::Create(const shell::Identity& remote_identity,
+void InputDeviceServer::Create(const service_manager::Identity& remote_identity,
                                mojom::InputDeviceServerRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
diff --git a/services/ui/input_devices/input_device_server.h b/services/ui/input_devices/input_device_server.h
index 30a09be4..a84651d 100644
--- a/services/ui/input_devices/input_device_server.h
+++ b/services/ui/input_devices/input_device_server.h
@@ -8,13 +8,13 @@
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
 #include "services/ui/public/interfaces/input_devices/input_device_server.mojom.h"
 #include "ui/events/devices/device_data_manager.h"
 #include "ui/events/devices/input_device_event_observer.h"
 
-namespace shell {
+namespace service_manager {
 class InterfaceRegistry;
 }
 
@@ -24,7 +24,7 @@
 // updates to any registered InputDeviceObserverMojo in other processes via
 // Mojo IPC. This runs in the mus-ws process.
 class InputDeviceServer
-    : public shell::InterfaceFactory<mojom::InputDeviceServer>,
+    : public service_manager::InterfaceFactory<mojom::InputDeviceServer>,
       public mojom::InputDeviceServer,
       public ui::InputDeviceEventObserver {
  public:
@@ -39,7 +39,7 @@
   // connect. You should have already called RegisterAsObserver() to get local
   // input-device event updates and checked it was successful by calling
   // IsRegisteredAsObserver().
-  void AddInterface(shell::InterfaceRegistry* registry);
+  void AddInterface(service_manager::InterfaceRegistry* registry);
 
   // mojom::InputDeviceServer:
   void AddObserver(mojom::InputDeviceObserverMojoPtr observer) override;
@@ -57,7 +57,7 @@
   void SendDeviceListsComplete(mojom::InputDeviceObserverMojo* observer);
 
   // mojo::InterfaceFactory<mojom::InputDeviceServer>:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               mojom::InputDeviceServerRequest request) override;
 
   mojo::BindingSet<mojom::InputDeviceServer> bindings_;
diff --git a/services/ui/main.cc b/services/ui/main.cc
index 7200d45..a2f79bf 100644
--- a/services/ui/main.cc
+++ b/services/ui/main.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/ui/service.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new ui::Service);
+  service_manager::ServiceRunner runner(new ui::Service);
   runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
   return runner.Run(service_request_handle);
 }
diff --git a/services/ui/manifest.json b/services/ui/manifest.json
index 39bf1834..e6ff135 100644
--- a/services/ui/manifest.json
+++ b/services/ui/manifest.json
@@ -42,11 +42,9 @@
       ]
     },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:shell": {
-        "classes": [ "shell:all_users", "shell:explicit_class" ]
-      },
-      "service:ui": { "classes": [ "ozone" ] }
+      "*": [ "app" ],
+      "service:shell": [ "shell:all_users", "shell:explicit_class" ],
+      "service:ui": [ "ozone" ]
     }
   }
 }
diff --git a/services/ui/public/cpp/BUILD.gn b/services/ui/public/cpp/BUILD.gn
index 3cf457f..c8cf62b4 100644
--- a/services/ui/public/cpp/BUILD.gn
+++ b/services/ui/public/cpp/BUILD.gn
@@ -15,6 +15,7 @@
     "property_type_converters.h",
     "raster_thread_helper.h",
     "scoped_window_ptr.h",
+    "surface_id_handler.h",
     "window.h",
     "window_manager_delegate.h",
     "window_observer.h",
@@ -38,7 +39,7 @@
     "//gpu/command_buffer/common",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/interfaces",
     "//services/ui/common:mus_common",
     "//services/ui/public/interfaces",
   ]
@@ -49,7 +50,7 @@
     "//gpu/command_buffer/client:gles2_cmd_helper",
     "//gpu/command_buffer/client:gles2_interface",
     "//gpu/ipc/client",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/public/interfaces",
     "//ui/display",
     "//ui/events",
@@ -137,8 +138,8 @@
     "//gpu/ipc/client",
     "//mojo/public/cpp/bindings",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/ui/common:mus_common",
     "//services/ui/public/interfaces",
     "//services/ui/public/interfaces",
diff --git a/services/ui/public/cpp/context_provider.h b/services/ui/public/cpp/context_provider.h
index 5a0539b..c4949635 100644
--- a/services/ui/public/cpp/context_provider.h
+++ b/services/ui/public/cpp/context_provider.h
@@ -17,7 +17,7 @@
 class GpuChannelHost;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
diff --git a/services/ui/public/cpp/gpu_service.cc b/services/ui/public/cpp/gpu_service.cc
index a27a2419..3fb1449 100644
--- a/services/ui/public/cpp/gpu_service.cc
+++ b/services/ui/public/cpp/gpu_service.cc
@@ -10,14 +10,14 @@
 #include "build/build_config.h"
 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
 #include "mojo/public/cpp/system/platform_handle.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/common/switches.h"
 #include "services/ui/public/cpp/mojo_gpu_memory_buffer_manager.h"
 #include "services/ui/public/interfaces/gpu_service.mojom.h"
 
 namespace ui {
 
-GpuService::GpuService(shell::Connector* connector,
+GpuService::GpuService(service_manager::Connector* connector,
                        scoped_refptr<base::SingleThreadTaskRunner> task_runner)
     : main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       io_task_runner_(std::move(task_runner)),
@@ -47,7 +47,7 @@
 
 // static
 std::unique_ptr<GpuService> GpuService::Create(
-    shell::Connector* connector,
+    service_manager::Connector* connector,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
   return base::WrapUnique(new GpuService(connector, std::move(task_runner)));
 }
diff --git a/services/ui/public/cpp/gpu_service.h b/services/ui/public/cpp/gpu_service.h
index f50b239..79b3893 100644
--- a/services/ui/public/cpp/gpu_service.h
+++ b/services/ui/public/cpp/gpu_service.h
@@ -19,7 +19,7 @@
 #include "services/ui/public/cpp/mojo_gpu_memory_buffer_manager.h"
 #include "services/ui/public/interfaces/gpu_service.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -38,7 +38,7 @@
   // the gpu channel. If no |task_runner| is provided, then a new thread is
   // created and used.
   static std::unique_ptr<GpuService> Create(
-      shell::Connector* connector,
+      service_manager::Connector* connector,
       scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr);
 
   // gpu::GpuChannelEstablishFactory:
@@ -50,7 +50,7 @@
  private:
   friend struct base::DefaultSingletonTraits<GpuService>;
 
-  GpuService(shell::Connector* connector,
+  GpuService(service_manager::Connector* connector,
              scoped_refptr<base::SingleThreadTaskRunner> task_runner);
 
   scoped_refptr<gpu::GpuChannelHost> GetGpuChannel();
@@ -67,7 +67,7 @@
 
   scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
   scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
-  shell::Connector* connector_;
+  service_manager::Connector* connector_;
   base::WaitableEvent shutdown_event_;
   std::unique_ptr<base::Thread> io_thread_;
   std::unique_ptr<MojoGpuMemoryBufferManager> gpu_memory_buffer_manager_;
diff --git a/services/ui/public/cpp/input_devices/BUILD.gn b/services/ui/public/cpp/input_devices/BUILD.gn
index da90c47..5fc4f27 100644
--- a/services/ui/public/cpp/input_devices/BUILD.gn
+++ b/services/ui/public/cpp/input_devices/BUILD.gn
@@ -10,7 +10,7 @@
 
   deps = [
     "//base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//ui/events/devices",
   ]
 
diff --git a/services/ui/public/cpp/surface_id_handler.h b/services/ui/public/cpp/surface_id_handler.h
new file mode 100644
index 0000000..77bacfd
--- /dev/null
+++ b/services/ui/public/cpp/surface_id_handler.h
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_
+#define SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_
+
+#include "cc/surfaces/surface_id.h"
+#include "cc/surfaces/surface_sequence.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace ui {
+
+class Window;
+
+// Holds information about the current surface held by a Window.
+// |surface_id| uniquely identifies the surface in the display
+// compositor.
+// |surface_sequence| is a reference to the surface to retain
+// this surface even after a new surface has been created.
+// |frame_size| is the size of the frame held by the surface.
+// |device_scale_factor| is the scale factor that the frame was
+// renderered for.
+struct SurfaceInfo {
+  cc::SurfaceId surface_id;
+  cc::SurfaceSequence surface_sequence;
+  gfx::Size frame_size;
+  float device_scale_factor;
+};
+
+class SurfaceIdHandler {
+ public:
+  // Called when a child window allocates a new surface ID.
+  // If the handler wishes to retain ownership of the |surface_info|,
+  // it can move it. If a child's surface has been cleared then
+  // |surface_info| will refer to a null pointer.
+  virtual void OnChildWindowSurfaceChanged(
+      Window* window,
+      std::unique_ptr<SurfaceInfo>* surface_info) = 0;
+};
+
+}  // namespace ui
+
+#endif  // SERVICES_UI_PUBLIC_CPP_SURFACE_ID_HANDLER_H_
diff --git a/services/ui/public/cpp/tests/BUILD.gn b/services/ui/public/cpp/tests/BUILD.gn
index 98cdbb2..c86fa8e 100644
--- a/services/ui/public/cpp/tests/BUILD.gn
+++ b/services/ui/public/cpp/tests/BUILD.gn
@@ -42,8 +42,8 @@
   deps = [
     "//base",
     "//base/test:test_config",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
     "//services/ui/common:mus_common",
     "//services/ui/public/cpp",
     "//testing/gtest",
@@ -68,7 +68,7 @@
     "//mojo/common:common_base",
     "//mojo/edk/system",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/common:mus_common",
     "//services/ui/public/cpp",
     "//services/ui/public/cpp:internal_or_test",
diff --git a/services/ui/public/cpp/tests/test_window_tree.cc b/services/ui/public/cpp/tests/test_window_tree.cc
index e973ad4..eb9784ec 100644
--- a/services/ui/public/cpp/tests/test_window_tree.cc
+++ b/services/ui/public/cpp/tests/test_window_tree.cc
@@ -186,4 +186,8 @@
 
 void TestWindowTree::CancelWindowMove(uint32_t window_id) {}
 
+void TestWindowTree::OnWindowSurfaceDetached(
+    uint32_t window_id,
+    const cc::SurfaceSequence& sequence) {}
+
 }  // namespace ui
diff --git a/services/ui/public/cpp/tests/test_window_tree.h b/services/ui/public/cpp/tests/test_window_tree.h
index 7deed9d..2ac860a 100644
--- a/services/ui/public/cpp/tests/test_window_tree.h
+++ b/services/ui/public/cpp/tests/test_window_tree.h
@@ -113,6 +113,8 @@
                          mojom::MoveLoopSource source,
                          const gfx::Point& cursor_location) override;
   void CancelWindowMove(uint32_t window_id) override;
+  void OnWindowSurfaceDetached(uint32_t window_id,
+                               const cc::SurfaceSequence& sequence) override;
 
   bool got_change_;
   uint32_t change_id_;
diff --git a/services/ui/public/cpp/tests/window_server_shelltest_base.cc b/services/ui/public/cpp/tests/window_server_shelltest_base.cc
index 4a010ef..9635a88 100644
--- a/services/ui/public/cpp/tests/window_server_shelltest_base.cc
+++ b/services/ui/public/cpp/tests/window_server_shelltest_base.cc
@@ -9,8 +9,8 @@
 #include "base/command_line.h"
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/common/switches.h"
 #include "ui/gl/gl_switches.h"
 
@@ -20,16 +20,17 @@
 
 const char kTestAppName[] = "service:mus_ws_unittests_app";
 
-class WindowServerServiceTestClient : public shell::test::ServiceTestClient {
+class WindowServerServiceTestClient
+    : public service_manager::test::ServiceTestClient {
  public:
   explicit WindowServerServiceTestClient(WindowServerServiceTestBase* test)
       : ServiceTestClient(test), test_(test) {}
   ~WindowServerServiceTestClient() override {}
 
  private:
-  // shell::test::ServiceTestClient:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
+  // service_manager::test::ServiceTestClient:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
     return test_->OnConnect(remote_identity, registry);
   }
 
@@ -54,7 +55,7 @@
 
 WindowServerServiceTestBase::~WindowServerServiceTestBase() {}
 
-std::unique_ptr<shell::Service>
+std::unique_ptr<service_manager::Service>
 WindowServerServiceTestBase::CreateService() {
   return base::MakeUnique<WindowServerServiceTestClient>(this);
 }
diff --git a/services/ui/public/cpp/tests/window_server_shelltest_base.h b/services/ui/public/cpp/tests/window_server_shelltest_base.h
index 12bed02..7e6ebab5 100644
--- a/services/ui/public/cpp/tests/window_server_shelltest_base.h
+++ b/services/ui/public/cpp/tests/window_server_shelltest_base.h
@@ -6,23 +6,23 @@
 #define SERVICES_UI_PUBLIC_CPP_TESTS_WINDOW_SERVER_SHELLTEST_BASE_H_
 
 #include "base/macros.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/service_test.h"
 
 namespace ui {
 
 // Base class for all window manager ServiceTests to perform some common setup.
-class WindowServerServiceTestBase : public shell::test::ServiceTest {
+class WindowServerServiceTestBase : public service_manager::test::ServiceTest {
  public:
   WindowServerServiceTestBase();
   ~WindowServerServiceTestBase() override;
 
-  virtual bool OnConnect(const shell::Identity& remote_identity,
-                         shell::InterfaceRegistry* registry) = 0;
+  virtual bool OnConnect(const service_manager::Identity& remote_identity,
+                         service_manager::InterfaceRegistry* registry) = 0;
 
  private:
-  // shell::test::ServiceTest:
-  std::unique_ptr<shell::Service> CreateService() override;
+  // service_manager::test::ServiceTest:
+  std::unique_ptr<service_manager::Service> CreateService() override;
 
   DISALLOW_COPY_AND_ASSIGN(WindowServerServiceTestBase);
 };
diff --git a/services/ui/public/cpp/tests/window_server_test_base.cc b/services/ui/public/cpp/tests/window_server_test_base.cc
index 98c1d720..4ee691e 100644
--- a/services/ui/public/cpp/tests/window_server_test_base.cc
+++ b/services/ui/public/cpp/tests/window_server_test_base.cc
@@ -11,7 +11,7 @@
 #include "base/single_thread_task_runner.h"
 #include "base/test/test_timeouts.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/window.h"
 #include "services/ui/public/cpp/window_tree_client.h"
 #include "services/ui/public/cpp/window_tree_host_factory.h"
@@ -89,8 +89,9 @@
   ASSERT_TRUE(DoRunLoopWithTimeout());  // RunLoop should be quit by OnEmbed().
 }
 
-bool WindowServerTestBase::OnConnect(const shell::Identity& remote_identity,
-                                     shell::InterfaceRegistry* registry) {
+bool WindowServerTestBase::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::WindowTreeClient>(this);
   return true;
 }
@@ -181,8 +182,9 @@
              : mojom::EventResult::UNHANDLED;
 }
 
-void WindowServerTestBase::Create(const shell::Identity& remote_identity,
-                                  mojom::WindowTreeClientRequest request) {
+void WindowServerTestBase::Create(
+    const service_manager::Identity& remote_identity,
+    mojom::WindowTreeClientRequest request) {
   window_tree_clients_.insert(
       base::MakeUnique<WindowTreeClient>(this, nullptr, std::move(request)));
 }
diff --git a/services/ui/public/cpp/tests/window_server_test_base.h b/services/ui/public/cpp/tests/window_server_test_base.h
index 653080a..4339a4a3 100644
--- a/services/ui/public/cpp/tests/window_server_test_base.h
+++ b/services/ui/public/cpp/tests/window_server_test_base.h
@@ -9,7 +9,7 @@
 #include <set>
 
 #include "base/macros.h"
-#include "services/shell/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
 #include "services/ui/public/cpp/tests/window_server_shelltest_base.h"
 #include "services/ui/public/cpp/window_manager_delegate.h"
 #include "services/ui/public/cpp/window_tree_client_delegate.h"
@@ -26,7 +26,7 @@
     : public WindowServerServiceTestBase,
       public WindowTreeClientDelegate,
       public WindowManagerDelegate,
-      public shell::InterfaceFactory<mojom::WindowTreeClient> {
+      public service_manager::InterfaceFactory<mojom::WindowTreeClient> {
  public:
   WindowServerTestBase();
   ~WindowServerTestBase() override;
@@ -67,8 +67,8 @@
   void SetUp() override;
 
   // WindowServerServiceTestBase:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // WindowTreeClientDelegate:
   void OnEmbed(Window* root) override;
@@ -99,7 +99,7 @@
                                    const ui::Event& event) override;
 
   // InterfaceFactory<WindowTreeClient>:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               mojo::InterfaceRequest<mojom::WindowTreeClient> request) override;
 
   // Used to receive the most recent window tree client loaded by an embed
diff --git a/services/ui/public/cpp/window.cc b/services/ui/public/cpp/window.cc
index 966e5188..b7b6998 100644
--- a/services/ui/public/cpp/window.cc
+++ b/services/ui/public/cpp/window.cc
@@ -14,6 +14,7 @@
 #include "base/macros.h"
 #include "services/ui/common/transient_window_utils.h"
 #include "services/ui/public/cpp/property_type_converters.h"
+#include "services/ui/public/cpp/surface_id_handler.h"
 #include "services/ui/public/cpp/window_observer.h"
 #include "services/ui/public/cpp/window_private.h"
 #include "services/ui/public/cpp/window_property.h"
@@ -533,6 +534,10 @@
   if (transient_parent_)
     transient_parent_->LocalRemoveTransientWindow(this);
 
+  // Return the surface reference if there is one.
+  if (surface_info_)
+    LocalSetSurfaceId(nullptr);
+
   // Remove transient children.
   while (!transient_children_.empty()) {
     Window* transient_child = transient_children_.front();
@@ -582,6 +587,7 @@
       // Matches aura, see aura::Window for details.
       observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY),
       input_event_handler_(nullptr),
+      surface_id_handler_(nullptr),
       visible_(false),
       opacity_(1.0f),
       display_id_(display::Display::kInvalidDisplayID),
@@ -790,6 +796,27 @@
       OnWindowSharedPropertyChanged(this, name, old_value_ptr, value));
 }
 
+void Window::LocalSetSurfaceId(std::unique_ptr<SurfaceInfo> surface_info) {
+  if (surface_info_) {
+    const cc::SurfaceId& existing_surface_id = surface_info_->surface_id;
+    cc::SurfaceId new_surface_id =
+        surface_info ? surface_info->surface_id : cc::SurfaceId();
+    if (!existing_surface_id.is_null() &&
+        existing_surface_id != new_surface_id) {
+      // Return the existing surface sequence.
+      if (client_) {
+        client_->OnWindowSurfaceDetached(server_id_,
+                                         surface_info_->surface_sequence);
+      }
+    }
+  }
+  if (parent_ && parent_->surface_id_handler_) {
+    parent_->surface_id_handler_->OnChildWindowSurfaceChanged(this,
+                                                              &surface_info);
+  }
+  surface_info_ = std::move(surface_info);
+}
+
 void Window::NotifyWindowStackingChanged() {
   if (stacking_target_) {
     Children::const_iterator window_i = std::find(
diff --git a/services/ui/public/cpp/window.h b/services/ui/public/cpp/window.h
index af2aae4..b67af74 100644
--- a/services/ui/public/cpp/window.h
+++ b/services/ui/public/cpp/window.h
@@ -12,8 +12,9 @@
 #include "base/macros.h"
 #include "base/observer_list.h"
 #include "mojo/public/cpp/bindings/array.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "services/ui/common/types.h"
+#include "services/ui/public/cpp/surface_id_handler.h"
 #include "services/ui/public/interfaces/mus_constants.mojom.h"
 #include "services/ui/public/interfaces/window_tree.mojom.h"
 #include "ui/gfx/geometry/insets.h"
@@ -27,6 +28,7 @@
 
 class InputEventHandler;
 class ServiceProviderImpl;
+class SurfaceIdHandler;
 class WindowObserver;
 class WindowSurface;
 class WindowSurfaceBinding;
@@ -162,6 +164,10 @@
     input_event_handler_ = input_event_handler;
   }
 
+  void set_surface_id_handler(SurfaceIdHandler* surface_id_handler) {
+    surface_id_handler_ = surface_id_handler;
+  }
+
   // Observation.
   void AddObserver(WindowObserver* observer);
   void RemoveObserver(WindowObserver* observer);
@@ -309,6 +315,7 @@
   void LocalSetPredefinedCursor(mojom::Cursor cursor_id);
   void LocalSetSharedProperty(const std::string& name,
                               const std::vector<uint8_t>* data);
+  void LocalSetSurfaceId(std::unique_ptr<SurfaceInfo> surface_info);
 
   // Notifies this winodw that its stacking position has changed.
   void NotifyWindowStackingChanged();
@@ -356,6 +363,7 @@
 
   base::ObserverList<WindowObserver> observers_;
   InputEventHandler* input_event_handler_;
+  SurfaceIdHandler* surface_id_handler_;
 
   gfx::Rect bounds_;
   gfx::Insets client_area_;
@@ -393,6 +401,8 @@
 
   std::map<const void*, Value> prop_map_;
 
+  std::unique_ptr<SurfaceInfo> surface_info_;
+
   DISALLOW_COPY_AND_ASSIGN(Window);
 };
 
diff --git a/services/ui/public/cpp/window_private.h b/services/ui/public/cpp/window_private.h
index b875b8b..c64b9770 100644
--- a/services/ui/public/cpp/window_private.h
+++ b/services/ui/public/cpp/window_private.h
@@ -11,6 +11,7 @@
 
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/array.h"
+#include "services/ui/public/cpp/surface_id_handler.h"
 #include "services/ui/public/cpp/window.h"
 
 namespace ui {
@@ -87,6 +88,10 @@
                               const std::vector<uint8_t>* data) {
     window_->LocalSetSharedProperty(name, data);
   }
+  void LocalSetSurfaceId(std::unique_ptr<SurfaceInfo> surface_info) {
+    window_->LocalSetSurfaceId(std::move(surface_info));
+  }
+
   void NotifyWindowStackingChanged() { window_->NotifyWindowStackingChanged(); }
 
  private:
diff --git a/services/ui/public/cpp/window_tree_client.cc b/services/ui/public/cpp/window_tree_client.cc
index bd2d357..6106c69 100644
--- a/services/ui/public/cpp/window_tree_client.cc
+++ b/services/ui/public/cpp/window_tree_client.cc
@@ -12,10 +12,11 @@
 
 #include "base/bind.h"
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/common/util.h"
 #include "services/ui/public/cpp/in_flight_change.h"
 #include "services/ui/public/cpp/input_event_handler.h"
+#include "services/ui/public/cpp/surface_id_handler.h"
 #include "services/ui/public/cpp/window_drop_target.h"
 #include "services/ui/public/cpp/window_manager_delegate.h"
 #include "services/ui/public/cpp/window_observer.h"
@@ -118,7 +119,7 @@
 }
 
 void WindowTreeClient::ConnectViaWindowTreeFactory(
-    shell::Connector* connector) {
+    service_manager::Connector* connector) {
   // The client id doesn't really matter, we use 101 purely for debugging.
   client_id_ = 101;
 
@@ -130,7 +131,8 @@
   SetWindowTree(std::move(window_tree));
 }
 
-void WindowTreeClient::ConnectAsWindowManager(shell::Connector* connector) {
+void WindowTreeClient::ConnectAsWindowManager(
+    service_manager::Connector* connector) {
   DCHECK(window_manager_delegate_);
 
   mojom::WindowManagerWindowTreeFactoryPtr factory;
@@ -356,6 +358,13 @@
   tree_->AttachSurface(window_id, type, std::move(surface), std::move(client));
 }
 
+void WindowTreeClient::OnWindowSurfaceDetached(
+    Id window_id,
+    const cc::SurfaceSequence& sequence) {
+  DCHECK(tree_);
+  tree_->OnWindowSurfaceDetached(window_id, sequence);
+}
+
 void WindowTreeClient::LocalSetCapture(Window* window) {
   if (capture_window_ == window)
     return;
@@ -1092,6 +1101,23 @@
   WindowPrivate(window).LocalSetPredefinedCursor(cursor);
 }
 
+void WindowTreeClient::OnWindowSurfaceChanged(
+    Id window_id,
+    const cc::SurfaceId& surface_id,
+    const cc::SurfaceSequence& surface_sequence,
+    const gfx::Size& frame_size,
+    float device_scale_factor) {
+  Window* window = GetWindowByServerId(window_id);
+  if (!window)
+    return;
+  std::unique_ptr<SurfaceInfo> surface_info(base::MakeUnique<SurfaceInfo>());
+  surface_info->surface_id = surface_id;
+  surface_info->surface_sequence = surface_sequence;
+  surface_info->frame_size = frame_size;
+  surface_info->device_scale_factor = device_scale_factor;
+  WindowPrivate(window).LocalSetSurfaceId(std::move(surface_info));
+}
+
 void WindowTreeClient::OnDragDropStart(
     mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) {
   mime_drag_data_ = std::move(mime_data);
diff --git a/services/ui/public/cpp/window_tree_client.h b/services/ui/public/cpp/window_tree_client.h
index 64a45990..bac7249 100644
--- a/services/ui/public/cpp/window_tree_client.h
+++ b/services/ui/public/cpp/window_tree_client.h
@@ -33,7 +33,7 @@
 class Size;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -63,10 +63,10 @@
   ~WindowTreeClient() override;
 
   // Establishes the connection by way of the WindowTreeFactory.
-  void ConnectViaWindowTreeFactory(shell::Connector* connector);
+  void ConnectViaWindowTreeFactory(service_manager::Connector* connector);
 
   // Establishes the connection by way of WindowManagerWindowTreeFactory.
-  void ConnectAsWindowManager(shell::Connector* connector);
+  void ConnectAsWindowManager(service_manager::Connector* connector);
 
   // Wait for OnEmbed(), returning when done.
   void WaitForEmbed();
@@ -133,6 +133,9 @@
                      mojo::InterfaceRequest<mojom::Surface> surface,
                      mojom::SurfaceClientPtr client);
 
+  void OnWindowSurfaceDetached(Id window_id,
+                               const cc::SurfaceSequence& sequence);
+
   // Sets the input capture to |window| without notifying the server.
   void LocalSetCapture(Window* window);
   // Sets focus to |window| without notifying the server.
@@ -328,6 +331,11 @@
   void OnWindowFocused(Id focused_window_id) override;
   void OnWindowPredefinedCursorChanged(Id window_id,
                                        mojom::Cursor cursor) override;
+  void OnWindowSurfaceChanged(Id window_id,
+                              const cc::SurfaceId& surface_id,
+                              const cc::SurfaceSequence& surface_sequence,
+                              const gfx::Size& frame_size,
+                              float device_scale_factor) override;
   void OnDragDropStart(
       mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override;
   void OnDragEnter(Id window_id,
diff --git a/services/ui/public/cpp/window_tree_client_delegate.h b/services/ui/public/cpp/window_tree_client_delegate.h
index a169a421..3664ac28 100644
--- a/services/ui/public/cpp/window_tree_client_delegate.h
+++ b/services/ui/public/cpp/window_tree_client_delegate.h
@@ -7,7 +7,7 @@
 
 #include <string>
 
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
 #include "services/ui/public/interfaces/window_tree.mojom.h"
 
 namespace ui {
diff --git a/services/ui/public/cpp/window_tree_host_factory.cc b/services/ui/public/cpp/window_tree_host_factory.cc
index e69e2060..297e4cad 100644
--- a/services/ui/public/cpp/window_tree_host_factory.cc
+++ b/services/ui/public/cpp/window_tree_host_factory.cc
@@ -5,7 +5,7 @@
 #include "services/ui/public/cpp/window_tree_host_factory.h"
 
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/window_tree_client.h"
 #include "services/ui/public/cpp/window_tree_client_delegate.h"
 
@@ -25,7 +25,7 @@
 }
 
 std::unique_ptr<WindowTreeClient> CreateWindowTreeHost(
-    shell::Connector* connector,
+    service_manager::Connector* connector,
     WindowTreeClientDelegate* delegate,
     mojom::WindowTreeHostPtr* host,
     WindowManagerDelegate* window_manager_delegate) {
diff --git a/services/ui/public/cpp/window_tree_host_factory.h b/services/ui/public/cpp/window_tree_host_factory.h
index e21f39c..01adc7d 100644
--- a/services/ui/public/cpp/window_tree_host_factory.h
+++ b/services/ui/public/cpp/window_tree_host_factory.h
@@ -11,7 +11,7 @@
 #include "services/ui/public/interfaces/window_tree.mojom.h"
 #include "services/ui/public/interfaces/window_tree_host.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -30,7 +30,7 @@
     mojom::WindowTreeHostPtr* host,
     WindowManagerDelegate* window_manager_delegate);
 std::unique_ptr<WindowTreeClient> CreateWindowTreeHost(
-    shell::Connector* connector,
+    service_manager::Connector* connector,
     WindowTreeClientDelegate* delegate,
     mojom::WindowTreeHostPtr* host,
     WindowManagerDelegate* window_manager_delegate);
diff --git a/services/ui/public/interfaces/window_tree.mojom b/services/ui/public/interfaces/window_tree.mojom
index c7f68ed..fb8f8b1 100644
--- a/services/ui/public/interfaces/window_tree.mojom
+++ b/services/ui/public/interfaces/window_tree.mojom
@@ -5,6 +5,7 @@
 module ui.mojom;
 
 import "cc/ipc/surface_id.mojom";
+import "cc/ipc/surface_sequence.mojom";
 import "services/ui/public/interfaces/cursor.mojom";
 import "services/ui/public/interfaces/event_matcher.mojom";
 import "services/ui/public/interfaces/mus_constants.mojom";
@@ -142,6 +143,9 @@
                 Surface& surface,
                 SurfaceClient client);
 
+  // Returns surface reference back to window server for reclamation.
+  OnWindowSurfaceDetached(uint32 window_id, cc.mojom.SurfaceSequence sequence);
+
   // Reparents a window.
   // This fails for any of the following reasons:
   // . |parent| or |child| does not identify a valid window.
@@ -421,6 +425,18 @@
 
   OnWindowPredefinedCursorChanged(uint32 window_id, Cursor cursor_id);
 
+  // Invoked when a client window submits a new surface ID. The surface ID and
+  // associated information is propagated to the parent connection. The parent
+  // compositor can take ownership of this surface ID and embed it along with
+  // the SurfaceSequence, frame_size, and device_scale_factor in a layer.
+  // TODO(fsamuel): Surface IDs should be passed to parents directly instead of
+  // going through the window server. http://crbug.com/655231
+  OnWindowSurfaceChanged(uint32 window_id,
+                         cc.mojom.SurfaceId surface_id,
+                         cc.mojom.SurfaceSequence surface_sequence,
+                         gfx.mojom.Size frame_size,
+                         float device_scale_factor);
+                         
   // Called when the mouse cursor enters a window on this connection for the
   // first time, providing a list of available mime types. We want to send this
   // set of data only one time, so this isn't part of OnDragEnter(), which
diff --git a/services/ui/service.cc b/services/ui/service.cc
index 6f12ae8..c719043 100644
--- a/services/ui/service.cc
+++ b/services/ui/service.cc
@@ -15,9 +15,9 @@
 #include "build/build_config.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "services/catalog/public/cpp/resource_loader.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/ui/clipboard/clipboard_impl.h"
 #include "services/ui/common/switches.h"
@@ -53,7 +53,7 @@
 #include "ui/ozone/public/ozone_platform.h"
 #endif
 
-using shell::Connection;
+using service_manager::Connection;
 using mojo::InterfaceRequest;
 using ui::mojom::WindowServerTest;
 using ui::mojom::WindowTreeHostFactory;
@@ -70,7 +70,7 @@
 
 // TODO(sky): this is a pretty typical pattern, make it easier to do.
 struct Service::PendingRequest {
-  shell::Identity remote_identity;
+  service_manager::Identity remote_identity;
   std::unique_ptr<mojom::WindowTreeFactoryRequest> wtf_request;
   std::unique_ptr<mojom::DisplayManagerRequest> dm_request;
 };
@@ -93,7 +93,7 @@
   window_server_.reset();
 }
 
-void Service::InitializeResources(shell::Connector* connector) {
+void Service::InitializeResources(service_manager::Connector* connector) {
   if (ui::ResourceBundle::HasSharedInstance())
     return;
 
@@ -121,7 +121,7 @@
 }
 
 Service::UserState* Service::GetUserState(
-    const shell::Identity& remote_identity) {
+    const service_manager::Identity& remote_identity) {
   const ws::UserId& user_id = remote_identity.user_id();
   auto it = user_id_to_user_state_.find(user_id);
   if (it != user_id_to_user_state_.end())
@@ -130,11 +130,12 @@
   return user_id_to_user_state_[user_id].get();
 }
 
-void Service::AddUserIfNecessary(const shell::Identity& remote_identity) {
+void Service::AddUserIfNecessary(
+    const service_manager::Identity& remote_identity) {
   window_server_->user_id_tracker()->AddUserId(remote_identity.user_id());
 }
 
-void Service::OnStart(const shell::Identity& identity) {
+void Service::OnStart(const service_manager::Identity& identity) {
   base::PlatformThread::SetName("mus");
   tracing_.Initialize(connector(), identity.name());
   TRACE_EVENT0("mus", "Service::Initialize started");
@@ -193,8 +194,8 @@
   ime_server_.Init(connector());
 }
 
-bool Service::OnConnect(const shell::Identity& remote_identity,
-                        shell::InterfaceRegistry* registry) {
+bool Service::OnConnect(const service_manager::Identity& remote_identity,
+                        service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::AccessibilityManager>(this);
   registry->AddInterface<mojom::Clipboard>(this);
   registry->AddInterface<mojom::DisplayManager>(this);
@@ -257,7 +258,7 @@
   platform_screen_->Init(window_server_->display_manager());
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::AccessibilityManagerRequest request) {
   UserState* user_state = GetUserState(remote_identity);
   if (!user_state->accessibility) {
@@ -268,7 +269,7 @@
   user_state->accessibility->Bind(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::ClipboardRequest request) {
   UserState* user_state = GetUserState(remote_identity);
   if (!user_state->clipboard)
@@ -276,7 +277,7 @@
   user_state->clipboard->AddBinding(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::DisplayManagerRequest request) {
   // DisplayManagerObservers generally expect there to be at least one display.
   if (!window_server_->display_manager()->has_displays()) {
@@ -292,27 +293,27 @@
       ->AddDisplayManagerBinding(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::GpuServiceRequest request) {
   window_server_->gpu_proxy()->Add(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::IMERegistrarRequest request) {
   ime_registrar_.AddBinding(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::IMEServerRequest request) {
   ime_server_.AddBinding(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::UserAccessManagerRequest request) {
   window_server_->user_id_tracker()->Bind(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::UserActivityMonitorRequest request) {
   AddUserIfNecessary(remote_identity);
   const ws::UserId& user_id = remote_identity.user_id();
@@ -320,14 +321,14 @@
       std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::WindowManagerWindowTreeFactoryRequest request) {
   AddUserIfNecessary(remote_identity);
   window_server_->window_manager_window_tree_factory_set()->Add(
     remote_identity.user_id(), std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::WindowTreeFactoryRequest request) {
   AddUserIfNecessary(remote_identity);
   if (!window_server_->display_manager()->has_displays()) {
@@ -345,7 +346,7 @@
                           std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::WindowTreeHostFactoryRequest request) {
   UserState* user_state = GetUserState(remote_identity);
   if (!user_state->window_tree_host_factory) {
@@ -355,7 +356,7 @@
   user_state->window_tree_host_factory->AddBinding(std::move(request));
 }
 
-void Service::Create(const shell::Identity& remote_identity,
+void Service::Create(const service_manager::Identity& remote_identity,
                      mojom::WindowServerTestRequest request) {
   if (!test_config_)
     return;
diff --git a/services/ui/service.h b/services/ui/service.h
index 9e1b6b2..8e7e93c6 100644
--- a/services/ui/service.h
+++ b/services/ui/service.h
@@ -13,9 +13,9 @@
 #include <vector>
 
 #include "base/macros.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/tracing/public/cpp/provider.h"
 #include "services/ui/ime/ime_registrar_impl.h"
 #include "services/ui/ime/ime_server_impl.h"
@@ -48,7 +48,7 @@
 class Rect;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -62,20 +62,21 @@
 }
 
 class Service
-    : public shell::Service,
+    : public service_manager::Service,
       public ws::WindowServerDelegate,
-      public shell::InterfaceFactory<mojom::AccessibilityManager>,
-      public shell::InterfaceFactory<mojom::Clipboard>,
-      public shell::InterfaceFactory<mojom::DisplayManager>,
-      public shell::InterfaceFactory<mojom::GpuService>,
-      public shell::InterfaceFactory<mojom::IMERegistrar>,
-      public shell::InterfaceFactory<mojom::IMEServer>,
-      public shell::InterfaceFactory<mojom::UserAccessManager>,
-      public shell::InterfaceFactory<mojom::UserActivityMonitor>,
-      public shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>,
-      public shell::InterfaceFactory<mojom::WindowTreeFactory>,
-      public shell::InterfaceFactory<mojom::WindowTreeHostFactory>,
-      public shell::InterfaceFactory<mojom::WindowServerTest> {
+      public service_manager::InterfaceFactory<mojom::AccessibilityManager>,
+      public service_manager::InterfaceFactory<mojom::Clipboard>,
+      public service_manager::InterfaceFactory<mojom::DisplayManager>,
+      public service_manager::InterfaceFactory<mojom::GpuService>,
+      public service_manager::InterfaceFactory<mojom::IMERegistrar>,
+      public service_manager::InterfaceFactory<mojom::IMEServer>,
+      public service_manager::InterfaceFactory<mojom::UserAccessManager>,
+      public service_manager::InterfaceFactory<mojom::UserActivityMonitor>,
+      public service_manager::InterfaceFactory<
+          mojom::WindowManagerWindowTreeFactory>,
+      public service_manager::InterfaceFactory<mojom::WindowTreeFactory>,
+      public service_manager::InterfaceFactory<mojom::WindowTreeHostFactory>,
+      public service_manager::InterfaceFactory<mojom::WindowServerTest> {
  public:
   Service();
   ~Service() override;
@@ -88,20 +89,20 @@
 
   using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>;
 
-  void InitializeResources(shell::Connector* connector);
+  void InitializeResources(service_manager::Connector* connector);
 
   // Returns the user specific state for the user id of |remote_identity|.
   // Service owns the return value.
   // TODO(sky): if we allow removal of user ids then we need to close anything
   // associated with the user (all incoming pipes...) on removal.
-  UserState* GetUserState(const shell::Identity& remote_identity);
+  UserState* GetUserState(const service_manager::Identity& remote_identity);
 
-  void AddUserIfNecessary(const shell::Identity& remote_identity);
+  void AddUserIfNecessary(const service_manager::Identity& remote_identity);
 
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override;
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override;
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
   // WindowServerDelegate:
   void OnFirstDisplayReady() override;
@@ -110,53 +111,55 @@
   void CreateDefaultDisplays() override;
   void UpdateTouchTransforms() override;
 
-  // shell::InterfaceFactory<mojom::AccessibilityManager> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::AccessibilityManager>
+  // implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::AccessibilityManagerRequest request) override;
 
-  // shell::InterfaceFactory<mojom::Clipboard> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::Clipboard> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::ClipboardRequest request) override;
 
-  // shell::InterfaceFactory<mojom::DisplayManager> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::DisplayManager> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::DisplayManagerRequest request) override;
 
-  // shell::InterfaceFactory<mojom::GpuService> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::GpuService> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::GpuServiceRequest request) override;
 
-  // shell::InterfaceFactory<mojom::IMERegistrar> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::IMERegistrar> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::IMERegistrarRequest request) override;
 
-  // shell::InterfaceFactory<mojom::IMEServer> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::IMEServer> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::IMEServerRequest request) override;
 
-  // shell::InterfaceFactory<mojom::UserAccessManager> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::UserAccessManager> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::UserAccessManagerRequest request) override;
 
-  // shell::InterfaceFactory<mojom::UserActivityMonitor> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::UserActivityMonitor>
+  // implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::UserActivityMonitorRequest request) override;
 
-  // shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>
+  // service_manager::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>
   // implementation.
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               mojom::WindowManagerWindowTreeFactoryRequest request) override;
 
-  // shell::InterfaceFactory<mojom::WindowTreeFactory>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::WindowTreeFactory>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::WindowTreeFactoryRequest request) override;
 
-  // shell::InterfaceFactory<mojom::WindowTreeHostFactory>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::WindowTreeHostFactory>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::WindowTreeHostFactoryRequest request) override;
 
-  // shell::InterfaceFactory<mojom::WindowServerTest> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::WindowServerTest> implementation.
+  void Create(const service_manager::Identity& remote_identity,
               mojom::WindowServerTestRequest request) override;
 
   std::unique_ptr<ws::WindowServer> window_server_;
@@ -168,7 +171,7 @@
   UserIdToUserState user_id_to_user_state_;
 
   // Provides input-device information via Mojo IPC. Registers Mojo interfaces
-  // and must outlive shell::InterfaceRegistry.
+  // and must outlive service_manager::InterfaceRegistry.
   InputDeviceServer input_device_server_;
 
   bool test_config_;
@@ -177,7 +180,7 @@
 #endif
 
   // Manages display hardware and handles display management. May register Mojo
-  // interfaces and must outlive shell::InterfaceRegistry.
+  // interfaces and must outlive service_manager::InterfaceRegistry.
   std::unique_ptr<display::PlatformScreen> platform_screen_;
 
   std::unique_ptr<ws::TouchController> touch_controller_;
diff --git a/services/ui/surfaces/BUILD.gn b/services/ui/surfaces/BUILD.gn
index deefac2..1a2b750 100644
--- a/services/ui/surfaces/BUILD.gn
+++ b/services/ui/surfaces/BUILD.gn
@@ -12,6 +12,7 @@
     "direct_output_surface.h",
     "display_compositor.cc",
     "display_compositor.h",
+    "display_compositor_client.h",
     "surfaces_context_provider.cc",
     "surfaces_context_provider.h",
     "surfaces_context_provider_delegate.h",
@@ -28,7 +29,7 @@
     "//gpu/command_buffer/client:gles2_implementation",
     "//gpu/command_buffer/client:gles2_interface",
     "//gpu/ipc/client",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/tracing/public/cpp",
     "//services/ui/common:mus_common",
     "//services/ui/public/interfaces",
diff --git a/services/ui/surfaces/DEPS b/services/ui/surfaces/DEPS
index 162b083..99486850 100644
--- a/services/ui/surfaces/DEPS
+++ b/services/ui/surfaces/DEPS
@@ -3,7 +3,7 @@
   "+components/display_compositor",
   "+components/gpu",
   "+gpu",
-  "+services/shell",
+  "+services/service_manager",
   "+mojo/common",
   "+mojo/converters",
   "+mojo/public",
diff --git a/services/ui/surfaces/direct_output_surface.cc b/services/ui/surfaces/direct_output_surface.cc
index 67cd659..02274df 100644
--- a/services/ui/surfaces/direct_output_surface.cc
+++ b/services/ui/surfaces/direct_output_surface.cc
@@ -117,7 +117,7 @@
 }
 
 void DirectOutputSurface::OnSwapBuffersComplete() {
-  client_->DidSwapBuffersComplete();
+  client_->DidReceiveSwapBuffersAck();
 }
 
 }  // namespace ui
diff --git a/services/ui/surfaces/direct_output_surface_ozone.cc b/services/ui/surfaces/direct_output_surface_ozone.cc
index eb37ad7..22fbe00 100644
--- a/services/ui/surfaces/direct_output_surface_ozone.cc
+++ b/services/ui/surfaces/direct_output_surface_ozone.cc
@@ -172,7 +172,7 @@
   }
 
   buffer_queue_->PageFlipComplete();
-  client_->DidSwapBuffersComplete();
+  client_->DidReceiveSwapBuffersAck();
 
   if (force_swap)
     client_->SetNeedsRedrawRect(gfx::Rect(swap_size_));
diff --git a/services/ui/surfaces/display_compositor.cc b/services/ui/surfaces/display_compositor.cc
index 1bc067e..5847814 100644
--- a/services/ui/surfaces/display_compositor.cc
+++ b/services/ui/surfaces/display_compositor.cc
@@ -4,14 +4,38 @@
 
 #include "services/ui/surfaces/display_compositor.h"
 
+#include "services/ui/surfaces/display_compositor_client.h"
+
 namespace ui {
 
-DisplayCompositor::DisplayCompositor() : next_client_id_(1u) {}
-
-DisplayCompositor::~DisplayCompositor() {}
+DisplayCompositor::DisplayCompositor(DisplayCompositorClient* client)
+    : client_(client), next_client_id_(1u) {
+  manager_.AddObserver(this);
+}
 
 uint32_t DisplayCompositor::GenerateNextClientId() {
   return next_client_id_++;
 }
 
+void DisplayCompositor::ReturnSurfaceReference(
+    const cc::SurfaceSequence& sequence) {
+  std::vector<uint32_t> sequences;
+  sequences.push_back(sequence.sequence);
+  manager_.DidSatisfySequences(sequence.frame_sink_id, &sequences);
+}
+
+DisplayCompositor::~DisplayCompositor() {
+  manager_.RemoveObserver(this);
+}
+
+void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceId& surface_id,
+                                         const gfx::Size& frame_size,
+                                         float device_scale_factor) {
+  if (client_)
+    client_->OnSurfaceCreated(surface_id, frame_size, device_scale_factor);
+}
+
+void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id,
+                                         bool* changed) {}
+
 }  // namespace ui
diff --git a/services/ui/surfaces/display_compositor.h b/services/ui/surfaces/display_compositor.h
index a59fe9e..2498bac 100644
--- a/services/ui/surfaces/display_compositor.h
+++ b/services/ui/surfaces/display_compositor.h
@@ -10,6 +10,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "cc/surfaces/surface_manager.h"
+#include "cc/surfaces/surface_observer.h"
 
 namespace cc {
 class SurfaceHittest;
@@ -18,26 +19,36 @@
 
 namespace ui {
 
+class DisplayCompositorClient;
+
 // The DisplayCompositor object is an object global to the Window Server app
 // that holds the SurfaceServer and allocates new Surfaces namespaces.
 // This object lives on the main thread of the Window Server.
 // TODO(rjkroege, fsamuel): This object will need to change to support multiple
 // displays.
-class DisplayCompositor : public base::RefCounted<DisplayCompositor> {
+class DisplayCompositor : public cc::SurfaceObserver,
+                          public base::RefCounted<DisplayCompositor> {
  public:
-  DisplayCompositor();
+  explicit DisplayCompositor(DisplayCompositorClient* client);
 
   uint32_t GenerateNextClientId();
 
+  void ReturnSurfaceReference(const cc::SurfaceSequence& sequence);
+
   cc::SurfaceManager* manager() { return &manager_; }
 
  private:
   friend class base::RefCounted<DisplayCompositor>;
-  ~DisplayCompositor();
+  virtual ~DisplayCompositor();
 
-  // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated
-  // by the Surfaces service, and the low 32-bits are generated by the process
-  // that requested the Surface.
+  // cc::SurfaceObserver implementation.
+  void OnSurfaceCreated(const cc::SurfaceId& surface_id,
+                        const gfx::Size& frame_size,
+                        float device_scale_factor) override;
+  void OnSurfaceDamaged(const cc::SurfaceId& surface_id,
+                        bool* changed) override;
+
+  DisplayCompositorClient* const client_;
   uint32_t next_client_id_;
   cc::SurfaceManager manager_;
 
diff --git a/services/ui/surfaces/display_compositor_client.h b/services/ui/surfaces/display_compositor_client.h
new file mode 100644
index 0000000..5d7436b
--- /dev/null
+++ b/services/ui/surfaces/display_compositor_client.h
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_CLIENT_H_
+#define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_CLIENT_H_
+
+namespace ui {
+
+// TODO(fsamuel: In the future, this will be a mojo interface from mus-gpu to
+// mus-ws.
+class DisplayCompositorClient {
+ public:
+  virtual void OnSurfaceCreated(const cc::SurfaceId& surface_id,
+                                const gfx::Size& frame_size,
+                                float device_scale_factor) = 0;
+
+ protected:
+  virtual ~DisplayCompositorClient() {}
+};
+
+}  // namespace ui
+
+#endif  // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_CLIENT_H_
diff --git a/services/ui/test_wm/BUILD.gn b/services/ui/test_wm/BUILD.gn
index 2b2c8d6..d8ba438 100644
--- a/services/ui/test_wm/BUILD.gn
+++ b/services/ui/test_wm/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 
 service("test_wm") {
   sources = [
@@ -12,7 +12,7 @@
 
   deps = [
     "//base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
     "//ui/display",
diff --git a/services/ui/test_wm/manifest.json b/services/ui/test_wm/manifest.json
index a265e60..45e4d0e 100644
--- a/services/ui/test_wm/manifest.json
+++ b/services/ui/test_wm/manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Test Window Manager",
   "capabilities": {
     "required": {
-      "service:ui": { "classes": [ "ui:window_manager" ] }
+      "service:ui": [ "ui:window_manager" ]
     }
   }
 }
diff --git a/services/ui/test_wm/test_wm.cc b/services/ui/test_wm/test_wm.cc
index 037f78c..0a83940 100644
--- a/services/ui/test_wm/test_wm.cc
+++ b/services/ui/test_wm/test_wm.cc
@@ -6,10 +6,10 @@
 #include <utility>
 
 #include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/ui/public/cpp/window.h"
 #include "services/ui/public/cpp/window_manager_delegate.h"
 #include "services/ui/public/cpp/window_tree_client.h"
@@ -19,7 +19,7 @@
 namespace ui {
 namespace test {
 
-class TestWM : public shell::Service,
+class TestWM : public service_manager::Service,
                public ui::WindowTreeClientDelegate,
                public ui::WindowManagerDelegate {
  public:
@@ -27,8 +27,8 @@
   ~TestWM() override {}
 
  private:
-  // shell::Service:
-  void OnStart(const shell::Identity& identity) override {
+  // service_manager::Service:
+  void OnStart(const service_manager::Identity& identity) override {
     window_tree_client_.reset(new ui::WindowTreeClient(this, this));
     window_tree_client_->ConnectAsWindowManager(connector());
   }
@@ -109,6 +109,6 @@
 }  // namespace ui
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  shell::ServiceRunner runner(new ui::test::TestWM);
+  service_manager::ServiceRunner runner(new ui::test::TestWM);
   return runner.Run(service_request_handle);
 }
diff --git a/services/ui/ws/BUILD.gn b/services/ui/ws/BUILD.gn
index 975f5be..8e36790 100644
--- a/services/ui/ws/BUILD.gn
+++ b/services/ui/ws/BUILD.gn
@@ -4,8 +4,8 @@
 
 import("//build/config/ui.gni")
 import("//testing/test.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 
 static_library("lib") {
   sources = [
@@ -128,8 +128,8 @@
     "//cc/surfaces:surface_id",
     "//mojo/common:common_base",
     "//mojo/public/cpp/bindings",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/tracing/public/cpp",
     "//services/ui/common:mus_common",
     "//services/ui/display",
@@ -235,10 +235,10 @@
     "//cc:cc",
     "//gpu/ipc/client",
     "//mojo/public/cpp/bindings:bindings",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp:sources",
-    "//services/shell/public/cpp/test:run_all_shelltests",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp:sources",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/interfaces",
     "//services/ui/common:mus_common",
     "//services/ui/public/cpp",
     "//services/ui/public/cpp:internal_or_test",
diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc
index 261c1ef..19a73ca 100644
--- a/services/ui/ws/display.cc
+++ b/services/ui/ws/display.cc
@@ -11,7 +11,7 @@
 #include "base/debug/debugger.h"
 #include "base/strings/utf_string_conversions.h"
 #include "mojo/common/common_type_converters.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 #include "services/ui/common/types.h"
 #include "services/ui/public/interfaces/cursor.mojom.h"
 #include "services/ui/ws/display_binding.h"
@@ -233,7 +233,7 @@
     WindowManagerDisplayRoot* display_root = display_root_ptr.get();
     // For this case we never create additional displays roots, so any
     // id works.
-    window_manager_display_root_map_[shell::mojom::kRootUserID] =
+    window_manager_display_root_map_[service_manager::mojom::kRootUserID] =
         display_root_ptr.get();
     WindowTree* window_tree = binding_->CreateWindowTree(display_root->root());
     display_root->window_manager_state_ = window_tree->window_manager_state();
diff --git a/services/ui/ws/display_binding.cc b/services/ui/ws/display_binding.cc
index 5883504..f70c92b 100644
--- a/services/ui/ws/display_binding.cc
+++ b/services/ui/ws/display_binding.cc
@@ -5,7 +5,7 @@
 #include "services/ui/ws/display_binding.h"
 
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 #include "services/ui/ws/display.h"
 #include "services/ui/ws/window_manager_access_policy.h"
 #include "services/ui/ws/window_server.h"
diff --git a/services/ui/ws/frame_generator_unittest.cc b/services/ui/ws/frame_generator_unittest.cc
index 496ce9d..cb7e7ba 100644
--- a/services/ui/ws/frame_generator_unittest.cc
+++ b/services/ui/ws/frame_generator_unittest.cc
@@ -36,7 +36,7 @@
 
 class FrameGeneratorTest : public testing::Test {
  public:
-  FrameGeneratorTest() : display_compositor_(new DisplayCompositor()) {}
+  FrameGeneratorTest() : display_compositor_(new DisplayCompositor(nullptr)) {}
   ~FrameGeneratorTest() override {}
 
   // Calls DrawWindowTree() on |frame_generator_|
diff --git a/services/ui/ws/gpu_service_proxy.cc b/services/ui/ws/gpu_service_proxy.cc
index cc8bc49..2beb73c 100644
--- a/services/ui/ws/gpu_service_proxy.cc
+++ b/services/ui/ws/gpu_service_proxy.cc
@@ -9,7 +9,7 @@
 #include "base/run_loop.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "gpu/ipc/client/gpu_channel_host.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 #include "services/ui/ws/gpu_service_proxy_delegate.h"
 #include "services/ui/ws/mus_gpu_memory_buffer_manager.h"
 
diff --git a/services/ui/ws/mus_ws_unittests_app_manifest.json b/services/ui/ws/mus_ws_unittests_app_manifest.json
index 978b8df..1017887 100644
--- a/services/ui/ws/mus_ws_unittests_app_manifest.json
+++ b/services/ui/ws/mus_ws_unittests_app_manifest.json
@@ -9,11 +9,9 @@
       ]
     },
     "required": {
-      "*": { "classes": [ "app" ] },
-      "service:mus_ws_unittests_app": {
-        "classes": [ "ui:window_tree_client" ]
-      },
-      "service:ui": { "classes": [ "ui:window_tree_host_factory" ] }
+      "*": [ "app" ],
+      "service:mus_ws_unittests_app": [ "ui:window_tree_client" ],
+      "service:ui": [ "ui:window_tree_host_factory" ]
     }
   }
 }
diff --git a/services/ui/ws/platform_display.cc b/services/ui/ws/platform_display.cc
index c9ff1b06..35d7f9b7 100644
--- a/services/ui/ws/platform_display.cc
+++ b/services/ui/ws/platform_display.cc
@@ -10,8 +10,8 @@
 #include "cc/output/copy_output_request.h"
 #include "cc/output/delegated_frame_data.h"
 #include "gpu/ipc/client/gpu_channel_host.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/display/platform_screen.h"
 #include "services/ui/surfaces/compositor_frame_sink.h"
 #include "services/ui/surfaces/display_compositor.h"
diff --git a/services/ui/ws/server_window_surface.cc b/services/ui/ws/server_window_surface.cc
index 48f4fd5..01de602 100644
--- a/services/ui/ws/server_window_surface.cc
+++ b/services/ui/ws/server_window_surface.cc
@@ -30,6 +30,7 @@
   cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager();
   surface_manager->RegisterFrameSinkId(frame_sink_id_);
   surface_manager->RegisterSurfaceFactoryClient(frame_sink_id_, this);
+  surface_sequence_generator_.set_frame_sink_id(frame_sink_id_);
 }
 
 ServerWindowSurface::~ServerWindowSurface() {
@@ -68,6 +69,10 @@
   return cc::SurfaceId(frame_sink_id_, local_frame_id_);
 }
 
+cc::SurfaceSequence ServerWindowSurface::CreateSurfaceSequence() {
+  return surface_sequence_generator_.CreateSurfaceSequence();
+}
+
 ServerWindow* ServerWindowSurface::window() {
   return manager_->window();
 }
diff --git a/services/ui/ws/server_window_surface.h b/services/ui/ws/server_window_surface.h
index 8b5dfd9b..1a606c2 100644
--- a/services/ui/ws/server_window_surface.h
+++ b/services/ui/ws/server_window_surface.h
@@ -14,6 +14,7 @@
 #include "cc/surfaces/surface_factory_client.h"
 #include "cc/surfaces/surface_id.h"
 #include "cc/surfaces/surface_id_allocator.h"
+#include "cc/surfaces/surface_sequence_generator.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "services/ui/public/interfaces/surface.mojom.h"
 #include "services/ui/public/interfaces/window_tree.mojom.h"
@@ -66,6 +67,10 @@
 
   cc::SurfaceId GetSurfaceId() const;
 
+  // Creates a surface dependency token that expires when this
+  // ServerWindowSurface goes away.
+  cc::SurfaceSequence CreateSurfaceSequence();
+
   ServerWindow* window();
 
  private:
@@ -75,6 +80,7 @@
   void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
 
   const cc::FrameSinkId frame_sink_id_;
+  cc::SurfaceSequenceGenerator surface_sequence_generator_;
 
   ServerWindowSurfaceManager* manager_;  // Owns this.
 
diff --git a/services/ui/ws/test_change_tracker.cc b/services/ui/ws/test_change_tracker.cc
index cf9deb3..c5350be 100644
--- a/services/ui/ws/test_change_tracker.cc
+++ b/services/ui/ws/test_change_tracker.cc
@@ -142,6 +142,10 @@
       return base::StringPrintf("OpacityChanged window_id=%s opacity=%.2f",
                                 WindowIdToString(change.window_id).c_str(),
                                 change.float_value);
+    case CHANGE_TYPE_SURFACE_CHANGED:
+      return base::StringPrintf("SurfaceCreated window_id=%s surface_id=%s",
+                                WindowIdToString(change.window_id).c_str(),
+                                change.surface_id.ToString().c_str());
   }
   return std::string();
 }
@@ -421,6 +425,22 @@
   AddChange(change);
 }
 
+void TestChangeTracker::OnWindowSurfaceChanged(
+    Id window_id,
+    const cc::SurfaceId& surface_id,
+    const cc::SurfaceSequence& surface_sequence,
+    const gfx::Size& frame_size,
+    float device_scale_factor) {
+  Change change;
+  change.type = CHANGE_TYPE_SURFACE_CHANGED;
+  change.window_id = window_id;
+  change.surface_id = surface_id;
+  change.surface_sequence = surface_sequence;
+  change.frame_size = frame_size;
+  change.device_scale_factor = device_scale_factor;
+  AddChange(change);
+}
+
 void TestChangeTracker::AddChange(const Change& change) {
   changes_.push_back(change);
   if (delegate_)
diff --git a/services/ui/ws/test_change_tracker.h b/services/ui/ws/test_change_tracker.h
index cbc0656..47c76bf 100644
--- a/services/ui/ws/test_change_tracker.h
+++ b/services/ui/ws/test_change_tracker.h
@@ -42,6 +42,7 @@
   CHANGE_TYPE_ON_CHANGE_COMPLETED,
   CHANGE_TYPE_ON_TOP_LEVEL_CREATED,
   CHANGE_TYPE_OPACITY,
+  CHANGE_TYPE_SURFACE_CHANGED,
 };
 
 // TODO(sky): consider nuking and converting directly to WindowData.
@@ -87,6 +88,10 @@
   std::string property_value;
   int32_t cursor_id;
   uint32_t change_id;
+  cc::SurfaceId surface_id;
+  cc::SurfaceSequence surface_sequence;
+  gfx::Size frame_size;
+  float device_scale_factor;
 };
 
 // Converts Changes to string descriptions.
@@ -169,6 +174,11 @@
   void OnTopLevelCreated(uint32_t change_id,
                          mojom::WindowDataPtr window_data,
                          bool drawn);
+  void OnWindowSurfaceChanged(Id window_id,
+                              const cc::SurfaceId& surface_id,
+                              const cc::SurfaceSequence& surface_sequence,
+                              const gfx::Size& frame_size,
+                              float device_scale_factor);
 
  private:
   void AddChange(const Change& change);
diff --git a/services/ui/ws/test_server_window_delegate.cc b/services/ui/ws/test_server_window_delegate.cc
index 2d926c4a..bc232800 100644
--- a/services/ui/ws/test_server_window_delegate.cc
+++ b/services/ui/ws/test_server_window_delegate.cc
@@ -11,7 +11,8 @@
 namespace ws {
 
 TestServerWindowDelegate::TestServerWindowDelegate()
-    : root_window_(nullptr), display_compositor_(new DisplayCompositor()) {}
+    : root_window_(nullptr),
+      display_compositor_(new DisplayCompositor(nullptr)) {}
 
 TestServerWindowDelegate::~TestServerWindowDelegate() {}
 
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc
index e842ca8..f5b9ea86 100644
--- a/services/ui/ws/test_utils.cc
+++ b/services/ui/ws/test_utils.cc
@@ -9,7 +9,7 @@
 #include "base/memory/ptr_util.h"
 #include "cc/output/copy_output_request.h"
 #include "gpu/ipc/client/gpu_channel_host.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 #include "services/ui/public/interfaces/cursor.mojom.h"
 #include "services/ui/surfaces/display_compositor.h"
 #include "services/ui/ws/display_binding.h"
@@ -191,8 +191,9 @@
 WindowTree* TestDisplayBinding::CreateWindowTree(ServerWindow* root) {
   const uint32_t embed_flags = 0;
   WindowTree* tree = window_server_->EmbedAtWindow(
-      root, shell::mojom::kRootUserID, ui::mojom::WindowTreeClientPtr(),
-      embed_flags, base::WrapUnique(new WindowManagerAccessPolicy));
+      root, service_manager::mojom::kRootUserID,
+      ui::mojom::WindowTreeClientPtr(), embed_flags,
+      base::WrapUnique(new WindowManagerAccessPolicy));
   tree->ConfigureWindowManager();
   return tree;
 }
@@ -357,6 +358,13 @@
   tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
 }
 
+void TestWindowTreeClient::OnWindowSurfaceChanged(
+    Id window_id,
+    const cc::SurfaceId& surface_id,
+    const cc::SurfaceSequence& surface_sequence,
+    const gfx::Size& frame_size,
+    float device_scale_factor) {}
+
 void TestWindowTreeClient::OnDragDropStart(
     mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) {}
 
@@ -485,7 +493,7 @@
     : wm_client_(nullptr),
       display_binding_(nullptr),
       display_(nullptr),
-      display_compositor_(new DisplayCompositor()) {
+      display_compositor_(new DisplayCompositor(nullptr)) {
   PlatformDisplayInitParams display_init_params;
   display_init_params.display_compositor = display_compositor_;
   display_ = new Display(window_server(), display_init_params);
diff --git a/services/ui/ws/test_utils.h b/services/ui/ws/test_utils.h
index a6f52e8..0a1917de 100644
--- a/services/ui/ws/test_utils.h
+++ b/services/ui/ws/test_utils.h
@@ -437,6 +437,11 @@
   void OnWindowFocused(uint32_t focused_window_id) override;
   void OnWindowPredefinedCursorChanged(uint32_t window_id,
                                        mojom::Cursor cursor_id) override;
+  void OnWindowSurfaceChanged(Id window_id,
+                              const cc::SurfaceId& surface_id,
+                              const cc::SurfaceSequence& surface_sequence,
+                              const gfx::Size& frame_size,
+                              float device_scale_factor) override;
   void OnDragDropStart(
       mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) override;
   void OnDragEnter(uint32_t window,
diff --git a/services/ui/ws/user_id_tracker.cc b/services/ui/ws/user_id_tracker.cc
index 3b3e198..d3e4b2a 100644
--- a/services/ui/ws/user_id_tracker.cc
+++ b/services/ui/ws/user_id_tracker.cc
@@ -4,13 +4,14 @@
 
 #include "services/ui/ws/user_id_tracker.h"
 
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 #include "services/ui/ws/user_id_tracker_observer.h"
 
 namespace ui {
 namespace ws {
 
-UserIdTracker::UserIdTracker() : active_id_(shell::mojom::kRootUserID) {
+UserIdTracker::UserIdTracker()
+    : active_id_(service_manager::mojom::kRootUserID) {
   ids_.insert(active_id_);
 }
 
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
index 9dfd741..b00cef21 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -7,7 +7,7 @@
 #include <utility>
 
 #include "base/memory/weak_ptr.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 #include "services/ui/common/event_matcher_util.h"
 #include "services/ui/ws/accelerator.h"
 #include "services/ui/ws/display_manager.h"
diff --git a/services/ui/ws/window_manager_state_unittest.cc b/services/ui/ws/window_manager_state_unittest.cc
index dc27ed9..31d78604 100644
--- a/services/ui/ws/window_manager_state_unittest.cc
+++ b/services/ui/ws/window_manager_state_unittest.cc
@@ -11,7 +11,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/test/test_simple_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 #include "services/ui/common/event_matcher_util.h"
 #include "services/ui/surfaces/display_compositor.h"
 #include "services/ui/ws/accelerator.h"
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc
index ad3286e..3a463cc 100644
--- a/services/ui/ws/window_server.cc
+++ b/services/ui/ws/window_server.cc
@@ -10,7 +10,7 @@
 #include "base/logging.h"
 #include "base/memory/ptr_util.h"
 #include "base/stl_util.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 #include "services/ui/ws/display.h"
 #include "services/ui/ws/display_binding.h"
 #include "services/ui/ws/display_manager.h"
@@ -46,7 +46,7 @@
 
 WindowServer::WindowServer(WindowServerDelegate* delegate)
     : delegate_(delegate),
-      display_compositor_(new DisplayCompositor()),
+      display_compositor_(new DisplayCompositor(this)),
       next_client_id_(1),
       display_manager_(new DisplayManager(this, &user_id_tracker_)),
       current_operation_(nullptr),
@@ -799,6 +799,28 @@
     display->platform_display()->OnGpuChannelEstablished(gpu_channel_);
 }
 
+void WindowServer::OnSurfaceCreated(const cc::SurfaceId& surface_id,
+                                    const gfx::Size& frame_size,
+                                    float device_scale_factor) {
+  WindowId window_id(
+      WindowIdFromTransportId(surface_id.frame_sink_id().client_id()));
+  mojom::SurfaceType surface_type(
+      static_cast<mojom::SurfaceType>(surface_id.frame_sink_id().sink_id()));
+  // We only care about propagating default surface IDs.
+  // TODO(fsamuel, sadrul): we should get rid of surface types.
+  if (surface_type != mojom::SurfaceType::DEFAULT)
+    return;
+  ServerWindow* window = GetWindow(window_id);
+  // If the window doesn't have a parent then we have nothing to propagate.
+  if (!window || !window->parent())
+    return;
+  WindowTree* window_tree = GetTreeWithId(window->parent()->id().client_id);
+  if (window_tree) {
+    window_tree->ProcessWindowSurfaceChanged(window, surface_id, frame_size,
+                                             device_scale_factor);
+  }
+}
+
 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id,
                                          const UserId& active_id) {
   if (IsUserInHighContrastMode(previously_active_id) ==
diff --git a/services/ui/ws/window_server.h b/services/ui/ws/window_server.h
index 265ac56..a572c5e3 100644
--- a/services/ui/ws/window_server.h
+++ b/services/ui/ws/window_server.h
@@ -20,6 +20,7 @@
 #include "services/ui/public/interfaces/window_tree.mojom.h"
 #include "services/ui/public/interfaces/window_tree_host.mojom.h"
 #include "services/ui/surfaces/display_compositor.h"
+#include "services/ui/surfaces/display_compositor_client.h"
 #include "services/ui/ws/display.h"
 #include "services/ui/ws/gpu_service_proxy_delegate.h"
 #include "services/ui/ws/ids.h"
@@ -50,7 +51,8 @@
                      public ServerWindowObserver,
                      public GpuServiceProxyDelegate,
                      public UserDisplayManagerDelegate,
-                     public UserIdTrackerObserver {
+                     public UserIdTrackerObserver,
+                     public DisplayCompositorClient {
  public:
   explicit WindowServer(WindowServerDelegate* delegate);
   ~WindowServer() override;
@@ -194,6 +196,11 @@
   void ProcessWindowDeleted(ServerWindow* window);
   void ProcessWillChangeWindowPredefinedCursor(ServerWindow* window,
                                                mojom::Cursor cursor_id);
+  void ProcessWindowSurfaceCreated(ServerWindow* window,
+                                   mojom::SurfaceType surface_type,
+                                   const cc::SurfaceId& surface_id,
+                                   const gfx::Size& frame_size,
+                                   float device_scale_factor);
 
   // Sends an |event| to all WindowTrees belonging to |user_id| that might be
   // observing events. Skips |ignore_tree| if it is non-null. |target_window| is
@@ -333,6 +340,11 @@
   void OnGpuChannelEstablished(
       scoped_refptr<gpu::GpuChannelHost> gpu_channel) override;
 
+  // DisplayCompositorClient:
+  void OnSurfaceCreated(const cc::SurfaceId& surface_id,
+                        const gfx::Size& frame_size,
+                        float device_scale_factor) override;
+
   // UserIdTrackerObserver:
   void OnActiveUserIdChanged(const UserId& previously_active_id,
                              const UserId& active_id) override;
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index d79f72f7..9a99c46 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -20,6 +20,7 @@
 #include "services/ui/ws/platform_display.h"
 #include "services/ui/ws/server_window.h"
 #include "services/ui/ws/server_window_observer.h"
+#include "services/ui/ws/server_window_surface_manager.h"
 #include "services/ui/ws/user_display_manager.h"
 #include "services/ui/ws/window_manager_display_root.h"
 #include "services/ui/ws/window_manager_state.h"
@@ -756,6 +757,26 @@
                                      transient_client_window_id.id);
 }
 
+void WindowTree::ProcessWindowSurfaceChanged(ServerWindow* window,
+                                             const cc::SurfaceId& surface_id,
+                                             const gfx::Size& frame_size,
+                                             float device_scale_factor) {
+  ServerWindow* parent_window = window->parent();
+  ClientWindowId client_window_id, parent_client_window_id;
+  if (!IsWindowKnown(window, &client_window_id) ||
+      !IsWindowKnown(parent_window, &parent_client_window_id) ||
+      !created_window_map_.count(parent_window->id())) {
+    return;
+  }
+
+  ServerWindowSurfaceManager* surface_manager =
+      window->GetOrCreateSurfaceManager();
+  ServerWindowSurface* surface = surface_manager->GetDefaultSurface();
+  cc::SurfaceSequence sequence = surface->CreateSurfaceSequence();
+  client()->OnWindowSurfaceChanged(client_window_id.id, surface_id, sequence,
+                                   frame_size, device_scale_factor);
+}
+
 void WindowTree::SendToPointerWatcher(const ui::Event& event,
                                       ServerWindow* target_window) {
   if (!EventMatchesPointerWatcher(event))
@@ -1339,6 +1360,15 @@
   window->CreateSurface(type, std::move(surface), std::move(client));
 }
 
+void WindowTree::OnWindowSurfaceDetached(Id transport_window_id,
+                                         const cc::SurfaceSequence& sequence) {
+  ServerWindow* window =
+      GetWindowByClientId(ClientWindowId(transport_window_id));
+  if (!window)
+    return;
+  window_server_->GetDisplayCompositor()->ReturnSurfaceReference(sequence);
+}
+
 void WindowTree::SetWindowTextInputState(Id transport_window_id,
                                          mojo::TextInputStatePtr state) {
   ServerWindow* window =
diff --git a/services/ui/ws/window_tree.h b/services/ui/ws/window_tree.h
index 4268d0e..0fc9476 100644
--- a/services/ui/ws/window_tree.h
+++ b/services/ui/ws/window_tree.h
@@ -256,6 +256,10 @@
   void ProcessTransientWindowRemoved(const ServerWindow* window,
                                      const ServerWindow* transient_window,
                                      bool originated_change);
+  void ProcessWindowSurfaceChanged(ServerWindow* window,
+                                   const cc::SurfaceId& surface_id,
+                                   const gfx::Size& frame_size,
+                                   float device_scale_factor);
 
   // Sends this event to the client if it matches an active pointer watcher.
   // |target_window| is the target of the event, and may be null or not known
@@ -413,6 +417,8 @@
                      mojom::SurfaceType type,
                      mojo::InterfaceRequest<mojom::Surface> surface,
                      mojom::SurfaceClientPtr client) override;
+  void OnWindowSurfaceDetached(Id transport_window_id,
+                               const cc::SurfaceSequence& sequence) override;
   void Embed(Id transport_window_id,
              mojom::WindowTreeClientPtr client,
              uint32_t flags,
diff --git a/services/ui/ws/window_tree_client_unittest.cc b/services/ui/ws/window_tree_client_unittest.cc
index 1f02766..013d54b 100644
--- a/services/ui/ws/window_tree_client_unittest.cc
+++ b/services/ui/ws/window_tree_client_unittest.cc
@@ -11,7 +11,7 @@
 #include "base/run_loop.h"
 #include "base/strings/stringprintf.h"
 #include "mojo/public/cpp/bindings/associated_binding.h"
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/ui/public/cpp/tests/window_server_shelltest_base.h"
 #include "services/ui/public/interfaces/window_tree.mojom.h"
 #include "services/ui/public/interfaces/window_tree_host.mojom.h"
@@ -19,9 +19,9 @@
 #include "services/ui/ws/test_change_tracker.h"
 
 using mojo::Array;
-using shell::Connection;
+using service_manager::Connection;
 using mojo::InterfaceRequest;
-using shell::Service;
+using service_manager::Service;
 using mojo::String;
 using ui::mojom::WindowDataPtr;
 using ui::mojom::WindowTree;
@@ -58,7 +58,7 @@
 
 // -----------------------------------------------------------------------------
 
-bool EmbedUrl(shell::Connector* connector,
+bool EmbedUrl(service_manager::Connector* connector,
               WindowTree* tree,
               const String& url,
               Id root_id) {
@@ -377,6 +377,15 @@
     NOTIMPLEMENTED();
   }
 
+  void OnWindowSurfaceChanged(Id window_id,
+                              const cc::SurfaceId& surface_id,
+                              const cc::SurfaceSequence& surface_sequence,
+                              const gfx::Size& frame_size,
+                              float device_scale_factor) override {
+    tracker_.OnWindowSurfaceChanged(window_id, surface_id, surface_sequence,
+                                    frame_size, device_scale_factor);
+  }
+
   void OnDragEnter(uint32_t window,
                    uint32_t key_state,
                    const gfx::Point& position,
@@ -497,7 +506,7 @@
 
 // InterfaceFactory for vending TestWindowTreeClients.
 class WindowTreeClientFactory
-    : public shell::InterfaceFactory<WindowTreeClient> {
+    : public service_manager::InterfaceFactory<WindowTreeClient> {
  public:
   WindowTreeClientFactory() {}
   ~WindowTreeClientFactory() override {}
@@ -515,7 +524,7 @@
 
  private:
   // InterfaceFactory<WindowTreeClient>:
-  void Create(const shell::Identity& remote_identity,
+  void Create(const service_manager::Identity& remote_identity,
               InterfaceRequest<WindowTreeClient> request) override {
     client_impl_ = base::MakeUnique<TestWindowTreeClient>();
     client_impl_->Bind(std::move(request));
@@ -624,8 +633,8 @@
   }
 
   // WindowServerServiceTestBase:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override {
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override {
     registry->AddInterface(client_factory_.get());
     return true;
   }
@@ -2112,6 +2121,56 @@
   EXPECT_TRUE(changes1()->empty());
 }
 
+TEST_F(WindowTreeClientTest, SurfaceIdPropagation) {
+  const Id window_1_100 = wt_client1()->NewWindow(100);
+  ASSERT_TRUE(window_1_100);
+  ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100));
+
+  // Establish the second client at 1,100.
+  ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_100));
+
+  // 1,100 is the id in the wt_client1's id space. The new client should see
+  // 2,1 (the server id).
+  const Id window_1_100_in_ws2 = BuildWindowId(client_id_1(), 1);
+  EXPECT_EQ(window_1_100_in_ws2, wt_client2()->root_window_id());
+
+  // The first window created in the second client gets a server id of 2,1
+  // regardless of the id the client uses.
+  const Id window_2_101 = wt_client2()->NewWindow(101);
+  ASSERT_TRUE(wt_client2()->AddWindow(window_1_100_in_ws2, window_2_101));
+  const Id window_2_101_in_ws1 = BuildWindowId(client_id_2(), 1);
+  wt_client1()->WaitForChangeCount(1);
+  EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) +
+                " old_parent=null new_parent=" + IdToString(window_1_100),
+            SingleChangeToDescription(*changes1()));
+  changes1()->clear();
+
+  // Submit a CompositorFrame to window_2_101 and make sure server gets it.
+  mojom::SurfacePtr surface_ptr;
+  mojom::SurfaceClientRequest client_request;
+  mojom::SurfaceClientPtr surface_client_ptr;
+  client_request = mojo::GetProxy(&surface_client_ptr);
+  wt2()->AttachSurface(window_2_101, mojom::SurfaceType::DEFAULT,
+                       mojo::GetProxy(&surface_ptr),
+                       std::move(surface_client_ptr));
+  cc::CompositorFrame compositor_frame;
+  compositor_frame.delegated_frame_data =
+      base::MakeUnique<cc::DelegatedFrameData>();
+  std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
+  gfx::Rect frame_rect(0, 0, 100, 100);
+  render_pass->SetNew(cc::RenderPassId(1, 1), frame_rect, frame_rect,
+                      gfx::Transform());
+  compositor_frame.delegated_frame_data->render_pass_list.push_back(
+      std::move(render_pass));
+  surface_ptr->SubmitCompositorFrame(std::move(compositor_frame),
+                                     base::Closure());
+  // Make sure the parent connection gets the surface ID.
+  wt_client1()->WaitForChangeCount(1);
+  // Verify that the submitted frame is for |window_2_101|.
+  EXPECT_EQ(window_2_101_in_ws1,
+            changes1()->back().surface_id.frame_sink_id().client_id());
+}
+
 // TODO(sky): need to better track changes to initial client. For example,
 // that SetBounsdWindows/AddWindow and the like don't result in messages to the
 // originating client.
diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc
index 32fcb9b..6fdeb04 100644
--- a/services/ui/ws/window_tree_unittest.cc
+++ b/services/ui/ws/window_tree_unittest.cc
@@ -12,7 +12,7 @@
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
 #include "base/strings/stringprintf.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
+#include "services/service_manager/public/interfaces/connector.mojom.h"
 #include "services/ui/common/types.h"
 #include "services/ui/common/util.h"
 #include "services/ui/public/interfaces/window_tree.mojom.h"
diff --git a/services/video_capture/BUILD.gn b/services/video_capture/BUILD.gn
index e5f17a75..61833a2 100644
--- a/services/video_capture/BUILD.gn
+++ b/services/video_capture/BUILD.gn
@@ -2,8 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 
 service("video_capture") {
@@ -17,7 +17,7 @@
     ":lib",
     "//media/capture:capture",
     "//mojo/public/cpp/system",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/video_capture/public/interfaces",
   ]
 
@@ -58,7 +58,7 @@
     "//media/mojo/common:common",
     "//media/mojo/interfaces:image_capture",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp",
+    "//services/service_manager/public/cpp",
     "//services/video_capture/public/interfaces",
   ]
 }
@@ -90,9 +90,9 @@
     "//base",
     "//base/test:test_support",
     "//media/mojo/common:common",
-    "//services/shell/public/cpp",
-    "//services/shell/public/cpp:service_test_support",
-    "//services/shell/public/cpp/test:run_all_shelltests",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/cpp:service_test_support",
+    "//services/service_manager/public/cpp/test:run_all_shelltests",
     "//services/video_capture/public/interfaces",
     "//testing/gmock",
     "//testing/gtest",
diff --git a/services/video_capture/mock_device_video_capture_service_test.cc b/services/video_capture/mock_device_video_capture_service_test.cc
index 1597c0383..14f36472 100644
--- a/services/video_capture/mock_device_video_capture_service_test.cc
+++ b/services/video_capture/mock_device_video_capture_service_test.cc
@@ -7,7 +7,7 @@
 namespace video_capture {
 
 MockDeviceVideoCaptureServiceTest::MockDeviceVideoCaptureServiceTest()
-    : shell::test::ServiceTest("exe:video_capture_unittests") {}
+    : service_manager::test::ServiceTest("exe:video_capture_unittests") {}
 
 MockDeviceVideoCaptureServiceTest::~MockDeviceVideoCaptureServiceTest() =
     default;
diff --git a/services/video_capture/mock_device_video_capture_service_test.h b/services/video_capture/mock_device_video_capture_service_test.h
index 1b218e5..592c9f7 100644
--- a/services/video_capture/mock_device_video_capture_service_test.h
+++ b/services/video_capture/mock_device_video_capture_service_test.h
@@ -5,7 +5,7 @@
 #ifndef SERVICES_VIDEO_CAPTURE_MOCK_DEVICE_VIDEO_CAPTURE_SERVICE_TEST_H_
 #define SERVICES_VIDEO_CAPTURE_MOCK_DEVICE_VIDEO_CAPTURE_SERVICE_TEST_H_
 
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/video_capture/mock_device_descriptor_receiver.h"
 #include "services/video_capture/mock_video_capture_device_impl.h"
 #include "services/video_capture/mock_video_frame_receiver.h"
@@ -14,7 +14,8 @@
 namespace video_capture {
 
 // Reusable test setup for testing with a single mock device.
-class MockDeviceVideoCaptureServiceTest : public shell::test::ServiceTest {
+class MockDeviceVideoCaptureServiceTest
+    : public service_manager::test::ServiceTest {
  public:
   MockDeviceVideoCaptureServiceTest();
   ~MockDeviceVideoCaptureServiceTest() override;
diff --git a/services/video_capture/service_main.cc b/services/video_capture/service_main.cc
index c8e53c1f..1b7b5d3 100644
--- a/services/video_capture/service_main.cc
+++ b/services/video_capture/service_main.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "services/shell/public/c/main.h"
-#include "services/shell/public/cpp/service_runner.h"
+#include "services/service_manager/public/c/main.h"
+#include "services/service_manager/public/cpp/service_runner.h"
 #include "services/video_capture/video_capture_service.h"
 
 MojoResult ServiceMain(MojoHandle service_request_handle) {
-  return shell::ServiceRunner(new video_capture::VideoCaptureService)
+  return service_manager::ServiceRunner(new video_capture::VideoCaptureService)
       .Run(service_request_handle);
 }
diff --git a/services/video_capture/service_manifest.json b/services/video_capture/service_manifest.json
index 485f45f0..c3461d5 100644
--- a/services/video_capture/service_manifest.json
+++ b/services/video_capture/service_manifest.json
@@ -7,7 +7,7 @@
       "tests": ["*"]
     },
     "required": {
-      "service:shell": { "classes": [ "shell:all_users" ] }
+      "service:shell": [ "shell:all_users" ]
     }
   }
 }
diff --git a/services/video_capture/service_unittest_manifest.json b/services/video_capture/service_unittest_manifest.json
index 98758716..f6211339 100644
--- a/services/video_capture/service_unittest_manifest.json
+++ b/services/video_capture/service_unittest_manifest.json
@@ -4,8 +4,7 @@
   "display_name": "Video Capture Unittests",
   "capabilities": {
     "required": {
-      "service:video_capture": {
-        "classes": [ "tests" ] }
+      "service:video_capture": [ "tests" ]
     }
   }
 }
diff --git a/services/video_capture/video_capture_service.cc b/services/video_capture/video_capture_service.cc
index b38914d..f23bde1 100644
--- a/services/video_capture/video_capture_service.cc
+++ b/services/video_capture/video_capture_service.cc
@@ -28,14 +28,16 @@
 
 VideoCaptureService::~VideoCaptureService() = default;
 
-bool VideoCaptureService::OnConnect(const shell::Identity& remote_identity,
-                                    shell::InterfaceRegistry* registry) {
+bool VideoCaptureService::OnConnect(
+    const service_manager::Identity& remote_identity,
+    service_manager::InterfaceRegistry* registry) {
   registry->AddInterface<mojom::VideoCaptureService>(this);
   return true;
 }
 
-void VideoCaptureService::Create(const shell::Identity& remote_identity,
-                                 mojom::VideoCaptureServiceRequest request) {
+void VideoCaptureService::Create(
+    const service_manager::Identity& remote_identity,
+    mojom::VideoCaptureServiceRequest request) {
   service_bindings_.AddBinding(this, std::move(request));
 }
 
diff --git a/services/video_capture/video_capture_service.h b/services/video_capture/video_capture_service.h
index e402657..5c13810 100644
--- a/services/video_capture/video_capture_service.h
+++ b/services/video_capture/video_capture_service.h
@@ -8,7 +8,7 @@
 #include <memory>
 
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service.h"
 #include "services/video_capture/public/interfaces/video_capture_service.mojom.h"
 
 namespace video_capture {
@@ -18,19 +18,19 @@
 
 // Implementation of mojom::VideoCaptureService as a Mojo Shell Service.
 class VideoCaptureService
-    : public shell::Service,
-      public shell::InterfaceFactory<mojom::VideoCaptureService>,
+    : public service_manager::Service,
+      public service_manager::InterfaceFactory<mojom::VideoCaptureService>,
       public mojom::VideoCaptureService {
  public:
   VideoCaptureService();
   ~VideoCaptureService() override;
 
-  // shell::Service:
-  bool OnConnect(const shell::Identity& remote_identity,
-                 shell::InterfaceRegistry* registry) override;
+  // service_manager::Service:
+  bool OnConnect(const service_manager::Identity& remote_identity,
+                 service_manager::InterfaceRegistry* registry) override;
 
-  // shell::InterfaceFactory<mojom::VideoCaptureService>:
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<mojom::VideoCaptureService>:
+  void Create(const service_manager::Identity& remote_identity,
               mojom::VideoCaptureServiceRequest request) override;
 
   // mojom::VideoCaptureService
diff --git a/services/video_capture/video_capture_service_test.cc b/services/video_capture/video_capture_service_test.cc
index 29264a7..4fead98 100644
--- a/services/video_capture/video_capture_service_test.cc
+++ b/services/video_capture/video_capture_service_test.cc
@@ -7,7 +7,7 @@
 namespace video_capture {
 
 VideoCaptureServiceTest::VideoCaptureServiceTest()
-    : shell::test::ServiceTest("exe:video_capture_unittests") {}
+    : service_manager::test::ServiceTest("exe:video_capture_unittests") {}
 
 VideoCaptureServiceTest::~VideoCaptureServiceTest() = default;
 
diff --git a/services/video_capture/video_capture_service_test.h b/services/video_capture/video_capture_service_test.h
index 86d3cea..62970a4 100644
--- a/services/video_capture/video_capture_service_test.h
+++ b/services/video_capture/video_capture_service_test.h
@@ -5,7 +5,7 @@
 #ifndef SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_SERVICE_TEST_H_
 #define SERVICES_VIDEO_CAPTURE_VIDEO_CAPTURE_SERVICE_TEST_H_
 
-#include "services/shell/public/cpp/service_test.h"
+#include "services/service_manager/public/cpp/service_test.h"
 #include "services/video_capture/mock_device_descriptor_receiver.h"
 #include "services/video_capture/public/interfaces/video_capture_service.mojom.h"
 #include "testing/gmock/include/gmock/gmock.h"
@@ -13,7 +13,7 @@
 namespace video_capture {
 
 // Basic test fixture that sets up a connection to the fake device factory.
-class VideoCaptureServiceTest : public shell::test::ServiceTest {
+class VideoCaptureServiceTest : public service_manager::test::ServiceTest {
  public:
   VideoCaptureServiceTest();
   ~VideoCaptureServiceTest() override;
diff --git a/skia/public/interfaces/bitmap.mojom b/skia/public/interfaces/bitmap.mojom
index 9d50e4c5..b02833a 100644
--- a/skia/public/interfaces/bitmap.mojom
+++ b/skia/public/interfaces/bitmap.mojom
@@ -39,6 +39,7 @@
 
   uint32 width;
   uint32 height;
+  uint64 row_bytes;
 
   array<uint8> pixel_data;
 };
diff --git a/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc b/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc
index ecd9707..b630eb4 100644
--- a/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc
+++ b/skia/public/interfaces/bitmap_skbitmap_struct_traits.cc
@@ -150,6 +150,12 @@
 }
 
 // static
+uint64_t StructTraits<skia::mojom::BitmapDataView, SkBitmap>::row_bytes(
+    const SkBitmap& b) {
+  return b.rowBytes();
+}
+
+// static
 BitmapBuffer StructTraits<skia::mojom::BitmapDataView, SkBitmap>::pixel_data(
     const SkBitmap& b) {
   return {b.getSize(), b.getSize(), static_cast<uint8_t*>(b.getPixels())};
@@ -161,10 +167,12 @@
     SkBitmap* b) {
   // TODO: Ensure width and height are reasonable, eg. <= kMaxBitmapSize?
   *b = SkBitmap();
-  if (!b->tryAllocPixels(SkImageInfo::Make(
-          data.width(), data.height(), MojoColorTypeToSk(data.color_type()),
-          MojoAlphaTypeToSk(data.alpha_type()),
-          MojoProfileTypeToSk(data.profile_type())))) {
+  if (!b->tryAllocPixels(
+          SkImageInfo::Make(data.width(), data.height(),
+                            MojoColorTypeToSk(data.color_type()),
+                            MojoAlphaTypeToSk(data.alpha_type()),
+                            MojoProfileTypeToSk(data.profile_type())),
+          data.row_bytes())) {
     return false;
   }
 
@@ -173,9 +181,12 @@
     return true;
 
   SkAutoPixmapUnlock pixmap;
+  mojo::ArrayDataView<uint8_t> data_view;
+  data.GetPixelDataDataView(&data_view);
   if (static_cast<uint32_t>(b->width()) != data.width() ||
       static_cast<uint32_t>(b->height()) != data.height() ||
-      !b->requestLock(&pixmap) ||
+      static_cast<uint64_t>(b->rowBytes()) != data.row_bytes() ||
+      b->getSize() != data_view.size() || !b->requestLock(&pixmap) ||
       !b->readyToDraw()) {
     return false;
   }
diff --git a/skia/public/interfaces/bitmap_skbitmap_struct_traits.h b/skia/public/interfaces/bitmap_skbitmap_struct_traits.h
index 4e05184..8c7cf77 100644
--- a/skia/public/interfaces/bitmap_skbitmap_struct_traits.h
+++ b/skia/public/interfaces/bitmap_skbitmap_struct_traits.h
@@ -24,6 +24,7 @@
   static skia::mojom::ColorProfileType profile_type(const SkBitmap& b);
   static uint32_t width(const SkBitmap& b);
   static uint32_t height(const SkBitmap& b);
+  static uint64_t row_bytes(const SkBitmap& b);
   static BitmapBuffer pixel_data(const SkBitmap& b);
   static bool Read(skia::mojom::BitmapDataView data, SkBitmap* b);
   static void* SetUpContext(const SkBitmap& b);
diff --git a/skia/public/interfaces/test/struct_traits_unittest.cc b/skia/public/interfaces/test/struct_traits_unittest.cc
index 2643705..711fe018 100644
--- a/skia/public/interfaces/test/struct_traits_unittest.cc
+++ b/skia/public/interfaces/test/struct_traits_unittest.cc
@@ -7,6 +7,7 @@
 #include "skia/public/interfaces/test/traits_test_service.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/skia/include/core/SkColorFilter.h"
+#include "third_party/skia/include/core/SkImageInfo.h"
 #include "third_party/skia/include/core/SkString.h"
 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h"
 #include "third_party/skia/include/effects/SkDropShadowImageFilter.h"
@@ -78,6 +79,27 @@
             colorspace_srgb_gamma(output.colorSpace()));
   EXPECT_EQ(input.width(), output.width());
   EXPECT_EQ(input.height(), output.height());
+  EXPECT_EQ(input.rowBytes(), output.rowBytes());
+  EXPECT_TRUE(gfx::BitmapsAreEqual(input, output));
+}
+
+TEST_F(StructTraitsTest, BitmapWithExtraRowBytes) {
+  SkBitmap input;
+  // Ensure traits work with bitmaps containing additional bytes between rows.
+  SkImageInfo info = SkImageInfo::MakeN32(8, 5, kPremul_SkAlphaType);
+  input.allocPixels(info, info.minRowBytes() + 2);
+  input.eraseColor(SK_ColorRED);
+  input.erase(SK_ColorTRANSPARENT, SkIRect::MakeXYWH(0, 1, 2, 3));
+  mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
+  SkBitmap output;
+  proxy->EchoBitmap(input, &output);
+  EXPECT_EQ(input.colorType(), output.colorType());
+  EXPECT_EQ(input.alphaType(), output.alphaType());
+  EXPECT_EQ(colorspace_srgb_gamma(input.colorSpace()),
+            colorspace_srgb_gamma(output.colorSpace()));
+  EXPECT_EQ(input.width(), output.width());
+  EXPECT_EQ(input.height(), output.height());
+  EXPECT_EQ(input.rowBytes(), output.rowBytes());
   EXPECT_TRUE(gfx::BitmapsAreEqual(input, output));
 }
 
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json
index 4a02b3da..2d9c33dc 100644
--- a/testing/buildbot/chromium.linux.json
+++ b/testing/buildbot/chromium.linux.json
@@ -2061,12 +2061,6 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
-        "test": "mojo_shell_unittests"
-      },
-      {
-        "swarming": {
-          "can_use_on_swarming_builders": true
-        },
         "test": "mojo_system_unittests"
       },
       {
@@ -2145,6 +2139,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "service_manager_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "skia_unittests"
       },
       {
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json
index 8f17fb6c..1f219144 100644
--- a/testing/buildbot/chromium.win.json
+++ b/testing/buildbot/chromium.win.json
@@ -322,12 +322,6 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
-        "test": "mojo_shell_unittests"
-      },
-      {
-        "swarming": {
-          "can_use_on_swarming_builders": true
-        },
         "test": "mojo_system_unittests"
       },
       {
@@ -406,6 +400,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "service_manager_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "setup_unittests"
       },
       {
@@ -1315,12 +1315,6 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
-        "test": "mojo_shell_unittests"
-      },
-      {
-        "swarming": {
-          "can_use_on_swarming_builders": true
-        },
         "test": "mojo_system_unittests"
       },
       {
@@ -1375,6 +1369,12 @@
         "swarming": {
           "can_use_on_swarming_builders": true
         },
+        "test": "service_manager_unittests"
+      },
+      {
+        "swarming": {
+          "can_use_on_swarming_builders": true
+        },
         "test": "setup_unittests"
       },
       {
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl
index 0ae16f4b..e51cac3 100644
--- a/testing/buildbot/gn_isolate_map.pyl
+++ b/testing/buildbot/gn_isolate_map.pyl
@@ -627,7 +627,7 @@
     "type": "console_test_launcher",
   },
   "mojo_public_application_unittests": {
-    "label": "//services/shell/public/cpp/tests:mojo_public_application_unittests",
+    "label": "//services/service_manager/public/cpp/tests:mojo_public_application_unittests",
     "type": "windowed_test_launcher",
   },
   "mojo_public_bindings_unittests": {
@@ -639,11 +639,7 @@
     "type": "console_test_launcher",
   },
   "mojo_runner_host_unittests": {
-    "label": "//services/shell/runner/host:mojo_runner_host_unittests",
-    "type": "console_test_launcher",
-  },
-  "mojo_shell_unittests": {
-    "label": "//services/shell/tests:mojo_shell_unittests",
+    "label": "//services/service_manager/runner/host:mojo_runner_host_unittests",
     "type": "console_test_launcher",
   },
   "mojo_system_unittests": {
@@ -777,6 +773,10 @@
     "label": "//sandbox/win:sbox_validation_tests",
     "type": "console_test_launcher",
   },
+  "service_manager_unittests": {
+    "label": "//services/service_manager/tests:service_manager_unittests",
+    "type": "console_test_launcher",
+  },
   "setup_unittests": {
     "label": "//chrome/installer/setup:setup_unittests",
     "type": "console_test_launcher",
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
index cae33b80..538e7ed2 100644
--- a/testing/variations/fieldtrial_testing_config.json
+++ b/testing/variations/fieldtrial_testing_config.json
@@ -912,6 +912,9 @@
             "experiments": [
                 {
                     "name": "Enabled",
+                    "params": {
+                        "quota_SuggestionFetcher": "2"
+                    },
                     "enable_features": [
                         "NTPArticleSuggestions",
                         "NTPBookmarkSuggestions",
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 6598954..a6eefb2 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -400,6 +400,7 @@
 crbug.com/490511 imported/wpt/html/rendering/replaced-elements/embedded-content-rendering-rules/canvas-fallback.html [ Failure ]
 crbug.com/490511 imported/wpt/html/semantics/document-metadata/styling/LinkStyle.html [ Failure Pass ]
 crbug.com/627706 imported/wpt/html/semantics/embedded-content/the-img-element/invalid-src.html [ Skip ]
+crbug.com/656459 imported/wpt/dom/ranges/Range-set.html [ Failure ]
 
 crbug.com/636961 [ Linux Debug ] virtual/threaded/fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-vertical-rl-anchors.html [ Pass Failure ]
 
@@ -1131,6 +1132,18 @@
 
 crbug.com/610464 [ Linux Win7 Debug ] inspector/components/throttler.html [ Failure Pass ]
 
+# TODO(alph): Rebaseline once v8 part lands.
+crbug.com/655430 inspector/tracing/timeline-js/timeline-script-tag-1.html [ NeedsManualRebaseline ]
+crbug.com/655430 inspector/tracing/timeline-js/timeline-script-tag-2.html [ NeedsManualRebaseline ]
+crbug.com/655430 inspector/tracing/timeline-misc/timeline-receive-response-event.html [ NeedsManualRebaseline ]
+crbug.com/655430 inspector/tracing/timeline-time/timeline-time.html [ NeedsManualRebaseline ]
+crbug.com/655430 inspector/tracing/timeline-time/timeline-timer.html [ NeedsManualRebaseline ]
+crbug.com/655430 virtual/threaded/inspector/tracing/timeline-js/timeline-script-tag-1.html [ NeedsManualRebaseline ]
+crbug.com/655430 virtual/threaded/inspector/tracing/timeline-js/timeline-script-tag-2.html [ NeedsManualRebaseline ]
+crbug.com/655430 virtual/threaded/inspector/tracing/timeline-misc/timeline-receive-response-event.html [ NeedsManualRebaseline ]
+crbug.com/655430 virtual/threaded/inspector/tracing/timeline-time/timeline-time.html [ NeedsManualRebaseline ]
+crbug.com/655430 virtual/threaded/inspector/tracing/timeline-time/timeline-timer.html [ NeedsManualRebaseline ]
+
 # TODO(jlebel): Remove when methods are implemented.
 crbug.com/624019 [ Mac ] bluetooth/notifications/add-multiple-event-listeners.html [ Skip ]
 crbug.com/624019 [ Mac ] bluetooth/notifications/concurrent-stops.html [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Node/textContent-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Node/textContent-expected.txt
deleted file mode 100644
index aa392a96..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/Node/textContent-expected.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-This is a testharness.js-based test.
-PASS For an empty Element, textContent should be the empty string 
-PASS For an empty DocumentFragment, textContent should be the empty string 
-PASS Element with children 
-PASS Element with descendants 
-PASS DocumentFragment with children 
-PASS DocumentFragment with descendants 
-PASS For an empty Text, textContent should be the empty string 
-PASS For an empty ProcessingInstruction, textContent should be the empty string 
-PASS For an empty Comment, textContent should be the empty string 
-PASS For a Text with data, textContent should be that data 
-PASS For a ProcessingInstruction with data, textContent should be that data 
-PASS For a Comment with data, textContent should be that data 
-PASS For Documents created by parser, textContent should be null 
-PASS For Documents created by createDocument, textContent should be null 
-PASS For Documents created by createHTMLDocument, textContent should be null 
-PASS For DocumentType created by parser, textContent should be null 
-PASS For DocumentType created by script, textContent should be null 
-PASS Element without children set to null 
-PASS Element with empty text node as child set to null 
-PASS Element with children set to null 
-PASS Element with descendants set to null 
-PASS DocumentFragment without children set to null 
-PASS DocumentFragment with empty text node as child set to null 
-PASS DocumentFragment with children set to null 
-PASS DocumentFragment with descendants set to null 
-PASS Element without children set to undefined 
-PASS Element with empty text node as child set to undefined 
-PASS Element with children set to undefined 
-PASS Element with descendants set to undefined 
-PASS DocumentFragment without children set to undefined 
-PASS DocumentFragment with empty text node as child set to undefined 
-PASS DocumentFragment with children set to undefined 
-PASS DocumentFragment with descendants set to undefined 
-PASS Element without children set to "" 
-FAIL Element with empty text node as child set to "" assert_equals: expected null but got Text node ""
-PASS Element with children set to "" 
-PASS Element with descendants set to "" 
-PASS DocumentFragment without children set to "" 
-FAIL DocumentFragment with empty text node as child set to "" assert_equals: expected null but got Text node ""
-PASS DocumentFragment with children set to "" 
-PASS DocumentFragment with descendants set to "" 
-PASS Element without children set to 42 
-PASS Element with empty text node as child set to 42 
-PASS Element with children set to 42 
-PASS Element with descendants set to 42 
-PASS DocumentFragment without children set to 42 
-PASS DocumentFragment with empty text node as child set to 42 
-PASS DocumentFragment with children set to 42 
-PASS DocumentFragment with descendants set to 42 
-PASS Element without children set to "abc" 
-PASS Element with empty text node as child set to "abc" 
-PASS Element with children set to "abc" 
-PASS Element with descendants set to "abc" 
-PASS DocumentFragment without children set to "abc" 
-PASS DocumentFragment with empty text node as child set to "abc" 
-PASS DocumentFragment with children set to "abc" 
-PASS DocumentFragment with descendants set to "abc" 
-PASS Element without children set to "<b>xyz</b>" 
-PASS Element with empty text node as child set to "<b>xyz</b>" 
-PASS Element with children set to "<b>xyz</b>" 
-PASS Element with descendants set to "<b>xyz</b>" 
-PASS DocumentFragment without children set to "<b>xyz</b>" 
-PASS DocumentFragment with empty text node as child set to "<b>xyz</b>" 
-PASS DocumentFragment with children set to "<b>xyz</b>" 
-PASS DocumentFragment with descendants set to "<b>xyz</b>" 
-PASS Element without children set to "d\0e" 
-PASS Element with empty text node as child set to "d\0e" 
-PASS Element with children set to "d\0e" 
-PASS Element with descendants set to "d\0e" 
-PASS DocumentFragment without children set to "d\0e" 
-PASS DocumentFragment with empty text node as child set to "d\0e" 
-PASS DocumentFragment with children set to "d\0e" 
-PASS DocumentFragment with descendants set to "d\0e" 
-PASS For a Text, textContent should set the data 
-PASS For a ProcessingInstruction, textContent should set the data 
-PASS For a Comment, textContent should set the data 
-PASS For Documents created by parser, setting textContent should do nothing 
-PASS For Documents created by createDocument, setting textContent should do nothing 
-PASS For Documents created by createHTMLDocument, setting textContent should do nothing 
-PASS For DocumentType created by parser, setting textContent should do nothing 
-PASS For DocumentType created by script, setting textContent should do nothing 
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Node/textContent.html b/third_party/WebKit/LayoutTests/fast/dom/Node/textContent.html
deleted file mode 100644
index 6f09ed65..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/Node/textContent.html
+++ /dev/null
@@ -1,258 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../../resources/testharness.js"></script>
-<script src="../../../resources/testharnessreport.js"></script>
-</head>
-<body>
-<script>
-var documents, doctypes;
-setup(function() {
-    documents = [
-        [document, "parser"],
-        [document.implementation.createDocument("", "test", null), "createDocument"],
-        [document.implementation.createHTMLDocument("title"), "createHTMLDocument"],
-    ]
-    doctypes = [
-        [document.doctype, "parser"],
-        [document.implementation.createDocumentType("x", "", ""), "script"],
-    ]
-});
-
-// Getting
-// DocumentFragment, Element:
-test(function() {
-    var element = document.createElement("div");
-    assert_equals(element.textContent, "");
-}, "For an empty Element, textContent should be the empty string");
-
-test(function() {
-    assert_equals(document.createDocumentFragment().textContent, "");
-}, "For an empty DocumentFragment, textContent should be the empty string");
-
-test(function() {
-    var el = document.createElement("div");
-    el.appendChild(document.createComment(" abc "));
-    el.appendChild(document.createTextNode("\tDEF\t"));
-    el.appendChild(document.createProcessingInstruction("x", " ghi "));
-    assert_equals(el.textContent, "\tDEF\t");
-}, "Element with children");
-
-test(function() {
-    var el = document.createElement("div");
-    var child = document.createElement("div");
-    el.appendChild(child);
-    child.appendChild(document.createComment(" abc "));
-    child.appendChild(document.createTextNode("\tDEF\t"));
-    child.appendChild(document.createProcessingInstruction("x", " ghi "));
-    assert_equals(el.textContent, "\tDEF\t");
-}, "Element with descendants");
-
-test(function() {
-    var df = document.createDocumentFragment();
-    df.appendChild(document.createComment(" abc "));
-    df.appendChild(document.createTextNode("\tDEF\t"));
-    df.appendChild(document.createProcessingInstruction("x", " ghi "));
-    assert_equals(df.textContent, "\tDEF\t");
-}, "DocumentFragment with children");
-
-test(function() {
-    var df = document.createDocumentFragment();
-    var child = document.createElement("div");
-    df.appendChild(child);
-    child.appendChild(document.createComment(" abc "));
-    child.appendChild(document.createTextNode("\tDEF\t"));
-    child.appendChild(document.createProcessingInstruction("x", " ghi "));
-    assert_equals(df.textContent, "\tDEF\t");
-}, "DocumentFragment with descendants");
-
-// Text, ProcessingInstruction, Comment:
-test(function() {
-    assert_equals(document.createTextNode("").textContent, "");
-}, "For an empty Text, textContent should be the empty string");
-
-test(function() {
-    assert_equals(document.createProcessingInstruction("x", "").textContent, "");
-}, "For an empty ProcessingInstruction, textContent should be the empty string");
-
-test(function() {
-    assert_equals(document.createComment("").textContent, "");
-}, "For an empty Comment, textContent should be the empty string");
-
-test(function() {
-    assert_equals(document.createTextNode("abc").textContent, "abc");
-}, "For a Text with data, textContent should be that data");
-
-test(function() {
-    assert_equals(document.createProcessingInstruction("x", "abc").textContent, "abc");
-}, "For a ProcessingInstruction with data, textContent should be that data");
-
-test(function() {
-    assert_equals(document.createComment("abc").textContent, "abc");
-}, "For a Comment with data, textContent should be that data");
-
-// Any other node:
-documents.forEach(function(argument) {
-    var doc = argument[0], creator = argument[1];
-    test(function() {
-        assert_equals(doc.textContent, null);
-    }, "For Documents created by " + creator + ", textContent should be null");
-});
-
-doctypes.forEach(function(argument) {
-    var doctype = argument[0], creator = argument[1];
-    test(function() {
-        assert_equals(doctype.textContent, null);
-    }, "For DocumentType created by " + creator + ", textContent should be null");
-});
-
-// Setting
-// DocumentFragment, Element:
-var arguments = [
-    [null, null],
-    [undefined, null],
-    ["", null],
-    [42, "42"],
-    ["abc", "abc"],
-    ["<b>xyz<\/b>", "<b>xyz<\/b>"],
-    ["d\0e", "d\0e"]
-    // XXX unpaired surrogate?
-]
-arguments.forEach(function(aValue) {
-    var argument = aValue[0], expectation = aValue[1];
-    var check = function(aElementOrDocumentFragment) {
-        if (expectation === null) {
-            assert_equals(aElementOrDocumentFragment.textContent, "");
-            assert_equals(aElementOrDocumentFragment.firstChild, null);
-        } else {
-            assert_equals(aElementOrDocumentFragment.textContent, expectation);
-            assert_equals(aElementOrDocumentFragment.childNodes.length, 1, "Should have one child");
-            var firstChild = aElementOrDocumentFragment.firstChild;
-            assert_true(firstChild instanceof Text, "child should be a Text");
-            assert_equals(firstChild.data, expectation);
-        }
-    }
-
-    test(function() {
-        var el = document.createElement("div");
-        el.textContent = argument;
-        check(el);
-    }, "Element without children set to " + format_value(argument));
-
-    test(function() {
-        var el = document.createElement("div");
-        var text = el.appendChild(document.createTextNode(""));
-        el.textContent = argument;
-        check(el);
-        assert_equals(text.parentNode, null, "Preexisting Text should have been removed");
-    }, "Element with empty text node as child set to " + format_value(argument));
-
-    test(function() {
-        var el = document.createElement("div");
-        el.appendChild(document.createComment(" abc "));
-        el.appendChild(document.createTextNode("\tDEF\t"));
-        el.appendChild(document.createProcessingInstruction("x", " ghi "));
-        el.textContent = argument;
-        check(el);
-    }, "Element with children set to " + format_value(argument));
-
-    test(function() {
-        var el = document.createElement("div");
-        var child = document.createElement("div");
-        el.appendChild(child);
-        child.appendChild(document.createComment(" abc "));
-        child.appendChild(document.createTextNode("\tDEF\t"));
-        child.appendChild(document.createProcessingInstruction("x", " ghi "));
-        el.textContent = argument;
-        check(el);
-        assert_equals(child.childNodes.length, 3, "Should not have changed the internal structure of the removed nodes.");
-    }, "Element with descendants set to " + format_value(argument));
-
-    test(function() {
-        var df = document.createDocumentFragment();
-        df.textContent = argument;
-        check(df);
-    }, "DocumentFragment without children set to " + format_value(argument));
-
-    test(function() {
-        var df = document.createDocumentFragment();
-        var text = df.appendChild(document.createTextNode(""));
-        df.textContent = argument;
-        check(df);
-        assert_equals(text.parentNode, null, "Preexisting Text should have been removed");
-    }, "DocumentFragment with empty text node as child set to " + format_value(argument));
-
-    test(function() {
-        var df = document.createDocumentFragment();
-        df.appendChild(document.createComment(" abc "));
-        df.appendChild(document.createTextNode("\tDEF\t"));
-        df.appendChild(document.createProcessingInstruction("x", " ghi "));
-        df.textContent = argument;
-        check(df);
-    }, "DocumentFragment with children set to " + format_value(argument));
-
-    test(function() {
-        var df = document.createDocumentFragment();
-        var child = document.createElement("div");
-        df.appendChild(child);
-        child.appendChild(document.createComment(" abc "));
-        child.appendChild(document.createTextNode("\tDEF\t"));
-        child.appendChild(document.createProcessingInstruction("x", " ghi "));
-        df.textContent = argument;
-        check(df);
-        assert_equals(child.childNodes.length, 3, "Should not have changed the internal structure of the removed nodes.");
-    }, "DocumentFragment with descendants set to " + format_value(argument));
-})
-
-// Text, ProcessingInstruction, Comment:
-test(function() {
-    var text = document.createTextNode("abc");
-    text.textContent = "def";
-    assert_equals(text.textContent, "def");
-    assert_equals(text.data, "def");
-}, "For a Text, textContent should set the data");
-
-test(function() {
-    var pi = document.createProcessingInstruction("x", "abc");
-    pi.textContent = "def";
-    assert_equals(pi.textContent, "def");
-    assert_equals(pi.data, "def");
-    assert_equals(pi.target, "x");
-}, "For a ProcessingInstruction, textContent should set the data");
-
-test(function() {
-    var comment = document.createComment("abc");
-    comment.textContent = "def";
-    assert_equals(comment.textContent, "def");
-    assert_equals(comment.data, "def");
-}, "For a Comment, textContent should set the data");
-
-// Any other node:
-documents.forEach(function(argument) {
-    var doc = argument[0], creator = argument[1];
-    test(function() {
-        var root = doc.documentElement;
-        doc.textContent = "a";
-        assert_equals(doc.textContent, null);
-        assert_equals(doc.documentElement, root);
-    }, "For Documents created by " + creator + ", setting textContent should do nothing");
-});
-
-doctypes.forEach(function(argument) {
-    var doctype = argument[0], creator = argument[1];
-    test(function() {
-        var props = {
-            name: doctype.name,
-            publicId: doctype.publicId,
-            systemId: doctype.systemId,
-        }
-        doctype.textContent = "b";
-        assert_equals(doctype.textContent, null);
-        assert_equals(doctype.name, props.name, "name should not change");
-        assert_equals(doctype.publicId, props.publicId, "publicId should not change");
-        assert_equals(doctype.systemId, props.systemId, "systemId should not change");
-    }, "For DocumentType created by " + creator + ", setting textContent should do nothing");
-});
-</script>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html
new file mode 100644
index 0000000..40b29a7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html
@@ -0,0 +1,366 @@
+<!DOCTYPE HTML>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="./resources/geometry-interfaces-test-helpers.js"></script>
+<script>
+
+function deg2rad(degrees) {
+  return degrees * Math.PI / 180;
+}
+
+function getRotationMatrix(x, y, z, alpha_in_degrees) {
+  // Vector normalizing
+  var nx = x;
+  var ny = y;
+  var nz = z;
+  var length = Math.sqrt(x * x + y * y + z * z);
+  if (length) {
+    nx = x / length;
+    ny = y / length;
+    nz = z / length;
+  }
+
+  // The 3D rotation matrix is described in CSS Transforms with alpha.
+  // Please see: https://drafts.csswg.org/css-transforms-1/#Rotate3dDefined
+  var alpha_in_radians = deg2rad(alpha_in_degrees / 2);
+  var sc = Math.sin(alpha_in_radians) * Math.cos(alpha_in_radians);
+  var sq = Math.sin(alpha_in_radians) * Math.sin(alpha_in_radians);
+
+  var m11 = 1 - 2 * (ny * ny + nz * nz) * sq;
+  var m12 = 2 * (nx * ny * sq + nz * sc);
+  var m13 = 2 * (nx * nz * sq - ny * sc);
+  var m14 = 0;
+  var m21 = 2 * (nx * ny * sq - nz * sc);
+  var m22 = 1 - 2 * (nx * nx + nz * nz) * sq;
+  var m23 = 2 * (ny * nz * sq + nx * sc);
+  var m24 = 0;
+  var m31 = 2 * (nx * nz * sq + ny * sc);
+  var m32 = 2 * (ny * nz * sq - nx * sc);
+  var m33 = 1 - 2 * (nx * nx + ny * ny) * sq;
+  var m34 = 0;
+  var m41 = 0;
+  var m42 = 0;
+  var m43 = 0;
+  var m44 = 1;
+
+  return new DOMMatrix([m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44]);
+}
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf();
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 0, 0));
+  assert_true(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf()");
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf(0, 0, 1);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0));
+  assert_true(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1)");
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf(1, 1, 1);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 0));
+  assert_false(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 0)");
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf(1, 0, 0, 10);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  expectedMatrix.multiplySelf(getRotationMatrix(1, 0, 0, 10));
+  assert_false(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf(1, 0, 0, 10)");
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf(0, 1, 0, 27);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 1, 0, 27));
+  assert_false(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf(0, 1, 0, 27)");
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf(0, 0, 1, 38);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 38));
+  assert_true(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1, 38)");
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf(1, 1, 1, 45);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 45));
+  assert_false(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 45)");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf();
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 0, 0));
+    assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf()");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf(0, 0, 1);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1)");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf(0, 0, 1, 0);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 0)");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf(1, 0, 0, 19);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix.multiplySelf(getRotationMatrix(1, 0, 0, 19));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf(1, 0, 0, 19)");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf(0, 1, 0, 46);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 1, 0, 46));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 1, 0, 46)");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf(0, 0, 1, 65);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 65));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 65)");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf(1, 1, 1, 67);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 67));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf(1, 1, 1, 67)");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle();
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 0, 0));
+  assert_true(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrixReadOnly 2d - rotateAxisAngle()");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle(0, 0, 1);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0));
+  assert_true(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1)");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle(1, 1, 1);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 0));
+}, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 0)");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle(1, 0, 0, 21);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 0, 0, 21));
+  assert_false(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 0, 0, 21)");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, 35);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 1, 0, 35));
+  assert_false(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 1, 0, 35)");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle(0, 0, 1, 55);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 55));
+  assert_true(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1, 55)");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle(1, 1, 1, 75);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 75));
+  assert_false(matrix2d.is2D);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 75)");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle();
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 0, 0));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle()");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(0, 0, 1);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1)");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 0);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 0)");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 0);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 0));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 0)");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, 105);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 0, 0, 105));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 0, 0, 105)");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, 45);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 1, 0, 45));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 1, 0, 45)");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 65);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 65));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 65)");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 78);
+  var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 78));
+  assert_false(matrix3d.is2D);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 78)");
+
+test(() => {
+  var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  matrix2d.rotateAxisAngleSelf(1, 0, 0, 90);
+  matrix2d.rotateAxisAngleSelf(1, 0, 0, -90);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngleSelf() - do rotate +90,-90");
+
+test(() => {
+  var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]);
+  matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, -180);
+  matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, +180);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]);
+  assert_matrix_almost_equals(matrix2d, expectedMatrix);
+}, "DOMMatrix 2d - rotateAxisAngle() - do rotate -180,+180" );
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d.rotateAxisAngleSelf(1, 1, 0, 90);
+  matrix3d.rotateAxisAngleSelf(1, 1, 0, -90);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngleSelf() - do rotate +90,-90");
+
+test(() => {
+  var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, -180);
+  matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, +180);
+  var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
+  assert_matrix_almost_equals(matrix3d, expectedMatrix);
+}, "DOMMatrix 3d - rotateAxisAngle() - do rotate -180,+180");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+  matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, -90);
+  var expectedMatrix1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0]);
+  assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix1.toFloat64Array());
+  matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, -90);
+  var expectedMatrix2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0]);
+  assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix2.toFloat64Array());
+  matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, -90);
+  var expectedMatrix3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+  assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix3.toFloat64Array());
+}, "DOMMatrix 3d - rotateAxisAngle()");
+
+test(() => {
+  var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+  matrix3d.rotateAxisAngleSelf(0, 0, 1, -90);
+  var expectedMatrix1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0]);
+  assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix1.toFloat64Array());
+  matrix3d.rotateAxisAngleSelf(1, 0, 0, -90);
+  var expectedMatrix2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0]);
+  assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix2.toFloat64Array());
+  matrix3d.rotateAxisAngleSelf(0, 1, 0, -90);
+  var expectedMatrix3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+  assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix3.toFloat64Array());
+}, "DOMMatrix 3d - rotateAxisAngleSelf()");
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html
index 0ed3214..2f790fb 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-scale.html
@@ -3,21 +3,55 @@
 <script src="../../resources/testharnessreport.js"></script>
 <script src="./resources/geometry-interfaces-test-helpers.js"></script>
 <script>
+
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scale();
+  assert_identity_2d_matrix(result);
+  assert_identity_2d_matrix(matrix);
+  assert_not_equals(result, matrix, 'result and matrix should be different object');
+}, "DOMMatrix.scale()");
+
 test(function() {
   var matrix = new DOMMatrix();
   assert_identity_2d_matrix(matrix);
   var result = matrix.scale(3);
   assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]);
   assert_identity_2d_matrix(matrix);
-}, "DOMMatrix.scale(scale)");
+}, "DOMMatrix.scale(sx)");
 
 test(function() {
   var matrix = new DOMMatrix();
   assert_identity_2d_matrix(matrix);
-  var result = matrix.scale(3, 4, 2);
+  var result = matrix.scale(3, 3);
+  assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]);
+  assert_identity_2d_matrix(matrix);
+}, "DOMMatrix.scale(sx, sy)");
+
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scale(3, 8);
+  assert_2d_matrix_equals(result, [3, 0, 0, 8, 0, 0]);
+  assert_identity_2d_matrix(matrix);
+}, "DOMMatrix.scale(sx, sy)");
+
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scale(3, 3, 1, 4, 2);
   assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]);
   assert_identity_2d_matrix(matrix);
-}, "DOMMatrix.scale(scale, ox, oy)");
+}, "DOMMatrix.scale(sx, sy, sz, ox, oy)");
+
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scale(2, 3, 0.5, 2, -4, -1);
+  assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
+  assert_identity_2d_matrix(matrix);
+}, "DOMMatrix.scale(sx, sy, sz, ox, oy, oz)");
 
 test(function() {
   var matrix = new DOMMatrix();
@@ -38,33 +72,68 @@
 test(function() {
   var matrix = new DOMMatrix();
   assert_identity_2d_matrix(matrix);
-  var result = matrix.scaleNonUniform(2, 3, 0.5, 2, -4, -1);
-  assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
-  assert_identity_2d_matrix(matrix);
-}, "DOMMatrix.scaleNonUniform(sx, sy, sz, ox, oy, oz)");
+  var result = matrix.scaleSelf();
+  assert_identity_2d_matrix(result);
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
+}, "DOMMatrix.scaleSelf()");
 
 test(function() {
   var matrix = new DOMMatrix();
   assert_identity_2d_matrix(matrix);
   var result = matrix.scaleSelf(3);
   assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]);
-  assert_2d_matrix_equals(matrix, [3, 0, 0, 3, 0, 0]);
-}, "DOMMatrix.scaleSelf(scale)");
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
+}, "DOMMatrix.scaleSelf(sx)");
 
 test(function() {
   var matrix = new DOMMatrix();
   assert_identity_2d_matrix(matrix);
-  var result = matrix.scaleSelf(3, 4, 2);
+  var result = matrix.scaleSelf(3, 3);
+  assert_2d_matrix_equals(result, [3, 0, 0, 3, 0, 0]);
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
+}, "DOMMatrix.scaleSelf(sx, sy)");
+
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scaleSelf(3, 7);
+  assert_2d_matrix_equals(result, [3, 0, 0, 7, 0, 0]);
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
+}, "DOMMatrix.scaleSelf(sx, sy)");
+
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scaleSelf(3, 3, 1, 4, 2);
   assert_2d_matrix_equals(result, [3, 0, 0, 3, -8, -4]);
-  assert_2d_matrix_equals(matrix, [3, 0, 0, 3, -8, -4]);
-}, "DOMMatrix.scaleSelf(scale)");
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
+}, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy)");
+
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scaleSelf(2, 3, 0.5, 2, -4, -1);
+  assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
+}, "DOMMatrix.scaleSelf(sx, sy, sz, ox, oy, oz)");
+
+// origin value is used to move base point before scale.
+// after scale, base point is return to negative origin value.
+// if scale value were 1, value of matrix should be same before scale.
+test(function() {
+  var matrix = new DOMMatrix();
+  assert_identity_2d_matrix(matrix);
+  var result = matrix.scaleSelf(1, 1, 1, 2, -4, -1);
+  assert_identity_3d_matrix(result);
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
+}, "DOMMatrix.scaleSelf(1, 1, 1, ox, oy, oz)");
 
 test(function() {
   var matrix = new DOMMatrix();
   assert_identity_2d_matrix(matrix);
   var result = matrix.scale3dSelf(3);
   assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]);
-  assert_3d_matrix_equals(matrix, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1]);
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
 }, "DOMMatrix.scale3dSelf(scale)");
 
 test(function() {
@@ -72,22 +141,7 @@
   assert_identity_2d_matrix(matrix);
   var result = matrix.scale3dSelf(3, 2, 7, -1);
   assert_3d_matrix_equals(result, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1]);
-  assert_3d_matrix_equals(matrix, [3, 0, 0, 0, 0, 3, 0, 0, 0, 0, 3, 0, -4, -14, 2, 1]);
+  assert_equals(result, matrix, 'result and matrix should be the exact same object');
 }, "DOMMatrix.scale3dSelf(scale, ox, oy, oz)");
 
-test(function() {
-  var matrix = new DOMMatrix();
-  assert_identity_2d_matrix(matrix);
-  var result = matrix.scaleNonUniformSelf(2, 3, 0.5, 2, -4, -1);
-  assert_3d_matrix_equals(result, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
-  assert_3d_matrix_equals(matrix, [2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0.5, 0, -2, 8, -0.5, 1]);
-}, "DOMMatrix.scaleNonUniformSelf(sx, sy, sz, ox, oy, oz)");
-
-test(function() {
-  var matrix = new DOMMatrix();
-  assert_identity_2d_matrix(matrix);
-  var result = matrix.scaleNonUniformSelf(1, 1, 1, 2, -4, -1);
-  assert_identity_3d_matrix(result);
-  assert_identity_3d_matrix(matrix);
-}, "DOMMatrix.scaleNonUniformSelf(1, 1, 1, ox, oy, oz)");
 </script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js b/third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js
index e54ca056..ee27f2b8 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js
+++ b/third_party/WebKit/LayoutTests/fast/dom/resources/geometry-interfaces-test-helpers.js
@@ -53,3 +53,13 @@
     expected[12], expected[13], expected[14], expected[15],
   ]);
 }
+
+function assert_array_almost_equals(actual, expected) {
+  for (var i = 0; i < actual.length; i++) {
+    assert_equals(actual[i].toFixed(10), expected[i].toFixed(10));
+  }
+}
+
+function assert_matrix_almost_equals(actual, expected) {
+  assert_array_almost_equals(actual.toFloat64Array(), expected.toFloat64Array());
+}
diff --git a/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor-expected.txt b/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor-expected.txt
index 1fc0418..c824a64b 100644
--- a/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor-expected.txt
@@ -12,6 +12,7 @@
 PASS new SecurityPolicyViolationEvent('eventType').effectiveDirective is ""
 PASS new SecurityPolicyViolationEvent('eventType').originalPolicy is ""
 PASS new SecurityPolicyViolationEvent('eventType').sourceFile is ""
+PASS new SecurityPolicyViolationEvent('eventType').disposition is "enforce"
 PASS new SecurityPolicyViolationEvent('eventType').lineNumber is 0
 PASS new SecurityPolicyViolationEvent('eventType').columnNumber is 0
 PASS new SecurityPolicyViolationEvent('eventType').statusCode is 0
@@ -26,6 +27,7 @@
 PASS new SecurityPolicyViolationEvent('eventType', { effectiveDirective: 'foo' }).effectiveDirective is "foo"
 PASS new SecurityPolicyViolationEvent('eventType', { originalPolicy: 'foo' }).originalPolicy is "foo"
 PASS new SecurityPolicyViolationEvent('eventType', { sourceFile: 'foo' }).sourceFile is "foo"
+PASS new SecurityPolicyViolationEvent('eventType', { disposition: 'foo' }).disposition threw exception TypeError: Failed to construct 'SecurityPolicyViolationEvent': The provided value 'foo' is not a valid enum value of type SecurityPolicyViolationEventDisposition..
 PASS new SecurityPolicyViolationEvent('eventType', { lineNumber: 42 }).lineNumber is 42
 PASS new SecurityPolicyViolationEvent('eventType', { columnNumber: 42 }).columnNumber is 42
 PASS new SecurityPolicyViolationEvent('eventType', { statusCode: 42 }).statusCode is 42
diff --git a/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor.html b/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor.html
index 10ffd7b..14b3a56 100644
--- a/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor.html
+++ b/third_party/WebKit/LayoutTests/fast/events/constructors/security-policy-violation-event-constructor.html
@@ -21,6 +21,7 @@
 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').effectiveDirective");
 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').originalPolicy");
 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').sourceFile");
+shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType').disposition", "enforce");
 shouldBe("new SecurityPolicyViolationEvent('eventType').lineNumber", "0");
 shouldBe("new SecurityPolicyViolationEvent('eventType').columnNumber", "0");
 shouldBe("new SecurityPolicyViolationEvent('eventType').statusCode", "0");
@@ -38,6 +39,9 @@
     shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType', { " + member + ": 'foo' })." + member, "foo");
 });
 
+// Enum members throw on unknown initializer values.
+shouldThrow("new SecurityPolicyViolationEvent('eventType', { disposition: 'foo' }).disposition");
+
 // Number members are passed.
 ["lineNumber", "columnNumber", "statusCode"].forEach(function(member) {
     shouldBe("new SecurityPolicyViolationEvent('eventType', { " + member + ": 42 })." + member, "42");
diff --git a/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.png b/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.png
index 1ce4eee..6ef921f00 100644
--- a/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.png
+++ b/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.txt b/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.txt
index aee7101..a73f8db7 100644
--- a/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/images/exif-orientation-height-image-document-expected.txt
@@ -3,4 +3,5 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (0,0) size 800x600
-      LayoutImage {IMG} at (0,0) size 38x600
+      LayoutFlexibleBox {DIV} at (0,0) size 800x600
+        LayoutImage {IMG} at (381,0) size 38x600
diff --git a/third_party/WebKit/LayoutTests/fast/images/image-click-scale-restore-zoomed-image-expected.txt b/third_party/WebKit/LayoutTests/fast/images/image-click-scale-restore-zoomed-image-expected.txt
index 0841d041..6920287b 100644
--- a/third_party/WebKit/LayoutTests/fast/images/image-click-scale-restore-zoomed-image-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/images/image-click-scale-restore-zoomed-image-expected.txt
@@ -2,6 +2,6 @@
 
 Size at zoomed in level : 77 x 100
 Size at zoomed level after scale up click 1 : 500 x 644
-Size at zoomed out level after click 2 (Image restored): 77 x 100
+Size at zoomed out level after click 2 (Image restored): 77 x 101
 Size at zoomed level after scale up click 3 : 500 x 644
 
diff --git a/third_party/WebKit/LayoutTests/fast/images/image-zoom-to-25-expected.txt b/third_party/WebKit/LayoutTests/fast/images/image-zoom-to-25-expected.txt
index 6af96342..08fc5f1 100644
--- a/third_party/WebKit/LayoutTests/fast/images/image-zoom-to-25-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/images/image-zoom-to-25-expected.txt
@@ -1,9 +1,9 @@
 This tests that page zoom and image auto-sizing interact well together. This test requires testRunner to run. To test manually, open this image in a browser window, resize the window to 200px tall and zoom out 6 times. The image should get smaller at each step.
 
-Size at zoom level0 : 200 x 150
-Size at zoom level1 : 200 x 150
-Size at zoom level2 : 200 x 150
+Size at zoom level0 : 199 x 150
+Size at zoom level1 : 199 x 150
+Size at zoom level2 : 200 x 149
 Size at zoom level3 : 199 x 149
 Size at zoom level4 : 199 x 149
-Size at zoom level5 : 200 x 149
+Size at zoom level5 : 197 x 149
 
diff --git a/third_party/WebKit/LayoutTests/fragmentation/abspos-table-in-nested-multicol-crash.html b/third_party/WebKit/LayoutTests/fragmentation/abspos-table-in-nested-multicol-crash.html
new file mode 100644
index 0000000..a6c2122
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/abspos-table-in-nested-multicol-crash.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<div style="columns:2;">
+    <div style="position:relative;">
+        <div style="columns:2;">
+            <div style="position:absolute; display:table;">
+                &nbsp;<br>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+test(() => { }, "No crash or assertion failure.");
+</script>
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-caption-before-tbody-expected.txt b/third_party/WebKit/LayoutTests/fragmentation/break-in-caption-before-tbody-expected.txt
new file mode 100644
index 0000000..3384ca0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-caption-before-tbody-expected.txt
@@ -0,0 +1,12 @@
+There should be a blue, a cyan, and another blue square below, stacked vertically.
+
+
+
+
+
+
+
+
+
+
+PASS
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-caption-before-tbody.html b/third_party/WebKit/LayoutTests/fragmentation/break-in-caption-before-tbody.html
new file mode 100644
index 0000000..d9a6582
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-caption-before-tbody.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<style>
+    body { overflow:scroll; } /* A second layout pass might hide the bug. */
+</style>
+<p>There should be a blue, a cyan, and another blue square below, stacked vertically.</p>
+<div id="multicol" style="columns:3; column-gap:0; column-fill:auto; width:60px; height:99px; line-height:20px; orphans:1; widows:1;">
+    <br>
+    <br>
+    <br>
+    <table cellspacing="0" cellpadding="0">
+        <caption>
+            <br><br>
+        </caption>
+        <tbody data-expected-height="60">
+            <tr data-expected-height="60">
+                <td data-expected-height="60"><br><br><br></td>
+                <td data-expected-height="60" style="background:blue;">
+                    <div data-offset-y="20" data-expected-height="20" style="width:20px; background:cyan;"><br></div>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+</div>
+<script src="../resources/check-layout.js"></script>
+<script>
+    checkLayout("#multicol");
+</script>
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-first-table-section-expected.txt b/third_party/WebKit/LayoutTests/fragmentation/break-in-first-table-section-expected.txt
new file mode 100644
index 0000000..501bf6b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-first-table-section-expected.txt
@@ -0,0 +1,14 @@
+There should be a blue, a cyan, and another blue square below, stacked vertically.
+
+
+
+
+
+
+
+
+
+
+
+
+PASS
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-first-table-section.html b/third_party/WebKit/LayoutTests/fragmentation/break-in-first-table-section.html
new file mode 100644
index 0000000..df4e274
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-first-table-section.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<style>
+    body { overflow:scroll; } /* A second layout pass might hide bugs. */
+</style>
+<p>There should be a blue, a cyan, and another blue square below, stacked vertically.</p>
+<div id="multicol" style="columns:3; column-gap:0; column-fill:auto; width:60px; height:99px; line-height:20px; orphans:1; widows:1;">
+    <br>
+    <br>
+    <br>
+    <table cellspacing="0" cellpadding="0">
+        <thead>
+            <tr>
+                <td style="vertical-align:top;"><br><br></td>
+                <td style="vertical-align:top;"><br><br></td>
+            </tr>
+        </thead>
+        <tbody>
+            <tr data-expected-height="60">
+                <td data-expected-height="60"><br><br><br></td>
+                <td data-expected-height="60" style="background:blue;">
+                    <div data-offset-y="20" data-expected-height="20" style="width:20px; background:cyan;"><br></div>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+</div>
+<script src="../resources/check-layout.js"></script>
+<script>
+    checkLayout("#multicol");
+</script>
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-second-table-section-expected.txt b/third_party/WebKit/LayoutTests/fragmentation/break-in-second-table-section-expected.txt
new file mode 100644
index 0000000..c23938cd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-second-table-section-expected.txt
@@ -0,0 +1,13 @@
+There should be a blue square below.
+
+
+
+
+
+
+
+
+
+
+
+PASS
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-second-table-section.html b/third_party/WebKit/LayoutTests/fragmentation/break-in-second-table-section.html
new file mode 100644
index 0000000..720eb6c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-second-table-section.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<style>
+    body {
+        overflow:scroll; /* A second layout pass might hide bugs. */
+        color: black;
+        background: white;
+    }
+</style>
+<p>There should be a blue square below.</p>
+<div id="multicol" style="position:relative; columns:3; column-gap:0; column-fill:auto; height:99px; line-height:20px; orphans:1; widows:1;">
+    <br>
+    <br>
+    <table cellspacing="0" cellpadding="0">
+        <col style="width:20px;">
+        <col style="width:20px;">
+        <thead>
+            <tr>
+                <td style="vertical-align:top;"><br><br></td>
+                <td style="vertical-align:top;"><br><br></td>
+            </tr>
+        </thead>
+        <tbody>
+            <tr data-expected-height="79">
+                <td data-expected-height="79" style="vertical-align:top;">
+                    <br>
+                    <div data-offset-y="20" style="position:relative; background:blue;">
+                        <br><br>
+                    </div>
+                </td>
+                <td data-expected-height="79" style="vertical-align:top; background:blue;">
+                    <div style="background:white;"><br></div>
+                    <div data-offset-y="20" style="position:relative;"></div>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+</div>
+<script src="../resources/check-layout.js"></script>
+<script>
+    checkLayout("#multicol");
+</script>
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-tbody-after-caption-expected.txt b/third_party/WebKit/LayoutTests/fragmentation/break-in-tbody-after-caption-expected.txt
new file mode 100644
index 0000000..7b102190
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-tbody-after-caption-expected.txt
@@ -0,0 +1,11 @@
+There should be a blue square below.
+
+
+
+
+
+
+
+
+
+PASS
diff --git a/third_party/WebKit/LayoutTests/fragmentation/break-in-tbody-after-caption.html b/third_party/WebKit/LayoutTests/fragmentation/break-in-tbody-after-caption.html
new file mode 100644
index 0000000..59d8065
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/break-in-tbody-after-caption.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<style>
+    body {
+        overflow:scroll; /* A second layout pass might hide bugs. */
+        color: black;
+        background: white;
+    }
+</style>
+<p>There should be a blue square below.</p>
+<div id="multicol" style="position:relative; columns:3; column-gap:0; column-fill:auto; height:99px; line-height:20px; orphans:1; widows:1;">
+    <br>
+    <br>
+    <table cellspacing="0" cellpadding="0">
+        <caption>
+            <br><br>
+        </caption>
+        <col style="width:20px;">
+        <col style="width:20px;">
+        <tbody>
+            <tr data-expected-height="79">
+                <td data-expected-height="79" style="vertical-align:top;">
+                    <br>
+                    <div data-offset-y="20" style="position:relative; background:blue;">
+                        <br><br>
+                    </div>
+                </td>
+                <td data-expected-height="79" style="vertical-align:top; background:blue;">
+                    <div style="background:white;"><br></div>
+                    <div data-offset-y="20" style="position:relative;"></div>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+</div>
+<script src="../resources/check-layout.js"></script>
+<script>
+    checkLayout("#multicol");
+</script>
diff --git a/third_party/WebKit/LayoutTests/fragmentation/tbody-before-thead-expected.txt b/third_party/WebKit/LayoutTests/fragmentation/tbody-before-thead-expected.txt
new file mode 100644
index 0000000..501bf6b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/tbody-before-thead-expected.txt
@@ -0,0 +1,14 @@
+There should be a blue, a cyan, and another blue square below, stacked vertically.
+
+
+
+
+
+
+
+
+
+
+
+
+PASS
diff --git a/third_party/WebKit/LayoutTests/fragmentation/tbody-before-thead.html b/third_party/WebKit/LayoutTests/fragmentation/tbody-before-thead.html
new file mode 100644
index 0000000..41a5d2d1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fragmentation/tbody-before-thead.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<style>
+    body { overflow:scroll; } /* A second layout pass might hide bugs. */
+</style>
+<p>There should be a blue, a cyan, and another blue square below, stacked vertically.</p>
+<div id="multicol" style="columns:3; column-gap:0; column-fill:auto; width:60px; height:99px; line-height:20px; orphans:1; widows:1;">
+    <br>
+    <br>
+    <br>
+    <table cellspacing="0" cellpadding="0">
+        <tbody>
+            <tr data-expected-height="60">
+                <td data-expected-height="60"><br><br><br></td>
+                <td data-expected-height="60" style="background:blue;">
+                    <div data-offset-y="20" data-expected-height="20" style="width:20px; background:cyan;"><br></div>
+                </td>
+            </tr>
+        </tbody>
+        <thead>
+            <tr>
+                <td style="vertical-align:top;"><br><br></td>
+                <td style="vertical-align:top;"><br><br></td>
+            </tr>
+        </thead>
+    </table>
+</div>
+<script src="../resources/check-layout.js"></script>
+<script>
+    checkLayout("#multicol");
+</script>
diff --git a/third_party/WebKit/LayoutTests/harness-tests/mojo-helpers.html b/third_party/WebKit/LayoutTests/harness-tests/mojo-helpers.html
index 567fbc7..cb27dce 100644
--- a/third_party/WebKit/LayoutTests/harness-tests/mojo-helpers.html
+++ b/third_party/WebKit/LayoutTests/harness-tests/mojo-helpers.html
@@ -96,10 +96,10 @@
 mojo_test(() => {
   return loadMojoModules(
       'module loading test',
-      ['services/shell/public/interfaces/interface_provider.mojom']).then(mojo => {
+      ['services/service_manager/public/interfaces/interface_provider.mojom']).then(mojo => {
     let interfaceProvider = mojo.modules[0];
     assert_equals(interfaceProvider.InterfaceProvider.name,
-                  'shell::mojom::InterfaceProvider');
+                  'service_manager::mojom::InterfaceProvider');
 
   });
 }, 'Generated mojo bindings can be loaded in tests');
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt
index b4b795f..f4a14ec 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping-expected.txt
@@ -108,8 +108,10 @@
 g?y/../x resolves to http://a/b/c/g?y/../x===http://a/b/c/g?y/../x passes: true
 g#s/./x resolves to http://a/b/c/g#s/./x===http://a/b/c/g#s/./x passes: true
 g#s/../x resolves to http://a/b/c/g#s/../x===http://a/b/c/g#s/../x passes: true
+Custom completeURL tests
 //secure.com/moo resolves to http://secure.com/moo===http://secure.com/moo passes: true
 cat.jpeg resolves to http://a/b/c/cat.jpeg===http://a/b/c/cat.jpeg passes: true
+ resolves to http://example.com/path.css?query===http://example.com/path.css?query passes: true
 
 Running: testCompilerScriptMapping
 UISourceCodeAdded: [debugger] debugger:///VM1 compiled.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping.html b/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping.html
index d9cbfb5..397c7f3 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping.html
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/compiler-script-mapping.html
@@ -162,13 +162,15 @@
             InspectorTest.addResult("http://example.com/map.json === " + func("http://example.com/script.js", "http://example.com/map.json"));
             InspectorTest.addResult("http://example.com/map.json === " + func("http://example.com/script.js", "/map.json"));
             InspectorTest.addResult("http://example.com/maps/map.json === " + func("http://example.com/scripts/script.js", "../maps/map.json"));
-            var base = "http://a/b/c/d;p?q";
-            InspectorTest.addResult("Tests from http://tools.ietf.org/html/rfc3986#section-5.4 using baseURL=\"" + base + "\"");
-            function rfc3986_5_4(lhs, rhs)
+            function testCompleteURL(base, lhs, rhs)
             {
                 var actual =  WebInspector.ParsedURL.completeURL(base, lhs);
                 InspectorTest.addResult(lhs + " resolves to " + actual + "===" + rhs + " passes: " + (actual === rhs));
             }
+
+            var rfc3986_5_4_baseURL =  "http://a/b/c/d;p?q";
+            InspectorTest.addResult("Tests from http://tools.ietf.org/html/rfc3986#section-5.4 using baseURL=\"" + rfc3986_5_4_baseURL + "\"");
+            var rfc3986_5_4 = testCompleteURL.bind(null, rfc3986_5_4_baseURL);
             rfc3986_5_4("http://h", "http://h");  // modified from RFC3986
             rfc3986_5_4("g", "http://a/b/c/g");
             rfc3986_5_4("./g", "http://a/b/c/g");
@@ -211,8 +213,10 @@
             rfc3986_5_4("g#s/./x", "http://a/b/c/g#s/./x");
             rfc3986_5_4("g#s/../x", "http://a/b/c/g#s/../x");
 
-             rfc3986_5_4("//secure.com/moo", "http://secure.com/moo");  // not in RFC3986
-             rfc3986_5_4("cat.jpeg", "http://a/b/c/cat.jpeg");  // not in RFC3986
+            InspectorTest.addResult("Custom completeURL tests");
+            testCompleteURL("http://a/b/c/d;p?q", "//secure.com/moo", "http://secure.com/moo");
+            testCompleteURL("http://a/b/c/d;p?q", "cat.jpeg", "http://a/b/c/cat.jpeg");
+            testCompleteURL("http://example.com/path.css?query#fragment","", "http://example.com/path.css?query");
             next();
         },
 
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/cached-resource-metadata-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/cached-resource-metadata-expected.txt
new file mode 100644
index 0000000..ce5c396
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/cached-resource-metadata-expected.txt
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: line 1: Done.
+Verify that cached resource has metadata.
+
+Last modified: 1989-12-01T08:00:00.000Z
+Content size: 21
+
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/cached-resource-metadata.html b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/cached-resource-metadata.html
new file mode 100644
index 0000000..9032d071
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/cached-resource-metadata.html
@@ -0,0 +1,43 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../network-test.js"></script>
+<script>
+function addScript()
+{
+    var fulfill;
+    var promise = new Promise(x => fulfill = x);
+    var script = document.createElement("script");
+    script.type = "text/javascript";
+    script.src = "resources/script-with-constant-last-modified.php";
+    script.onload = fulfill;
+    document.body.appendChild(script);
+    return promise;
+}
+
+function addScriptAndRunTest()
+{
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+    addScript().then(() => runTest());
+}
+
+function test()
+{
+    var resource = InspectorTest.resourceTreeModel.resourceForURL("http://127.0.0.1:8000/inspector/resource-tree/resources/script-with-constant-last-modified.php");
+    if (!resource) {
+        InspectorTest.addResult("ERROR: Failed to find resource.");
+        InspectorTest.completeTest();
+        return;
+    }
+    InspectorTest.addResult("Last modified: " + (resource.lastModified() ? resource.lastModified().toISOString() : null));
+    InspectorTest.addResult("Content size: " + resource.contentSize());
+
+    InspectorTest.completeTest();
+}
+</script>
+</head>
+<body onload="addScriptAndRunTest()">
+<p>Verify that cached resource has metadata.</p>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resource-metadata-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resource-metadata-expected.txt
new file mode 100644
index 0000000..f3c2617
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resource-metadata-expected.txt
@@ -0,0 +1,6 @@
+CONSOLE MESSAGE: line 1: Done.
+Verify that dynamically added resource has metadata.
+
+Last modified: 1989-12-01T08:00:00.000Z
+Content size: 21
+
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resource-metadata.html b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resource-metadata.html
new file mode 100644
index 0000000..acde4c7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resource-metadata.html
@@ -0,0 +1,41 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../network-test.js"></script>
+<script>
+function addScript()
+{
+    var fulfill;
+    var promise = new Promise(x => fulfill = x);
+    var script = document.createElement("script");
+    script.type = "text/javascript";
+    script.src = "resources/script-with-constant-last-modified.php";
+    script.onload = fulfill;
+    document.body.appendChild(script);
+    return promise;
+}
+
+function test()
+{
+    InspectorTest.evaluateInPageAsync("addScript()").then(step2);
+
+    function step2()
+    {
+        var resource = InspectorTest.resourceTreeModel.resourceForURL("http://127.0.0.1:8000/inspector/resource-tree/resources/script-with-constant-last-modified.php");
+        if (!resource) {
+            InspectorTest.addResult("ERROR: Failed to find resource.");
+            InspectorTest.completeTest();
+            return;
+        }
+        InspectorTest.addResult("Last modified: " + (resource.lastModified() ? resource.lastModified().toISOString() : null));
+        InspectorTest.addResult("Content size: " + resource.contentSize());
+
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Verify that dynamically added resource has metadata.</p>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resources/script-with-constant-last-modified.php b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resources/script-with-constant-last-modified.php
new file mode 100644
index 0000000..dbb2d28
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/resource-tree/resources/script-with-constant-last-modified.php
@@ -0,0 +1,14 @@
+<?php
+    $max_age = 12 * 31 * 24 * 60 * 60; //one year
+    $expires = gmdate(DATE_RFC1123, time() + $max_age);
+    // Dec 01, 1989, 8:00:00AM.
+    $last_modified = gmdate(DATE_RFC1123, 628502400);
+
+    header("Cache-Control: public, max-age=" . 5*$max_age);
+    header("Cache-control: max-age=0");
+    header("Expires: " . $expires);
+    header("Content-Type: text/javascript");
+    header("Last-Modified: " . $last_modified);
+
+    echo("console.log(\"Done.\");");
+?>
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/script.js b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/script.js
new file mode 100644
index 0000000..6618fa2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/script.js
@@ -0,0 +1 @@
+console.log("Script loaded.");
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/style.css b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/style.css
new file mode 100644
index 0000000..be6e6df
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/style.css
@@ -0,0 +1,4 @@
+html {
+  color: blue; }
+
+/*# sourceMappingURL=style.css.map */
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/style.css.map b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/style.css.map
new file mode 100644
index 0000000..d185eece
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/resources/style.css.map
@@ -0,0 +1,8 @@
+{
+"version": 3,
+"mappings": "AAAA,IAAK;EACD,KAAK,EAAE,IAAI",
+"sources": ["style.scss"],
+"sourcesContent": ["html {\n    color: blue;\n}\n"],
+"names": [],
+"file": "style.css"
+}
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata-expected.txt
new file mode 100644
index 0000000..bd2e5e29b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata-expected.txt
@@ -0,0 +1,19 @@
+CONSOLE MESSAGE: line 1: Script loaded.
+Verify that network UISourceCode has metadata.
+
+
+Running: testCachedResource
+Metadata for UISourceCode: http://127.0.0.1:8000/inspector/sources/resources/style.css
+    content size: 63
+    modification time: <Date>
+
+Running: testDynamicResource
+Metadata for UISourceCode: http://127.0.0.1:8000/inspector/sources/resources/script.js
+    content size: 31
+    modification time: <Date>
+
+Running: testInlinedSourceMapSource
+Metadata for UISourceCode: http://127.0.0.1:8000/inspector/sources/resources/style.scss
+    content size: 26
+    modification time: null
+
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html
new file mode 100644
index 0000000..995aa58
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/sources/ui-source-code-metadata.html
@@ -0,0 +1,91 @@
+<html>
+<head>
+<script src="/inspector/inspector-test.js"></script>
+<script src="/inspector/debugger-test.js"></script>
+<link rel="stylesheet">
+<script>
+
+function addScript()
+{
+    var fulfill;
+    var promise = new Promise(x => fulfill = x);
+    var script = document.createElement("script");
+    script.type = "text/javascript";
+    script.src = "resources/script.js";
+    script.onload = fulfill;
+    document.body.appendChild(script);
+    return promise;
+}
+
+function addStyleSheetAndRunTest()
+{
+    if (testRunner)
+        testRunner.waitUntilDone();
+    var link = document.head.querySelector("link");
+    link.href = "resources/style.css";
+    link.onload = runTest;
+}
+
+function test()
+{
+    InspectorTest.runTestSuite([
+        function testCachedResource(next)
+        {
+            InspectorTest.waitForScriptSource("style.css", onStyleSheet)
+
+            function onStyleSheet(uiSourceCode)
+            {
+                dumpMetadata(uiSourceCode, next);
+            }
+        },
+
+        function testDynamicResource(next)
+        {
+            InspectorTest.evaluateInPageAsync("addScript()");
+            InspectorTest.waitForScriptSource("script.js", onScript);
+
+            function onScript(uiSourceCode)
+            {
+                dumpMetadata(uiSourceCode, next);
+            }
+        },
+
+        function testInlinedSourceMapSource(next)
+        {
+            InspectorTest.waitForScriptSource("style.scss", onSourceMapSource);
+
+            function onSourceMapSource(uiSourceCode)
+            {
+                dumpMetadata(uiSourceCode, next);
+            }
+        },
+    ]);
+
+    function dumpMetadata(uiSourceCode, next)
+    {
+        uiSourceCode.requestMetadata().then(onMetadata);
+
+        function onMetadata(metadata)
+        {
+            InspectorTest.addResult("Metadata for UISourceCode: " + uiSourceCode.url());
+            if (!metadata) {
+                InspectorTest.addResult("    Metadata is EMPTY");
+                next();
+                return;
+            }
+            var contentSize = metadata.contentSize;
+            var time = metadata.modificationTime ? "<Date>" : "null";
+            InspectorTest.addResult("    content size: " + contentSize);
+            InspectorTest.addResult("    modification time: " + time);
+            next();
+        }
+    }
+}
+
+</script>
+</head>
+
+<body onload="addStyleSheetAndRunTest()">
+<p>Verify that network UISourceCode has metadata.</p>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt b/third_party/WebKit/LayoutTests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt
deleted file mode 100644
index c04a025..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/navigation/form-with-enctype-targets-cross-site-frame-expected.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Test field:    
-
-
---------
-Frame: 'cross-site-frame'
---------
-This page was requested with the HTTP method POST.
-
-Parameters:
-
-test-field = test-value
-Http headers:
-
-HTTP_CACHE_CONTROL = max-age=0
-HTTP_CONNECTION = keep-alive
-HTTP_HOST = localhost:8080
-HTTP_ORIGIN = http://127.0.0.1:8000
-HTTP_REFERER = http://127.0.0.1:8000/navigation/form-with-enctype-targets-cross-site-frame.html
-HTTP_UPGRADE_INSECURE_REQUESTS = 1
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/form-with-enctype-targets-cross-site-frame.html b/third_party/WebKit/LayoutTests/http/tests/navigation/form-with-enctype-targets-cross-site-frame.html
deleted file mode 100644
index 411f54e..0000000
--- a/third_party/WebKit/LayoutTests/http/tests/navigation/form-with-enctype-targets-cross-site-frame.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<!--
-The test verifies that a form with target="crossSiteFrame" and
-with enctype="multipart/form-data" works fine
-(especially in presence of out-of-process-iframes, aka OOPIFs, aka
-blink::RemoteFrames which are present in --site-per-process mode).
-
-The test finishes successfully, if form-target.pl ends up calling
-testRunner.notifyDone() after main frame calls testRuner.waitUntilDone
-and submits the form.  Expected test output helps verify that the
-correct HTTP headers were sent together with the HTTP POST request.
-In particular, if wrong Content-Type header is send with the HTTP request,
-then the field value will be garbled:
-
-- Expected:
-  test-field = test-value
-
-- Actual if no Content-Type is sent:
-  ------WebKitFormBoundaryxVEhq0cRaPT6heQg Content-Disposition: form-data =
-  name = "test-field" test-value ------WebKitFormBoundaryxVEhq0cRaPT6heQg--
-
--->
-<html>
-<script>
-    if (window.testRunner) {
-        testRunner.dumpAsText();
-        testRunner.dumpChildFramesAsText();
-    }
-
-    function onLoad() {
-        if (window.testRunner)
-            testRunner.waitUntilDone();
-        document.forms[0].submit();
-    }
-</script>
-<body onload="onLoad();">
-<form
-  method="POST"
-  enctype="multipart/form-data"
-  action="http://localhost:8080/navigation/resources/form-target.pl"
-  target="cross-site-frame">
-    Test field:
-    <input name="test-field" type="text" value="test-value">
-    <input type="submit" value="Submit">
-</form>
-<iframe
-  name="cross-site-frame"
-  src="http://localhost:8080/navigation/resources/otherpage.html"></iframe>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive-expected.txt
index 461fdd1..8fb209d3 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/report-uri-effective-directive-expected.txt
@@ -5,4 +5,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/report-uri-effective-directive.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/report-uri-effective-directive.php","referrer":"","violated-directive":"default-src 'self'","effective-directive":"script-src","original-policy":"default-src 'self'; report-uri ../resources/save-report.php?test=report-uri-effective-directive.php","blocked-uri":"inline","line-number":6,"status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/1.1/report-uri-effective-directive.php","referrer":"","violated-directive":"default-src 'self'","effective-directive":"script-src","original-policy":"default-src 'self'; report-uri ../resources/save-report.php?test=report-uri-effective-directive.php","disposition":"enforce","blocked-uri":"inline","line-number":6,"status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report-expected.txt
index fc74e3f1..9df46948 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php","referrer":"","violated-directive":"script-src 'self' 'unsafe-inline'","effective-directive":"script-src","original-policy":"script-src 'self' 'unsafe-inline'; report-uri resources/save-report.php?test=eval-allowed-in-report-only-mode-and-sends-report.php","blocked-uri":"eval","line-number":12,"column-number":13,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php","referrer":"","violated-directive":"script-src 'self' 'unsafe-inline'","effective-directive":"script-src","original-policy":"script-src 'self' 'unsafe-inline'; report-uri resources/save-report.php?test=eval-allowed-in-report-only-mode-and-sends-report.php","disposition":"report","blocked-uri":"eval","line-number":12,"column-number":13,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-allowed-in-report-only-mode-and-sends-report.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-blocked-and-sends-report-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-blocked-and-sends-report-expected.txt
index fe8e6c2..ab934c9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-blocked-and-sends-report-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/eval-blocked-and-sends-report-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/eval-blocked-and-sends-report.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-blocked-and-sends-report.php","referrer":"","violated-directive":"script-src 'self' 'unsafe-inline'","effective-directive":"script-src","original-policy":"script-src 'self' 'unsafe-inline'; report-uri resources/save-report.php?test=eval-blocked-and-sends-report.php","blocked-uri":"eval","line-number":8,"column-number":13,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-blocked-and-sends-report.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-blocked-and-sends-report.php","referrer":"","violated-directive":"script-src 'self' 'unsafe-inline'","effective-directive":"script-src","original-policy":"script-src 'self' 'unsafe-inline'; report-uri resources/save-report.php?test=eval-blocked-and-sends-report.php","disposition":"enforce","blocked-uri":"eval","line-number":8,"column-number":13,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/eval-blocked-and-sends-report.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/image-document-default-src-none-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/image-document-default-src-none-expected.txt
index 8e98ff2..f1b8bf48 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/image-document-default-src-none-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/image-document-default-src-none-expected.txt
@@ -1,5 +1,5 @@
 CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-H/s/dWGkGDaCkKqmo0VNeHrTgvJjinI5uvu7UmY6EB8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
 
-CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-15TqmL1cbLqMXH1nK4EwD191NLSXxlbnYzFAfbG/xp8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
+CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-VPZ2mdsWWlqXOFgt1tAllbbJhG8t9bh6emP1o9GwJxY='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
 
 Ensure that we don't crash when loading an ImageDocument that sets CSP headers 
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-and-enforce-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-and-enforce-expected.txt
index d62f56e..8e5f527 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-and-enforce-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-and-enforce-expected.txt
@@ -9,4 +9,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-and-enforce.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-and-enforce.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-and-enforce.php","blocked-uri":"inline","line-number":9,"status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-and-enforce.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-and-enforce.php","disposition":"report","blocked-uri":"inline","line-number":9,"status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-data-uri-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-data-uri-expected.txt
index 2d69c423..6c29ee9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-data-uri-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-data-uri-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-data-uri.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-data-uri.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-data-uri.php","blocked-uri":"data","line-number":7,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-data-uri.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-data-uri.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-data-uri.php","disposition":"enforce","blocked-uri":"data","line-number":7,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-data-uri.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt
index b8fc526..9fc4544 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-file-uri-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-file-uri.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-file-uri.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-file-uri.php","blocked-uri":"file","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-file-uri.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-file-uri.php","disposition":"enforce","blocked-uri":"file","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt
index 1d443da..033af2d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri-cross-origin.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri-cross-origin.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-uri-cross-origin.php","blocked-uri":"http://localhost:8080/security/resources/abe.png","line-number":4,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri-cross-origin.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri-cross-origin.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-uri-cross-origin.php","disposition":"report","blocked-uri":"http://localhost:8080/security/resources/abe.png","line-number":4,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri-cross-origin.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-expected.txt
index b95cf6bf..621cbcff 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-uri.php","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","line-number":4,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-blocked-uri.php","disposition":"report","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","line-number":4,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-blocked-uri.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-expected.txt
index bd73d1e..54f2ff6 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-cross-origin-no-cookies-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-cross-origin-no-cookies.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-cross-origin-no-cookies.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri http://localhost:8080/security/contentSecurityPolicy/resources/save-report.php?test=report-cross-origin-no-cookies.php","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-cross-origin-no-cookies.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri http://localhost:8080/security/contentSecurityPolicy/resources/save-report.php?test=report-cross-origin-no-cookies.php","disposition":"enforce","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-expected.txt
index 91132b9..61670f91 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-expected.txt
@@ -7,4 +7,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-only.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-only.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-only.php","blocked-uri":"inline","line-number":2,"status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-only.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-only.php","disposition":"report","blocked-uri":"inline","line-number":2,"status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt
index 3febb46..749fb834 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-only-from-header-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-only-from-header.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-only-from-header.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-only-from-header.php","blocked-uri":"inline","line-number":1,"status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-only-from-header.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-only-from-header.php","disposition":"report","blocked-uri":"inline","line-number":1,"status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-expected.txt
index 6af05a7..87ccc223 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-same-origin-with-cookies-expected.txt
@@ -8,4 +8,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-same-origin-with-cookies.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-same-origin-with-cookies.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri /security/contentSecurityPolicy/resources/save-report.php?test=report-same-origin-with-cookies.php","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","line-number":17,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-same-origin-with-cookies.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-same-origin-with-cookies.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri /security/contentSecurityPolicy/resources/save-report.php?test=report-same-origin-with-cookies.php","disposition":"enforce","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","line-number":17,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-same-origin-with-cookies.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-expected.txt
index 0e31202a..9eeeacb 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-uri.php","blocked-uri":"inline","line-number":2,"status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri resources/save-report.php?test=report-uri.php","disposition":"enforce","blocked-uri":"inline","line-number":2,"status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt
index 0044497..bca53d36d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-child-frame-expected.txt
@@ -11,4 +11,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/resources/generate-csp-report.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/resources/generate-csp-report.php","referrer":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-child-frame.html","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri save-report.php?test=generate-csp-report.php","blocked-uri":"inline","line-number":1,"status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/resources/generate-csp-report.php","referrer":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-child-frame.html","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri save-report.php?test=generate-csp-report.php","disposition":"enforce","blocked-uri":"inline","line-number":1,"status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-inline-javascript-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-inline-javascript-expected.txt
index fe236b0..21c8f94 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-inline-javascript-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-inline-javascript-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-inline-javascript.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-inline-javascript.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-uri-from-inline-javascript.php","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-inline-javascript.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-uri-from-inline-javascript.php","disposition":"enforce","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-javascript-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-javascript-expected.txt
index 7a613f8..4aebfbe 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-javascript-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-from-javascript-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-javascript.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-javascript.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-uri-from-javascript.php","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-from-javascript.php","referrer":"","violated-directive":"img-src 'none'","effective-directive":"img-src","original-policy":"img-src 'none'; report-uri resources/save-report.php?test=report-uri-from-javascript.php","disposition":"enforce","blocked-uri":"http://127.0.0.1:8000/security/resources/abe.png","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-expected.txt
index afe8d3a..83767575 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-expected.txt
@@ -8,4 +8,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple.php","referrer":"","violated-directive":"img-src http://*","effective-directive":"img-src","original-policy":"img-src http://*; script-src 'self'; report-uri resources/save-report.php?test=report-uri-multiple.php","blocked-uri":"ftp://blah.test","line-number":8,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple.php","referrer":"","violated-directive":"img-src http://*","effective-directive":"img-src","original-policy":"img-src http://*; script-src 'self'; report-uri resources/save-report.php?test=report-uri-multiple.php","disposition":"report","blocked-uri":"ftp://blah.test","line-number":8,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-reversed-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-reversed-expected.txt
index b190801..eb334ea 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-reversed-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple-reversed-expected.txt
@@ -8,4 +8,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple-reversed.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple-reversed.php","referrer":"","violated-directive":"img-src http://*","effective-directive":"img-src","original-policy":"img-src http://*; script-src 'self'; report-uri resources/save-report.php?test=report-uri-multiple-reversed.php","blocked-uri":"ftp://blah.test","line-number":8,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple-reversed.php","status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple-reversed.php","referrer":"","violated-directive":"img-src http://*","effective-directive":"img-src","original-policy":"img-src http://*; script-src 'self'; report-uri resources/save-report.php?test=report-uri-multiple-reversed.php","disposition":"report","blocked-uri":"ftp://blah.test","line-number":8,"source-file":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-multiple-reversed.php","status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple.php b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple.php
index 159841c..04da65d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple.php
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-multiple.php
@@ -11,4 +11,4 @@
     <img src="ftp://blah.test" />
     <script src="resources/go-to-echo-report.js"></script>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt
index e89abf9..c926be3 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt
@@ -6,4 +6,4 @@
 HTTP_REFERER: http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-scheme-relative.php
 REQUEST_METHOD: POST
 === POST DATA ===
-{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-scheme-relative.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri //127.0.0.1:8080/security/contentSecurityPolicy/resources/save-report.php?test=report-uri-scheme-relative.php","blocked-uri":"inline","line-number":2,"status-code":200}}
+{"csp-report":{"document-uri":"http://127.0.0.1:8000/security/contentSecurityPolicy/report-uri-scheme-relative.php","referrer":"","violated-directive":"script-src 'self'","effective-directive":"script-src","original-policy":"script-src 'self'; report-uri //127.0.0.1:8080/security/contentSecurityPolicy/resources/save-report.php?test=report-uri-scheme-relative.php","disposition":"enforce","blocked-uri":"inline","line-number":2,"status-code":200}}
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics-expected.txt
index 17ea7f3..057bc34 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics-expected.txt
@@ -12,6 +12,7 @@
 PASS window.e.violatedDirective is "violatedDirectiveValue"
 PASS window.e.effectiveDirective is "effectiveDirectiveValue"
 PASS window.e.originalPolicy is "originalPolicyValue"
+PASS window.e.disposition is "enforce"
 PASS window.e.sourceFile is "sourceFileValue"
 PASS window.e.lineNumber is 1
 PASS window.e.columnNumber is 1
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics.html
index 53fd74e..ad65767 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-basics.html
@@ -15,6 +15,7 @@
                 'violatedDirective': 'violatedDirectiveValue',
                 'effectiveDirective': 'effectiveDirectiveValue',
                 'originalPolicy': 'originalPolicyValue',
+                'disposition': 'enforce',
                 'sourceFile': 'sourceFileValue',
                 'lineNumber': 1,
                 'columnNumber': 1,
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-expected.txt
index 9d48cb4..680af36 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-expected.txt
@@ -12,6 +12,7 @@
 PASS window.e.violatedDirective is "img-src 'none'"
 PASS window.e.effectiveDirective is "img-src"
 PASS window.e.originalPolicy is "img-src 'none'"
+PASS window.e.disposition is "enforce"
 PASS window.e.sourceFile is ""
 PASS window.e.lineNumber is 0
 PASS window.e.columnNumber is 0
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script-expected.txt
index b2677f1..ca04e6c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script-expected.txt
@@ -12,6 +12,7 @@
 PASS window.e.violatedDirective is "img-src 'none'"
 PASS window.e.effectiveDirective is "img-src"
 PASS window.e.originalPolicy is "img-src 'none'"
+PASS window.e.disposition is "enforce"
 PASS window.e.sourceFile is ""
 PASS window.e.lineNumber is 0
 PASS window.e.columnNumber is 0
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script.html
index 2291d223..74747f8f 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image-from-script.html
@@ -14,6 +14,7 @@
             'violatedDirective': 'img-src \'none\'',
             'effectiveDirective': 'img-src',
             'originalPolicy': 'img-src \'none\'',
+            'disposition': 'enforce',
             'sourceFile': '',
             'lineNumber': 0,
             'columnNumber': 0,
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image.html
index 5db88087c..1d8eded 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-cross-origin-image.html
@@ -14,6 +14,7 @@
             'violatedDirective': 'img-src \'none\'',
             'effectiveDirective': 'img-src',
             'originalPolicy': 'img-src \'none\'',
+            'disposition': 'enforce',
             'sourceFile': '',
             'lineNumber': 0,
             'columnNumber': 0,
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-expected.txt
index 5e5f7eb5..a08dc5f 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-expected.txt
@@ -12,6 +12,7 @@
 PASS window.e.violatedDirective is "img-src 'none'"
 PASS window.e.effectiveDirective is "img-src"
 PASS window.e.originalPolicy is "img-src 'none'"
+PASS window.e.disposition is "enforce"
 PASS window.e.sourceFile is ""
 PASS window.e.lineNumber is 0
 PASS window.e.columnNumber is 0
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script-expected.txt
index a877f13..b8d03f7 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script-expected.txt
@@ -12,6 +12,7 @@
 PASS window.e.violatedDirective is "img-src 'none'"
 PASS window.e.effectiveDirective is "img-src"
 PASS window.e.originalPolicy is "img-src 'none'"
+PASS window.e.disposition is "enforce"
 PASS window.e.sourceFile is ""
 PASS window.e.lineNumber is 0
 PASS window.e.columnNumber is 0
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script.html
index fdefd28..581a399 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image-from-script.html
@@ -14,6 +14,7 @@
             'violatedDirective': 'img-src \'none\'',
             'effectiveDirective': 'img-src',
             'originalPolicy': 'img-src \'none\'',
+            'disposition': 'enforce',
             'sourceFile': '',
             'lineNumber': 0,
             'columnNumber': 0,
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image.html b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image.html
index 20a88cd..cb3d1fb 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/securitypolicyviolation/securitypolicyviolation-block-image.html
@@ -14,6 +14,7 @@
             'violatedDirective': 'img-src \'none\'',
             'effectiveDirective': 'img-src',
             'originalPolicy': 'img-src \'none\'',
+            'disposition': 'enforce',
             'sourceFile': '',
             'lineNumber': 0,
             'columnNumber': 0,
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html
index 47b6eda..c21bdff1 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html
@@ -25,6 +25,7 @@
                     'violatedDirective': 'block-all-mixed-content',
                     'effectiveDirective': 'block-all-mixed-content',
                     'originalPolicy': 'block-all-mixed-content',
+                    'disposition': 'enforce',
                     'sourceFile': '',
                     'lineNumber': 0,
                     'columnNumber': 0,
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-reportonly.https.php b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-reportonly.https.php
index 808bf02..ab24b563 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-reportonly.https.php
+++ b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-reportonly.https.php
@@ -27,6 +27,7 @@
                     'violatedDirective': 'block-all-mixed-content',
                     'effectiveDirective': 'block-all-mixed-content',
                     'originalPolicy': 'block-all-mixed-content',
+                    'disposition': 'report',
                     'sourceFile': '',
                     'lineNumber': 0,
                     'columnNumber': 0,
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/clients-openwindow.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/clients-openwindow.html
index 886e5eab..7aae5e4 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/clients-openwindow.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/clients-openwindow.html
@@ -51,11 +51,6 @@
                     'openWindow() error is: TypeError',
                     ];
 
-    // LayoutTests on Mac do not open focused windows.
-    var isMac = navigator.platform.indexOf('Mac') == 0;
-    if (isMac)
-      expected[10] = ' focused: false';
-
     function onMessage(e) {
       var message = e.data;
 
diff --git a/third_party/WebKit/LayoutTests/imagecapture/getphotocapabilities.html b/third_party/WebKit/LayoutTests/imagecapture/getphotocapabilities.html
index cb602b6..8b654e0 100644
--- a/third_party/WebKit/LayoutTests/imagecapture/getphotocapabilities.html
+++ b/third_party/WebKit/LayoutTests/imagecapture/getphotocapabilities.html
@@ -40,8 +40,8 @@
       assert_true(capabilities.iso instanceof MediaSettingsRange);
       assert_equals(capabilities.iso.max, mock_capabilities.iso.max);
       assert_equals(capabilities.iso.min, mock_capabilities.iso.min);
-      assert_equals(capabilities.iso.current,
-                    mock_capabilities.iso.current);
+      assert_equals(capabilities.iso.current, mock_capabilities.iso.current);
+      assert_equals(capabilities.iso.step, mock_capabilities.iso.step);
 
       assert_true(capabilities.imageHeight instanceof MediaSettingsRange);
       assert_equals(capabilities.imageHeight.max,
@@ -50,6 +50,8 @@
                     mock_capabilities.height.min);
       assert_equals(capabilities.imageHeight.current,
                     mock_capabilities.height.current);
+      assert_equals(capabilities.imageHeight.step,
+                    mock_capabilities.height.step);
 
       assert_true(capabilities.imageWidth instanceof MediaSettingsRange);
       assert_equals(capabilities.imageWidth.max,
@@ -58,12 +60,13 @@
                     mock_capabilities.width.min);
       assert_equals(capabilities.imageWidth.current,
                     mock_capabilities.width.current);
+      assert_equals(capabilities.imageWidth.step, mock_capabilities.width.step);
 
       assert_true(capabilities.zoom instanceof MediaSettingsRange);
       assert_equals(capabilities.zoom.max, mock_capabilities.zoom.max);
       assert_equals(capabilities.zoom.min, mock_capabilities.zoom.min);
-      assert_equals(capabilities.zoom.current,
-                    mock_capabilities.zoom.current);
+      assert_equals(capabilities.zoom.current, mock_capabilities.zoom.current);
+      assert_equals(capabilities.zoom.step, mock_capabilities.zoom.step);
 
       assert_equals(capabilities.focusMode,
           meteringModeNames[mock_capabilities.focus_mode], 'focusMode');
@@ -71,14 +74,16 @@
       assert_equals(capabilities.exposureMode,
           meteringModeNames[mock_capabilities.exposure_mode], 'exposureMode;');
 
-      assert_true(capabilities.exposureCompensation
-          instanceof MediaSettingsRange);
+      assert_true(capabilities.exposureCompensation instanceof
+                  MediaSettingsRange);
       assert_equals(capabilities.exposureCompensation.max,
-          mock_capabilities.exposure_compensation.max);
+                    mock_capabilities.exposure_compensation.max);
       assert_equals(capabilities.exposureCompensation.min,
-          mock_capabilities.exposure_compensation.min);
+                    mock_capabilities.exposure_compensation.min);
       assert_equals(capabilities.exposureCompensation.current,
-          mock_capabilities.exposure_compensation.current);
+                    mock_capabilities.exposure_compensation.current);
+      assert_equals(capabilities.exposureCompensation.step,
+                    mock_capabilities.exposure_compensation.step);
 
       assert_equals(capabilities.whiteBalanceMode,
           meteringModeNames[mock_capabilities.white_balance_mode],
@@ -98,6 +103,8 @@
                     mock_capabilities.color_temperature.min);
       assert_equals(capabilities.colorTemperature.current,
                     mock_capabilities.color_temperature.current);
+      assert_equals(capabilities.colorTemperature.step,
+                    mock_capabilities.color_temperature.step);
 
       assert_true(capabilities.brightness instanceof MediaSettingsRange);
       assert_equals(capabilities.brightness.max,
@@ -106,14 +113,16 @@
                     mock_capabilities.brightness.min);
       assert_equals(capabilities.brightness.current,
                     mock_capabilities.brightness.current);
+      assert_equals(capabilities.brightness.step,
+                    mock_capabilities.brightness.step);
 
       assert_true(capabilities.contrast instanceof MediaSettingsRange);
-      assert_equals(capabilities.contrast.max,
-                    mock_capabilities.contrast.max);
-      assert_equals(capabilities.contrast.min,
-                    mock_capabilities.contrast.min);
+      assert_equals(capabilities.contrast.max, mock_capabilities.contrast.max);
+      assert_equals(capabilities.contrast.min, mock_capabilities.contrast.min);
       assert_equals(capabilities.contrast.current,
                     mock_capabilities.contrast.current);
+      assert_equals(capabilities.contrast.step,
+                    mock_capabilities.contrast.step);
 
       assert_true(capabilities.saturation instanceof MediaSettingsRange);
       assert_equals(capabilities.saturation.max,
@@ -122,6 +131,8 @@
                     mock_capabilities.saturation.min);
       assert_equals(capabilities.saturation.current,
                     mock_capabilities.saturation.current);
+      assert_equals(capabilities.saturation.step,
+                    mock_capabilities.saturation.step);
 
       assert_true(capabilities.sharpness instanceof MediaSettingsRange);
       assert_equals(capabilities.sharpness.max,
@@ -130,6 +141,8 @@
                     mock_capabilities.sharpness.min);
       assert_equals(capabilities.sharpness.current,
                     mock_capabilities.sharpness.current);
+      assert_equals(capabilities.sharpness.step,
+                    mock_capabilities.sharpness.step);
       t.done();
     })
     .catch(error => {
diff --git a/third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js b/third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js
index fcaadba1..b50d16a 100644
--- a/third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js
+++ b/third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js
@@ -15,22 +15,23 @@
           pipe => this.bindToPipe(pipe));
 
       this.capabilities_ = { capabilities : {
-          iso : { min : 100, max : 12000, current : 400 },
-          height : { min : 240, max : 2448, current : 240 },
-          width : { min : 320, max : 3264, current : 320 },
-          width : { min : 320, max : 3264, current : 320 },
-          zoom : { min : 0, max : 10, current : 5 },
+          iso : { min : 100, max : 12000, current : 400, step : 1 },
+          height : { min : 240, max : 2448, current : 240, step : 2 },
+          width : { min : 320, max : 3264, current : 320, step : 3 },
+          zoom : { min : 0, max : 10, current : 5, step : 5 },
           focus_mode : imageCapture.MeteringMode.MANUAL,
           exposure_mode : imageCapture.MeteringMode.SINGLE_SHOT,
-          exposure_compensation : { min : -200, max : 200, current : 33},
+          exposure_compensation :
+              { min : -200, max : 200, current : 33, step : 33},
           white_balance_mode : imageCapture.MeteringMode.CONTINUOUS,
           fill_light_mode : imageCapture.FillLightMode.AUTO,
           red_eye_reduction : true,
-          color_temperature : { min : 2500, max : 6500, current : 6000 },
-          brightness : { min : 1, max : 10, current : 5 },
-          contrast : { min : 2, max : 9, current : 5 },
-          saturation : { min : 3, max : 8, current : 6 },
-          sharpness : { min : 4, max : 7, current : 7 },
+          color_temperature :
+              { min : 2500, max : 6500, current : 6000, step : 1000 },
+          brightness : { min : 1, max : 10, current : 5, step : 1 },
+          contrast : { min : 2, max : 9, current : 5, step : 1 },
+          saturation : { min : 3, max : 8, current : 6, step : 1 },
+          sharpness : { min : 4, max : 7, current : 7, step : 1 },
       }};
       this.settings_ = null;
     }
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/Element-classlist-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/Element-classlist-expected.txt
index 2a1ac5db..7166871 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/Element-classlist-expected.txt
+++ b/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/Element-classlist-expected.txt
@@ -12,7 +12,7 @@
 PASS classList.item() must return null for negative index 
 PASS classList[index] must be undefined for out-of-range index 
 PASS classList[index] must be undefined for negative index 
-FAIL className should contain initial markup whitespace assert_equals: expected " " but got ""
+PASS className should contain initial markup whitespace 
 PASS classList should contain initial markup whitespace 
 FAIL .contains(empty_string) must return false Failed to execute 'contains' on 'DOMTokenList': The token provided must not be empty.
 PASS .add(empty_string) must throw a SYNTAX_ERR 
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/Node-textContent-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/Node-textContent-expected.txt
deleted file mode 100644
index aa392a96..0000000
--- a/third_party/WebKit/LayoutTests/imported/wpt/dom/nodes/Node-textContent-expected.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-This is a testharness.js-based test.
-PASS For an empty Element, textContent should be the empty string 
-PASS For an empty DocumentFragment, textContent should be the empty string 
-PASS Element with children 
-PASS Element with descendants 
-PASS DocumentFragment with children 
-PASS DocumentFragment with descendants 
-PASS For an empty Text, textContent should be the empty string 
-PASS For an empty ProcessingInstruction, textContent should be the empty string 
-PASS For an empty Comment, textContent should be the empty string 
-PASS For a Text with data, textContent should be that data 
-PASS For a ProcessingInstruction with data, textContent should be that data 
-PASS For a Comment with data, textContent should be that data 
-PASS For Documents created by parser, textContent should be null 
-PASS For Documents created by createDocument, textContent should be null 
-PASS For Documents created by createHTMLDocument, textContent should be null 
-PASS For DocumentType created by parser, textContent should be null 
-PASS For DocumentType created by script, textContent should be null 
-PASS Element without children set to null 
-PASS Element with empty text node as child set to null 
-PASS Element with children set to null 
-PASS Element with descendants set to null 
-PASS DocumentFragment without children set to null 
-PASS DocumentFragment with empty text node as child set to null 
-PASS DocumentFragment with children set to null 
-PASS DocumentFragment with descendants set to null 
-PASS Element without children set to undefined 
-PASS Element with empty text node as child set to undefined 
-PASS Element with children set to undefined 
-PASS Element with descendants set to undefined 
-PASS DocumentFragment without children set to undefined 
-PASS DocumentFragment with empty text node as child set to undefined 
-PASS DocumentFragment with children set to undefined 
-PASS DocumentFragment with descendants set to undefined 
-PASS Element without children set to "" 
-FAIL Element with empty text node as child set to "" assert_equals: expected null but got Text node ""
-PASS Element with children set to "" 
-PASS Element with descendants set to "" 
-PASS DocumentFragment without children set to "" 
-FAIL DocumentFragment with empty text node as child set to "" assert_equals: expected null but got Text node ""
-PASS DocumentFragment with children set to "" 
-PASS DocumentFragment with descendants set to "" 
-PASS Element without children set to 42 
-PASS Element with empty text node as child set to 42 
-PASS Element with children set to 42 
-PASS Element with descendants set to 42 
-PASS DocumentFragment without children set to 42 
-PASS DocumentFragment with empty text node as child set to 42 
-PASS DocumentFragment with children set to 42 
-PASS DocumentFragment with descendants set to 42 
-PASS Element without children set to "abc" 
-PASS Element with empty text node as child set to "abc" 
-PASS Element with children set to "abc" 
-PASS Element with descendants set to "abc" 
-PASS DocumentFragment without children set to "abc" 
-PASS DocumentFragment with empty text node as child set to "abc" 
-PASS DocumentFragment with children set to "abc" 
-PASS DocumentFragment with descendants set to "abc" 
-PASS Element without children set to "<b>xyz</b>" 
-PASS Element with empty text node as child set to "<b>xyz</b>" 
-PASS Element with children set to "<b>xyz</b>" 
-PASS Element with descendants set to "<b>xyz</b>" 
-PASS DocumentFragment without children set to "<b>xyz</b>" 
-PASS DocumentFragment with empty text node as child set to "<b>xyz</b>" 
-PASS DocumentFragment with children set to "<b>xyz</b>" 
-PASS DocumentFragment with descendants set to "<b>xyz</b>" 
-PASS Element without children set to "d\0e" 
-PASS Element with empty text node as child set to "d\0e" 
-PASS Element with children set to "d\0e" 
-PASS Element with descendants set to "d\0e" 
-PASS DocumentFragment without children set to "d\0e" 
-PASS DocumentFragment with empty text node as child set to "d\0e" 
-PASS DocumentFragment with children set to "d\0e" 
-PASS DocumentFragment with descendants set to "d\0e" 
-PASS For a Text, textContent should set the data 
-PASS For a ProcessingInstruction, textContent should set the data 
-PASS For a Comment, textContent should set the data 
-PASS For Documents created by parser, setting textContent should do nothing 
-PASS For Documents created by createDocument, setting textContent should do nothing 
-PASS For Documents created by createHTMLDocument, setting textContent should do nothing 
-PASS For DocumentType created by parser, setting textContent should do nothing 
-PASS For DocumentType created by script, setting textContent should do nothing 
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/dom/ranges/Range-set-expected.txt b/third_party/WebKit/LayoutTests/imported/wpt/dom/ranges/Range-set-expected.txt
deleted file mode 100644
index eeb70b0..0000000
--- a/third_party/WebKit/LayoutTests/imported/wpt/dom/ranges/Range-set-expected.txt
+++ /dev/null
@@ -1,10073 +0,0 @@
-This is a testharness.js-based test.
-PASS Set up range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0] 
-PASS Set up range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1] 
-PASS Set up range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8] 
-PASS Set up range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9] 
-PASS Set up range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0] 
-PASS Set up range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9] 
-PASS Set up range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0] 
-PASS Set up range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8] 
-PASS Set up range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0] 
-PASS Set up range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8] 
-PASS Set up range 10 [document.documentElement, 0, document.documentElement, 1] 
-PASS Set up range 11 [document.documentElement, 0, document.documentElement, 2] 
-PASS Set up range 12 [document.documentElement, 1, document.documentElement, 2] 
-PASS Set up range 13 [document.head, 1, document.head, 1] 
-PASS Set up range 14 [document.body, 4, document.body, 5] 
-PASS Set up range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1] 
-PASS Set up range 16 [paras[0], 0, paras[0], 1] 
-PASS Set up range 17 [detachedPara1, 0, detachedPara1, 1] 
-PASS Set up range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0] 
-PASS Set up range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8] 
-PASS Set up range 20 [paras[0].firstChild, 3, paras[3], 1] 
-PASS Set up range 21 [paras[0], 0, paras[0].firstChild, 7] 
-PASS Set up range 22 [testDiv, 2, paras[4], 1] 
-PASS Set up range 23 [document, 0, document, 1] 
-PASS Set up range 24 [document, 0, document, 2] 
-PASS Set up range 25 [comment, 2, comment, 3] 
-PASS Set up range 26 [testDiv, 0, comment, 5] 
-PASS Set up range 27 [foreignDoc, 1, foreignComment, 2] 
-PASS Set up range 28 [foreignDoc.body, 0, foreignTextNode, 36] 
-PASS Set up range 29 [xmlDoc, 1, xmlComment, 0] 
-PASS Set up range 30 [detachedTextNode, 0, detachedTextNode, 8] 
-PASS Set up range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8] 
-PASS Set up range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8] 
-PASS Set up range 33 [detachedComment, 3, detachedComment, 4] 
-PASS Set up range 34 [detachedForeignComment, 0, detachedForeignComment, 1] 
-PASS Set up range 35 [detachedXmlComment, 2, detachedXmlComment, 6] 
-PASS Set up range 36 [docfrag, 0, docfrag, 0] 
-PASS Set up range 37 [processingInstruction, 0, processingInstruction, 4] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 29 [document.head, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 30 [document.body, 3] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 35 [paras[0], 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 36 [paras[0], 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 37 [paras[0], 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 38 [paras[1], 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 39 [paras[1], 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 40 [paras[1], 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 43 [testDiv, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 44 [testDiv, 3] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 45 [document, -1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 46 [document, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 47 [document, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 48 [document, 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 49 [document, 3] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 50 [comment, -1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 51 [comment, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 52 [comment, 4] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 53 [comment, 96] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 56 [foreignComment, 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 75 [detachedComment, 3] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 76 [detachedComment, 5] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 80 [docfrag, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 83 [doctype, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 84 [doctype, -17] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 85 [doctype, 1] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 29 [document.head, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 30 [document.body, 3] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 35 [paras[0], 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 36 [paras[0], 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 37 [paras[0], 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 38 [paras[1], 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 39 [paras[1], 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 40 [paras[1], 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 43 [testDiv, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 44 [testDiv, 3] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 45 [document, -1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 46 [document, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 47 [document, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 48 [document, 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 49 [document, 3] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 50 [comment, -1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 51 [comment, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 52 [comment, 4] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 53 [comment, 96] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 80 [docfrag, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 83 [doctype, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 84 [doctype, -17] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 85 [doctype, 1] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 29 [document.head, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 30 [document.body, 3] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 35 [paras[0], 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 36 [paras[0], 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 37 [paras[0], 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 38 [paras[1], 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 39 [paras[1], 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 40 [paras[1], 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 43 [testDiv, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 44 [testDiv, 3] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 45 [document, -1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 46 [document, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 47 [document, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 48 [document, 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 49 [document, 3] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 50 [comment, -1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 51 [comment, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 52 [comment, 4] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 53 [comment, 96] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 56 [foreignComment, 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 75 [detachedComment, 3] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 76 [detachedComment, 5] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 80 [docfrag, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 83 [doctype, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 84 [doctype, -17] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 85 [doctype, 1] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 24 [document.documentElement, -1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 25 [document.documentElement, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 26 [document.documentElement, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 27 [document.documentElement, 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 28 [document.documentElement, 7] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 29 [document.head, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 30 [document.body, 3] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 35 [paras[0], 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 36 [paras[0], 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 37 [paras[0], 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 38 [paras[1], 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 39 [paras[1], 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 40 [paras[1], 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 41 [detachedPara1, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 42 [detachedPara1, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 43 [testDiv, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 44 [testDiv, 3] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 45 [document, -1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 46 [document, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 47 [document, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 48 [document, 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 49 [document, 3] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 50 [comment, -1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 51 [comment, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 52 [comment, 4] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 53 [comment, 96] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 54 [foreignDoc, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 55 [foreignDoc, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 56 [foreignComment, 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 75 [detachedComment, 3] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 76 [detachedComment, 5] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 80 [docfrag, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 83 [doctype, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 84 [doctype, -17] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 85 [doctype, 1] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 29 [document.head, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 30 [document.body, 3] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 35 [paras[0], 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 36 [paras[0], 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 37 [paras[0], 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 38 [paras[1], 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 39 [paras[1], 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 40 [paras[1], 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 43 [testDiv, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 44 [testDiv, 3] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 45 [document, -1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 46 [document, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 47 [document, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 48 [document, 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 49 [document, 3] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 50 [comment, -1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 51 [comment, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 52 [comment, 4] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 53 [comment, 96] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 56 [foreignComment, 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 75 [detachedComment, 3] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 76 [detachedComment, 5] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 80 [docfrag, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 83 [doctype, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 84 [doctype, -17] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 85 [doctype, 1] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 24 [document.documentElement, -1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 25 [document.documentElement, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 26 [document.documentElement, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 27 [document.documentElement, 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 28 [document.documentElement, 7] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 29 [document.head, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 30 [document.body, 3] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 35 [paras[0], 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 36 [paras[0], 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 37 [paras[0], 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 38 [paras[1], 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 39 [paras[1], 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 40 [paras[1], 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 41 [detachedPara1, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 42 [detachedPara1, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 43 [testDiv, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 44 [testDiv, 3] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 45 [document, -1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 46 [document, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 47 [document, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 48 [document, 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 49 [document, 3] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 50 [comment, -1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 51 [comment, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 52 [comment, 4] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 53 [comment, 96] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 54 [foreignDoc, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 55 [foreignDoc, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 56 [foreignComment, 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 75 [detachedComment, 3] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 76 [detachedComment, 5] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 80 [docfrag, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 83 [doctype, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 84 [doctype, -17] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 85 [doctype, 1] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 16 [detachedPara1.firstChild, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 17 [detachedPara1.firstChild, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 18 [detachedPara1.firstChild, 8] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 29 [document.head, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 30 [document.body, 3] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 35 [paras[0], 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 36 [paras[0], 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 37 [paras[0], 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 38 [paras[1], 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 39 [paras[1], 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 40 [paras[1], 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 43 [testDiv, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 44 [testDiv, 3] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 45 [document, -1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 46 [document, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 47 [document, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 48 [document, 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 49 [document, 3] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 50 [comment, -1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 51 [comment, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 52 [comment, 4] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 53 [comment, 96] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 56 [foreignComment, 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 75 [detachedComment, 3] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 76 [detachedComment, 5] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 80 [docfrag, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 83 [doctype, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 84 [doctype, -17] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 85 [doctype, 1] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 16 [detachedPara1.firstChild, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 17 [detachedPara1.firstChild, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 18 [detachedPara1.firstChild, 8] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 29 [document.head, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 30 [document.body, 3] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 35 [paras[0], 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 36 [paras[0], 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 37 [paras[0], 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 38 [paras[1], 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 39 [paras[1], 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 40 [paras[1], 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 43 [testDiv, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 44 [testDiv, 3] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 45 [document, -1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 46 [document, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 47 [document, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 48 [document, 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 49 [document, 3] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 50 [comment, -1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 51 [comment, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 52 [comment, 4] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 53 [comment, 96] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 56 [foreignComment, 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 75 [detachedComment, 3] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 76 [detachedComment, 5] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 80 [docfrag, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 83 [doctype, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 84 [doctype, -17] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 85 [doctype, 1] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 29 [document.head, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 30 [document.body, 3] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 35 [paras[0], 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 36 [paras[0], 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 37 [paras[0], 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 38 [paras[1], 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 39 [paras[1], 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 40 [paras[1], 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 43 [testDiv, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 44 [testDiv, 3] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 45 [document, -1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 46 [document, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 47 [document, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 48 [document, 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 49 [document, 3] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 50 [comment, -1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 51 [comment, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 52 [comment, 4] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 53 [comment, 96] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 56 [foreignComment, 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 75 [detachedComment, 3] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 76 [detachedComment, 5] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 80 [docfrag, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 83 [doctype, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 84 [doctype, -17] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 85 [doctype, 1] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 29 [document.head, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 30 [document.body, 3] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 35 [paras[0], 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 36 [paras[0], 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 37 [paras[0], 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 38 [paras[1], 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 39 [paras[1], 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 40 [paras[1], 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 43 [testDiv, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 44 [testDiv, 3] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 45 [document, -1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 46 [document, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 47 [document, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 48 [document, 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 49 [document, 3] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 50 [comment, -1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 51 [comment, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 52 [comment, 4] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 53 [comment, 96] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 56 [foreignComment, 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 75 [detachedComment, 3] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 76 [detachedComment, 5] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 80 [docfrag, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 83 [doctype, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 84 [doctype, -17] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 85 [doctype, 1] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 29 [document.head, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 30 [document.body, 3] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 35 [paras[0], 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 36 [paras[0], 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 37 [paras[0], 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 38 [paras[1], 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 39 [paras[1], 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 40 [paras[1], 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 43 [testDiv, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 44 [testDiv, 3] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 45 [document, -1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 46 [document, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 47 [document, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 48 [document, 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 49 [document, 3] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 50 [comment, -1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 51 [comment, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 52 [comment, 4] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 53 [comment, 96] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 80 [docfrag, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 83 [doctype, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 84 [doctype, -17] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 85 [doctype, 1] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 10 [document.documentElement, 0, document.documentElement, 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 24 [document.documentElement, -1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 25 [document.documentElement, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 26 [document.documentElement, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 27 [document.documentElement, 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 28 [document.documentElement, 7] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 29 [document.head, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 30 [document.body, 3] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 35 [paras[0], 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 36 [paras[0], 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 37 [paras[0], 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 38 [paras[1], 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 39 [paras[1], 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 40 [paras[1], 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 41 [detachedPara1, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 42 [detachedPara1, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 43 [testDiv, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 44 [testDiv, 3] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 45 [document, -1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 46 [document, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 47 [document, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 48 [document, 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 49 [document, 3] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 50 [comment, -1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 51 [comment, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 52 [comment, 4] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 53 [comment, 96] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 54 [foreignDoc, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 55 [foreignDoc, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 56 [foreignComment, 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 75 [detachedComment, 3] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 76 [detachedComment, 5] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 80 [docfrag, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 83 [doctype, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 84 [doctype, -17] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 85 [doctype, 1] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 11 [document.documentElement, 0, document.documentElement, 2], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 24 [document.documentElement, -1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 25 [document.documentElement, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 26 [document.documentElement, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 27 [document.documentElement, 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 28 [document.documentElement, 7] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 29 [document.head, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 30 [document.body, 3] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 35 [paras[0], 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 36 [paras[0], 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 37 [paras[0], 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 38 [paras[1], 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 39 [paras[1], 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 40 [paras[1], 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 41 [detachedPara1, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 42 [detachedPara1, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 43 [testDiv, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 44 [testDiv, 3] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 45 [document, -1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 46 [document, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 47 [document, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 48 [document, 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 49 [document, 3] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 50 [comment, -1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 51 [comment, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 52 [comment, 4] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 53 [comment, 96] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 54 [foreignDoc, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 55 [foreignDoc, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 56 [foreignComment, 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 75 [detachedComment, 3] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 76 [detachedComment, 5] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 80 [docfrag, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 83 [doctype, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 84 [doctype, -17] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 85 [doctype, 1] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 12 [document.documentElement, 1, document.documentElement, 2], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 29 [document.head, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 30 [document.body, 3] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 35 [paras[0], 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 36 [paras[0], 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 37 [paras[0], 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 38 [paras[1], 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 39 [paras[1], 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 40 [paras[1], 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 43 [testDiv, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 44 [testDiv, 3] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 45 [document, -1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 46 [document, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 47 [document, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 48 [document, 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 49 [document, 3] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 50 [comment, -1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 51 [comment, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 52 [comment, 4] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 53 [comment, 96] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 13 [document.head, 1, document.head, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 13 [document.head, 1, document.head, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 13 [document.head, 1, document.head, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 13 [document.head, 1, document.head, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 13 [document.head, 1, document.head, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 13 [document.head, 1, document.head, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 13 [document.head, 1, document.head, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 80 [docfrag, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 83 [doctype, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 84 [doctype, -17] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 85 [doctype, 1] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 13 [document.head, 1, document.head, 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 24 [document.documentElement, -1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 25 [document.documentElement, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 26 [document.documentElement, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 27 [document.documentElement, 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 28 [document.documentElement, 7] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 29 [document.head, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 30 [document.body, 3] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 35 [paras[0], 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 36 [paras[0], 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 37 [paras[0], 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 38 [paras[1], 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 39 [paras[1], 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 40 [paras[1], 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 41 [detachedPara1, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 42 [detachedPara1, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 43 [testDiv, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 44 [testDiv, 3] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 45 [document, -1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 46 [document, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 47 [document, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 48 [document, 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 49 [document, 3] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 50 [comment, -1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 51 [comment, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 52 [comment, 4] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 53 [comment, 96] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 54 [foreignDoc, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 55 [foreignDoc, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 56 [foreignComment, 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 14 [document.body, 4, document.body, 5], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 14 [document.body, 4, document.body, 5], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 14 [document.body, 4, document.body, 5], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 14 [document.body, 4, document.body, 5], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 14 [document.body, 4, document.body, 5], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 14 [document.body, 4, document.body, 5], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 14 [document.body, 4, document.body, 5], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 75 [detachedComment, 3] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 76 [detachedComment, 5] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 80 [docfrag, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 83 [doctype, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 84 [doctype, -17] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 85 [doctype, 1] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 14 [document.body, 4, document.body, 5], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 29 [document.head, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 30 [document.body, 3] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 35 [paras[0], 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 36 [paras[0], 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 37 [paras[0], 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 38 [paras[1], 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 39 [paras[1], 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 40 [paras[1], 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 43 [testDiv, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 44 [testDiv, 3] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 45 [document, -1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 46 [document, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 47 [document, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 48 [document, 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 49 [document, 3] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 50 [comment, -1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 51 [comment, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 52 [comment, 4] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 53 [comment, 96] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 80 [docfrag, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 83 [doctype, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 84 [doctype, -17] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 85 [doctype, 1] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 29 [document.head, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 30 [document.body, 3] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 35 [paras[0], 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 36 [paras[0], 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 37 [paras[0], 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 38 [paras[1], 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 39 [paras[1], 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 40 [paras[1], 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 43 [testDiv, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 44 [testDiv, 3] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 45 [document, -1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 46 [document, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 47 [document, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 48 [document, 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 49 [document, 3] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 50 [comment, -1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 51 [comment, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 52 [comment, 4] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 53 [comment, 96] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 16 [paras[0], 0, paras[0], 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 16 [paras[0], 0, paras[0], 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 16 [paras[0], 0, paras[0], 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 16 [paras[0], 0, paras[0], 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 16 [paras[0], 0, paras[0], 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 16 [paras[0], 0, paras[0], 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 16 [paras[0], 0, paras[0], 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 80 [docfrag, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 83 [doctype, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 84 [doctype, -17] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 85 [doctype, 1] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 16 [paras[0], 0, paras[0], 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 15 [paras[1].firstChild, 65535] 
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 16 [detachedPara1.firstChild, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 17 [detachedPara1.firstChild, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 18 [detachedPara1.firstChild, 8] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 29 [document.head, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 30 [document.body, 3] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 35 [paras[0], 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 36 [paras[0], 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 37 [paras[0], 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 38 [paras[1], 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 39 [paras[1], 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 40 [paras[1], 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 43 [testDiv, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 44 [testDiv, 3] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 45 [document, -1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 46 [document, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 47 [document, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 48 [document, 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 49 [document, 3] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 50 [comment, -1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 51 [comment, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 52 [comment, 4] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 53 [comment, 96] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 80 [docfrag, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 83 [doctype, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 84 [doctype, -17] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 85 [doctype, 1] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 17 [detachedPara1, 0, detachedPara1, 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 29 [document.head, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 30 [document.body, 3] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 35 [paras[0], 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 36 [paras[0], 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 37 [paras[0], 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 38 [paras[1], 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 39 [paras[1], 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 40 [paras[1], 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 43 [testDiv, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 44 [testDiv, 3] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 45 [document, -1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 46 [document, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 47 [document, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 48 [document, 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 49 [document, 3] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 50 [comment, -1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 51 [comment, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 52 [comment, 4] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 53 [comment, 96] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 56 [foreignComment, 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 75 [detachedComment, 3] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 76 [detachedComment, 5] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 80 [docfrag, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 83 [doctype, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 84 [doctype, -17] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 85 [doctype, 1] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 29 [document.head, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 30 [document.body, 3] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 35 [paras[0], 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 36 [paras[0], 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 37 [paras[0], 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 38 [paras[1], 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 39 [paras[1], 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 40 [paras[1], 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 43 [testDiv, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 44 [testDiv, 3] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 45 [document, -1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 46 [document, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 47 [document, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 48 [document, 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 49 [document, 3] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 50 [comment, -1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 51 [comment, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 52 [comment, 4] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 53 [comment, 96] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 56 [foreignComment, 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 75 [detachedComment, 3] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 76 [detachedComment, 5] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 80 [docfrag, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 83 [doctype, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 84 [doctype, -17] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 85 [doctype, 1] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 29 [document.head, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 30 [document.body, 3] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 35 [paras[0], 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 36 [paras[0], 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 37 [paras[0], 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 38 [paras[1], 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 39 [paras[1], 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 40 [paras[1], 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 43 [testDiv, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 44 [testDiv, 3] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 45 [document, -1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 46 [document, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 47 [document, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 48 [document, 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 49 [document, 3] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 50 [comment, -1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 51 [comment, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 52 [comment, 4] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 53 [comment, 96] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 80 [docfrag, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 83 [doctype, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 84 [doctype, -17] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 85 [doctype, 1] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 24 [document.documentElement, -1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 25 [document.documentElement, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 26 [document.documentElement, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 27 [document.documentElement, 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 28 [document.documentElement, 7] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 29 [document.head, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 30 [document.body, 3] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 35 [paras[0], 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 36 [paras[0], 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 37 [paras[0], 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 38 [paras[1], 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 39 [paras[1], 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 40 [paras[1], 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 41 [detachedPara1, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 42 [detachedPara1, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 43 [testDiv, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 44 [testDiv, 3] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 45 [document, -1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 46 [document, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 47 [document, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 48 [document, 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 49 [document, 3] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 50 [comment, -1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 51 [comment, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 52 [comment, 4] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 53 [comment, 96] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 54 [foreignDoc, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 55 [foreignDoc, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 56 [foreignComment, 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 75 [detachedComment, 3] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 76 [detachedComment, 5] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 80 [docfrag, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 83 [doctype, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 84 [doctype, -17] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 85 [doctype, 1] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 29 [document.head, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 30 [document.body, 3] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 35 [paras[0], 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 36 [paras[0], 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 37 [paras[0], 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 38 [paras[1], 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 39 [paras[1], 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 40 [paras[1], 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 43 [testDiv, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 44 [testDiv, 3] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 45 [document, -1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 46 [document, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 47 [document, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 48 [document, 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 49 [document, 3] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 50 [comment, -1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 51 [comment, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 52 [comment, 4] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 53 [comment, 96] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 22 [testDiv, 2, paras[4], 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 22 [testDiv, 2, paras[4], 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 22 [testDiv, 2, paras[4], 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 22 [testDiv, 2, paras[4], 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 22 [testDiv, 2, paras[4], 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 22 [testDiv, 2, paras[4], 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 22 [testDiv, 2, paras[4], 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 80 [docfrag, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 83 [doctype, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 84 [doctype, -17] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 85 [doctype, 1] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 22 [testDiv, 2, paras[4], 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 23 [document, 0, document, 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 23 [document, 0, document, 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 23 [document, 0, document, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 23 [document, 0, document, 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 23 [document, 0, document, 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 23 [document, 0, document, 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 23 [document, 0, document, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 23 [document, 0, document, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 23 [document, 0, document, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 23 [document, 0, document, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 23 [document, 0, document, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 23 [document, 0, document, 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 23 [document, 0, document, 1], point 29 [document.head, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 30 [document.body, 3] 
-PASS setStart() with range 23 [document, 0, document, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 35 [paras[0], 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 36 [paras[0], 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 37 [paras[0], 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 38 [paras[1], 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 39 [paras[1], 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 40 [paras[1], 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 43 [testDiv, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 44 [testDiv, 3] 
-PASS setStart() with range 23 [document, 0, document, 1], point 45 [document, -1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 46 [document, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 47 [document, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 48 [document, 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 49 [document, 3] 
-PASS setStart() with range 23 [document, 0, document, 1], point 50 [comment, -1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 51 [comment, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 52 [comment, 4] 
-PASS setStart() with range 23 [document, 0, document, 1], point 53 [comment, 96] 
-PASS setStart() with range 23 [document, 0, document, 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 23 [document, 0, document, 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 23 [document, 0, document, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 23 [document, 0, document, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 23 [document, 0, document, 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 23 [document, 0, document, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 23 [document, 0, document, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 23 [document, 0, document, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 23 [document, 0, document, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 23 [document, 0, document, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 23 [document, 0, document, 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 23 [document, 0, document, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 23 [document, 0, document, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 23 [document, 0, document, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 23 [document, 0, document, 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 23 [document, 0, document, 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 23 [document, 0, document, 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 23 [document, 0, document, 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 23 [document, 0, document, 1], point 80 [docfrag, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 83 [doctype, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 84 [doctype, -17] 
-PASS setStart() with range 23 [document, 0, document, 1], point 85 [doctype, 1] 
-PASS setStart() with range 23 [document, 0, document, 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 23 [document, 0, document, 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 24 [document, 0, document, 2], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 24 [document, 0, document, 2], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 24 [document, 0, document, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 24 [document, 0, document, 2], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 24 [document, 0, document, 2], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 24 [document, 0, document, 2], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 24 [document, 0, document, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 24 [document, 0, document, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 24 [document, 0, document, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 24 [document, 0, document, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 24 [document, 0, document, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 24 [document, 0, document, 2], point 24 [document.documentElement, -1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 25 [document.documentElement, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 26 [document.documentElement, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 27 [document.documentElement, 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 28 [document.documentElement, 7] 
-PASS setStart() with range 24 [document, 0, document, 2], point 29 [document.head, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 30 [document.body, 3] 
-PASS setStart() with range 24 [document, 0, document, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 35 [paras[0], 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 36 [paras[0], 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 37 [paras[0], 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 38 [paras[1], 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 39 [paras[1], 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 40 [paras[1], 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 41 [detachedPara1, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 42 [detachedPara1, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 43 [testDiv, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 44 [testDiv, 3] 
-PASS setStart() with range 24 [document, 0, document, 2], point 45 [document, -1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 46 [document, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 47 [document, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 48 [document, 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 49 [document, 3] 
-PASS setStart() with range 24 [document, 0, document, 2], point 50 [comment, -1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 51 [comment, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 52 [comment, 4] 
-PASS setStart() with range 24 [document, 0, document, 2], point 53 [comment, 96] 
-PASS setStart() with range 24 [document, 0, document, 2], point 54 [foreignDoc, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 55 [foreignDoc, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 56 [foreignComment, 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 24 [document, 0, document, 2], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 24 [document, 0, document, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 24 [document, 0, document, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 24 [document, 0, document, 2], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 24 [document, 0, document, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 24 [document, 0, document, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 24 [document, 0, document, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 24 [document, 0, document, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 24 [document, 0, document, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 24 [document, 0, document, 2], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 24 [document, 0, document, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 24 [document, 0, document, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 24 [document, 0, document, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 24 [document, 0, document, 2], point 75 [detachedComment, 3] 
-PASS setStart() with range 24 [document, 0, document, 2], point 76 [detachedComment, 5] 
-PASS setStart() with range 24 [document, 0, document, 2], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 24 [document, 0, document, 2], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 24 [document, 0, document, 2], point 80 [docfrag, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 83 [doctype, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 84 [doctype, -17] 
-PASS setStart() with range 24 [document, 0, document, 2], point 85 [doctype, 1] 
-PASS setStart() with range 24 [document, 0, document, 2], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 24 [document, 0, document, 2], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 24 [document.documentElement, -1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 25 [document.documentElement, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 26 [document.documentElement, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 27 [document.documentElement, 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 28 [document.documentElement, 7] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 29 [document.head, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 30 [document.body, 3] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 35 [paras[0], 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 36 [paras[0], 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 37 [paras[0], 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 38 [paras[1], 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 39 [paras[1], 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 40 [paras[1], 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 41 [detachedPara1, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 42 [detachedPara1, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 43 [testDiv, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 44 [testDiv, 3] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 45 [document, -1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 46 [document, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 47 [document, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 48 [document, 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 49 [document, 3] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 50 [comment, -1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 51 [comment, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 52 [comment, 4] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 53 [comment, 96] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 54 [foreignDoc, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 55 [foreignDoc, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 56 [foreignComment, 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 25 [comment, 2, comment, 3], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 25 [comment, 2, comment, 3], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 25 [comment, 2, comment, 3], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 25 [comment, 2, comment, 3], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 25 [comment, 2, comment, 3], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 25 [comment, 2, comment, 3], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 25 [comment, 2, comment, 3], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 25 [comment, 2, comment, 3], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 25 [comment, 2, comment, 3], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 75 [detachedComment, 3] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 76 [detachedComment, 5] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 80 [docfrag, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 83 [doctype, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 84 [doctype, -17] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 85 [doctype, 1] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 25 [comment, 2, comment, 3], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 24 [document.documentElement, -1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 25 [document.documentElement, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 26 [document.documentElement, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 27 [document.documentElement, 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 28 [document.documentElement, 7] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 29 [document.head, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 30 [document.body, 3] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 35 [paras[0], 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 36 [paras[0], 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 37 [paras[0], 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 38 [paras[1], 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 39 [paras[1], 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 40 [paras[1], 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 41 [detachedPara1, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 42 [detachedPara1, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 43 [testDiv, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 44 [testDiv, 3] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 45 [document, -1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 46 [document, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 47 [document, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 48 [document, 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 49 [document, 3] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 50 [comment, -1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 51 [comment, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 52 [comment, 4] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 53 [comment, 96] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 54 [foreignDoc, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 55 [foreignDoc, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 56 [foreignComment, 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 26 [testDiv, 0, comment, 5], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 26 [testDiv, 0, comment, 5], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 26 [testDiv, 0, comment, 5], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 26 [testDiv, 0, comment, 5], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 26 [testDiv, 0, comment, 5], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 26 [testDiv, 0, comment, 5], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 26 [testDiv, 0, comment, 5], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 75 [detachedComment, 3] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 76 [detachedComment, 5] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 80 [docfrag, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 83 [doctype, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 84 [doctype, -17] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 85 [doctype, 1] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 26 [testDiv, 0, comment, 5], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 24 [document.documentElement, -1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 25 [document.documentElement, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 26 [document.documentElement, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 27 [document.documentElement, 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 28 [document.documentElement, 7] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 29 [document.head, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 30 [document.body, 3] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 35 [paras[0], 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 36 [paras[0], 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 37 [paras[0], 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 38 [paras[1], 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 39 [paras[1], 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 40 [paras[1], 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 41 [detachedPara1, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 42 [detachedPara1, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 43 [testDiv, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 44 [testDiv, 3] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 45 [document, -1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 46 [document, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 47 [document, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 48 [document, 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 49 [document, 3] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 50 [comment, -1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 51 [comment, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 52 [comment, 4] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 53 [comment, 96] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 54 [foreignDoc, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 55 [foreignDoc, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 56 [foreignComment, 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 75 [detachedComment, 3] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 76 [detachedComment, 5] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 80 [docfrag, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 83 [doctype, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 84 [doctype, -17] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 85 [doctype, 1] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 27 [foreignDoc, 1, foreignComment, 2], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 24 [document.documentElement, -1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 25 [document.documentElement, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 26 [document.documentElement, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 27 [document.documentElement, 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 28 [document.documentElement, 7] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 29 [document.head, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 30 [document.body, 3] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 35 [paras[0], 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 36 [paras[0], 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 37 [paras[0], 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 38 [paras[1], 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 39 [paras[1], 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 40 [paras[1], 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 41 [detachedPara1, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 42 [detachedPara1, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 43 [testDiv, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 44 [testDiv, 3] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 45 [document, -1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 46 [document, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 47 [document, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 48 [document, 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 49 [document, 3] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 50 [comment, -1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 51 [comment, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 52 [comment, 4] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 53 [comment, 96] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 54 [foreignDoc, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 55 [foreignDoc, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 56 [foreignComment, 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 75 [detachedComment, 3] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 76 [detachedComment, 5] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 80 [docfrag, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 83 [doctype, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 84 [doctype, -17] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 85 [doctype, 1] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 24 [document.documentElement, -1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 25 [document.documentElement, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 26 [document.documentElement, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 27 [document.documentElement, 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 28 [document.documentElement, 7] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 29 [document.head, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 30 [document.body, 3] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 35 [paras[0], 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 36 [paras[0], 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 37 [paras[0], 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 38 [paras[1], 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 39 [paras[1], 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 40 [paras[1], 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 41 [detachedPara1, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 42 [detachedPara1, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 43 [testDiv, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 44 [testDiv, 3] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 45 [document, -1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 46 [document, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 47 [document, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 48 [document, 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 49 [document, 3] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 50 [comment, -1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 51 [comment, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 52 [comment, 4] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 53 [comment, 96] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 54 [foreignDoc, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 55 [foreignDoc, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 56 [foreignComment, 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 75 [detachedComment, 3] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 76 [detachedComment, 5] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 80 [docfrag, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 83 [doctype, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 84 [doctype, -17] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 85 [doctype, 1] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 29 [xmlDoc, 1, xmlComment, 0], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 24 [document.documentElement, -1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 25 [document.documentElement, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 26 [document.documentElement, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 27 [document.documentElement, 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 28 [document.documentElement, 7] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 29 [document.head, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 30 [document.body, 3] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 35 [paras[0], 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 36 [paras[0], 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 37 [paras[0], 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 38 [paras[1], 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 39 [paras[1], 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 40 [paras[1], 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 41 [detachedPara1, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 42 [detachedPara1, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 43 [testDiv, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 44 [testDiv, 3] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 45 [document, -1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 46 [document, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 47 [document, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 48 [document, 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 49 [document, 3] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 50 [comment, -1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 51 [comment, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 52 [comment, 4] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 53 [comment, 96] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 54 [foreignDoc, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 55 [foreignDoc, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 56 [foreignComment, 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 75 [detachedComment, 3] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 76 [detachedComment, 5] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 80 [docfrag, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 83 [doctype, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 84 [doctype, -17] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 85 [doctype, 1] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 24 [document.documentElement, -1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 25 [document.documentElement, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 26 [document.documentElement, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 27 [document.documentElement, 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 28 [document.documentElement, 7] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 29 [document.head, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 30 [document.body, 3] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 35 [paras[0], 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 36 [paras[0], 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 37 [paras[0], 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 38 [paras[1], 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 39 [paras[1], 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 40 [paras[1], 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 41 [detachedPara1, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 42 [detachedPara1, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 43 [testDiv, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 44 [testDiv, 3] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 45 [document, -1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 46 [document, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 47 [document, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 48 [document, 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 49 [document, 3] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 50 [comment, -1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 51 [comment, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 52 [comment, 4] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 53 [comment, 96] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 54 [foreignDoc, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 55 [foreignDoc, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 56 [foreignComment, 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 75 [detachedComment, 3] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 76 [detachedComment, 5] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 80 [docfrag, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 83 [doctype, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 84 [doctype, -17] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 85 [doctype, 1] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 24 [document.documentElement, -1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 25 [document.documentElement, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 26 [document.documentElement, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 27 [document.documentElement, 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 28 [document.documentElement, 7] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 29 [document.head, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 30 [document.body, 3] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 35 [paras[0], 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 36 [paras[0], 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 37 [paras[0], 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 38 [paras[1], 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 39 [paras[1], 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 40 [paras[1], 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 41 [detachedPara1, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 42 [detachedPara1, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 43 [testDiv, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 44 [testDiv, 3] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 45 [document, -1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 46 [document, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 47 [document, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 48 [document, 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 49 [document, 3] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 50 [comment, -1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 51 [comment, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 52 [comment, 4] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 53 [comment, 96] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 54 [foreignDoc, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 55 [foreignDoc, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 56 [foreignComment, 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 75 [detachedComment, 3] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 76 [detachedComment, 5] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 80 [docfrag, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 83 [doctype, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 84 [doctype, -17] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 85 [doctype, 1] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 24 [document.documentElement, -1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 25 [document.documentElement, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 26 [document.documentElement, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 27 [document.documentElement, 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 28 [document.documentElement, 7] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 29 [document.head, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 30 [document.body, 3] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 35 [paras[0], 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 36 [paras[0], 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 37 [paras[0], 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 38 [paras[1], 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 39 [paras[1], 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 40 [paras[1], 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 41 [detachedPara1, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 42 [detachedPara1, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 43 [testDiv, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 44 [testDiv, 3] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 45 [document, -1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 46 [document, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 47 [document, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 48 [document, 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 49 [document, 3] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 50 [comment, -1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 51 [comment, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 52 [comment, 4] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 53 [comment, 96] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 54 [foreignDoc, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 55 [foreignDoc, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 56 [foreignComment, 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 75 [detachedComment, 3] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 76 [detachedComment, 5] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 80 [docfrag, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 83 [doctype, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 84 [doctype, -17] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 85 [doctype, 1] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 33 [detachedComment, 3, detachedComment, 4], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 24 [document.documentElement, -1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 25 [document.documentElement, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 26 [document.documentElement, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 27 [document.documentElement, 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 28 [document.documentElement, 7] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 29 [document.head, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 30 [document.body, 3] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 35 [paras[0], 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 36 [paras[0], 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 37 [paras[0], 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 38 [paras[1], 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 39 [paras[1], 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 40 [paras[1], 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 41 [detachedPara1, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 42 [detachedPara1, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 43 [testDiv, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 44 [testDiv, 3] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 45 [document, -1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 46 [document, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 47 [document, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 48 [document, 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 49 [document, 3] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 50 [comment, -1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 51 [comment, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 52 [comment, 4] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 53 [comment, 96] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 54 [foreignDoc, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 55 [foreignDoc, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 56 [foreignComment, 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 75 [detachedComment, 3] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 76 [detachedComment, 5] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 80 [docfrag, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 83 [doctype, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 84 [doctype, -17] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 85 [doctype, 1] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 24 [document.documentElement, -1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 25 [document.documentElement, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 26 [document.documentElement, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 27 [document.documentElement, 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 28 [document.documentElement, 7] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 29 [document.head, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 30 [document.body, 3] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 35 [paras[0], 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 36 [paras[0], 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 37 [paras[0], 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 38 [paras[1], 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 39 [paras[1], 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 40 [paras[1], 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 41 [detachedPara1, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 42 [detachedPara1, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 43 [testDiv, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 44 [testDiv, 3] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 45 [document, -1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 46 [document, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 47 [document, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 48 [document, 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 49 [document, 3] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 50 [comment, -1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 51 [comment, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 52 [comment, 4] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 53 [comment, 96] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 54 [foreignDoc, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 55 [foreignDoc, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 56 [foreignComment, 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 75 [detachedComment, 3] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 76 [detachedComment, 5] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 80 [docfrag, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 83 [doctype, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 84 [doctype, -17] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 85 [doctype, 1] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 24 [document.documentElement, -1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 25 [document.documentElement, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 26 [document.documentElement, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 27 [document.documentElement, 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 28 [document.documentElement, 7] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 29 [document.head, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 30 [document.body, 3] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 35 [paras[0], 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 36 [paras[0], 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 37 [paras[0], 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 38 [paras[1], 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 39 [paras[1], 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 40 [paras[1], 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 41 [detachedPara1, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 42 [detachedPara1, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 43 [testDiv, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 44 [testDiv, 3] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 45 [document, -1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 46 [document, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 47 [document, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 48 [document, 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 49 [document, 3] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 50 [comment, -1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 51 [comment, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 52 [comment, 4] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 53 [comment, 96] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 54 [foreignDoc, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 55 [foreignDoc, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 56 [foreignComment, 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 36 [docfrag, 0, docfrag, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 36 [docfrag, 0, docfrag, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 36 [docfrag, 0, docfrag, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 36 [docfrag, 0, docfrag, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 36 [docfrag, 0, docfrag, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 36 [docfrag, 0, docfrag, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 36 [docfrag, 0, docfrag, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 75 [detachedComment, 3] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 76 [detachedComment, 5] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 80 [docfrag, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 83 [doctype, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 84 [doctype, -17] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 85 [doctype, 1] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 36 [docfrag, 0, docfrag, 0], point 87 [xmlDoctype, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 0 [paras[0].firstChild, -1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 1 [paras[0].firstChild, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 2 [paras[0].firstChild, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 3 [paras[0].firstChild, 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 4 [paras[0].firstChild, 8] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 5 [paras[0].firstChild, 9] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 6 [paras[0].firstChild, 10] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 7 [paras[0].firstChild, 65535] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 8 [paras[1].firstChild, -1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 9 [paras[1].firstChild, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 10 [paras[1].firstChild, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 11 [paras[1].firstChild, 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 12 [paras[1].firstChild, 8] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 13 [paras[1].firstChild, 9] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 14 [paras[1].firstChild, 10] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 15 [paras[1].firstChild, 65535] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 16 [detachedPara1.firstChild, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 17 [detachedPara1.firstChild, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 18 [detachedPara1.firstChild, 8] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 19 [detachedPara1.firstChild, 9] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 20 [foreignPara1.firstChild, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 21 [foreignPara1.firstChild, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 22 [foreignPara1.firstChild, 8] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 23 [foreignPara1.firstChild, 9] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 24 [document.documentElement, -1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 25 [document.documentElement, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 26 [document.documentElement, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 27 [document.documentElement, 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 28 [document.documentElement, 7] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 29 [document.head, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 30 [document.body, 3] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 31 [foreignDoc.documentElement, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 32 [foreignDoc.documentElement, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 33 [foreignDoc.head, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 34 [foreignDoc.body, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 35 [paras[0], 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 36 [paras[0], 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 37 [paras[0], 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 38 [paras[1], 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 39 [paras[1], 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 40 [paras[1], 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 41 [detachedPara1, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 42 [detachedPara1, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 43 [testDiv, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 44 [testDiv, 3] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 45 [document, -1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 46 [document, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 47 [document, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 48 [document, 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 49 [document, 3] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 50 [comment, -1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 51 [comment, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 52 [comment, 4] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 53 [comment, 96] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 54 [foreignDoc, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 55 [foreignDoc, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 56 [foreignComment, 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 57 [foreignTextNode, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 58 [foreignTextNode, 36] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 59 [xmlDoc, -1] 
-FAIL setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 62 [xmlDoc, 5] 
-FAIL setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 68 [detachedTextNode, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 69 [detachedTextNode, 8] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 70 [detachedForeignTextNode, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 71 [detachedForeignTextNode, 8] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 72 [detachedXmlTextNode, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 73 [detachedXmlTextNode, 8] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 74 [detachedProcessingInstruction, 12] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 75 [detachedComment, 3] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 76 [detachedComment, 5] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 77 [detachedForeignComment, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 78 [detachedForeignComment, 4] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 79 [detachedXmlComment, 2] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 80 [docfrag, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 81 [foreignDocfrag, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 82 [xmlDocfrag, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 83 [doctype, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 84 [doctype, -17] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 85 [doctype, 1] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 86 [foreignDoctype, 0] 
-PASS setStart() with range 37 [processingInstruction, 0, processingInstruction, 4], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 29 [document.head, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 30 [document.body, 3] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 35 [paras[0], 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 36 [paras[0], 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 37 [paras[0], 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 38 [paras[1], 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 39 [paras[1], 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 40 [paras[1], 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 43 [testDiv, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 44 [testDiv, 3] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 45 [document, -1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 46 [document, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 47 [document, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 48 [document, 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 49 [document, 3] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 50 [comment, -1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 51 [comment, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 52 [comment, 4] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 53 [comment, 96] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 56 [foreignComment, 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 75 [detachedComment, 3] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 76 [detachedComment, 5] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 80 [docfrag, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 83 [doctype, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 84 [doctype, -17] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 85 [doctype, 1] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 29 [document.head, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 30 [document.body, 3] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 45 [document, -1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 46 [document, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 47 [document, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 48 [document, 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 49 [document, 3] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 50 [comment, -1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 51 [comment, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 52 [comment, 4] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 53 [comment, 96] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 83 [doctype, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 84 [doctype, -17] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 85 [doctype, 1] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 29 [document.head, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 30 [document.body, 3] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 35 [paras[0], 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 36 [paras[0], 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 37 [paras[0], 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 38 [paras[1], 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 39 [paras[1], 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 40 [paras[1], 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 43 [testDiv, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 44 [testDiv, 3] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 45 [document, -1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 46 [document, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 47 [document, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 48 [document, 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 49 [document, 3] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 50 [comment, -1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 51 [comment, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 52 [comment, 4] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 53 [comment, 96] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 56 [foreignComment, 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 75 [detachedComment, 3] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 76 [detachedComment, 5] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 80 [docfrag, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 83 [doctype, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 84 [doctype, -17] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 85 [doctype, 1] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 29 [document.head, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 30 [document.body, 3] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 35 [paras[0], 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 36 [paras[0], 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 37 [paras[0], 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 38 [paras[1], 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 39 [paras[1], 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 40 [paras[1], 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 43 [testDiv, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 44 [testDiv, 3] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 45 [document, -1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 46 [document, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 47 [document, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 48 [document, 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 49 [document, 3] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 50 [comment, -1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 51 [comment, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 52 [comment, 4] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 53 [comment, 96] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 56 [foreignComment, 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 75 [detachedComment, 3] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 76 [detachedComment, 5] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 80 [docfrag, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 83 [doctype, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 84 [doctype, -17] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 85 [doctype, 1] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 29 [document.head, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 30 [document.body, 3] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 35 [paras[0], 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 36 [paras[0], 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 37 [paras[0], 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 38 [paras[1], 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 39 [paras[1], 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 40 [paras[1], 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 43 [testDiv, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 44 [testDiv, 3] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 45 [document, -1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 46 [document, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 47 [document, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 48 [document, 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 49 [document, 3] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 50 [comment, -1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 51 [comment, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 52 [comment, 4] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 53 [comment, 96] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 56 [foreignComment, 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 75 [detachedComment, 3] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 76 [detachedComment, 5] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 80 [docfrag, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 83 [doctype, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 84 [doctype, -17] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 85 [doctype, 1] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 29 [document.head, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 30 [document.body, 3] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 35 [paras[0], 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 36 [paras[0], 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 37 [paras[0], 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 38 [paras[1], 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 39 [paras[1], 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 40 [paras[1], 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 43 [testDiv, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 44 [testDiv, 3] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 45 [document, -1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 46 [document, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 47 [document, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 48 [document, 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 49 [document, 3] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 50 [comment, -1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 51 [comment, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 52 [comment, 4] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 53 [comment, 96] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 56 [foreignComment, 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 75 [detachedComment, 3] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 76 [detachedComment, 5] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 80 [docfrag, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 83 [doctype, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 84 [doctype, -17] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 85 [doctype, 1] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 29 [document.head, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 30 [document.body, 3] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 35 [paras[0], 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 36 [paras[0], 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 37 [paras[0], 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 38 [paras[1], 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 39 [paras[1], 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 40 [paras[1], 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 43 [testDiv, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 44 [testDiv, 3] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 45 [document, -1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 46 [document, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 47 [document, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 48 [document, 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 49 [document, 3] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 50 [comment, -1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 51 [comment, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 52 [comment, 4] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 53 [comment, 96] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 56 [foreignComment, 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 75 [detachedComment, 3] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 76 [detachedComment, 5] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 80 [docfrag, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 83 [doctype, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 84 [doctype, -17] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 85 [doctype, 1] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 29 [document.head, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 30 [document.body, 3] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 35 [paras[0], 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 36 [paras[0], 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 37 [paras[0], 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 38 [paras[1], 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 39 [paras[1], 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 40 [paras[1], 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 43 [testDiv, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 44 [testDiv, 3] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 45 [document, -1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 46 [document, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 47 [document, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 48 [document, 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 49 [document, 3] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 50 [comment, -1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 51 [comment, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 52 [comment, 4] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 53 [comment, 96] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 56 [foreignComment, 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 75 [detachedComment, 3] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 76 [detachedComment, 5] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 80 [docfrag, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 83 [doctype, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 84 [doctype, -17] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 85 [doctype, 1] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 29 [document.head, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 30 [document.body, 3] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 35 [paras[0], 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 36 [paras[0], 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 37 [paras[0], 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 38 [paras[1], 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 39 [paras[1], 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 40 [paras[1], 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 43 [testDiv, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 44 [testDiv, 3] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 45 [document, -1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 46 [document, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 47 [document, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 48 [document, 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 49 [document, 3] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 50 [comment, -1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 51 [comment, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 52 [comment, 4] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 53 [comment, 96] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 56 [foreignComment, 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 75 [detachedComment, 3] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 76 [detachedComment, 5] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 80 [docfrag, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 83 [doctype, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 84 [doctype, -17] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 85 [doctype, 1] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 29 [document.head, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 30 [document.body, 3] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 35 [paras[0], 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 36 [paras[0], 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 37 [paras[0], 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 38 [paras[1], 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 39 [paras[1], 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 40 [paras[1], 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 43 [testDiv, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 44 [testDiv, 3] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 45 [document, -1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 46 [document, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 47 [document, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 48 [document, 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 49 [document, 3] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 50 [comment, -1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 51 [comment, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 52 [comment, 4] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 53 [comment, 96] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 56 [foreignComment, 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 75 [detachedComment, 3] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 76 [detachedComment, 5] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 80 [docfrag, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 83 [doctype, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 84 [doctype, -17] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 85 [doctype, 1] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 29 [document.head, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 30 [document.body, 3] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 45 [document, -1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 46 [document, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 47 [document, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 48 [document, 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 49 [document, 3] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 50 [comment, -1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 51 [comment, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 52 [comment, 4] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 53 [comment, 96] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 83 [doctype, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 84 [doctype, -17] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 85 [doctype, 1] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 10 [document.documentElement, 0, document.documentElement, 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 29 [document.head, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 30 [document.body, 3] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 35 [paras[0], 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 36 [paras[0], 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 37 [paras[0], 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 38 [paras[1], 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 39 [paras[1], 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 40 [paras[1], 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 43 [testDiv, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 44 [testDiv, 3] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 45 [document, -1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 46 [document, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 47 [document, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 48 [document, 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 49 [document, 3] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 50 [comment, -1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 51 [comment, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 52 [comment, 4] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 53 [comment, 96] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 56 [foreignComment, 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 75 [detachedComment, 3] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 76 [detachedComment, 5] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 80 [docfrag, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 83 [doctype, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 84 [doctype, -17] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 85 [doctype, 1] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 11 [document.documentElement, 0, document.documentElement, 2], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 29 [document.head, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 30 [document.body, 3] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 35 [paras[0], 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 36 [paras[0], 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 37 [paras[0], 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 38 [paras[1], 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 39 [paras[1], 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 40 [paras[1], 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 43 [testDiv, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 44 [testDiv, 3] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 45 [document, -1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 46 [document, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 47 [document, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 48 [document, 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 49 [document, 3] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 50 [comment, -1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 51 [comment, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 52 [comment, 4] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 53 [comment, 96] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 56 [foreignComment, 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 75 [detachedComment, 3] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 76 [detachedComment, 5] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 80 [docfrag, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 83 [doctype, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 84 [doctype, -17] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 85 [doctype, 1] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 12 [document.documentElement, 1, document.documentElement, 2], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 29 [document.head, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 30 [document.body, 3] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 45 [document, -1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 46 [document, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 47 [document, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 48 [document, 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 49 [document, 3] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 50 [comment, -1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 51 [comment, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 52 [comment, 4] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 53 [comment, 96] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 13 [document.head, 1, document.head, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 13 [document.head, 1, document.head, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 13 [document.head, 1, document.head, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 13 [document.head, 1, document.head, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 13 [document.head, 1, document.head, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 13 [document.head, 1, document.head, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 13 [document.head, 1, document.head, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 83 [doctype, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 84 [doctype, -17] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 85 [doctype, 1] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 13 [document.head, 1, document.head, 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 29 [document.head, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 30 [document.body, 3] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 35 [paras[0], 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 36 [paras[0], 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 37 [paras[0], 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 38 [paras[1], 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 39 [paras[1], 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 40 [paras[1], 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 43 [testDiv, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 44 [testDiv, 3] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 45 [document, -1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 46 [document, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 47 [document, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 48 [document, 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 49 [document, 3] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 50 [comment, -1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 51 [comment, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 52 [comment, 4] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 53 [comment, 96] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 56 [foreignComment, 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 14 [document.body, 4, document.body, 5], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 14 [document.body, 4, document.body, 5], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 14 [document.body, 4, document.body, 5], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 14 [document.body, 4, document.body, 5], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 14 [document.body, 4, document.body, 5], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 14 [document.body, 4, document.body, 5], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 14 [document.body, 4, document.body, 5], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 75 [detachedComment, 3] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 76 [detachedComment, 5] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 80 [docfrag, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 83 [doctype, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 84 [doctype, -17] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 85 [doctype, 1] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 14 [document.body, 4, document.body, 5], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 29 [document.head, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 30 [document.body, 3] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 45 [document, -1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 46 [document, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 47 [document, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 48 [document, 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 49 [document, 3] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 50 [comment, -1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 51 [comment, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 52 [comment, 4] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 53 [comment, 96] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 83 [doctype, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 84 [doctype, -17] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 85 [doctype, 1] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 29 [document.head, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 30 [document.body, 3] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 45 [document, -1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 46 [document, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 47 [document, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 48 [document, 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 49 [document, 3] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 50 [comment, -1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 51 [comment, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 52 [comment, 4] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 53 [comment, 96] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 16 [paras[0], 0, paras[0], 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 16 [paras[0], 0, paras[0], 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 16 [paras[0], 0, paras[0], 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 16 [paras[0], 0, paras[0], 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 16 [paras[0], 0, paras[0], 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 16 [paras[0], 0, paras[0], 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 16 [paras[0], 0, paras[0], 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 83 [doctype, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 84 [doctype, -17] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 85 [doctype, 1] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 16 [paras[0], 0, paras[0], 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 29 [document.head, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 30 [document.body, 3] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 45 [document, -1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 46 [document, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 47 [document, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 48 [document, 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 49 [document, 3] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 50 [comment, -1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 51 [comment, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 52 [comment, 4] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 53 [comment, 96] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 83 [doctype, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 84 [doctype, -17] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 85 [doctype, 1] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 17 [detachedPara1, 0, detachedPara1, 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 29 [document.head, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 30 [document.body, 3] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 35 [paras[0], 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 36 [paras[0], 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 37 [paras[0], 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 38 [paras[1], 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 39 [paras[1], 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 40 [paras[1], 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 43 [testDiv, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 44 [testDiv, 3] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 45 [document, -1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 46 [document, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 47 [document, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 48 [document, 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 49 [document, 3] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 50 [comment, -1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 51 [comment, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 52 [comment, 4] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 53 [comment, 96] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 56 [foreignComment, 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 75 [detachedComment, 3] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 76 [detachedComment, 5] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 80 [docfrag, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 83 [doctype, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 84 [doctype, -17] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 85 [doctype, 1] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 29 [document.head, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 30 [document.body, 3] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 35 [paras[0], 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 36 [paras[0], 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 37 [paras[0], 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 38 [paras[1], 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 39 [paras[1], 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 40 [paras[1], 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 43 [testDiv, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 44 [testDiv, 3] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 45 [document, -1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 46 [document, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 47 [document, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 48 [document, 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 49 [document, 3] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 50 [comment, -1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 51 [comment, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 52 [comment, 4] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 53 [comment, 96] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 56 [foreignComment, 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 75 [detachedComment, 3] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 76 [detachedComment, 5] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 80 [docfrag, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 83 [doctype, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 84 [doctype, -17] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 85 [doctype, 1] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 29 [document.head, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 30 [document.body, 3] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 45 [document, -1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 46 [document, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 47 [document, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 48 [document, 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 49 [document, 3] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 50 [comment, -1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 51 [comment, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 52 [comment, 4] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 53 [comment, 96] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 83 [doctype, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 84 [doctype, -17] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 85 [doctype, 1] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 20 [paras[0].firstChild, 3, paras[3], 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 29 [document.head, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 30 [document.body, 3] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 35 [paras[0], 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 36 [paras[0], 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 37 [paras[0], 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 38 [paras[1], 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 39 [paras[1], 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 40 [paras[1], 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 43 [testDiv, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 44 [testDiv, 3] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 45 [document, -1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 46 [document, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 47 [document, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 48 [document, 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 49 [document, 3] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 50 [comment, -1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 51 [comment, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 52 [comment, 4] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 53 [comment, 96] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 56 [foreignComment, 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 75 [detachedComment, 3] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 76 [detachedComment, 5] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 80 [docfrag, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 83 [doctype, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 84 [doctype, -17] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 85 [doctype, 1] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 21 [paras[0], 0, paras[0].firstChild, 7], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 29 [document.head, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 30 [document.body, 3] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 45 [document, -1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 46 [document, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 47 [document, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 48 [document, 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 49 [document, 3] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 50 [comment, -1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 51 [comment, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 52 [comment, 4] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 53 [comment, 96] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 22 [testDiv, 2, paras[4], 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 22 [testDiv, 2, paras[4], 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 22 [testDiv, 2, paras[4], 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 22 [testDiv, 2, paras[4], 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 22 [testDiv, 2, paras[4], 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 22 [testDiv, 2, paras[4], 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 22 [testDiv, 2, paras[4], 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 83 [doctype, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 84 [doctype, -17] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 85 [doctype, 1] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 22 [testDiv, 2, paras[4], 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 29 [document.head, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 30 [document.body, 3] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 45 [document, -1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 46 [document, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 47 [document, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 48 [document, 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 49 [document, 3] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 50 [comment, -1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 51 [comment, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 52 [comment, 4] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 53 [comment, 96] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 23 [document, 0, document, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 23 [document, 0, document, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 23 [document, 0, document, 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 23 [document, 0, document, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 23 [document, 0, document, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 23 [document, 0, document, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 23 [document, 0, document, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 23 [document, 0, document, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 23 [document, 0, document, 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 83 [doctype, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 84 [doctype, -17] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 85 [doctype, 1] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 23 [document, 0, document, 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 29 [document.head, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 30 [document.body, 3] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 35 [paras[0], 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 36 [paras[0], 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 37 [paras[0], 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 38 [paras[1], 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 39 [paras[1], 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 40 [paras[1], 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 43 [testDiv, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 44 [testDiv, 3] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 45 [document, -1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 46 [document, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 47 [document, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 48 [document, 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 49 [document, 3] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 50 [comment, -1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 51 [comment, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 52 [comment, 4] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 53 [comment, 96] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 56 [foreignComment, 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 24 [document, 0, document, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 24 [document, 0, document, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 24 [document, 0, document, 2], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 24 [document, 0, document, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 24 [document, 0, document, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 24 [document, 0, document, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 24 [document, 0, document, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 24 [document, 0, document, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 24 [document, 0, document, 2], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 75 [detachedComment, 3] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 76 [detachedComment, 5] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 80 [docfrag, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 83 [doctype, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 84 [doctype, -17] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 85 [doctype, 1] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 24 [document, 0, document, 2], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 29 [document.head, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 30 [document.body, 3] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 35 [paras[0], 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 36 [paras[0], 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 37 [paras[0], 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 38 [paras[1], 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 39 [paras[1], 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 40 [paras[1], 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 43 [testDiv, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 44 [testDiv, 3] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 45 [document, -1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 46 [document, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 47 [document, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 48 [document, 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 49 [document, 3] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 50 [comment, -1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 51 [comment, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 52 [comment, 4] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 53 [comment, 96] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 56 [foreignComment, 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 25 [comment, 2, comment, 3], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 25 [comment, 2, comment, 3], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 25 [comment, 2, comment, 3], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 25 [comment, 2, comment, 3], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 25 [comment, 2, comment, 3], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 25 [comment, 2, comment, 3], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 25 [comment, 2, comment, 3], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 75 [detachedComment, 3] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 76 [detachedComment, 5] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 80 [docfrag, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 83 [doctype, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 84 [doctype, -17] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 85 [doctype, 1] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 25 [comment, 2, comment, 3], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 29 [document.head, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 30 [document.body, 3] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 35 [paras[0], 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 36 [paras[0], 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 37 [paras[0], 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 38 [paras[1], 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 39 [paras[1], 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 40 [paras[1], 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 43 [testDiv, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 44 [testDiv, 3] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 45 [document, -1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 46 [document, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 47 [document, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 48 [document, 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 49 [document, 3] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 50 [comment, -1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 51 [comment, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 52 [comment, 4] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 53 [comment, 96] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 56 [foreignComment, 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 26 [testDiv, 0, comment, 5], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 26 [testDiv, 0, comment, 5], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 26 [testDiv, 0, comment, 5], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 26 [testDiv, 0, comment, 5], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 26 [testDiv, 0, comment, 5], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 26 [testDiv, 0, comment, 5], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 26 [testDiv, 0, comment, 5], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 75 [detachedComment, 3] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 76 [detachedComment, 5] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 80 [docfrag, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 83 [doctype, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 84 [doctype, -17] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 85 [doctype, 1] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 26 [testDiv, 0, comment, 5], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 29 [document.head, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 30 [document.body, 3] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 35 [paras[0], 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 36 [paras[0], 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 37 [paras[0], 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 38 [paras[1], 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 39 [paras[1], 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 40 [paras[1], 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 43 [testDiv, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 44 [testDiv, 3] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 45 [document, -1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 46 [document, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 47 [document, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 48 [document, 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 49 [document, 3] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 50 [comment, -1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 51 [comment, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 52 [comment, 4] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 53 [comment, 96] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 56 [foreignComment, 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 75 [detachedComment, 3] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 76 [detachedComment, 5] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 80 [docfrag, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 83 [doctype, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 84 [doctype, -17] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 85 [doctype, 1] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 27 [foreignDoc, 1, foreignComment, 2], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 29 [document.head, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 30 [document.body, 3] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 35 [paras[0], 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 36 [paras[0], 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 37 [paras[0], 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 38 [paras[1], 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 39 [paras[1], 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 40 [paras[1], 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 43 [testDiv, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 44 [testDiv, 3] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 45 [document, -1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 46 [document, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 47 [document, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 48 [document, 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 49 [document, 3] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 50 [comment, -1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 51 [comment, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 52 [comment, 4] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 53 [comment, 96] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 56 [foreignComment, 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 75 [detachedComment, 3] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 76 [detachedComment, 5] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 80 [docfrag, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 83 [doctype, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 84 [doctype, -17] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 85 [doctype, 1] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 29 [document.head, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 30 [document.body, 3] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 35 [paras[0], 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 36 [paras[0], 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 37 [paras[0], 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 38 [paras[1], 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 39 [paras[1], 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 40 [paras[1], 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 43 [testDiv, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 44 [testDiv, 3] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 45 [document, -1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 46 [document, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 47 [document, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 48 [document, 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 49 [document, 3] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 50 [comment, -1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 51 [comment, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 52 [comment, 4] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 53 [comment, 96] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 56 [foreignComment, 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 75 [detachedComment, 3] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 76 [detachedComment, 5] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 80 [docfrag, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 83 [doctype, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 84 [doctype, -17] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 85 [doctype, 1] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 29 [xmlDoc, 1, xmlComment, 0], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 29 [document.head, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 30 [document.body, 3] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 35 [paras[0], 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 36 [paras[0], 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 37 [paras[0], 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 38 [paras[1], 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 39 [paras[1], 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 40 [paras[1], 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 43 [testDiv, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 44 [testDiv, 3] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 45 [document, -1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 46 [document, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 47 [document, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 48 [document, 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 49 [document, 3] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 50 [comment, -1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 51 [comment, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 52 [comment, 4] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 53 [comment, 96] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 56 [foreignComment, 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 75 [detachedComment, 3] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 76 [detachedComment, 5] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 80 [docfrag, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 83 [doctype, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 84 [doctype, -17] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 85 [doctype, 1] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 30 [detachedTextNode, 0, detachedTextNode, 8], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 29 [document.head, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 30 [document.body, 3] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 35 [paras[0], 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 36 [paras[0], 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 37 [paras[0], 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 38 [paras[1], 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 39 [paras[1], 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 40 [paras[1], 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 43 [testDiv, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 44 [testDiv, 3] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 45 [document, -1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 46 [document, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 47 [document, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 48 [document, 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 49 [document, 3] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 50 [comment, -1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 51 [comment, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 52 [comment, 4] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 53 [comment, 96] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 56 [foreignComment, 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 75 [detachedComment, 3] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 76 [detachedComment, 5] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 80 [docfrag, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 83 [doctype, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 84 [doctype, -17] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 85 [doctype, 1] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 29 [document.head, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 30 [document.body, 3] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 35 [paras[0], 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 36 [paras[0], 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 37 [paras[0], 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 38 [paras[1], 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 39 [paras[1], 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 40 [paras[1], 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 43 [testDiv, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 44 [testDiv, 3] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 45 [document, -1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 46 [document, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 47 [document, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 48 [document, 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 49 [document, 3] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 50 [comment, -1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 51 [comment, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 52 [comment, 4] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 53 [comment, 96] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 56 [foreignComment, 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 75 [detachedComment, 3] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 76 [detachedComment, 5] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 80 [docfrag, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 83 [doctype, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 84 [doctype, -17] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 85 [doctype, 1] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 29 [document.head, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 30 [document.body, 3] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 35 [paras[0], 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 36 [paras[0], 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 37 [paras[0], 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 38 [paras[1], 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 39 [paras[1], 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 40 [paras[1], 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 43 [testDiv, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 44 [testDiv, 3] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 45 [document, -1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 46 [document, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 47 [document, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 48 [document, 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 49 [document, 3] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 50 [comment, -1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 51 [comment, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 52 [comment, 4] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 53 [comment, 96] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 56 [foreignComment, 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 75 [detachedComment, 3] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 76 [detachedComment, 5] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 80 [docfrag, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 83 [doctype, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 84 [doctype, -17] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 85 [doctype, 1] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 33 [detachedComment, 3, detachedComment, 4], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 29 [document.head, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 30 [document.body, 3] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 35 [paras[0], 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 36 [paras[0], 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 37 [paras[0], 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 38 [paras[1], 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 39 [paras[1], 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 40 [paras[1], 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 43 [testDiv, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 44 [testDiv, 3] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 45 [document, -1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 46 [document, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 47 [document, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 48 [document, 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 49 [document, 3] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 50 [comment, -1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 51 [comment, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 52 [comment, 4] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 53 [comment, 96] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 56 [foreignComment, 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 75 [detachedComment, 3] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 76 [detachedComment, 5] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 80 [docfrag, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 83 [doctype, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 84 [doctype, -17] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 85 [doctype, 1] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 29 [document.head, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 30 [document.body, 3] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 35 [paras[0], 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 36 [paras[0], 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 37 [paras[0], 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 38 [paras[1], 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 39 [paras[1], 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 40 [paras[1], 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 43 [testDiv, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 44 [testDiv, 3] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 45 [document, -1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 46 [document, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 47 [document, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 48 [document, 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 49 [document, 3] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 50 [comment, -1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 51 [comment, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 52 [comment, 4] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 53 [comment, 96] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 56 [foreignComment, 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 75 [detachedComment, 3] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 76 [detachedComment, 5] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 80 [docfrag, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 83 [doctype, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 84 [doctype, -17] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 85 [doctype, 1] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 29 [document.head, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 30 [document.body, 3] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 35 [paras[0], 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 36 [paras[0], 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 37 [paras[0], 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 38 [paras[1], 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 39 [paras[1], 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 40 [paras[1], 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 43 [testDiv, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 44 [testDiv, 3] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 45 [document, -1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 46 [document, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 47 [document, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 48 [document, 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 49 [document, 3] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 50 [comment, -1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 51 [comment, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 52 [comment, 4] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 53 [comment, 96] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 56 [foreignComment, 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 36 [docfrag, 0, docfrag, 0], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 36 [docfrag, 0, docfrag, 0], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 36 [docfrag, 0, docfrag, 0], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 36 [docfrag, 0, docfrag, 0], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 36 [docfrag, 0, docfrag, 0], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 36 [docfrag, 0, docfrag, 0], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 36 [docfrag, 0, docfrag, 0], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 75 [detachedComment, 3] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 76 [detachedComment, 5] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 80 [docfrag, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 83 [doctype, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 84 [doctype, -17] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 85 [doctype, 1] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 36 [docfrag, 0, docfrag, 0], point 87 [xmlDoctype, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 0 [paras[0].firstChild, -1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 1 [paras[0].firstChild, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 2 [paras[0].firstChild, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 3 [paras[0].firstChild, 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 4 [paras[0].firstChild, 8] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 5 [paras[0].firstChild, 9] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 6 [paras[0].firstChild, 10] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 7 [paras[0].firstChild, 65535] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 8 [paras[1].firstChild, -1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 9 [paras[1].firstChild, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 10 [paras[1].firstChild, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 11 [paras[1].firstChild, 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 12 [paras[1].firstChild, 8] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 13 [paras[1].firstChild, 9] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 14 [paras[1].firstChild, 10] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 15 [paras[1].firstChild, 65535] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 16 [detachedPara1.firstChild, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 17 [detachedPara1.firstChild, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 18 [detachedPara1.firstChild, 8] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 19 [detachedPara1.firstChild, 9] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 20 [foreignPara1.firstChild, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 21 [foreignPara1.firstChild, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 22 [foreignPara1.firstChild, 8] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 23 [foreignPara1.firstChild, 9] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 24 [document.documentElement, -1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 25 [document.documentElement, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 26 [document.documentElement, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 27 [document.documentElement, 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 28 [document.documentElement, 7] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 29 [document.head, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 30 [document.body, 3] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 31 [foreignDoc.documentElement, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 32 [foreignDoc.documentElement, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 33 [foreignDoc.head, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 34 [foreignDoc.body, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 35 [paras[0], 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 36 [paras[0], 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 37 [paras[0], 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 38 [paras[1], 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 39 [paras[1], 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 40 [paras[1], 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 41 [detachedPara1, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 42 [detachedPara1, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 43 [testDiv, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 44 [testDiv, 3] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 45 [document, -1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 46 [document, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 47 [document, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 48 [document, 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 49 [document, 3] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 50 [comment, -1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 51 [comment, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 52 [comment, 4] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 53 [comment, 96] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 54 [foreignDoc, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 55 [foreignDoc, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 56 [foreignComment, 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 57 [foreignTextNode, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 58 [foreignTextNode, 36] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 59 [xmlDoc, -1] 
-FAIL setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 60 [xmlDoc, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 61 [xmlDoc, 1] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 62 [xmlDoc, 5] 
-FAIL setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 63 [xmlComment, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 64 [xmlComment, 4] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 65 [processingInstruction, 0] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 66 [processingInstruction, 5] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-FAIL setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 67 [processingInstruction, 9] Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 68 [detachedTextNode, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 69 [detachedTextNode, 8] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 70 [detachedForeignTextNode, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 71 [detachedForeignTextNode, 8] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 72 [detachedXmlTextNode, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 73 [detachedXmlTextNode, 8] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 74 [detachedProcessingInstruction, 12] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 75 [detachedComment, 3] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 76 [detachedComment, 5] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 77 [detachedForeignComment, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 78 [detachedForeignComment, 4] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 79 [detachedXmlComment, 2] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 80 [docfrag, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 81 [foreignDocfrag, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 82 [xmlDocfrag, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 83 [doctype, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 84 [doctype, -17] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 85 [doctype, 1] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 86 [foreignDoctype, 0] 
-PASS setEnd() with range 37 [processingInstruction, 0, processingInstruction, 4], point 87 [xmlDoctype, 0] 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 0 paras[0] 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 3 foreignPara1 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 5 detachedPara1 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 7 document 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 8 detachedDiv 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 9 foreignDoc 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 10 foreignPara2 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 11 xmlDoc 
-FAIL setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 13 detachedTextNode 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 14 foreignTextNode 
-FAIL setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 17 comment 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 18 detachedComment 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 19 docfrag 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 20 doctype 
-PASS setStartBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 21 foreignDoctype 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 0 paras[0] 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 3 foreignPara1 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 5 detachedPara1 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 7 document 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 8 detachedDiv 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 9 foreignDoc 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 10 foreignPara2 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 17 comment 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 18 detachedComment 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 19 docfrag 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 20 doctype 
-PASS setStartBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 0 paras[0] 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 3 foreignPara1 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 5 detachedPara1 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 7 document 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 8 detachedDiv 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 9 foreignDoc 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 10 foreignPara2 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 11 xmlDoc 
-FAIL setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 13 detachedTextNode 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 14 foreignTextNode 
-FAIL setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 17 comment 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 18 detachedComment 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 19 docfrag 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 20 doctype 
-PASS setStartBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 21 foreignDoctype 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 0 paras[0] 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 3 foreignPara1 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 5 detachedPara1 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 7 document 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 8 detachedDiv 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 9 foreignDoc 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 10 foreignPara2 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 11 xmlDoc 
-FAIL setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 13 detachedTextNode 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 14 foreignTextNode 
-FAIL setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 17 comment 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 18 detachedComment 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 19 docfrag 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 20 doctype 
-PASS setStartBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 21 foreignDoctype 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setStartBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 0 paras[0] 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 3 foreignPara1 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 5 detachedPara1 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 7 document 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 8 detachedDiv 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 9 foreignDoc 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 10 foreignPara2 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 11 xmlDoc 
-FAIL setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 13 detachedTextNode 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 14 foreignTextNode 
-FAIL setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 17 comment 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 18 detachedComment 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 19 docfrag 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 20 doctype 
-PASS setStartBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 21 foreignDoctype 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 0 paras[0] 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 3 foreignPara1 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 5 detachedPara1 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 7 document 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 8 detachedDiv 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 9 foreignDoc 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 10 foreignPara2 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 17 comment 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 18 detachedComment 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 19 docfrag 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 20 doctype 
-PASS setStartBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 0 paras[0] 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 3 foreignPara1 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 5 detachedPara1 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 7 document 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 8 detachedDiv 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 9 foreignDoc 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 10 foreignPara2 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 17 comment 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 18 detachedComment 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 19 docfrag 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 20 doctype 
-PASS setStartBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 0 paras[0] 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 3 foreignPara1 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 5 detachedPara1 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 7 document 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 8 detachedDiv 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 9 foreignDoc 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 10 foreignPara2 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 17 comment 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 18 detachedComment 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 19 docfrag 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 20 doctype 
-PASS setStartBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 0 paras[0] 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 3 foreignPara1 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 5 detachedPara1 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 7 document 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 8 detachedDiv 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 9 foreignDoc 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 10 foreignPara2 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 17 comment 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 18 detachedComment 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 19 docfrag 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 20 doctype 
-PASS setStartBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 0 paras[0] 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 3 foreignPara1 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 5 detachedPara1 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 7 document 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 8 detachedDiv 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 9 foreignDoc 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 10 foreignPara2 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 17 comment 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 18 detachedComment 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 19 docfrag 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 20 doctype 
-PASS setStartBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 0 paras[0] 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 3 foreignPara1 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 5 detachedPara1 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 7 document 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 8 detachedDiv 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 9 foreignDoc 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 10 foreignPara2 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 11 xmlDoc 
-FAIL setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 13 detachedTextNode 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 17 comment 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 18 detachedComment 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 19 docfrag 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 20 doctype 
-PASS setStartBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 21 foreignDoctype 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 0 paras[0] 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 3 foreignPara1 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 5 detachedPara1 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 7 document 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 8 detachedDiv 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 9 foreignDoc 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 10 foreignPara2 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 11 xmlDoc 
-FAIL setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 13 detachedTextNode 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 17 comment 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 18 detachedComment 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 19 docfrag 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 20 doctype 
-PASS setStartBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 21 foreignDoctype 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 0 paras[0] 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 3 foreignPara1 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 5 detachedPara1 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 7 document 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 8 detachedDiv 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 9 foreignDoc 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 10 foreignPara2 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 13 [document.head, 1, document.head, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 13 [document.head, 1, document.head, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 17 comment 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 18 detachedComment 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 19 docfrag 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 20 doctype 
-PASS setStartBefore() with range 13 [document.head, 1, document.head, 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 0 paras[0] 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 3 foreignPara1 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 5 detachedPara1 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 7 document 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 8 detachedDiv 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 9 foreignDoc 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 10 foreignPara2 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 11 xmlDoc 
-FAIL setStartBefore() with range 14 [document.body, 4, document.body, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 13 detachedTextNode 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 14 foreignTextNode 
-FAIL setStartBefore() with range 14 [document.body, 4, document.body, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 17 comment 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 18 detachedComment 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 19 docfrag 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 20 doctype 
-PASS setStartBefore() with range 14 [document.body, 4, document.body, 5], node 21 foreignDoctype 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 0 paras[0] 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 3 foreignPara1 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 5 detachedPara1 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 7 document 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 8 detachedDiv 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 9 foreignDoc 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 10 foreignPara2 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 17 comment 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 18 detachedComment 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 19 docfrag 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 20 doctype 
-PASS setStartBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 0 paras[0] 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 3 foreignPara1 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 5 detachedPara1 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 7 document 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 8 detachedDiv 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 9 foreignDoc 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 10 foreignPara2 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 17 comment 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 18 detachedComment 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 19 docfrag 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 20 doctype 
-PASS setStartBefore() with range 16 [paras[0], 0, paras[0], 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 0 paras[0] 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 3 foreignPara1 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 5 detachedPara1 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 7 document 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 8 detachedDiv 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 9 foreignDoc 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 10 foreignPara2 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 17 comment 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 18 detachedComment 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 19 docfrag 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 20 doctype 
-PASS setStartBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setStartBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 0 paras[0] 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 3 foreignPara1 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 5 detachedPara1 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 7 document 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 8 detachedDiv 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 9 foreignDoc 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 10 foreignPara2 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 11 xmlDoc 
-FAIL setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 13 detachedTextNode 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 14 foreignTextNode 
-FAIL setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 17 comment 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 18 detachedComment 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 19 docfrag 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 20 doctype 
-PASS setStartBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 21 foreignDoctype 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 0 paras[0] 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 3 foreignPara1 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 5 detachedPara1 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 7 document 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 8 detachedDiv 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 9 foreignDoc 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 10 foreignPara2 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 17 comment 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 18 detachedComment 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 19 docfrag 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 20 doctype 
-PASS setStartBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 0 paras[0] 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 3 foreignPara1 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 5 detachedPara1 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 7 document 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 8 detachedDiv 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 9 foreignDoc 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 10 foreignPara2 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 11 xmlDoc 
-FAIL setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 13 detachedTextNode 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 14 foreignTextNode 
-FAIL setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 17 comment 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 18 detachedComment 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 19 docfrag 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 20 doctype 
-PASS setStartBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 21 foreignDoctype 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 0 paras[0] 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 3 foreignPara1 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 5 detachedPara1 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 7 document 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 8 detachedDiv 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 9 foreignDoc 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 10 foreignPara2 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 17 comment 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 18 detachedComment 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 19 docfrag 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 20 doctype 
-PASS setStartBefore() with range 22 [testDiv, 2, paras[4], 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 0 paras[0] 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 3 foreignPara1 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 5 detachedPara1 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 7 document 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 8 detachedDiv 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 9 foreignDoc 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 10 foreignPara2 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 23 [document, 0, document, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 23 [document, 0, document, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 17 comment 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 18 detachedComment 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 19 docfrag 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 20 doctype 
-PASS setStartBefore() with range 23 [document, 0, document, 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 0 paras[0] 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 3 foreignPara1 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 5 detachedPara1 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 7 document 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 8 detachedDiv 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 9 foreignDoc 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 10 foreignPara2 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 11 xmlDoc 
-FAIL setStartBefore() with range 24 [document, 0, document, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 13 detachedTextNode 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 14 foreignTextNode 
-FAIL setStartBefore() with range 24 [document, 0, document, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 17 comment 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 18 detachedComment 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 19 docfrag 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 20 doctype 
-PASS setStartBefore() with range 24 [document, 0, document, 2], node 21 foreignDoctype 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 0 paras[0] 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 3 foreignPara1 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 5 detachedPara1 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 7 document 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 8 detachedDiv 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 9 foreignDoc 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 10 foreignPara2 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 11 xmlDoc 
-FAIL setStartBefore() with range 25 [comment, 2, comment, 3], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 13 detachedTextNode 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 14 foreignTextNode 
-FAIL setStartBefore() with range 25 [comment, 2, comment, 3], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 17 comment 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 18 detachedComment 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 19 docfrag 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 20 doctype 
-PASS setStartBefore() with range 25 [comment, 2, comment, 3], node 21 foreignDoctype 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 0 paras[0] 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 3 foreignPara1 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 5 detachedPara1 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 7 document 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 8 detachedDiv 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 9 foreignDoc 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 10 foreignPara2 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 11 xmlDoc 
-FAIL setStartBefore() with range 26 [testDiv, 0, comment, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 13 detachedTextNode 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 14 foreignTextNode 
-FAIL setStartBefore() with range 26 [testDiv, 0, comment, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 17 comment 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 18 detachedComment 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 19 docfrag 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 20 doctype 
-PASS setStartBefore() with range 26 [testDiv, 0, comment, 5], node 21 foreignDoctype 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 0 paras[0] 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 3 foreignPara1 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 5 detachedPara1 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 7 document 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 8 detachedDiv 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 9 foreignDoc 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 10 foreignPara2 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 11 xmlDoc 
-FAIL setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 13 detachedTextNode 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 14 foreignTextNode 
-FAIL setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 17 comment 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 18 detachedComment 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 19 docfrag 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 20 doctype 
-PASS setStartBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 21 foreignDoctype 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 0 paras[0] 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 3 foreignPara1 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 5 detachedPara1 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 7 document 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 8 detachedDiv 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 9 foreignDoc 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 10 foreignPara2 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 11 xmlDoc 
-FAIL setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 13 detachedTextNode 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 14 foreignTextNode 
-FAIL setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 17 comment 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 18 detachedComment 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 19 docfrag 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 20 doctype 
-PASS setStartBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 21 foreignDoctype 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 0 paras[0] 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 3 foreignPara1 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 5 detachedPara1 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 7 document 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 8 detachedDiv 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 9 foreignDoc 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 10 foreignPara2 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 11 xmlDoc 
-FAIL setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 13 detachedTextNode 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 14 foreignTextNode 
-FAIL setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 17 comment 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 18 detachedComment 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 19 docfrag 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 20 doctype 
-PASS setStartBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 21 foreignDoctype 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 0 paras[0] 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 3 foreignPara1 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 5 detachedPara1 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 7 document 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 8 detachedDiv 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 9 foreignDoc 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 10 foreignPara2 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 11 xmlDoc 
-FAIL setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 13 detachedTextNode 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 14 foreignTextNode 
-FAIL setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 17 comment 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 18 detachedComment 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 19 docfrag 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 20 doctype 
-PASS setStartBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 21 foreignDoctype 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 0 paras[0] 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 3 foreignPara1 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 5 detachedPara1 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 7 document 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 8 detachedDiv 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 9 foreignDoc 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 10 foreignPara2 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 11 xmlDoc 
-FAIL setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 13 detachedTextNode 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 14 foreignTextNode 
-FAIL setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 17 comment 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 18 detachedComment 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 19 docfrag 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 20 doctype 
-PASS setStartBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 21 foreignDoctype 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 0 paras[0] 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 3 foreignPara1 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 5 detachedPara1 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 7 document 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 8 detachedDiv 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 9 foreignDoc 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 10 foreignPara2 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 11 xmlDoc 
-FAIL setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 13 detachedTextNode 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 14 foreignTextNode 
-FAIL setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 17 comment 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 18 detachedComment 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 19 docfrag 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 20 doctype 
-PASS setStartBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 21 foreignDoctype 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 0 paras[0] 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 3 foreignPara1 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 5 detachedPara1 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 7 document 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 8 detachedDiv 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 9 foreignDoc 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 10 foreignPara2 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 11 xmlDoc 
-FAIL setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 13 detachedTextNode 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 14 foreignTextNode 
-FAIL setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 17 comment 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 18 detachedComment 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 19 docfrag 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 20 doctype 
-PASS setStartBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 21 foreignDoctype 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 0 paras[0] 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 3 foreignPara1 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 5 detachedPara1 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 7 document 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 8 detachedDiv 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 9 foreignDoc 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 10 foreignPara2 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 11 xmlDoc 
-FAIL setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 13 detachedTextNode 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 14 foreignTextNode 
-FAIL setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 17 comment 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 18 detachedComment 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 19 docfrag 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 20 doctype 
-PASS setStartBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 21 foreignDoctype 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 0 paras[0] 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 3 foreignPara1 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 5 detachedPara1 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 7 document 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 8 detachedDiv 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 9 foreignDoc 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 10 foreignPara2 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 11 xmlDoc 
-FAIL setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 13 detachedTextNode 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 14 foreignTextNode 
-FAIL setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 17 comment 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 18 detachedComment 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 19 docfrag 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 20 doctype 
-PASS setStartBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 21 foreignDoctype 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 0 paras[0] 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 3 foreignPara1 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 5 detachedPara1 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 7 document 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 8 detachedDiv 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 9 foreignDoc 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 10 foreignPara2 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 11 xmlDoc 
-FAIL setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 13 detachedTextNode 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 14 foreignTextNode 
-FAIL setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 17 comment 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 18 detachedComment 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 19 docfrag 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 20 doctype 
-PASS setStartBefore() with range 36 [docfrag, 0, docfrag, 0], node 21 foreignDoctype 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 0 paras[0] 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 1 paras[0].firstChild 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 2 paras[1].firstChild 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 3 foreignPara1 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 4 foreignPara1.firstChild 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 5 detachedPara1 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 6 detachedPara1.firstChild 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 7 document 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 8 detachedDiv 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 9 foreignDoc 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 10 foreignPara2 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 11 xmlDoc 
-FAIL setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 13 detachedTextNode 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 14 foreignTextNode 
-FAIL setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 16 detachedProcessingInstruction 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 17 comment 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 18 detachedComment 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 19 docfrag 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 20 doctype 
-PASS setStartBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 21 foreignDoctype 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 0 paras[0] 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 3 foreignPara1 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 5 detachedPara1 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 7 document 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 8 detachedDiv 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 9 foreignDoc 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 10 foreignPara2 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 11 xmlDoc 
-FAIL setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 13 detachedTextNode 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 14 foreignTextNode 
-FAIL setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 17 comment 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 18 detachedComment 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 19 docfrag 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 20 doctype 
-PASS setStartAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 21 foreignDoctype 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 0 paras[0] 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 3 foreignPara1 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 5 detachedPara1 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 7 document 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 8 detachedDiv 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 9 foreignDoc 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 10 foreignPara2 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 17 comment 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 18 detachedComment 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 19 docfrag 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 20 doctype 
-PASS setStartAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 0 paras[0] 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 3 foreignPara1 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 5 detachedPara1 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 7 document 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 8 detachedDiv 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 9 foreignDoc 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 10 foreignPara2 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 11 xmlDoc 
-FAIL setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 13 detachedTextNode 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 14 foreignTextNode 
-FAIL setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 17 comment 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 18 detachedComment 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 19 docfrag 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 20 doctype 
-PASS setStartAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 21 foreignDoctype 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 0 paras[0] 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 3 foreignPara1 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 5 detachedPara1 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 7 document 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 8 detachedDiv 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 9 foreignDoc 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 10 foreignPara2 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 11 xmlDoc 
-FAIL setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 13 detachedTextNode 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 14 foreignTextNode 
-FAIL setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 17 comment 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 18 detachedComment 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 19 docfrag 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 20 doctype 
-PASS setStartAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 21 foreignDoctype 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setStartAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 0 paras[0] 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 3 foreignPara1 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 5 detachedPara1 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 7 document 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 8 detachedDiv 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 9 foreignDoc 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 10 foreignPara2 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 11 xmlDoc 
-FAIL setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 13 detachedTextNode 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 14 foreignTextNode 
-FAIL setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 17 comment 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 18 detachedComment 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 19 docfrag 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 20 doctype 
-PASS setStartAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 21 foreignDoctype 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 0 paras[0] 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 3 foreignPara1 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 5 detachedPara1 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 7 document 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 8 detachedDiv 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 9 foreignDoc 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 10 foreignPara2 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 17 comment 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 18 detachedComment 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 19 docfrag 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 20 doctype 
-PASS setStartAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 0 paras[0] 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 3 foreignPara1 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 5 detachedPara1 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 7 document 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 8 detachedDiv 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 9 foreignDoc 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 10 foreignPara2 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 17 comment 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 18 detachedComment 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 19 docfrag 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 20 doctype 
-PASS setStartAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 0 paras[0] 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 3 foreignPara1 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 5 detachedPara1 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 7 document 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 8 detachedDiv 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 9 foreignDoc 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 10 foreignPara2 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 17 comment 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 18 detachedComment 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 19 docfrag 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 20 doctype 
-PASS setStartAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 0 paras[0] 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 3 foreignPara1 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 5 detachedPara1 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 7 document 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 8 detachedDiv 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 9 foreignDoc 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 10 foreignPara2 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 17 comment 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 18 detachedComment 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 19 docfrag 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 20 doctype 
-PASS setStartAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 0 paras[0] 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 3 foreignPara1 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 5 detachedPara1 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 7 document 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 8 detachedDiv 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 9 foreignDoc 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 10 foreignPara2 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 17 comment 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 18 detachedComment 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 19 docfrag 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 20 doctype 
-PASS setStartAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 0 paras[0] 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 3 foreignPara1 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 5 detachedPara1 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 7 document 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 8 detachedDiv 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 9 foreignDoc 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 10 foreignPara2 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 11 xmlDoc 
-FAIL setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 13 detachedTextNode 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 17 comment 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 18 detachedComment 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 19 docfrag 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 20 doctype 
-PASS setStartAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 21 foreignDoctype 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 0 paras[0] 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 3 foreignPara1 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 5 detachedPara1 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 7 document 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 8 detachedDiv 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 9 foreignDoc 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 10 foreignPara2 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 11 xmlDoc 
-FAIL setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 13 detachedTextNode 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 17 comment 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 18 detachedComment 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 19 docfrag 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 20 doctype 
-PASS setStartAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 21 foreignDoctype 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 0 paras[0] 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 3 foreignPara1 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 5 detachedPara1 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 7 document 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 8 detachedDiv 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 9 foreignDoc 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 10 foreignPara2 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 13 [document.head, 1, document.head, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 13 [document.head, 1, document.head, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 17 comment 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 18 detachedComment 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 19 docfrag 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 20 doctype 
-PASS setStartAfter() with range 13 [document.head, 1, document.head, 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 0 paras[0] 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 3 foreignPara1 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 5 detachedPara1 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 7 document 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 8 detachedDiv 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 9 foreignDoc 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 10 foreignPara2 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 11 xmlDoc 
-FAIL setStartAfter() with range 14 [document.body, 4, document.body, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 13 detachedTextNode 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 14 foreignTextNode 
-FAIL setStartAfter() with range 14 [document.body, 4, document.body, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 17 comment 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 18 detachedComment 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 19 docfrag 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 20 doctype 
-PASS setStartAfter() with range 14 [document.body, 4, document.body, 5], node 21 foreignDoctype 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 0 paras[0] 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 3 foreignPara1 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 5 detachedPara1 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 7 document 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 8 detachedDiv 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 9 foreignDoc 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 10 foreignPara2 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 17 comment 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 18 detachedComment 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 19 docfrag 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 20 doctype 
-PASS setStartAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 0 paras[0] 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 3 foreignPara1 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 5 detachedPara1 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 7 document 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 8 detachedDiv 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 9 foreignDoc 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 10 foreignPara2 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 17 comment 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 18 detachedComment 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 19 docfrag 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 20 doctype 
-PASS setStartAfter() with range 16 [paras[0], 0, paras[0], 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 0 paras[0] 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 3 foreignPara1 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 5 detachedPara1 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 7 document 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 8 detachedDiv 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 9 foreignDoc 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 10 foreignPara2 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 17 comment 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 18 detachedComment 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 19 docfrag 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 20 doctype 
-PASS setStartAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setStartAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 0 paras[0] 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 3 foreignPara1 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 5 detachedPara1 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 7 document 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 8 detachedDiv 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 9 foreignDoc 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 10 foreignPara2 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 11 xmlDoc 
-FAIL setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 13 detachedTextNode 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 14 foreignTextNode 
-FAIL setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 17 comment 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 18 detachedComment 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 19 docfrag 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 20 doctype 
-PASS setStartAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 21 foreignDoctype 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 0 paras[0] 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 3 foreignPara1 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 5 detachedPara1 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 7 document 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 8 detachedDiv 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 9 foreignDoc 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 10 foreignPara2 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 17 comment 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 18 detachedComment 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 19 docfrag 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 20 doctype 
-PASS setStartAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 0 paras[0] 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 3 foreignPara1 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 5 detachedPara1 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 7 document 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 8 detachedDiv 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 9 foreignDoc 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 10 foreignPara2 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 11 xmlDoc 
-FAIL setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 13 detachedTextNode 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 14 foreignTextNode 
-FAIL setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 17 comment 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 18 detachedComment 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 19 docfrag 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 20 doctype 
-PASS setStartAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 21 foreignDoctype 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 0 paras[0] 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 3 foreignPara1 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 5 detachedPara1 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 7 document 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 8 detachedDiv 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 9 foreignDoc 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 10 foreignPara2 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 17 comment 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 18 detachedComment 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 19 docfrag 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 20 doctype 
-PASS setStartAfter() with range 22 [testDiv, 2, paras[4], 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 0 paras[0] 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 3 foreignPara1 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 5 detachedPara1 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 7 document 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 8 detachedDiv 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 9 foreignDoc 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 10 foreignPara2 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 23 [document, 0, document, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 23 [document, 0, document, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 17 comment 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 18 detachedComment 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 19 docfrag 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 20 doctype 
-PASS setStartAfter() with range 23 [document, 0, document, 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 0 paras[0] 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 3 foreignPara1 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 5 detachedPara1 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 7 document 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 8 detachedDiv 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 9 foreignDoc 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 10 foreignPara2 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 11 xmlDoc 
-FAIL setStartAfter() with range 24 [document, 0, document, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 13 detachedTextNode 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 14 foreignTextNode 
-FAIL setStartAfter() with range 24 [document, 0, document, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 17 comment 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 18 detachedComment 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 19 docfrag 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 20 doctype 
-PASS setStartAfter() with range 24 [document, 0, document, 2], node 21 foreignDoctype 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 0 paras[0] 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 3 foreignPara1 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 5 detachedPara1 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 7 document 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 8 detachedDiv 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 9 foreignDoc 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 10 foreignPara2 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 11 xmlDoc 
-FAIL setStartAfter() with range 25 [comment, 2, comment, 3], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 13 detachedTextNode 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 14 foreignTextNode 
-FAIL setStartAfter() with range 25 [comment, 2, comment, 3], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 17 comment 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 18 detachedComment 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 19 docfrag 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 20 doctype 
-PASS setStartAfter() with range 25 [comment, 2, comment, 3], node 21 foreignDoctype 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 0 paras[0] 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 3 foreignPara1 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 5 detachedPara1 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 7 document 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 8 detachedDiv 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 9 foreignDoc 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 10 foreignPara2 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 11 xmlDoc 
-FAIL setStartAfter() with range 26 [testDiv, 0, comment, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 13 detachedTextNode 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 14 foreignTextNode 
-FAIL setStartAfter() with range 26 [testDiv, 0, comment, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 17 comment 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 18 detachedComment 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 19 docfrag 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 20 doctype 
-PASS setStartAfter() with range 26 [testDiv, 0, comment, 5], node 21 foreignDoctype 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 0 paras[0] 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 3 foreignPara1 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 5 detachedPara1 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 7 document 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 8 detachedDiv 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 9 foreignDoc 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 10 foreignPara2 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 11 xmlDoc 
-FAIL setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 13 detachedTextNode 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 14 foreignTextNode 
-FAIL setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 17 comment 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 18 detachedComment 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 19 docfrag 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 20 doctype 
-PASS setStartAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 21 foreignDoctype 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 0 paras[0] 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 3 foreignPara1 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 5 detachedPara1 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 7 document 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 8 detachedDiv 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 9 foreignDoc 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 10 foreignPara2 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 11 xmlDoc 
-FAIL setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 13 detachedTextNode 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 14 foreignTextNode 
-FAIL setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 17 comment 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 18 detachedComment 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 19 docfrag 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 20 doctype 
-PASS setStartAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 21 foreignDoctype 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 0 paras[0] 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 3 foreignPara1 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 5 detachedPara1 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 7 document 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 8 detachedDiv 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 9 foreignDoc 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 10 foreignPara2 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 11 xmlDoc 
-FAIL setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 13 detachedTextNode 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 14 foreignTextNode 
-FAIL setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 17 comment 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 18 detachedComment 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 19 docfrag 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 20 doctype 
-PASS setStartAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 21 foreignDoctype 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 0 paras[0] 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 3 foreignPara1 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 5 detachedPara1 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 7 document 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 8 detachedDiv 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 9 foreignDoc 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 10 foreignPara2 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 11 xmlDoc 
-FAIL setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 13 detachedTextNode 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 14 foreignTextNode 
-FAIL setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 17 comment 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 18 detachedComment 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 19 docfrag 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 20 doctype 
-PASS setStartAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 21 foreignDoctype 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 0 paras[0] 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 3 foreignPara1 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 5 detachedPara1 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 7 document 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 8 detachedDiv 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 9 foreignDoc 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 10 foreignPara2 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 11 xmlDoc 
-FAIL setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 13 detachedTextNode 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 14 foreignTextNode 
-FAIL setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 17 comment 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 18 detachedComment 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 19 docfrag 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 20 doctype 
-PASS setStartAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 21 foreignDoctype 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 0 paras[0] 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 3 foreignPara1 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 5 detachedPara1 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 7 document 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 8 detachedDiv 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 9 foreignDoc 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 10 foreignPara2 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 11 xmlDoc 
-FAIL setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 13 detachedTextNode 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 14 foreignTextNode 
-FAIL setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 17 comment 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 18 detachedComment 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 19 docfrag 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 20 doctype 
-PASS setStartAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 21 foreignDoctype 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 0 paras[0] 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 3 foreignPara1 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 5 detachedPara1 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 7 document 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 8 detachedDiv 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 9 foreignDoc 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 10 foreignPara2 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 11 xmlDoc 
-FAIL setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 13 detachedTextNode 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 14 foreignTextNode 
-FAIL setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 17 comment 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 18 detachedComment 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 19 docfrag 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 20 doctype 
-PASS setStartAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 21 foreignDoctype 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 0 paras[0] 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 3 foreignPara1 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 5 detachedPara1 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 7 document 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 8 detachedDiv 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 9 foreignDoc 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 10 foreignPara2 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 11 xmlDoc 
-FAIL setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 13 detachedTextNode 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 14 foreignTextNode 
-FAIL setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 17 comment 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 18 detachedComment 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 19 docfrag 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 20 doctype 
-PASS setStartAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 21 foreignDoctype 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 0 paras[0] 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 3 foreignPara1 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 5 detachedPara1 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 7 document 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 8 detachedDiv 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 9 foreignDoc 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 10 foreignPara2 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 11 xmlDoc 
-FAIL setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 13 detachedTextNode 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 14 foreignTextNode 
-FAIL setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 17 comment 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 18 detachedComment 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 19 docfrag 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 20 doctype 
-PASS setStartAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 21 foreignDoctype 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 0 paras[0] 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 3 foreignPara1 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 5 detachedPara1 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 7 document 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 8 detachedDiv 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 9 foreignDoc 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 10 foreignPara2 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 11 xmlDoc 
-FAIL setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 13 detachedTextNode 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 14 foreignTextNode 
-FAIL setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 17 comment 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 18 detachedComment 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 19 docfrag 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 20 doctype 
-PASS setStartAfter() with range 36 [docfrag, 0, docfrag, 0], node 21 foreignDoctype 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 0 paras[0] 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 1 paras[0].firstChild 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 2 paras[1].firstChild 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 3 foreignPara1 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 4 foreignPara1.firstChild 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 5 detachedPara1 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 6 detachedPara1.firstChild 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 7 document 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 8 detachedDiv 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 9 foreignDoc 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 10 foreignPara2 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 11 xmlDoc 
-FAIL setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 13 detachedTextNode 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 14 foreignTextNode 
-FAIL setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 16 detachedProcessingInstruction 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 17 comment 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 18 detachedComment 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 19 docfrag 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 20 doctype 
-PASS setStartAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 21 foreignDoctype 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 0 paras[0] 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 3 foreignPara1 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 5 detachedPara1 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 7 document 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 8 detachedDiv 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 9 foreignDoc 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 10 foreignPara2 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 11 xmlDoc 
-FAIL setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 13 detachedTextNode 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 14 foreignTextNode 
-FAIL setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 17 comment 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 18 detachedComment 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 19 docfrag 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 20 doctype 
-PASS setEndBefore() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 21 foreignDoctype 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 0 paras[0] 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 3 foreignPara1 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 5 detachedPara1 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 7 document 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 8 detachedDiv 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 9 foreignDoc 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 10 foreignPara2 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 17 comment 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 18 detachedComment 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 19 docfrag 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 20 doctype 
-PASS setEndBefore() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 0 paras[0] 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 3 foreignPara1 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 5 detachedPara1 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 7 document 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 8 detachedDiv 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 9 foreignDoc 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 10 foreignPara2 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 11 xmlDoc 
-FAIL setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 13 detachedTextNode 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 14 foreignTextNode 
-FAIL setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 17 comment 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 18 detachedComment 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 19 docfrag 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 20 doctype 
-PASS setEndBefore() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 21 foreignDoctype 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 0 paras[0] 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 3 foreignPara1 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 5 detachedPara1 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 7 document 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 8 detachedDiv 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 9 foreignDoc 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 10 foreignPara2 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 11 xmlDoc 
-FAIL setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 13 detachedTextNode 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 14 foreignTextNode 
-FAIL setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 17 comment 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 18 detachedComment 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 19 docfrag 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 20 doctype 
-PASS setEndBefore() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 21 foreignDoctype 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setEndBefore() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 0 paras[0] 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 3 foreignPara1 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 5 detachedPara1 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 7 document 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 8 detachedDiv 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 9 foreignDoc 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 10 foreignPara2 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 11 xmlDoc 
-FAIL setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 13 detachedTextNode 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 14 foreignTextNode 
-FAIL setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 17 comment 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 18 detachedComment 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 19 docfrag 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 20 doctype 
-PASS setEndBefore() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 21 foreignDoctype 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 0 paras[0] 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 3 foreignPara1 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 5 detachedPara1 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 7 document 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 8 detachedDiv 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 9 foreignDoc 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 10 foreignPara2 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 17 comment 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 18 detachedComment 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 19 docfrag 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 20 doctype 
-PASS setEndBefore() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 0 paras[0] 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 3 foreignPara1 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 5 detachedPara1 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 7 document 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 8 detachedDiv 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 9 foreignDoc 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 10 foreignPara2 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 17 comment 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 18 detachedComment 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 19 docfrag 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 20 doctype 
-PASS setEndBefore() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 0 paras[0] 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 3 foreignPara1 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 5 detachedPara1 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 7 document 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 8 detachedDiv 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 9 foreignDoc 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 10 foreignPara2 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 17 comment 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 18 detachedComment 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 19 docfrag 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 20 doctype 
-PASS setEndBefore() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 0 paras[0] 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 3 foreignPara1 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 5 detachedPara1 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 7 document 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 8 detachedDiv 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 9 foreignDoc 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 10 foreignPara2 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 17 comment 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 18 detachedComment 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 19 docfrag 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 20 doctype 
-PASS setEndBefore() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 0 paras[0] 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 3 foreignPara1 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 5 detachedPara1 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 7 document 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 8 detachedDiv 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 9 foreignDoc 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 10 foreignPara2 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 17 comment 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 18 detachedComment 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 19 docfrag 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 20 doctype 
-PASS setEndBefore() with range 10 [document.documentElement, 0, document.documentElement, 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 0 paras[0] 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 3 foreignPara1 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 5 detachedPara1 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 7 document 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 8 detachedDiv 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 9 foreignDoc 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 10 foreignPara2 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 11 xmlDoc 
-FAIL setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 13 detachedTextNode 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 17 comment 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 18 detachedComment 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 19 docfrag 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 20 doctype 
-PASS setEndBefore() with range 11 [document.documentElement, 0, document.documentElement, 2], node 21 foreignDoctype 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 0 paras[0] 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 3 foreignPara1 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 5 detachedPara1 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 7 document 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 8 detachedDiv 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 9 foreignDoc 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 10 foreignPara2 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 11 xmlDoc 
-FAIL setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 13 detachedTextNode 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 17 comment 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 18 detachedComment 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 19 docfrag 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 20 doctype 
-PASS setEndBefore() with range 12 [document.documentElement, 1, document.documentElement, 2], node 21 foreignDoctype 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 0 paras[0] 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 3 foreignPara1 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 5 detachedPara1 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 7 document 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 8 detachedDiv 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 9 foreignDoc 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 10 foreignPara2 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 13 [document.head, 1, document.head, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 13 [document.head, 1, document.head, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 17 comment 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 18 detachedComment 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 19 docfrag 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 20 doctype 
-PASS setEndBefore() with range 13 [document.head, 1, document.head, 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 0 paras[0] 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 3 foreignPara1 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 5 detachedPara1 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 7 document 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 8 detachedDiv 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 9 foreignDoc 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 10 foreignPara2 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 11 xmlDoc 
-FAIL setEndBefore() with range 14 [document.body, 4, document.body, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 13 detachedTextNode 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 14 foreignTextNode 
-FAIL setEndBefore() with range 14 [document.body, 4, document.body, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 17 comment 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 18 detachedComment 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 19 docfrag 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 20 doctype 
-PASS setEndBefore() with range 14 [document.body, 4, document.body, 5], node 21 foreignDoctype 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 0 paras[0] 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 3 foreignPara1 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 5 detachedPara1 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 7 document 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 8 detachedDiv 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 9 foreignDoc 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 10 foreignPara2 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 17 comment 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 18 detachedComment 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 19 docfrag 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 20 doctype 
-PASS setEndBefore() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 0 paras[0] 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 3 foreignPara1 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 5 detachedPara1 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 7 document 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 8 detachedDiv 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 9 foreignDoc 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 10 foreignPara2 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 17 comment 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 18 detachedComment 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 19 docfrag 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 20 doctype 
-PASS setEndBefore() with range 16 [paras[0], 0, paras[0], 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 0 paras[0] 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 3 foreignPara1 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 5 detachedPara1 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 7 document 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 8 detachedDiv 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 9 foreignDoc 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 10 foreignPara2 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 17 comment 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 18 detachedComment 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 19 docfrag 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 20 doctype 
-PASS setEndBefore() with range 17 [detachedPara1, 0, detachedPara1, 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setEndBefore() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 0 paras[0] 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 3 foreignPara1 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 5 detachedPara1 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 7 document 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 8 detachedDiv 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 9 foreignDoc 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 10 foreignPara2 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 11 xmlDoc 
-FAIL setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 13 detachedTextNode 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 14 foreignTextNode 
-FAIL setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 17 comment 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 18 detachedComment 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 19 docfrag 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 20 doctype 
-PASS setEndBefore() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 21 foreignDoctype 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 0 paras[0] 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 3 foreignPara1 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 5 detachedPara1 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 7 document 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 8 detachedDiv 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 9 foreignDoc 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 10 foreignPara2 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 17 comment 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 18 detachedComment 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 19 docfrag 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 20 doctype 
-PASS setEndBefore() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 0 paras[0] 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 3 foreignPara1 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 5 detachedPara1 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 7 document 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 8 detachedDiv 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 9 foreignDoc 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 10 foreignPara2 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 11 xmlDoc 
-FAIL setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 13 detachedTextNode 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 14 foreignTextNode 
-FAIL setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 17 comment 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 18 detachedComment 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 19 docfrag 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 20 doctype 
-PASS setEndBefore() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 21 foreignDoctype 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 0 paras[0] 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 3 foreignPara1 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 5 detachedPara1 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 7 document 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 8 detachedDiv 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 9 foreignDoc 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 10 foreignPara2 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 17 comment 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 18 detachedComment 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 19 docfrag 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 20 doctype 
-PASS setEndBefore() with range 22 [testDiv, 2, paras[4], 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 0 paras[0] 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 3 foreignPara1 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 5 detachedPara1 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 7 document 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 8 detachedDiv 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 9 foreignDoc 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 10 foreignPara2 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 23 [document, 0, document, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 23 [document, 0, document, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 17 comment 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 18 detachedComment 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 19 docfrag 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 20 doctype 
-PASS setEndBefore() with range 23 [document, 0, document, 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 0 paras[0] 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 3 foreignPara1 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 5 detachedPara1 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 7 document 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 8 detachedDiv 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 9 foreignDoc 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 10 foreignPara2 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 11 xmlDoc 
-FAIL setEndBefore() with range 24 [document, 0, document, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 13 detachedTextNode 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 14 foreignTextNode 
-FAIL setEndBefore() with range 24 [document, 0, document, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 17 comment 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 18 detachedComment 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 19 docfrag 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 20 doctype 
-PASS setEndBefore() with range 24 [document, 0, document, 2], node 21 foreignDoctype 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 0 paras[0] 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 3 foreignPara1 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 5 detachedPara1 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 7 document 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 8 detachedDiv 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 9 foreignDoc 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 10 foreignPara2 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 11 xmlDoc 
-FAIL setEndBefore() with range 25 [comment, 2, comment, 3], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 13 detachedTextNode 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 14 foreignTextNode 
-FAIL setEndBefore() with range 25 [comment, 2, comment, 3], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 17 comment 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 18 detachedComment 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 19 docfrag 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 20 doctype 
-PASS setEndBefore() with range 25 [comment, 2, comment, 3], node 21 foreignDoctype 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 0 paras[0] 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 3 foreignPara1 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 5 detachedPara1 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 7 document 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 8 detachedDiv 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 9 foreignDoc 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 10 foreignPara2 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 11 xmlDoc 
-FAIL setEndBefore() with range 26 [testDiv, 0, comment, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 13 detachedTextNode 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 14 foreignTextNode 
-FAIL setEndBefore() with range 26 [testDiv, 0, comment, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 17 comment 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 18 detachedComment 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 19 docfrag 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 20 doctype 
-PASS setEndBefore() with range 26 [testDiv, 0, comment, 5], node 21 foreignDoctype 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 0 paras[0] 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 3 foreignPara1 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 5 detachedPara1 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 7 document 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 8 detachedDiv 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 9 foreignDoc 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 10 foreignPara2 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 11 xmlDoc 
-FAIL setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 13 detachedTextNode 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 14 foreignTextNode 
-FAIL setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 17 comment 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 18 detachedComment 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 19 docfrag 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 20 doctype 
-PASS setEndBefore() with range 27 [foreignDoc, 1, foreignComment, 2], node 21 foreignDoctype 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 0 paras[0] 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 3 foreignPara1 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 5 detachedPara1 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 7 document 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 8 detachedDiv 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 9 foreignDoc 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 10 foreignPara2 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 11 xmlDoc 
-FAIL setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 13 detachedTextNode 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 14 foreignTextNode 
-FAIL setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 17 comment 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 18 detachedComment 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 19 docfrag 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 20 doctype 
-PASS setEndBefore() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 21 foreignDoctype 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 0 paras[0] 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 3 foreignPara1 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 5 detachedPara1 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 7 document 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 8 detachedDiv 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 9 foreignDoc 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 10 foreignPara2 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 11 xmlDoc 
-FAIL setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 13 detachedTextNode 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 14 foreignTextNode 
-FAIL setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 17 comment 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 18 detachedComment 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 19 docfrag 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 20 doctype 
-PASS setEndBefore() with range 29 [xmlDoc, 1, xmlComment, 0], node 21 foreignDoctype 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 0 paras[0] 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 3 foreignPara1 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 5 detachedPara1 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 7 document 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 8 detachedDiv 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 9 foreignDoc 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 10 foreignPara2 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 11 xmlDoc 
-FAIL setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 13 detachedTextNode 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 14 foreignTextNode 
-FAIL setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 17 comment 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 18 detachedComment 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 19 docfrag 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 20 doctype 
-PASS setEndBefore() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 21 foreignDoctype 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 0 paras[0] 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 3 foreignPara1 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 5 detachedPara1 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 7 document 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 8 detachedDiv 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 9 foreignDoc 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 10 foreignPara2 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 11 xmlDoc 
-FAIL setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 13 detachedTextNode 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 14 foreignTextNode 
-FAIL setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 17 comment 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 18 detachedComment 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 19 docfrag 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 20 doctype 
-PASS setEndBefore() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 21 foreignDoctype 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 0 paras[0] 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 3 foreignPara1 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 5 detachedPara1 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 7 document 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 8 detachedDiv 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 9 foreignDoc 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 10 foreignPara2 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 11 xmlDoc 
-FAIL setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 13 detachedTextNode 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 14 foreignTextNode 
-FAIL setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 17 comment 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 18 detachedComment 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 19 docfrag 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 20 doctype 
-PASS setEndBefore() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 21 foreignDoctype 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 0 paras[0] 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 3 foreignPara1 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 5 detachedPara1 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 7 document 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 8 detachedDiv 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 9 foreignDoc 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 10 foreignPara2 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 11 xmlDoc 
-FAIL setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 13 detachedTextNode 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 14 foreignTextNode 
-FAIL setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 17 comment 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 18 detachedComment 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 19 docfrag 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 20 doctype 
-PASS setEndBefore() with range 33 [detachedComment, 3, detachedComment, 4], node 21 foreignDoctype 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 0 paras[0] 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 3 foreignPara1 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 5 detachedPara1 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 7 document 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 8 detachedDiv 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 9 foreignDoc 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 10 foreignPara2 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 11 xmlDoc 
-FAIL setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 13 detachedTextNode 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 14 foreignTextNode 
-FAIL setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 17 comment 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 18 detachedComment 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 19 docfrag 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 20 doctype 
-PASS setEndBefore() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 21 foreignDoctype 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 0 paras[0] 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 3 foreignPara1 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 5 detachedPara1 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 7 document 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 8 detachedDiv 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 9 foreignDoc 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 10 foreignPara2 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 11 xmlDoc 
-FAIL setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 13 detachedTextNode 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 14 foreignTextNode 
-FAIL setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 17 comment 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 18 detachedComment 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 19 docfrag 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 20 doctype 
-PASS setEndBefore() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 21 foreignDoctype 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 0 paras[0] 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 3 foreignPara1 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 5 detachedPara1 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 7 document 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 8 detachedDiv 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 9 foreignDoc 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 10 foreignPara2 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 11 xmlDoc 
-FAIL setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 13 detachedTextNode 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 14 foreignTextNode 
-FAIL setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 17 comment 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 18 detachedComment 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 19 docfrag 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 20 doctype 
-PASS setEndBefore() with range 36 [docfrag, 0, docfrag, 0], node 21 foreignDoctype 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 0 paras[0] 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 1 paras[0].firstChild 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 2 paras[1].firstChild 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 3 foreignPara1 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 4 foreignPara1.firstChild 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 5 detachedPara1 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 6 detachedPara1.firstChild 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 7 document 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 8 detachedDiv 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 9 foreignDoc 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 10 foreignPara2 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 11 xmlDoc 
-FAIL setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 13 detachedTextNode 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 14 foreignTextNode 
-FAIL setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 16 detachedProcessingInstruction 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 17 comment 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 18 detachedComment 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 19 docfrag 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 20 doctype 
-PASS setEndBefore() with range 37 [processingInstruction, 0, processingInstruction, 4], node 21 foreignDoctype 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 0 paras[0] 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 3 foreignPara1 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 5 detachedPara1 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 7 document 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 8 detachedDiv 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 9 foreignDoc 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 10 foreignPara2 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 11 xmlDoc 
-FAIL setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 13 detachedTextNode 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 14 foreignTextNode 
-FAIL setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 17 comment 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 18 detachedComment 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 19 docfrag 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 20 doctype 
-PASS setEndAfter() with range 0 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 21 foreignDoctype 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 0 paras[0] 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 3 foreignPara1 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 5 detachedPara1 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 7 document 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 8 detachedDiv 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 9 foreignDoc 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 10 foreignPara2 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 17 comment 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 18 detachedComment 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 19 docfrag 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 20 doctype 
-PASS setEndAfter() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 0 paras[0] 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 3 foreignPara1 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 5 detachedPara1 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 7 document 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 8 detachedDiv 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 9 foreignDoc 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 10 foreignPara2 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 11 xmlDoc 
-FAIL setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 13 detachedTextNode 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 14 foreignTextNode 
-FAIL setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 17 comment 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 18 detachedComment 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 19 docfrag 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 20 doctype 
-PASS setEndAfter() with range 2 [paras[0].firstChild, 2, paras[0].firstChild, 8], node 21 foreignDoctype 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 0 paras[0] 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 3 foreignPara1 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 5 detachedPara1 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 7 document 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 8 detachedDiv 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 9 foreignDoc 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 10 foreignPara2 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 11 xmlDoc 
-FAIL setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 13 detachedTextNode 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 14 foreignTextNode 
-FAIL setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 17 comment 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 18 detachedComment 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 19 docfrag 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 20 doctype 
-PASS setEndAfter() with range 3 [paras[0].firstChild, 2, paras[0].firstChild, 9], node 21 foreignDoctype 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setEndAfter() with range 4 [paras[1].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 0 paras[0] 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 3 foreignPara1 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 5 detachedPara1 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 7 document 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 8 detachedDiv 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 9 foreignDoc 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 10 foreignPara2 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 11 xmlDoc 
-FAIL setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 13 detachedTextNode 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 14 foreignTextNode 
-FAIL setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 17 comment 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 18 detachedComment 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 19 docfrag 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 20 doctype 
-PASS setEndAfter() with range 5 [paras[1].firstChild, 2, paras[1].firstChild, 9], node 21 foreignDoctype 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 0 paras[0] 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 3 foreignPara1 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 5 detachedPara1 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 7 document 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 8 detachedDiv 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 9 foreignDoc 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 10 foreignPara2 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 17 comment 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 18 detachedComment 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 19 docfrag 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 20 doctype 
-PASS setEndAfter() with range 6 [detachedPara1.firstChild, 0, detachedPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 0 paras[0] 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 3 foreignPara1 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 5 detachedPara1 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 7 document 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 8 detachedDiv 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 9 foreignDoc 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 10 foreignPara2 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 17 comment 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 18 detachedComment 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 19 docfrag 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 20 doctype 
-PASS setEndAfter() with range 7 [detachedPara1.firstChild, 2, detachedPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 0 paras[0] 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 3 foreignPara1 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 5 detachedPara1 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 7 document 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 8 detachedDiv 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 9 foreignDoc 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 10 foreignPara2 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 11 xmlDoc 
-FAIL setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 13 detachedTextNode 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 14 foreignTextNode 
-FAIL setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 17 comment 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 18 detachedComment 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 19 docfrag 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 20 doctype 
-PASS setEndAfter() with range 8 [foreignPara1.firstChild, 0, foreignPara1.firstChild, 0], node 21 foreignDoctype 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 0 paras[0] 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 3 foreignPara1 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 5 detachedPara1 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 7 document 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 8 detachedDiv 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 9 foreignDoc 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 10 foreignPara2 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 11 xmlDoc 
-FAIL setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 13 detachedTextNode 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 14 foreignTextNode 
-FAIL setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 17 comment 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 18 detachedComment 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 19 docfrag 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 20 doctype 
-PASS setEndAfter() with range 9 [foreignPara1.firstChild, 2, foreignPara1.firstChild, 8], node 21 foreignDoctype 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 0 paras[0] 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 3 foreignPara1 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 5 detachedPara1 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 7 document 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 8 detachedDiv 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 9 foreignDoc 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 10 foreignPara2 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 17 comment 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 18 detachedComment 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 19 docfrag 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 20 doctype 
-PASS setEndAfter() with range 10 [document.documentElement, 0, document.documentElement, 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 0 paras[0] 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 3 foreignPara1 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 5 detachedPara1 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 7 document 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 8 detachedDiv 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 9 foreignDoc 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 10 foreignPara2 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 11 xmlDoc 
-FAIL setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 13 detachedTextNode 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 17 comment 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 18 detachedComment 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 19 docfrag 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 20 doctype 
-PASS setEndAfter() with range 11 [document.documentElement, 0, document.documentElement, 2], node 21 foreignDoctype 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 0 paras[0] 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 3 foreignPara1 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 5 detachedPara1 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 7 document 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 8 detachedDiv 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 9 foreignDoc 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 10 foreignPara2 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 11 xmlDoc 
-FAIL setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 13 detachedTextNode 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 14 foreignTextNode 
-FAIL setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 17 comment 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 18 detachedComment 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 19 docfrag 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 20 doctype 
-PASS setEndAfter() with range 12 [document.documentElement, 1, document.documentElement, 2], node 21 foreignDoctype 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 0 paras[0] 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 3 foreignPara1 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 5 detachedPara1 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 7 document 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 8 detachedDiv 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 9 foreignDoc 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 10 foreignPara2 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 13 [document.head, 1, document.head, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 13 [document.head, 1, document.head, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 17 comment 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 18 detachedComment 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 19 docfrag 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 20 doctype 
-PASS setEndAfter() with range 13 [document.head, 1, document.head, 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 0 paras[0] 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 3 foreignPara1 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 5 detachedPara1 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 7 document 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 8 detachedDiv 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 9 foreignDoc 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 10 foreignPara2 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 11 xmlDoc 
-FAIL setEndAfter() with range 14 [document.body, 4, document.body, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 13 detachedTextNode 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 14 foreignTextNode 
-FAIL setEndAfter() with range 14 [document.body, 4, document.body, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 17 comment 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 18 detachedComment 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 19 docfrag 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 20 doctype 
-PASS setEndAfter() with range 14 [document.body, 4, document.body, 5], node 21 foreignDoctype 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 0 paras[0] 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 3 foreignPara1 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 5 detachedPara1 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 7 document 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 8 detachedDiv 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 9 foreignDoc 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 10 foreignPara2 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 17 comment 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 18 detachedComment 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 19 docfrag 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 20 doctype 
-PASS setEndAfter() with range 15 [foreignDoc.documentElement, 0, foreignDoc.documentElement, 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 0 paras[0] 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 3 foreignPara1 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 5 detachedPara1 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 7 document 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 8 detachedDiv 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 9 foreignDoc 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 10 foreignPara2 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 17 comment 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 18 detachedComment 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 19 docfrag 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 20 doctype 
-PASS setEndAfter() with range 16 [paras[0], 0, paras[0], 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 0 paras[0] 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 3 foreignPara1 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 5 detachedPara1 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 7 document 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 8 detachedDiv 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 9 foreignDoc 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 10 foreignPara2 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 17 comment 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 18 detachedComment 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 19 docfrag 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 20 doctype 
-PASS setEndAfter() with range 17 [detachedPara1, 0, detachedPara1, 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 0 paras[0] 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 3 foreignPara1 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 5 detachedPara1 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 7 document 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 8 detachedDiv 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 9 foreignDoc 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 10 foreignPara2 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 11 xmlDoc 
-FAIL setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 13 detachedTextNode 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 14 foreignTextNode 
-FAIL setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 17 comment 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 18 detachedComment 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 19 docfrag 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 20 doctype 
-PASS setEndAfter() with range 18 [paras[0].firstChild, 0, paras[1].firstChild, 0], node 21 foreignDoctype 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 0 paras[0] 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 3 foreignPara1 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 5 detachedPara1 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 7 document 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 8 detachedDiv 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 9 foreignDoc 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 10 foreignPara2 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 11 xmlDoc 
-FAIL setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 13 detachedTextNode 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 14 foreignTextNode 
-FAIL setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 17 comment 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 18 detachedComment 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 19 docfrag 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 20 doctype 
-PASS setEndAfter() with range 19 [paras[0].firstChild, 0, paras[1].firstChild, 8], node 21 foreignDoctype 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 0 paras[0] 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 3 foreignPara1 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 5 detachedPara1 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 7 document 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 8 detachedDiv 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 9 foreignDoc 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 10 foreignPara2 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 17 comment 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 18 detachedComment 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 19 docfrag 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 20 doctype 
-PASS setEndAfter() with range 20 [paras[0].firstChild, 3, paras[3], 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 0 paras[0] 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 3 foreignPara1 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 5 detachedPara1 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 7 document 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 8 detachedDiv 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 9 foreignDoc 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 10 foreignPara2 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 11 xmlDoc 
-FAIL setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 13 detachedTextNode 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 14 foreignTextNode 
-FAIL setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 17 comment 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 18 detachedComment 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 19 docfrag 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 20 doctype 
-PASS setEndAfter() with range 21 [paras[0], 0, paras[0].firstChild, 7], node 21 foreignDoctype 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 0 paras[0] 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 3 foreignPara1 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 5 detachedPara1 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 7 document 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 8 detachedDiv 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 9 foreignDoc 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 10 foreignPara2 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 17 comment 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 18 detachedComment 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 19 docfrag 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 20 doctype 
-PASS setEndAfter() with range 22 [testDiv, 2, paras[4], 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 0 paras[0] 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 3 foreignPara1 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 5 detachedPara1 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 7 document 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 8 detachedDiv 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 9 foreignDoc 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 10 foreignPara2 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 23 [document, 0, document, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 23 [document, 0, document, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 17 comment 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 18 detachedComment 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 19 docfrag 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 20 doctype 
-PASS setEndAfter() with range 23 [document, 0, document, 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 0 paras[0] 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 3 foreignPara1 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 5 detachedPara1 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 7 document 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 8 detachedDiv 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 9 foreignDoc 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 10 foreignPara2 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 11 xmlDoc 
-FAIL setEndAfter() with range 24 [document, 0, document, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 13 detachedTextNode 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 14 foreignTextNode 
-FAIL setEndAfter() with range 24 [document, 0, document, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 17 comment 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 18 detachedComment 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 19 docfrag 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 20 doctype 
-PASS setEndAfter() with range 24 [document, 0, document, 2], node 21 foreignDoctype 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 0 paras[0] 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 3 foreignPara1 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 5 detachedPara1 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 7 document 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 8 detachedDiv 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 9 foreignDoc 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 10 foreignPara2 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 11 xmlDoc 
-FAIL setEndAfter() with range 25 [comment, 2, comment, 3], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 13 detachedTextNode 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 14 foreignTextNode 
-FAIL setEndAfter() with range 25 [comment, 2, comment, 3], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 17 comment 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 18 detachedComment 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 19 docfrag 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 20 doctype 
-PASS setEndAfter() with range 25 [comment, 2, comment, 3], node 21 foreignDoctype 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 0 paras[0] 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 3 foreignPara1 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 5 detachedPara1 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 7 document 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 8 detachedDiv 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 9 foreignDoc 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 10 foreignPara2 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 11 xmlDoc 
-FAIL setEndAfter() with range 26 [testDiv, 0, comment, 5], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 13 detachedTextNode 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 14 foreignTextNode 
-FAIL setEndAfter() with range 26 [testDiv, 0, comment, 5], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 17 comment 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 18 detachedComment 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 19 docfrag 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 20 doctype 
-PASS setEndAfter() with range 26 [testDiv, 0, comment, 5], node 21 foreignDoctype 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 0 paras[0] 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 3 foreignPara1 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 5 detachedPara1 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 7 document 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 8 detachedDiv 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 9 foreignDoc 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 10 foreignPara2 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 11 xmlDoc 
-FAIL setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 13 detachedTextNode 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 14 foreignTextNode 
-FAIL setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 17 comment 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 18 detachedComment 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 19 docfrag 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 20 doctype 
-PASS setEndAfter() with range 27 [foreignDoc, 1, foreignComment, 2], node 21 foreignDoctype 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 0 paras[0] 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 3 foreignPara1 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 5 detachedPara1 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 7 document 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 8 detachedDiv 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 9 foreignDoc 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 10 foreignPara2 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 11 xmlDoc 
-FAIL setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 13 detachedTextNode 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 14 foreignTextNode 
-FAIL setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 17 comment 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 18 detachedComment 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 19 docfrag 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 20 doctype 
-PASS setEndAfter() with range 28 [foreignDoc.body, 0, foreignTextNode, 36], node 21 foreignDoctype 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 0 paras[0] 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 3 foreignPara1 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 5 detachedPara1 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 7 document 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 8 detachedDiv 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 9 foreignDoc 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 10 foreignPara2 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 11 xmlDoc 
-FAIL setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 13 detachedTextNode 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 14 foreignTextNode 
-FAIL setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 17 comment 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 18 detachedComment 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 19 docfrag 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 20 doctype 
-PASS setEndAfter() with range 29 [xmlDoc, 1, xmlComment, 0], node 21 foreignDoctype 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 0 paras[0] 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 3 foreignPara1 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 5 detachedPara1 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 7 document 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 8 detachedDiv 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 9 foreignDoc 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 10 foreignPara2 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 11 xmlDoc 
-FAIL setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 13 detachedTextNode 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 14 foreignTextNode 
-FAIL setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 17 comment 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 18 detachedComment 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 19 docfrag 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 20 doctype 
-PASS setEndAfter() with range 30 [detachedTextNode, 0, detachedTextNode, 8], node 21 foreignDoctype 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 0 paras[0] 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 3 foreignPara1 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 5 detachedPara1 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 7 document 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 8 detachedDiv 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 9 foreignDoc 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 10 foreignPara2 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 11 xmlDoc 
-FAIL setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 13 detachedTextNode 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 14 foreignTextNode 
-FAIL setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 17 comment 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 18 detachedComment 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 19 docfrag 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 20 doctype 
-PASS setEndAfter() with range 31 [detachedForeignTextNode, 0, detachedForeignTextNode, 8], node 21 foreignDoctype 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 0 paras[0] 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 3 foreignPara1 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 5 detachedPara1 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 7 document 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 8 detachedDiv 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 9 foreignDoc 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 10 foreignPara2 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 11 xmlDoc 
-FAIL setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 13 detachedTextNode 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 14 foreignTextNode 
-FAIL setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 17 comment 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 18 detachedComment 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 19 docfrag 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 20 doctype 
-PASS setEndAfter() with range 32 [detachedXmlTextNode, 0, detachedXmlTextNode, 8], node 21 foreignDoctype 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 0 paras[0] 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 3 foreignPara1 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 5 detachedPara1 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 7 document 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 8 detachedDiv 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 9 foreignDoc 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 10 foreignPara2 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 11 xmlDoc 
-FAIL setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 13 detachedTextNode 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 14 foreignTextNode 
-FAIL setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 17 comment 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 18 detachedComment 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 19 docfrag 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 20 doctype 
-PASS setEndAfter() with range 33 [detachedComment, 3, detachedComment, 4], node 21 foreignDoctype 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 0 paras[0] 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 3 foreignPara1 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 5 detachedPara1 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 7 document 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 8 detachedDiv 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 9 foreignDoc 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 10 foreignPara2 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 11 xmlDoc 
-FAIL setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 13 detachedTextNode 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 14 foreignTextNode 
-FAIL setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 17 comment 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 18 detachedComment 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 19 docfrag 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 20 doctype 
-PASS setEndAfter() with range 34 [detachedForeignComment, 0, detachedForeignComment, 1], node 21 foreignDoctype 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 0 paras[0] 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 3 foreignPara1 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 5 detachedPara1 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 7 document 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 8 detachedDiv 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 9 foreignDoc 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 10 foreignPara2 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 11 xmlDoc 
-FAIL setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 13 detachedTextNode 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 14 foreignTextNode 
-FAIL setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 17 comment 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 18 detachedComment 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 19 docfrag 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 20 doctype 
-PASS setEndAfter() with range 35 [detachedXmlComment, 2, detachedXmlComment, 6], node 21 foreignDoctype 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 0 paras[0] 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 3 foreignPara1 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 5 detachedPara1 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 7 document 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 8 detachedDiv 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 9 foreignDoc 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 10 foreignPara2 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 11 xmlDoc 
-FAIL setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 13 detachedTextNode 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 14 foreignTextNode 
-FAIL setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 17 comment 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 18 detachedComment 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 19 docfrag 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 20 doctype 
-PASS setEndAfter() with range 36 [docfrag, 0, docfrag, 0], node 21 foreignDoctype 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 0 paras[0] 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 1 paras[0].firstChild 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 2 paras[1].firstChild 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 3 foreignPara1 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 4 foreignPara1.firstChild 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 5 detachedPara1 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 6 detachedPara1.firstChild 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 7 document 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 8 detachedDiv 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 9 foreignDoc 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 10 foreignPara2 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 11 xmlDoc 
-FAIL setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 12 xmlElement Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 13 detachedTextNode 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 14 foreignTextNode 
-FAIL setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 15 processingInstruction Failed to execute 'comparePoint' on 'Range': The node provided is not in an active document.
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 16 detachedProcessingInstruction 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 17 comment 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 18 detachedComment 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 19 docfrag 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 20 doctype 
-PASS setEndAfter() with range 37 [processingInstruction, 0, processingInstruction, 4], node 21 foreignDoctype 
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/inspector/components/parsed-url-expected.txt b/third_party/WebKit/LayoutTests/inspector/components/parsed-url-expected.txt
index 8990ad4..99f83240 100644
--- a/third_party/WebKit/LayoutTests/inspector/components/parsed-url-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector/components/parsed-url-expected.txt
@@ -5,7 +5,7 @@
   scheme: http
   host: example.com
   port: undefined
-  path: /?queryParam1=value1&queryParam2=value2
+  path: /
   queryParams: queryParam1=value1&queryParam2=value2
   fragment: fragmentWith/Many//Slashes
   folderPathComponents: 
@@ -16,7 +16,7 @@
   scheme: http
   host: example.com
   port: undefined
-  path: /foo.html?queryParam1=value1&queryParam2=value2
+  path: /foo.html
   queryParams: queryParam1=value1&queryParam2=value2
   fragment: fragmentWith/Many//Slashes
   folderPathComponents: 
@@ -27,7 +27,7 @@
   scheme: http
   host: example.com
   port: undefined
-  path: /foo/bar.html?queryParam1=value1&queryParam2=value2
+  path: /foo/bar.html
   queryParams: queryParam1=value1&queryParam2=value2
   fragment: fragmentWith/Many//Slashes
   folderPathComponents: /foo
@@ -38,7 +38,7 @@
   scheme: http
   host: example.com
   port: undefined
-  path: /foo/bar/baz.html?queryParam1=value1&queryParam2=value2
+  path: /foo/bar/baz.html
   queryParams: queryParam1=value1&queryParam2=value2
   fragment: fragmentWith/Many//Slashes
   folderPathComponents: /foo/bar
@@ -49,7 +49,7 @@
   scheme: http
   host: example.com
   port: undefined
-  path: //?queryParam1=value1
+  path: //
   queryParams: queryParam1=value1
   fragment: undefined
   folderPathComponents: /
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-url-linkify.html b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-url-linkify.html
index 52ff3d4..76b48bd 100644
--- a/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-url-linkify.html
+++ b/third_party/WebKit/LayoutTests/inspector/elements/styles-4/styles-url-linkify.html
@@ -37,7 +37,7 @@
     completeURL("https://example.com/foo", dataURL);
     completeURL("http://example.com/foo", "javascript:alert('foo');");
     completeURL("http://example.com/foo", blobURL);
-    InspectorTest.addResult(WebInspector.ParsedURL.completeURL(blobURL));
+    completeURL("", blobURL);
 
     function dumpHref(dumpLinkClass)
     {
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-hide-on-click-panel.html b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-hide-on-click-panel.html
new file mode 100644
index 0000000..241962a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/video-controls-overflow-menu-hide-on-click-panel.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<title>Ensure overflow menu buttons are visible when expected.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-controls.js"></script>
+<script src="media-file.js"></script>
+<script src="overflow-menu.js"></script>
+
+<!--Padding ensures the overflow menu is visible for the tests. -->
+<body style="padding-top: 200px; padding-left: 100px">
+<video controls></video>
+<script>
+async_test(function(t) {
+  // Set up video
+  var video = document.querySelector("video");
+  video.src = findMediaFile("video", "content/test");
+  video.setAttribute("width", "200");
+  // Add captions
+  var track = video.addTextTrack("captions");
+  // Pretend we have a cast device
+  internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true);
+
+  video.onloadeddata = t.step_func_done(function() {
+    var playButton = mediaControlsButton(video, "play-button");
+    var overflowList = getOverflowList(video);
+    var overflowMenu = getOverflowMenuButton(video);
+
+    // Clicking on the overflow menu button should make the overflow list visible
+    var coords = elementCoordinates(overflowMenu);
+    clickAtCoordinates(coords[0], coords[1]);
+    assert_not_equals(getComputedStyle(overflowList).display, "none");
+
+    // Click on an overflow menu item should close overflow list.
+    var coords = elementCoordinates(playButton);
+    clickAtCoordinates(coords[0], coords[1]);
+    assert_equals(getComputedStyle(overflowList).display, "none");
+  });
+});
+</script>
+</body>
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/images/image-click-scale-restore-zoomed-image-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/images/image-click-scale-restore-zoomed-image-expected.txt
new file mode 100644
index 0000000..0841d041
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/images/image-click-scale-restore-zoomed-image-expected.txt
@@ -0,0 +1,7 @@
+This tests that on a zoomed page, click to scale up / down works fine. This test requires testRunner to run. To test manually, open this image in a browser window, resize the window to 100px tall and zoom out and click on the image to scale it up.
+
+Size at zoomed in level : 77 x 100
+Size at zoomed level after scale up click 1 : 500 x 644
+Size at zoomed out level after click 2 (Image restored): 77 x 100
+Size at zoomed level after scale up click 3 : 500 x 644
+
diff --git a/third_party/WebKit/LayoutTests/platform/android/http/tests/security/contentSecurityPolicy/image-document-default-src-none-expected.txt b/third_party/WebKit/LayoutTests/platform/android/http/tests/security/contentSecurityPolicy/image-document-default-src-none-expected.txt
new file mode 100644
index 0000000..8e98ff2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/http/tests/security/contentSecurityPolicy/image-document-default-src-none-expected.txt
@@ -0,0 +1,5 @@
+CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-H/s/dWGkGDaCkKqmo0VNeHrTgvJjinI5uvu7UmY6EB8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
+
+CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-15TqmL1cbLqMXH1nK4EwD191NLSXxlbnYzFAfbG/xp8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
+
+Ensure that we don't crash when loading an ImageDocument that sets CSP headers 
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
index 126ffc0..6438b9b8 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
index 126ffc0..6438b9b8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
index 360a320..c9196ffd 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/fast/images/exif-orientation-height-image-document-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/svg/custom/anchor-on-use-expected.svg b/third_party/WebKit/LayoutTests/svg/custom/anchor-on-use-expected.svg
index e8c285d..360097c 100644
--- a/third_party/WebKit/LayoutTests/svg/custom/anchor-on-use-expected.svg
+++ b/third_party/WebKit/LayoutTests/svg/custom/anchor-on-use-expected.svg
@@ -1,4 +1,4 @@
 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-    <image x="0" y="0" width="503" height="410" xlink:href="resources/green-checker.png"/>
+    <image x="149" y="95" width="503" height="410" xlink:href="resources/green-checker.png"/>
 </svg>
 
diff --git a/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/fast/images/image-zoom-to-25-expected.txt b/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/fast/images/image-zoom-to-25-expected.txt
index 6af96342..08fc5f1 100644
--- a/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/fast/images/image-zoom-to-25-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/gpu-rasterization/fast/images/image-zoom-to-25-expected.txt
@@ -1,9 +1,9 @@
 This tests that page zoom and image auto-sizing interact well together. This test requires testRunner to run. To test manually, open this image in a browser window, resize the window to 200px tall and zoom out 6 times. The image should get smaller at each step.
 
-Size at zoom level0 : 200 x 150
-Size at zoom level1 : 200 x 150
-Size at zoom level2 : 200 x 150
+Size at zoom level0 : 199 x 150
+Size at zoom level1 : 199 x 150
+Size at zoom level2 : 200 x 149
 Size at zoom level3 : 199 x 149
 Size at zoom level4 : 199 x 149
-Size at zoom level5 : 200 x 149
+Size at zoom level5 : 197 x 149
 
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
index 5c55e47..2fbda10 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -5156,6 +5156,7 @@
     attribute @@toStringTag
     getter blockedURI
     getter columnNumber
+    getter disposition
     getter documentURI
     getter effectiveDirective
     getter lineNumber
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index 107b4ec..00b37ad 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -989,8 +989,8 @@
     method invertSelf
     method multiplySelf
     method preMultiplySelf
+    method rotateAxisAngleSelf
     method scale3dSelf
-    method scaleNonUniformSelf
     method scaleSelf
     method skewXSelf
     method skewYSelf
@@ -1051,9 +1051,9 @@
     method flipY
     method inverse
     method multiply
+    method rotateAxisAngle
     method scale
     method scale3d
-    method scaleNonUniform
     method skewX
     method skewY
     method toFloat32Array
@@ -3882,6 +3882,7 @@
     getter current
     getter max
     getter min
+    getter step
     method constructor
 interface MediaSource : EventTarget
     static method isTypeSupported
@@ -6032,6 +6033,7 @@
     attribute @@toStringTag
     getter blockedURI
     getter columnNumber
+    getter disposition
     getter documentURI
     getter effectiveDirective
     getter lineNumber
diff --git a/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp b/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp
index 0874a35..e1f3d7f 100644
--- a/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp
+++ b/third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp
@@ -52,17 +52,22 @@
 
 float CSSToLengthConversionData::FontSizes::ex() const {
   ASSERT(m_font);
+  const SimpleFontData* fontData = m_font->primaryFont();
+  DCHECK(fontData);
+
   // FIXME: We have a bug right now where the zoom will be applied twice to EX
   // units. We really need to compute EX using fontMetrics for the original
   // specifiedSize and not use our actual constructed layoutObject font.
-  if (!m_font->getFontMetrics().hasXHeight())
+  if (!fontData || !fontData->getFontMetrics().hasXHeight())
     return m_em / 2.0f;
-  return m_font->getFontMetrics().xHeight();
+  return fontData->getFontMetrics().xHeight();
 }
 
 float CSSToLengthConversionData::FontSizes::ch() const {
-  ASSERT(m_font);
-  return m_font->getFontMetrics().zeroWidth();
+  DCHECK(m_font);
+  const SimpleFontData* fontData = m_font->primaryFont();
+  DCHECK(fontData);
+  return fontData ? fontData->getFontMetrics().zeroWidth() : 0;
 }
 
 CSSToLengthConversionData::ViewportSize::ViewportSize(
diff --git a/third_party/WebKit/Source/core/css/resolver/FontBuilder.cpp b/third_party/WebKit/Source/core/css/resolver/FontBuilder.cpp
index 958592f..79ce1e4 100644
--- a/third_party/WebKit/Source/core/css/resolver/FontBuilder.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/FontBuilder.cpp
@@ -319,11 +319,14 @@
 
   Font font(fontDescription);
   font.update(fontSelector);
-  if (!font.getFontMetrics().hasXHeight())
+
+  const SimpleFontData* fontData = font.primaryFont();
+
+  if (!fontData || !fontData->getFontMetrics().hasXHeight())
     return;
 
   const float sizeAdjust = fontDescription.sizeAdjust();
-  float aspectValue = font.getFontMetrics().xHeight() / specifiedSize;
+  float aspectValue = fontData->getFontMetrics().xHeight() / specifiedSize;
   float adjustedSize = (sizeAdjust / aspectValue) * specifiedSize;
   adjustedSize = getComputedSizeFromSpecifiedSize(
       fontDescription, style.effectiveZoom(), adjustedSize);
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
index 45e234d..eed0a17 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMMatrix.cpp
@@ -125,23 +125,16 @@
   return this;
 }
 
-DOMMatrix* DOMMatrix::scaleSelf(double scale, double ox, double oy) {
-  return scaleNonUniformSelf(scale, scale, 1, ox, oy);
+DOMMatrix* DOMMatrix::scaleSelf(double sx) {
+  return scaleSelf(sx, sx);
 }
 
-DOMMatrix* DOMMatrix::scale3dSelf(double scale,
-                                  double ox,
-                                  double oy,
-                                  double oz) {
-  return scaleNonUniformSelf(scale, scale, scale, ox, oy, oz);
-}
-
-DOMMatrix* DOMMatrix::scaleNonUniformSelf(double sx,
-                                          double sy,
-                                          double sz,
-                                          double ox,
-                                          double oy,
-                                          double oz) {
+DOMMatrix* DOMMatrix::scaleSelf(double sx,
+                                double sy,
+                                double sz,
+                                double ox,
+                                double oy,
+                                double oz) {
   if (sz != 1 || oz)
     m_is2D = false;
 
@@ -164,6 +157,25 @@
   return this;
 }
 
+DOMMatrix* DOMMatrix::scale3dSelf(double scale,
+                                  double ox,
+                                  double oy,
+                                  double oz) {
+  return scaleSelf(scale, scale, scale, ox, oy, oz);
+}
+
+DOMMatrix* DOMMatrix::rotateAxisAngleSelf(double x,
+                                          double y,
+                                          double z,
+                                          double angle) {
+  m_matrix->rotate3d(x, y, z, angle);
+
+  if (x != 0 || y != 0)
+    m_is2D = false;
+
+  return this;
+}
+
 DOMMatrix* DOMMatrix::skewXSelf(double sx) {
   m_matrix->skewX(sx);
   return this;
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrix.h b/third_party/WebKit/Source/core/dom/DOMMatrix.h
index efb2750..782d3ae 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrix.h
+++ b/third_party/WebKit/Source/core/dom/DOMMatrix.h
@@ -81,17 +81,21 @@
   DOMMatrix* multiplySelf(DOMMatrixInit&, ExceptionState&);
   DOMMatrix* preMultiplySelf(DOMMatrixInit&, ExceptionState&);
   DOMMatrix* translateSelf(double tx, double ty, double tz = 0);
-  DOMMatrix* scaleSelf(double scale, double ox = 0, double oy = 0);
+  DOMMatrix* scaleSelf(double sx = 1);
+  DOMMatrix* scaleSelf(double sx,
+                       double sy,
+                       double sz = 1,
+                       double ox = 0,
+                       double oy = 0,
+                       double oz = 0);
   DOMMatrix* scale3dSelf(double scale,
                          double ox = 0,
                          double oy = 0,
                          double oz = 0);
-  DOMMatrix* scaleNonUniformSelf(double sx,
-                                 double sy = 1,
-                                 double sz = 1,
-                                 double ox = 0,
-                                 double oy = 0,
-                                 double oz = 0);
+  DOMMatrix* rotateAxisAngleSelf(double x = 0,
+                                 double y = 0,
+                                 double z = 0,
+                                 double angle = 0);
   DOMMatrix* skewXSelf(double sx = 0);
   DOMMatrix* skewYSelf(double sy = 0);
   DOMMatrix* invertSelf();
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrix.idl b/third_party/WebKit/Source/core/dom/DOMMatrix.idl
index 128831e5..37465d2 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrix.idl
+++ b/third_party/WebKit/Source/core/dom/DOMMatrix.idl
@@ -53,19 +53,20 @@
     DOMMatrix translateSelf(unrestricted double tx,
                             unrestricted double ty,
                             optional unrestricted double tz = 0);
-    DOMMatrix scaleSelf(unrestricted double scale,
+    DOMMatrix scaleSelf(optional unrestricted double scaleX = 1,
+                        optional unrestricted double scaleY,
+                        optional unrestricted double scaleZ = 1,
                         optional unrestricted double originX = 0,
-                        optional unrestricted double originY = 0);
+                        optional unrestricted double originY = 0,
+                        optional unrestricted double originZ = 0);
     DOMMatrix scale3dSelf(unrestricted double scale,
                           optional unrestricted double originX = 0,
                           optional unrestricted double originY = 0,
                           optional unrestricted double originZ = 0);
-    DOMMatrix scaleNonUniformSelf(unrestricted double scaleX,
-                                  optional unrestricted double scaleY = 1,
-                                  optional unrestricted double scaleZ = 1,
-                                  optional unrestricted double originX = 0,
-                                  optional unrestricted double originY = 0,
-                                  optional unrestricted double originZ = 0);
+    DOMMatrix rotateAxisAngleSelf(optional unrestricted double x = 0,
+                                  optional unrestricted double y = 0,
+                                  optional unrestricted double z = 0,
+                                  optional unrestricted double angle = 0);
     DOMMatrix skewXSelf(optional unrestricted double sx = 0);
     DOMMatrix skewYSelf(optional unrestricted double sy = 0);
     DOMMatrix invertSelf();
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
index 79c08a3d..7cf081e 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.cpp
@@ -153,8 +153,17 @@
   return DOMMatrix::create(this)->translateSelf(tx, ty, tz);
 }
 
-DOMMatrix* DOMMatrixReadOnly::scale(double scale, double ox, double oy) {
-  return DOMMatrix::create(this)->scaleSelf(scale, ox, oy);
+DOMMatrix* DOMMatrixReadOnly::scale(double sx) {
+  return scale(sx, sx);
+}
+
+DOMMatrix* DOMMatrixReadOnly::scale(double sx,
+                                    double sy,
+                                    double sz,
+                                    double ox,
+                                    double oy,
+                                    double oz) {
+  return DOMMatrix::create(this)->scaleSelf(sx, sy, sz, ox, oy, oz);
 }
 
 DOMMatrix* DOMMatrixReadOnly::scale3d(double scale,
@@ -164,13 +173,11 @@
   return DOMMatrix::create(this)->scale3dSelf(scale, ox, oy, oz);
 }
 
-DOMMatrix* DOMMatrixReadOnly::scaleNonUniform(double sx,
-                                              double sy,
-                                              double sz,
-                                              double ox,
-                                              double oy,
-                                              double oz) {
-  return DOMMatrix::create(this)->scaleNonUniformSelf(sx, sy, sz, ox, oy, oz);
+DOMMatrix* DOMMatrixReadOnly::rotateAxisAngle(double x,
+                                              double y,
+                                              double z,
+                                              double angle) {
+  return DOMMatrix::create(this)->rotateAxisAngleSelf(x, y, z, angle);
 }
 
 DOMMatrix* DOMMatrixReadOnly::skewX(double sx) {
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h
index 914641b..77a0c680 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h
+++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.h
@@ -58,14 +58,18 @@
 
   DOMMatrix* multiply(DOMMatrixInit&, ExceptionState&);
   DOMMatrix* translate(double tx, double ty, double tz = 0);
-  DOMMatrix* scale(double scale, double ox = 0, double oy = 0);
+  DOMMatrix* scale(double sx = 1);
+  DOMMatrix* scale(double sx,
+                   double sy,
+                   double sz = 1,
+                   double ox = 0,
+                   double oy = 0,
+                   double oz = 0);
   DOMMatrix* scale3d(double scale, double ox = 0, double oy = 0, double oz = 0);
-  DOMMatrix* scaleNonUniform(double sx,
-                             double sy = 1,
-                             double sz = 1,
-                             double ox = 0,
-                             double oy = 0,
-                             double oz = 0);
+  DOMMatrix* rotateAxisAngle(double x = 0,
+                             double y = 0,
+                             double z = 0,
+                             double angle = 0);
   DOMMatrix* skewX(double sx);
   DOMMatrix* skewY(double sy);
   DOMMatrix* flipX();
diff --git a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.idl b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.idl
index 472fa33b..622ff0d 100644
--- a/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.idl
+++ b/third_party/WebKit/Source/core/dom/DOMMatrixReadOnly.idl
@@ -51,19 +51,20 @@
     DOMMatrix translate(unrestricted double tx,
                         unrestricted double ty,
                         optional unrestricted double tz = 0);
-    DOMMatrix scale(unrestricted double scale,
+    DOMMatrix scale(optional unrestricted double scaleX = 1,
+                    optional unrestricted double scaleY,
+                    optional unrestricted double scaleZ = 1,
                     optional unrestricted double originX = 0,
-                    optional unrestricted double originY = 0);
+                    optional unrestricted double originY = 0,
+                    optional unrestricted double originZ = 0);
     DOMMatrix scale3d(unrestricted double scale,
                       optional unrestricted double originX = 0,
                       optional unrestricted double originY = 0,
                       optional unrestricted double originZ = 0);
-    DOMMatrix scaleNonUniform(unrestricted double scaleX,
-                              optional unrestricted double scaleY = 1,
-                              optional unrestricted double scaleZn = 1,
-                              optional unrestricted double originX = 0,
-                              optional unrestricted double originY = 0,
-                              optional unrestricted double originZ = 0);
+    DOMMatrix rotateAxisAngle(optional unrestricted double x = 0,
+                              optional unrestricted double y = 0,
+                              optional unrestricted double z = 0,
+                              optional unrestricted double angle = 0);
     DOMMatrix skewX(optional unrestricted double sx = 0);
     DOMMatrix skewY(optional unrestricted double sy = 0);
     [RaisesException] DOMMatrix multiply(optional DOMMatrixInit other);
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 1d02cf51..11f5f61 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1255,8 +1255,7 @@
 }
 
 ComputedStyle* Document::getNonAttachedStyle(Element& element) {
-  RefPtr<ComputedStyle> style = m_nonAttachedStyle.get(&element);
-  return style.get();
+  return m_nonAttachedStyle.get(&element);
 }
 
 /*
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 047e339..7a6688b 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1343,9 +1343,7 @@
     ++i;
   } while (i < length);
 
-  if (i == length && length == 1)
-    return ClassStringContent::Empty;
-  if (i == length && length > 1)
+  if (i == length && length >= 1)
     return ClassStringContent::WhiteSpaceOnly;
 
   return ClassStringContent::HasClasses;
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h
index 9235d629..d793015 100644
--- a/third_party/WebKit/Source/core/dom/ElementRareData.h
+++ b/third_party/WebKit/Source/core/dom/ElementRareData.h
@@ -83,14 +83,17 @@
   void clearShadow() { m_shadow = nullptr; }
   ElementShadow* shadow() const { return m_shadow.get(); }
   ElementShadow& ensureShadow() {
-    if (!m_shadow)
+    if (!m_shadow) {
       m_shadow = ElementShadow::create();
+      ScriptWrappableVisitor::writeBarrier(this, m_shadow);
+    }
     return *m_shadow;
   }
 
   NamedNodeMap* attributeMap() const { return m_attributeMap.get(); }
   void setAttributeMap(NamedNodeMap* attributeMap) {
     m_attributeMap = attributeMap;
+    ScriptWrappableVisitor::writeBarrier(this, m_attributeMap);
   }
 
   ComputedStyle* computedStyle() const { return m_computedStyle.get(); }
@@ -100,7 +103,10 @@
   void clearComputedStyle() { m_computedStyle = nullptr; }
 
   ClassList* classList() const { return m_classList.get(); }
-  void setClassList(ClassList* classList) { m_classList = classList; }
+  void setClassList(ClassList* classList) {
+    m_classList = classList;
+    ScriptWrappableVisitor::writeBarrier(this, m_classList);
+  }
   void clearClassListValueForQuirksMode() {
     if (!m_classList)
       return;
@@ -108,7 +114,10 @@
   }
 
   DatasetDOMStringMap* dataset() const { return m_dataset.get(); }
-  void setDataset(DatasetDOMStringMap* dataset) { m_dataset = dataset; }
+  void setDataset(DatasetDOMStringMap* dataset) {
+    m_dataset = dataset;
+    ScriptWrappableVisitor::writeBarrier(this, m_dataset);
+  }
 
   LayoutSize minimumSizeForResizing() const { return m_minimumSizeForResizing; }
   void setMinimumSizeForResizing(LayoutSize size) {
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index e7766f1..fdc2090 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -1303,7 +1303,7 @@
       // See crbug.com/352836 also.
       // No need to do anything if the text is identical.
       if (container->hasOneTextChild() &&
-          toText(container->firstChild())->data() == text)
+          toText(container->firstChild())->data() == text && !text.isEmpty())
         return;
 
       ChildListMutationScope mutation(*this);
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
index 0854ba2..3681b8a9f 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -26,6 +26,7 @@
 
 #include "core/editing/InputMethodController.h"
 
+#include "core/InputTypeNames.h"
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
 #include "core/dom/Text.h"
@@ -35,6 +36,7 @@
 #include "core/editing/markers/DocumentMarkerController.h"
 #include "core/events/CompositionEvent.h"
 #include "core/frame/LocalFrame.h"
+#include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLTextAreaElement.h"
 #include "core/input/EventHandler.h"
 #include "core/layout/LayoutObject.h"
@@ -931,6 +933,203 @@
   setSelectionOffsets(PlainTextRange(selectionStart, selectionEnd));
 }
 
+WebTextInputInfo InputMethodController::textInputInfo() const {
+  WebTextInputInfo info;
+  if (!frame().document())
+    return info;
+
+  if (!frame().selection().isAvailable()) {
+    // plugins/mouse-capture-inside-shadow.html reaches here.
+    return info;
+  }
+  Element* element = frame().selection().rootEditableElement();
+  if (!element)
+    return info;
+
+  info.inputMode = inputModeOfFocusedElement();
+  info.type = textInputType();
+  info.flags = textInputFlags();
+  if (info.type == WebTextInputTypeNone)
+    return info;
+
+  if (!frame().editor().canEdit())
+    return info;
+
+  // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets
+  // needs to be audited.  see http://crbug.com/590369 for more details.
+  frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+  DocumentLifecycle::DisallowTransitionScope disallowTransition(
+      frame().document()->lifecycle());
+
+  // Emits an object replacement character for each replaced element so that
+  // it is exposed to IME and thus could be deleted by IME on android.
+  info.value = plainText(EphemeralRange::rangeOfContents(*element),
+                         TextIteratorEmitsObjectReplacementCharacter);
+
+  if (info.value.isEmpty())
+    return info;
+
+  EphemeralRange firstRange =
+      firstEphemeralRangeOf(frame().selection().selection());
+  if (firstRange.isNotNull()) {
+    PlainTextRange plainTextRange(PlainTextRange::create(*element, firstRange));
+    if (plainTextRange.isNotNull()) {
+      info.selectionStart = plainTextRange.start();
+      info.selectionEnd = plainTextRange.end();
+    }
+  }
+
+  EphemeralRange range = compositionEphemeralRange();
+  if (range.isNotNull()) {
+    PlainTextRange plainTextRange(PlainTextRange::create(*element, range));
+    if (plainTextRange.isNotNull()) {
+      info.compositionStart = plainTextRange.start();
+      info.compositionEnd = plainTextRange.end();
+    }
+  }
+
+  return info;
+}
+
+int InputMethodController::textInputFlags() const {
+  Element* element = frame().document()->focusedElement();
+  if (!element)
+    return WebTextInputFlagNone;
+
+  int flags = 0;
+
+  const AtomicString& autocomplete =
+      element->getAttribute(HTMLNames::autocompleteAttr);
+  if (autocomplete == "on")
+    flags |= WebTextInputFlagAutocompleteOn;
+  else if (autocomplete == "off")
+    flags |= WebTextInputFlagAutocompleteOff;
+
+  const AtomicString& autocorrect =
+      element->getAttribute(HTMLNames::autocorrectAttr);
+  if (autocorrect == "on")
+    flags |= WebTextInputFlagAutocorrectOn;
+  else if (autocorrect == "off")
+    flags |= WebTextInputFlagAutocorrectOff;
+
+  SpellcheckAttributeState spellcheck = element->spellcheckAttributeState();
+  if (spellcheck == SpellcheckAttributeTrue)
+    flags |= WebTextInputFlagSpellcheckOn;
+  else if (spellcheck == SpellcheckAttributeFalse)
+    flags |= WebTextInputFlagSpellcheckOff;
+
+  if (isHTMLTextFormControlElement(element)) {
+    HTMLTextFormControlElement* formElement =
+        static_cast<HTMLTextFormControlElement*>(element);
+    if (formElement->supportsAutocapitalize()) {
+      DEFINE_STATIC_LOCAL(const AtomicString, none, ("none"));
+      DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters"));
+      DEFINE_STATIC_LOCAL(const AtomicString, words, ("words"));
+      DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences"));
+
+      const AtomicString& autocapitalize = formElement->autocapitalize();
+      if (autocapitalize == none)
+        flags |= WebTextInputFlagAutocapitalizeNone;
+      else if (autocapitalize == characters)
+        flags |= WebTextInputFlagAutocapitalizeCharacters;
+      else if (autocapitalize == words)
+        flags |= WebTextInputFlagAutocapitalizeWords;
+      else if (autocapitalize == sentences)
+        flags |= WebTextInputFlagAutocapitalizeSentences;
+      else
+        NOTREACHED();
+    }
+  }
+
+  return flags;
+}
+
+String InputMethodController::inputModeOfFocusedElement() const {
+  if (!RuntimeEnabledFeatures::inputModeAttributeEnabled())
+    return String();
+
+  Element* element = frame().document()->focusedElement();
+  if (!element)
+    return String();
+
+  if (isHTMLInputElement(*element)) {
+    const HTMLInputElement& input = toHTMLInputElement(*element);
+    if (input.supportsInputModeAttribute())
+      return input.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
+    return String();
+  }
+  if (isHTMLTextAreaElement(*element)) {
+    const HTMLTextAreaElement& textarea = toHTMLTextAreaElement(*element);
+    return textarea.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
+  }
+
+  return String();
+}
+
+WebTextInputType InputMethodController::textInputType() const {
+  if (!frame().selection().isAvailable()) {
+    // "mouse-capture-inside-shadow.html" reaches here.
+    return WebTextInputTypeNone;
+  }
+
+  // It's important to preserve the equivalence of textInputInfo().type and
+  // textInputType(), so perform the same rootEditableElement() existence check
+  // here for consistency.
+  if (!frame().selection().selection().rootEditableElement())
+    return WebTextInputTypeNone;
+
+  Document* document = frame().document();
+  if (!document)
+    return WebTextInputTypeNone;
+
+  Element* element = document->focusedElement();
+  if (!element)
+    return WebTextInputTypeNone;
+
+  if (isHTMLInputElement(*element)) {
+    HTMLInputElement& input = toHTMLInputElement(*element);
+    const AtomicString& type = input.type();
+
+    if (input.isDisabledOrReadOnly())
+      return WebTextInputTypeNone;
+
+    if (type == InputTypeNames::password)
+      return WebTextInputTypePassword;
+    if (type == InputTypeNames::search)
+      return WebTextInputTypeSearch;
+    if (type == InputTypeNames::email)
+      return WebTextInputTypeEmail;
+    if (type == InputTypeNames::number)
+      return WebTextInputTypeNumber;
+    if (type == InputTypeNames::tel)
+      return WebTextInputTypeTelephone;
+    if (type == InputTypeNames::url)
+      return WebTextInputTypeURL;
+    if (type == InputTypeNames::text)
+      return WebTextInputTypeText;
+
+    return WebTextInputTypeNone;
+  }
+
+  if (isHTMLTextAreaElement(*element)) {
+    if (toHTMLTextAreaElement(*element).isDisabledOrReadOnly())
+      return WebTextInputTypeNone;
+    return WebTextInputTypeTextArea;
+  }
+
+  if (element->isHTMLElement()) {
+    if (toHTMLElement(element)->isDateTimeFieldElement())
+      return WebTextInputTypeDateTimeField;
+  }
+
+  document->updateStyleAndLayoutTree();
+  if (hasEditableStyle(*element))
+    return WebTextInputTypeContentEditable;
+
+  return WebTextInputTypeNone;
+}
+
 DEFINE_TRACE(InputMethodController) {
   visitor->trace(m_frame);
   visitor->trace(m_compositionRange);
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.h b/third_party/WebKit/Source/core/editing/InputMethodController.h
index 527f9b3..31881ae 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.h
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.h
@@ -33,6 +33,8 @@
 #include "core/editing/FrameSelection.h"
 #include "core/editing/PlainTextRange.h"
 #include "platform/heap/Handle.h"
+#include "public/platform/WebTextInputInfo.h"
+#include "public/platform/WebTextInputType.h"
 #include "wtf/Vector.h"
 
 namespace blink {
@@ -95,6 +97,8 @@
                                          int end,
                                          size_t textLength) const;
   void deleteSurroundingText(int before, int after);
+  WebTextInputInfo textInputInfo() const;
+  WebTextInputType textInputType() const;
 
  private:
   Member<LocalFrame> m_frame;
@@ -136,6 +140,9 @@
                                          const Vector<CompositionUnderline>&,
                                          int selectionStart,
                                          int selectionEnd);
+  int textInputFlags() const;
+  // TODO(dtapuska): Change this from a String to a WebTextInputMode.
+  String inputModeOfFocusedElement() const;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/events/BUILD.gn b/third_party/WebKit/Source/core/events/BUILD.gn
index 6768ebb..267b8934 100644
--- a/third_party/WebKit/Source/core/events/BUILD.gn
+++ b/third_party/WebKit/Source/core/events/BUILD.gn
@@ -83,6 +83,7 @@
     "ResourceProgressEvent.h",
     "ScopedEventQueue.cpp",
     "ScopedEventQueue.h",
+    "SecurityPolicyViolationEvent.cpp",
     "SecurityPolicyViolationEvent.h",
     "TextEvent.cpp",
     "TextEvent.h",
diff --git a/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.cpp b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.cpp
new file mode 100644
index 0000000..e59b529
--- /dev/null
+++ b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2016 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "core/events/SecurityPolicyViolationEvent.h"
+
+namespace blink {
+
+namespace {
+
+const char kEnforce[] = "enforce";
+const char kReport[] = "report";
+
+}  // namespace
+
+SecurityPolicyViolationEvent::SecurityPolicyViolationEvent(
+    const AtomicString& type,
+    const SecurityPolicyViolationEventInit& initializer)
+    : Event(type, initializer),
+      m_disposition(ContentSecurityPolicyHeaderTypeEnforce),
+      m_lineNumber(0),
+      m_columnNumber(0),
+      m_statusCode(0) {
+  if (initializer.hasDocumentURI())
+    m_documentURI = initializer.documentURI();
+  if (initializer.hasReferrer())
+    m_referrer = initializer.referrer();
+  if (initializer.hasBlockedURI())
+    m_blockedURI = initializer.blockedURI();
+  if (initializer.hasViolatedDirective())
+    m_violatedDirective = initializer.violatedDirective();
+  if (initializer.hasEffectiveDirective())
+    m_effectiveDirective = initializer.effectiveDirective();
+  if (initializer.hasOriginalPolicy())
+    m_originalPolicy = initializer.originalPolicy();
+  m_disposition = initializer.disposition() == kReport
+                      ? ContentSecurityPolicyHeaderTypeReport
+                      : ContentSecurityPolicyHeaderTypeEnforce;
+  if (initializer.hasSourceFile())
+    m_sourceFile = initializer.sourceFile();
+  if (initializer.hasLineNumber())
+    m_lineNumber = initializer.lineNumber();
+  if (initializer.hasColumnNumber())
+    m_columnNumber = initializer.columnNumber();
+  if (initializer.hasStatusCode())
+    m_statusCode = initializer.statusCode();
+}
+
+const String& SecurityPolicyViolationEvent::disposition() const {
+  DEFINE_STATIC_LOCAL(const String, enforce, (kEnforce));
+  DEFINE_STATIC_LOCAL(const String, report, (kReport));
+
+  if (m_disposition == ContentSecurityPolicyHeaderTypeReport)
+    return report;
+  return enforce;
+}
+
+}  // namespace blink
diff --git a/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h
index 1b4c412d..a2a08e5 100644
--- a/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h
+++ b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.h
@@ -28,6 +28,7 @@
 
 #include "core/events/Event.h"
 #include "core/events/SecurityPolicyViolationEventInit.h"
+#include "platform/network/ContentSecurityPolicyParsers.h"
 
 namespace blink {
 
@@ -47,6 +48,7 @@
   const String& violatedDirective() const { return m_violatedDirective; }
   const String& effectiveDirective() const { return m_effectiveDirective; }
   const String& originalPolicy() const { return m_originalPolicy; }
+  const String& disposition() const;
   const String& sourceFile() const { return m_sourceFile; }
   int lineNumber() const { return m_lineNumber; }
   int columnNumber() const { return m_columnNumber; }
@@ -61,32 +63,7 @@
  private:
   SecurityPolicyViolationEvent(
       const AtomicString& type,
-      const SecurityPolicyViolationEventInit& initializer)
-      : Event(type, initializer),
-        m_lineNumber(0),
-        m_columnNumber(0),
-        m_statusCode(0) {
-    if (initializer.hasDocumentURI())
-      m_documentURI = initializer.documentURI();
-    if (initializer.hasReferrer())
-      m_referrer = initializer.referrer();
-    if (initializer.hasBlockedURI())
-      m_blockedURI = initializer.blockedURI();
-    if (initializer.hasViolatedDirective())
-      m_violatedDirective = initializer.violatedDirective();
-    if (initializer.hasEffectiveDirective())
-      m_effectiveDirective = initializer.effectiveDirective();
-    if (initializer.hasOriginalPolicy())
-      m_originalPolicy = initializer.originalPolicy();
-    if (initializer.hasSourceFile())
-      m_sourceFile = initializer.sourceFile();
-    if (initializer.hasLineNumber())
-      m_lineNumber = initializer.lineNumber();
-    if (initializer.hasColumnNumber())
-      m_columnNumber = initializer.columnNumber();
-    if (initializer.hasStatusCode())
-      m_statusCode = initializer.statusCode();
-  }
+      const SecurityPolicyViolationEventInit& initializer);
 
   String m_documentURI;
   String m_referrer;
@@ -94,6 +71,7 @@
   String m_violatedDirective;
   String m_effectiveDirective;
   String m_originalPolicy;
+  ContentSecurityPolicyHeaderType m_disposition;
   String m_sourceFile;
   int m_lineNumber;
   int m_columnNumber;
diff --git a/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.idl b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.idl
index 9c5c4d7..cfdfce0 100644
--- a/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.idl
+++ b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEvent.idl
@@ -23,7 +23,11 @@
  * DAMAGE.
  */
 
-// http://w3c.github.io/webappsec/specs/content-security-policy/#securitypolicyviolationevent-interface
+// https://w3c.github.io/webappsec-csp/#idl-index
+
+enum SecurityPolicyViolationEventDisposition {
+    "enforce", "report"
+};
 
 [
     Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict),
@@ -36,6 +40,7 @@
     readonly attribute DOMString violatedDirective;
     readonly attribute DOMString effectiveDirective;
     readonly attribute DOMString originalPolicy;
+    readonly attribute SecurityPolicyViolationEventDisposition disposition;
     readonly attribute DOMString sourceFile;
     [Measure] readonly attribute unsigned short statusCode;
     readonly attribute long      lineNumber;
diff --git a/third_party/WebKit/Source/core/events/SecurityPolicyViolationEventInit.idl b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEventInit.idl
index ad892039..bdce54a 100644
--- a/third_party/WebKit/Source/core/events/SecurityPolicyViolationEventInit.idl
+++ b/third_party/WebKit/Source/core/events/SecurityPolicyViolationEventInit.idl
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// http://w3c.github.io/webappsec/specs/content-security-policy/#securitypolicyviolationevent-interface
+// https://w3c.github.io/webappsec-csp/#idl-index
 
 dictionary SecurityPolicyViolationEventInit : EventInit {
     // TODO(foolip): The spec says "documentURL".
@@ -13,6 +13,7 @@
     DOMString violatedDirective;
     DOMString effectiveDirective;
     DOMString originalPolicy;
+    SecurityPolicyViolationEventDisposition disposition;
     DOMString sourceFile;
     unsigned short statusCode;
     long      lineNumber;
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index e038370..292355fd 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -49,10 +49,11 @@
 // features are used and thus when it's safe to remove or change them.
 //
 // The Chromium Content layer controls what is done with this data.
-// For instance, in Google Chrome, these counts are submitted
-// anonymously through the Histogram recording system in Chrome
-// for users who opt-in to "Usage Statistics" submission
-// during their install of Google Chrome:
+//
+// For instance, in Google Chrome, these counts are submitted anonymously
+// through the UMA histogram recording system in Chrome for users who have the
+// "Automatically send usage statistics and crash reports to Google" setting
+// enabled:
 // http://www.google.com/chrome/intl/en/privacy.html
 
 class CORE_EXPORT UseCounter {
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
index 5f32222..bcb25c1 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -97,9 +97,10 @@
       isReportOnly() ? "[Report Only] " + consoleMessage : consoleMessage;
   m_policy->logToConsole(ConsoleMessage::create(SecurityMessageSource,
                                                 ErrorMessageLevel, message));
-  m_policy->reportViolation(
-      directiveText, effectiveDirective, message, blockedURL, m_reportEndpoints,
-      m_header, ContentSecurityPolicy::URLViolation, nullptr, redirectStatus);
+  m_policy->reportViolation(directiveText, effectiveDirective, message,
+                            blockedURL, m_reportEndpoints, m_header,
+                            m_headerType, ContentSecurityPolicy::URLViolation,
+                            nullptr, redirectStatus);
 }
 
 void CSPDirectiveList::reportViolationWithFrame(
@@ -113,9 +114,9 @@
   m_policy->logToConsole(
       ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, message),
       frame);
-  m_policy->reportViolation(directiveText, effectiveDirective, message,
-                            blockedURL, m_reportEndpoints, m_header,
-                            ContentSecurityPolicy::URLViolation, frame);
+  m_policy->reportViolation(
+      directiveText, effectiveDirective, message, blockedURL, m_reportEndpoints,
+      m_header, m_headerType, ContentSecurityPolicy::URLViolation, frame);
 }
 
 void CSPDirectiveList::reportViolationWithLocation(
@@ -132,7 +133,7 @@
       SourceLocation::capture(contextURL, contextLine.oneBasedInt(), 0)));
   m_policy->reportViolation(
       directiveText, effectiveDirective, message, blockedURL, m_reportEndpoints,
-      m_header, ContentSecurityPolicy::InlineViolation, nullptr,
+      m_header, m_headerType, ContentSecurityPolicy::InlineViolation, nullptr,
       RedirectStatus::NoRedirect, contextLine.oneBasedInt());
 }
 
@@ -156,7 +157,7 @@
   }
   m_policy->reportViolation(directiveText, effectiveDirective, message,
                             blockedURL, m_reportEndpoints, m_header,
-                            ContentSecurityPolicy::EvalViolation);
+                            m_headerType, ContentSecurityPolicy::EvalViolation);
 }
 
 bool CSPDirectiveList::checkEval(SourceListDirective* directive) const {
@@ -190,12 +191,13 @@
 void CSPDirectiveList::reportMixedContent(
     const KURL& mixedURL,
     ResourceRequest::RedirectStatus redirectStatus) const {
-  if (strictMixedContentChecking())
+  if (strictMixedContentChecking()) {
     m_policy->reportViolation(ContentSecurityPolicy::BlockAllMixedContent,
                               ContentSecurityPolicy::BlockAllMixedContent,
                               String(), mixedURL, m_reportEndpoints, m_header,
-                              ContentSecurityPolicy::URLViolation, nullptr,
-                              redirectStatus);
+                              m_headerType, ContentSecurityPolicy::URLViolation,
+                              nullptr, redirectStatus);
+  }
 }
 
 bool CSPDirectiveList::checkSource(
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
index 20fd4036..3ff3966 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -1055,6 +1055,7 @@
     const KURL& blockedURL,
     const String& header,
     RedirectStatus redirectStatus,
+    ContentSecurityPolicyHeaderType headerType,
     ContentSecurityPolicy::ViolationType violationType,
     int contextLine) {
   if (equalIgnoringCase(effectiveDirective,
@@ -1083,6 +1084,9 @@
   init.setViolatedDirective(directiveText);
   init.setEffectiveDirective(effectiveDirective);
   init.setOriginalPolicy(header);
+  init.setDisposition(headerType == ContentSecurityPolicyHeaderTypeEnforce
+                          ? "enforce"
+                          : "report");
   init.setSourceFile(String());
   init.setLineNumber(contextLine);
   init.setColumnNumber(0);
@@ -1108,6 +1112,7 @@
     const KURL& blockedURL,
     const Vector<String>& reportEndpoints,
     const String& header,
+    ContentSecurityPolicyHeaderType headerType,
     ViolationType violationType,
     LocalFrame* contextFrame,
     RedirectStatus redirectStatus,
@@ -1141,7 +1146,7 @@
   SecurityPolicyViolationEventInit violationData;
   gatherSecurityPolicyViolationEventData(
       violationData, document, directiveText, effectiveDirective, blockedURL,
-      header, redirectStatus, violationType, contextLine);
+      header, redirectStatus, headerType, violationType, contextLine);
 
   // TODO(mkwst): Obviously, we shouldn't hit this check, as extension-loaded
   // resources should be allowed regardless. We apparently do, however, so
@@ -1169,6 +1174,7 @@
   cspReport->setString("effective-directive",
                        violationData.effectiveDirective());
   cspReport->setString("original-policy", violationData.originalPolicy());
+  cspReport->setString("disposition", violationData.disposition());
   cspReport->setString("blocked-uri", violationData.blockedURI());
   if (violationData.lineNumber())
     cspReport->setInteger("line-number", violationData.lineNumber());
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h
index 563fb64..a51449bb 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h
@@ -313,6 +313,7 @@
                        const KURL& blockedURL,
                        const Vector<String>& reportEndpoints,
                        const String& header,
+                       ContentSecurityPolicyHeaderType,
                        ViolationType,
                        LocalFrame* = nullptr,
                        RedirectStatus = RedirectStatus::FollowedRedirect,
diff --git a/third_party/WebKit/Source/core/html/HTMLAttributeNames.in b/third_party/WebKit/Source/core/html/HTMLAttributeNames.in
index 64a1806..a3a9ff3d 100644
--- a/third_party/WebKit/Source/core/html/HTMLAttributeNames.in
+++ b/third_party/WebKit/Source/core/html/HTMLAttributeNames.in
@@ -56,6 +56,7 @@
 async
 autocapitalize
 autocomplete
+autocorrect
 autofocus
 autoplay
 axis
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 8350fcb..617bad3c 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -590,6 +590,8 @@
     setPlayerPreload();
   } else if (name == disableremoteplaybackAttr) {
     UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute);
+    if (mediaControls() && (oldValue != value))
+      mediaControls()->refreshCastButtonVisibility();
   } else {
     HTMLElement::parseAttribute(name, oldValue, value);
   }
diff --git a/third_party/WebKit/Source/core/html/ImageDocument.cpp b/third_party/WebKit/Source/core/html/ImageDocument.cpp
index ea2edaa..a3d63fc 100644
--- a/third_party/WebKit/Source/core/html/ImageDocument.cpp
+++ b/third_party/WebKit/Source/core/html/ImageDocument.cpp
@@ -38,6 +38,8 @@
 #include "core/frame/UseCounter.h"
 #include "core/frame/VisualViewport.h"
 #include "core/html/HTMLBodyElement.h"
+#include "core/html/HTMLContentElement.h"
+#include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLHeadElement.h"
 #include "core/html/HTMLHtmlElement.h"
 #include "core/html/HTMLImageElement.h"
@@ -180,6 +182,7 @@
 
 ImageDocument::ImageDocument(const DocumentInit& initializer)
     : HTMLDocument(initializer, ImageDocumentClass),
+      m_divElement(nullptr),
       m_imageElement(nullptr),
       m_imageSizeIsKnown(false),
       m_didShrinkImage(false),
@@ -212,12 +215,40 @@
   head->appendChild(meta);
 
   HTMLBodyElement* body = HTMLBodyElement::create(*this);
-  body->setAttribute(styleAttr, "margin: 0px;");
+
+  if (shouldShrinkToFit()) {
+    // Display the image prominently centered in the frame.
+    body->setAttribute(styleAttr, "margin: 0px;");
+
+    // See w3c example on how to centering an element:
+    // https://www.w3.org/Style/Examples/007/center.en.html
+    m_divElement = HTMLDivElement::create(*this);
+    m_divElement->setAttribute(styleAttr,
+                               "display: flex;"
+                               "flex-direction: column;"
+                               "justify-content: center;"
+                               "align-items: center;"
+                               "min-height: min-content;"
+                               "min-width: min-content;"
+                               "height: 100%;"
+                               "width: 100%;");
+    HTMLContentElement* content = HTMLContentElement::create(*this);
+    m_divElement->appendChild(content);
+
+    ShadowRoot& shadowRoot = body->ensureUserAgentShadowRoot();
+    shadowRoot.appendChild(m_divElement);
+  } else {
+    body->setAttribute(styleAttr, "margin: 0px;");
+  }
 
   willInsertBody();
 
+  StringBuilder imageStyle;
+  imageStyle.append("-webkit-user-select: none;");
+  if (shouldShrinkToFit() && m_shrinkToFitMode == Viewport)
+    imageStyle.append("max-width: 100%");
   m_imageElement = HTMLImageElement::create(*this);
-  m_imageElement->setAttribute(styleAttr, "-webkit-user-select: none");
+  m_imageElement->setAttribute(styleAttr, imageStyle.toAtomicString());
   m_imageElement->setLoadingImageDocument();
   m_imageElement->setSrc(url().getString());
   body->appendChild(m_imageElement.get());
@@ -294,6 +325,11 @@
   if (m_shouldShrinkImage) {
     windowSizeChanged();
   } else {
+    // Adjust the coordinates to account for the fact that the image was
+    // centered on the screen.
+    float imageX = x - m_imageElement->offsetLeft();
+    float imageY = y - m_imageElement->offsetTop();
+
     restoreImageSize();
 
     updateStyleAndLayout();
@@ -301,9 +337,9 @@
     double scale = this->scale();
 
     float scrollX =
-        x / scale - static_cast<float>(frame()->view()->width()) / 2;
+        imageX / scale - static_cast<float>(frame()->view()->width()) / 2;
     float scrollY =
-        y / scale - static_cast<float>(frame()->view()->height()) / 2;
+        imageY / scale - static_cast<float>(frame()->view()->height()) / 2;
 
     frame()->view()->layoutViewportScrollableArea()->setScrollOffset(
         ScrollOffset(scrollX, scrollY), ProgrammaticScroll);
@@ -367,15 +403,36 @@
     return;
 
   if (m_shrinkToFitMode == Viewport) {
-    // For huge images, minimum-scale=0.1 is still too big on small screens.
-    // Set max-width so that the image will shrink to fit the width of the
-    // screen when the scale is minimum.  Don't shrink height to fit because we
-    // use width=device-width in viewport meta tag, and expect a full-width
-    // reading mode for normal-width-huge-height images.
+    // Zooming in and out of an image being displayed within a viewport is done
+    // by changing the page scale factor of the page instead of changing the
+    // size of the image.  The size of the image is set so that:
+    // * Images wider than the viewport take the full width of the screen.
+    // * Images taller than the viewport are initially aligned with the top of
+    //   of the frame.
+    // * Images smaller in either dimension are centered along that axis.
+    LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(
+        LayoutObject::shouldRespectImageOrientation(
+            m_imageElement->layoutObject()),
+        1.f);
     int viewportWidth = frame()->host()->visualViewport().size().width();
-    m_imageElement->setInlineStyleProperty(CSSPropertyMaxWidth,
-                                           viewportWidth * 10,
-                                           CSSPrimitiveValue::UnitType::Pixels);
+    int viewportHeight = frame()->host()->visualViewport().size().height();
+    float viewportAspectRatio = (float)viewportWidth / viewportHeight;
+
+    // For huge images, minimum-scale=0.1 is still too big on small screens.
+    // Set the <div> width so that the image will shrink to fit the width of the
+    // screen when the scale is minimum.
+    int maxWidth = std::min(imageSize.width().toInt(), viewportWidth * 10);
+    int divWidth = std::max(viewportWidth, maxWidth);
+    m_divElement->setInlineStyleProperty(CSSPropertyWidth, divWidth,
+                                         CSSPrimitiveValue::UnitType::Pixels);
+
+    // Explicitly set the height of the <div> containing the <img> so that it
+    // can display the full image without shrinking it, allowing a full-width
+    // reading mode for normal-width-huge-height images.
+    int divHeight = std::max(imageSize.height().toInt(),
+                             (int)(divWidth / viewportAspectRatio));
+    m_divElement->setInlineStyleProperty(CSSPropertyHeight, divHeight,
+                                         CSSPrimitiveValue::UnitType::Pixels);
     return;
   }
 
@@ -425,6 +482,7 @@
 }
 
 DEFINE_TRACE(ImageDocument) {
+  visitor->trace(m_divElement);
   visitor->trace(m_imageElement);
   HTMLDocument::trace(visitor);
 }
diff --git a/third_party/WebKit/Source/core/html/ImageDocument.h b/third_party/WebKit/Source/core/html/ImageDocument.h
index 53e49697..ed05b58 100644
--- a/third_party/WebKit/Source/core/html/ImageDocument.h
+++ b/third_party/WebKit/Source/core/html/ImageDocument.h
@@ -25,6 +25,7 @@
 #ifndef ImageDocument_h
 #define ImageDocument_h
 
+#include "core/html/HTMLDivElement.h"
 #include "core/html/HTMLDocument.h"
 #include "core/html/HTMLImageElement.h"
 #include "wtf/RefPtr.h"
@@ -65,6 +66,7 @@
   // the window, taking into account page zoom and device scale.
   float scale() const;
 
+  Member<HTMLDivElement> m_divElement;
   Member<HTMLImageElement> m_imageElement;
 
   // Whether enough of the image has been loaded to determine its size
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.h b/third_party/WebKit/Source/core/html/shadow/MediaControls.h
index 6c1ba2e9..a450161 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.h
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.h
@@ -81,6 +81,15 @@
   // used for overlap checking during text track layout. May be null.
   LayoutObject* layoutObjectForTextTrackLayout();
 
+  // Return the internal elements, which is used by registering clicking
+  // EventHandlers from MediaControlsWindowEventListener.
+  MediaControlPanelElement* panelElement() { return m_panel; }
+  MediaControlTimelineElement* timelineElement() { return m_timeline; }
+  MediaControlCastButtonElement* castButtonElement() { return m_castButton; }
+  MediaControlVolumeSliderElement* volumeSliderElement() {
+    return m_volumeSlider;
+  }
+
   // Notify us that our controls enclosure has changed width.
   void notifyPanelWidthChanged(const LayoutUnit& newWidth);
 
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
index 2de2a55..31eeadb 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp
@@ -222,14 +222,16 @@
       mediaControls(), "-internal-media-controls-cast-button");
   ASSERT_NE(nullptr, castButton);
 
+  ASSERT_FALSE(isElementVisible(*castButton));
+  simulateRouteAvailabe();
+  ASSERT_TRUE(isElementVisible(*castButton));
+
   mediaControls().mediaElement().setBooleanAttribute(
       HTMLNames::disableremoteplaybackAttr, true);
-  simulateRouteAvailabe();
   ASSERT_FALSE(isElementVisible(*castButton));
 
   mediaControls().mediaElement().setBooleanAttribute(
       HTMLNames::disableremoteplaybackAttr, false);
-  mediaControls().reset();
   ASSERT_TRUE(isElementVisible(*castButton));
 }
 
@@ -247,14 +249,16 @@
       mediaControls(), "-internal-media-controls-overlay-cast-button");
   ASSERT_NE(nullptr, castOverlayButton);
 
+  ASSERT_FALSE(isElementVisible(*castOverlayButton));
+  simulateRouteAvailabe();
+  ASSERT_TRUE(isElementVisible(*castOverlayButton));
+
   mediaControls().mediaElement().setBooleanAttribute(
       HTMLNames::disableremoteplaybackAttr, true);
-  simulateRouteAvailabe();
   ASSERT_FALSE(isElementVisible(*castOverlayButton));
 
   mediaControls().mediaElement().setBooleanAttribute(
       HTMLNames::disableremoteplaybackAttr, false);
-  mediaControls().reset();
   ASSERT_TRUE(isElementVisible(*castOverlayButton));
 }
 
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsWindowEventListener.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsWindowEventListener.cpp
index 4f266ec..c18500c 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsWindowEventListener.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsWindowEventListener.cpp
@@ -39,6 +39,14 @@
 
   if (LocalDOMWindow* window = getLocalDOMWindow()) {
     window->addEventListener(EventTypeNames::click, this, false);
+    m_mediaControls->panelElement()->addEventListener(EventTypeNames::click,
+                                                      this, false);
+    m_mediaControls->timelineElement()->addEventListener(EventTypeNames::click,
+                                                         this, false);
+    m_mediaControls->castButtonElement()->addEventListener(
+        EventTypeNames::click, this, false);
+    m_mediaControls->volumeSliderElement()->addEventListener(
+        EventTypeNames::click, this, false);
     m_isActive = true;
   }
 }
@@ -47,8 +55,17 @@
   if (!m_isActive)
     return;
 
-  if (LocalDOMWindow* window = getLocalDOMWindow())
+  if (LocalDOMWindow* window = getLocalDOMWindow()) {
     window->removeEventListener(EventTypeNames::click, this, false);
+    m_mediaControls->panelElement()->removeEventListener(EventTypeNames::click,
+                                                         this, false);
+    m_mediaControls->timelineElement()->removeEventListener(
+        EventTypeNames::click, this, false);
+    m_mediaControls->castButtonElement()->removeEventListener(
+        EventTypeNames::click, this, false);
+    m_mediaControls->volumeSliderElement()->removeEventListener(
+        EventTypeNames::click, this, false);
+  }
   m_isActive = false;
 }
 
diff --git a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
index b44d350f..0e9e59125 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
@@ -781,6 +781,8 @@
             .setUrl(urlWithoutFragment(cachedResource->url()).getString())
             .setType(cachedResourceTypeJson(*cachedResource))
             .setMimeType(cachedResource->response().mimeType())
+            .setLastModified(cachedResource->response().lastModified())
+            .setContentSize(cachedResource->response().decodedBodyLength())
             .build();
     if (cachedResource->wasCanceled())
       resourceObject->setCanceled(true);
diff --git a/third_party/WebKit/Source/core/inspector/browser_protocol.json b/third_party/WebKit/Source/core/inspector/browser_protocol.json
index e8f88d9b..2293375a 100644
--- a/third_party/WebKit/Source/core/inspector/browser_protocol.json
+++ b/third_party/WebKit/Source/core/inspector/browser_protocol.json
@@ -108,6 +108,8 @@
                     { "name": "url", "type": "string", "description": "Resource URL." },
                     { "name": "type", "$ref": "ResourceType", "description": "Type of this resource." },
                     { "name": "mimeType", "type": "string", "description": "Resource mimeType as determined by the browser." },
+                    { "name": "lastModified", "$ref": "Network.Timestamp", "description": "last-modified timestamp as reported by server.", "optional": true },
+                    { "name": "contentSize", "type": "number", "description": "Resource content size.", "optional": true },
                     { "name": "failed", "type": "boolean", "optional": true, "description": "True if the resource failed to load." },
                     { "name": "canceled", "type": "boolean", "optional": true, "description": "True if the resource was canceled during loading." }
                 ],
@@ -1027,7 +1029,7 @@
                 "description": "Security details about a request.",
                 "properties": [
                     { "name": "protocol", "type": "string", "description": "Protocol name (e.g. \"TLS 1.2\" or \"QUIC\")." },
-                    { "name": "keyExchange", "type": "string", "description": "Key Exchange used by the connection." },
+                    { "name": "keyExchange", "type": "string", "description": "Key Exchange used by the connection, or the empty string if not applicable." },
                     { "name": "keyExchangeGroup", "type": "string", "optional": true, "description": "(EC)DH group used by the connection, if applicable." },
                     { "name": "cipher", "type": "string", "description": "Cipher name." },
                     { "name": "mac", "type": "string", "optional": true, "description": "TLS MAC. Note that AEAD ciphers do not have separate MACs." },
diff --git a/third_party/WebKit/Source/core/layout/BUILD.gn b/third_party/WebKit/Source/core/layout/BUILD.gn
index 4c60299e..128f9c2f 100644
--- a/third_party/WebKit/Source/core/layout/BUILD.gn
+++ b/third_party/WebKit/Source/core/layout/BUILD.gn
@@ -296,6 +296,7 @@
     "ng/ng_layout_input_text.h",
     "ng/ng_layout_opportunity_iterator.cc",
     "ng/ng_layout_opportunity_iterator.h",
+    "ng/ng_layout_opportunity_tree_node.h",
     "ng/ng_length_utils.cc",
     "ng/ng_length_utils.h",
     "ng/ng_physical_constraint_space.cc",
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 533e7795..9ebb1c9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1690,7 +1690,12 @@
   // Note that inline-block counts as replaced here.
   ASSERT(linePositionMode == PositionOfInteriorLineBoxes);
 
-  const FontMetrics& fontMetrics = style(firstLine)->getFontMetrics();
+  const SimpleFontData* fontData = style(firstLine)->font().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return -1;
+
+  const FontMetrics& fontMetrics = fontData->getFontMetrics();
   return (fontMetrics.ascent(baselineType) +
           (lineHeight(firstLine, direction, linePositionMode) -
            fontMetrics.height()) /
@@ -1759,8 +1764,9 @@
             .toInt();  // Translate to our coordinate space.
     }
   }
-  if (!haveNormalFlowChild && hasLineIfEmpty()) {
-    const FontMetrics& fontMetrics = firstLineStyle()->getFontMetrics();
+  const SimpleFontData* fontData = firstLineStyle()->font().primaryFont();
+  if (fontData && !haveNormalFlowChild && hasLineIfEmpty()) {
+    const FontMetrics& fontMetrics = fontData->getFontMetrics();
     return (fontMetrics.ascent() +
             (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) -
              fontMetrics.height()) /
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 72b8f91..18ee44b6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -2487,11 +2487,15 @@
     return -1;
   if (!childrenInline())
     return LayoutBlock::firstLineBoxBaseline();
-  if (firstLineBox())
+  if (firstLineBox()) {
+    const SimpleFontData* fontData = style(true)->font().primaryFont();
+    DCHECK(fontData);
+    if (!fontData)
+      return -1;
     return (firstLineBox()->logicalTop() +
-            style(true)->getFontMetrics().ascent(
-                firstRootBox()->baselineType()))
+            fontData->getFontMetrics().ascent(firstRootBox()->baselineType()))
         .toInt();
+  }
   return -1;
 }
 
@@ -2519,15 +2523,25 @@
     return -1;
   if (!childrenInline())
     return LayoutBlock::inlineBlockBaseline(lineDirection);
-  if (lastLineBox())
+  if (lastLineBox()) {
+    const SimpleFontData* fontData =
+        style(lastLineBox() == firstLineBox())->font().primaryFont();
+    DCHECK(fontData);
+    if (!fontData)
+      return -1;
     return (lastLineBox()->logicalTop() +
-            style(lastLineBox() == firstLineBox())
-                ->getFontMetrics()
-                .ascent(lastRootBox()->baselineType()))
+            fontData->getFontMetrics().ascent(lastRootBox()->baselineType()))
         .toInt();
+  }
   if (!hasLineIfEmpty())
     return -1;
-  const FontMetrics& fontMetrics = firstLineStyle()->getFontMetrics();
+
+  const SimpleFontData* fontData = firstLineStyle()->font().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return -1;
+
+  const FontMetrics& fontMetrics = fontData->getFontMetrics();
   return (fontMetrics.ascent() +
           (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes) -
            fontMetrics.height()) /
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
index 522082b..c3e2f3fb 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -621,9 +621,11 @@
     measuredWidth = 0;
   }
 
-  glyphOverflow.setFromBounds(glyphBounds, font.getFontMetrics().floatAscent(),
-                              font.getFontMetrics().floatDescent(),
-                              measuredWidth);
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  glyphOverflow.setFromBounds(
+      glyphBounds, fontData ? fontData->getFontMetrics().floatAscent() : 0,
+      fontData ? fontData->getFontMetrics().floatDescent() : 0, measuredWidth);
 
   run->m_box->setLogicalWidth(LayoutUnit(measuredWidth) + hyphenWidth);
   if (!fallbackFonts.isEmpty()) {
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 4efa030..a240f8a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -4531,7 +4531,9 @@
   // giant tall-as-window insertion point
   //
   // FIXME: ignoring :first-line, missing good reason to take care of
-  LayoutUnit fontHeight = LayoutUnit(style()->getFontMetrics().height());
+  const SimpleFontData* fontData = style()->font().primaryFont();
+  LayoutUnit fontHeight =
+      LayoutUnit(fontData ? fontData->getFontMetrics().height() : 0);
   if (fontHeight > rect.height() || (!isAtomicInlineLevel() && !isTable()))
     rect.setHeight(fontHeight);
 
@@ -5504,7 +5506,7 @@
 
 bool LayoutBox::crossesPageBoundary(LayoutUnit offset,
                                     LayoutUnit logicalHeight) const {
-  if (!view()->layoutState()->pageLogicalHeight())
+  if (!pageLogicalHeightForOffset(offset))
     return false;
   return pageRemainingLogicalHeightForOffset(offset, AssociateWithLatterPage) <
          logicalHeight;
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
index 259ecee..5ad6f0d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -49,17 +49,17 @@
 struct LayoutFlexibleBox::LineContext {
   LineContext(LayoutUnit crossAxisOffset,
               LayoutUnit crossAxisExtent,
-              size_t numberOfChildren,
-              LayoutUnit maxAscent)
+              LayoutUnit maxAscent,
+              OrderedFlexItemList&& flexItems)
       : crossAxisOffset(crossAxisOffset),
         crossAxisExtent(crossAxisExtent),
-        numberOfChildren(numberOfChildren),
-        maxAscent(maxAscent) {}
+        maxAscent(maxAscent),
+        flexItems(flexItems) {}
 
   LayoutUnit crossAxisOffset;
   LayoutUnit crossAxisExtent;
-  size_t numberOfChildren;
   LayoutUnit maxAscent;
+  OrderedFlexItemList flexItems;
 };
 
 struct LayoutFlexibleBox::FlexItem {
@@ -1046,6 +1046,7 @@
         continue;
       remainingFreeSpace -= flexItem.flexedMarginBoxSize();
     }
+    // This will std::move lineItems into a newly-created LineContext.
     layoutAndPlaceChildren(crossAxisOffset, lineItems, remainingFreeSpace,
                            relayoutChildren, layoutScope, lineContexts);
   }
@@ -1858,7 +1859,7 @@
 DISABLE_CFI_PERF
 void LayoutFlexibleBox::layoutAndPlaceChildren(
     LayoutUnit& crossAxisOffset,
-    const OrderedFlexItemList& children,
+    OrderedFlexItemList& children,
     LayoutUnit availableFreeSpace,
     bool relayoutChildren,
     SubtreeLayoutScope& layoutScope,
@@ -1994,7 +1995,7 @@
   if (m_numberOfInFlowChildrenOnFirstLine == -1)
     m_numberOfInFlowChildrenOnFirstLine = seenInFlowPositionedChildren;
   lineContexts.append(LineContext(crossAxisOffset, maxChildCrossAxisExtent,
-                                  children.size(), maxAscent));
+                                  maxAscent, std::move(children)));
   crossAxisOffset += maxChildCrossAxisExtent;
 }
 
@@ -2101,16 +2102,17 @@
   for (size_t i = 0; i < lineContexts.size(); ++i)
     availableCrossAxisSpace -= lineContexts[i].crossAxisExtent;
 
-  LayoutBox* child = m_orderIterator.first();
   LayoutUnit lineOffset = initialAlignContentOffset(
       availableCrossAxisSpace, position, distribution, lineContexts.size());
   for (unsigned lineNumber = 0; lineNumber < lineContexts.size();
        ++lineNumber) {
-    lineContexts[lineNumber].crossAxisOffset += lineOffset;
-    for (size_t childNumber = 0;
-         childNumber < lineContexts[lineNumber].numberOfChildren;
-         ++childNumber, child = m_orderIterator.next())
-      adjustAlignmentForChild(*child, lineOffset);
+    LineContext& lineContext = lineContexts[lineNumber];
+    lineContext.crossAxisOffset += lineOffset;
+    for (size_t childNumber = 0; childNumber < lineContext.flexItems.size();
+         ++childNumber) {
+      FlexItem& flexItem = lineContext.flexItems[childNumber];
+      adjustAlignmentForChild(*flexItem.box, lineOffset);
+    }
 
     if (distribution == ContentDistributionStretch &&
         availableCrossAxisSpace > 0)
@@ -2137,42 +2139,44 @@
   // the box for each line.
   Vector<LayoutUnit> minMarginAfterBaselines;
 
-  LayoutBox* child = m_orderIterator.first();
   for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
-    LayoutUnit minMarginAfterBaseline = LayoutUnit::max();
-    LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisExtent;
-    LayoutUnit maxAscent = lineContexts[lineNumber].maxAscent;
+    const LineContext& lineContext = lineContexts[lineNumber];
 
-    for (size_t childNumber = 0;
-         childNumber < lineContexts[lineNumber].numberOfChildren;
-         ++childNumber, child = m_orderIterator.next()) {
-      DCHECK(child);
-      if (child == childToExclude)
+    LayoutUnit minMarginAfterBaseline = LayoutUnit::max();
+    LayoutUnit lineCrossAxisExtent = lineContext.crossAxisExtent;
+    LayoutUnit maxAscent = lineContext.maxAscent;
+
+    for (size_t childNumber = 0; childNumber < lineContext.flexItems.size();
+         ++childNumber) {
+      const FlexItem& flexItem = lineContext.flexItems[childNumber];
+      if (flexItem.box == childToExclude)
         continue;
-      if (child->isOutOfFlowPositioned()) {
+      if (flexItem.box->isOutOfFlowPositioned()) {
         continue;
       }
 
       if (updateAutoMarginsInCrossAxis(
-              *child, std::max(LayoutUnit(), availableAlignmentSpaceForChild(
-                                                 lineCrossAxisExtent, *child))))
+              *flexItem.box,
+              std::max(LayoutUnit(), availableAlignmentSpaceForChild(
+                                         lineCrossAxisExtent, *flexItem.box))))
         continue;
 
-      ItemPosition position = alignmentForChild(*child);
+      ItemPosition position = alignmentForChild(*flexItem.box);
       if (position == ItemPositionStretch)
-        applyStretchAlignmentToChild(*child, lineCrossAxisExtent);
+        applyStretchAlignmentToChild(*flexItem.box, lineCrossAxisExtent);
       LayoutUnit availableSpace =
-          availableAlignmentSpaceForChild(lineCrossAxisExtent, *child);
+          availableAlignmentSpaceForChild(lineCrossAxisExtent, *flexItem.box);
       LayoutUnit offset = alignmentOffset(
-          availableSpace, position, marginBoxAscentForChild(*child), maxAscent,
-          styleRef().flexWrap() == FlexWrapReverse);
-      adjustAlignmentForChild(*child, offset);
+          availableSpace, position, marginBoxAscentForChild(*flexItem.box),
+          maxAscent, styleRef().flexWrap() == FlexWrapReverse);
+      adjustAlignmentForChild(*flexItem.box, offset);
       if (position == ItemPositionBaseline &&
-          styleRef().flexWrap() == FlexWrapReverse)
+          styleRef().flexWrap() == FlexWrapReverse) {
         minMarginAfterBaseline = std::min(
-            minMarginAfterBaseline,
-            availableAlignmentSpaceForChild(lineCrossAxisExtent, *child) -
-                offset);
+            minMarginAfterBaseline, availableAlignmentSpaceForChild(
+                                        lineCrossAxisExtent, *flexItem.box) -
+                                        offset);
+      }
     }
     minMarginAfterBaselines.append(minMarginAfterBaseline);
   }
@@ -2183,16 +2187,15 @@
   // wrap-reverse flips the cross axis start and end. For baseline alignment,
   // this means we need to align the after edge of baseline elements with the
   // after edge of the flex line.
-  child = m_orderIterator.first();
   for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
+    const LineContext& lineContext = lineContexts[lineNumber];
     LayoutUnit minMarginAfterBaseline = minMarginAfterBaselines[lineNumber];
-    for (size_t childNumber = 0;
-         childNumber < lineContexts[lineNumber].numberOfChildren;
-         ++childNumber, child = m_orderIterator.next()) {
-      DCHECK(child);
-      if (alignmentForChild(*child) == ItemPositionBaseline &&
-          !hasAutoMarginsInCrossAxis(*child) && minMarginAfterBaseline)
-        adjustAlignmentForChild(*child, minMarginAfterBaseline);
+    for (size_t childNumber = 0; childNumber < lineContext.flexItems.size();
+         ++childNumber) {
+      const FlexItem& flexItem = lineContext.flexItems[childNumber];
+      if (alignmentForChild(*flexItem.box) == ItemPositionBaseline &&
+          !hasAutoMarginsInCrossAxis(*flexItem.box) && minMarginAfterBaseline)
+        adjustAlignmentForChild(*flexItem.box, minMarginAfterBaseline);
     }
   }
 }
@@ -2279,18 +2282,17 @@
     const Vector<LineContext>& lineContexts,
     LayoutUnit crossAxisStartEdge) {
   LayoutUnit contentExtent = crossAxisContentExtent();
-  LayoutBox* child = m_orderIterator.first();
   for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
-    for (size_t childNumber = 0;
-         childNumber < lineContexts[lineNumber].numberOfChildren;
-         ++childNumber, child = m_orderIterator.next()) {
-      DCHECK(child);
+    const LineContext& lineContext = lineContexts[lineNumber];
+    for (size_t childNumber = 0; childNumber < lineContext.flexItems.size();
+         ++childNumber) {
+      const FlexItem& flexItem = lineContext.flexItems[childNumber];
       LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisExtent;
       LayoutUnit originalOffset =
           lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
       LayoutUnit newOffset =
           contentExtent - originalOffset - lineCrossAxisExtent;
-      adjustAlignmentForChild(*child, newOffset - originalOffset);
+      adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset);
     }
   }
 }
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h
index aa6d898..b294343 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h
@@ -234,7 +234,7 @@
   void prepareChildForPositionedLayout(LayoutBox& child);
   size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const;
   void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset,
-                              const OrderedFlexItemList&,
+                              OrderedFlexItemList&,
                               LayoutUnit availableFreeSpace,
                               bool relayoutChildren,
                               SubtreeLayoutScope&,
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
index ea9c613c..82b4600 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -618,8 +618,18 @@
                                         LayoutUnit* top,
                                         LayoutUnit* height) {
   bool firstLine = rootBox.isFirstLineStyle();
-  auto metrics = rootBox.getLineLayoutItem().style(firstLine)->getFontMetrics();
-  auto containerMetrics = container->style(firstLine)->getFontMetrics();
+  const SimpleFontData* fontData =
+      rootBox.getLineLayoutItem().style(firstLine)->font().primaryFont();
+  const SimpleFontData* containerFontData =
+      container->style(firstLine)->font().primaryFont();
+  DCHECK(fontData && containerFontData);
+  if (!fontData || !containerFontData) {
+    *top = LayoutUnit();
+    *height = LayoutUnit();
+    return;
+  }
+  auto metrics = fontData->getFontMetrics();
+  auto containerMetrics = containerFontData->getFontMetrics();
   *top = rootBox.logicalTop() + (metrics.ascent() - containerMetrics.ascent());
   *height = LayoutUnit(containerMetrics.height());
 }
@@ -1340,7 +1350,11 @@
                                    LineDirectionMode direction,
                                    LinePositionMode linePositionMode) const {
   ASSERT(linePositionMode == PositionOnContainingLine);
-  const FontMetrics& fontMetrics = style(firstLine)->getFontMetrics();
+  const SimpleFontData* fontData = style(firstLine)->font().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return -1;
+  const FontMetrics& fontMetrics = fontData->getFontMetrics();
   return (fontMetrics.ascent(baselineType) +
           (lineHeight(firstLine, direction, linePositionMode) -
            fontMetrics.height()) /
diff --git a/third_party/WebKit/Source/core/layout/LayoutListBox.cpp b/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
index 807d226..7388ff3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
@@ -66,7 +66,10 @@
 }
 
 LayoutUnit LayoutListBox::defaultItemHeight() const {
-  return LayoutUnit(style()->getFontMetrics().height() + defaultPaddingBottom);
+  const SimpleFontData* fontData = style()->font().primaryFont();
+  if (!fontData)
+    return LayoutUnit();
+  return LayoutUnit(fontData->getFontMetrics().height() + defaultPaddingBottom);
 }
 
 LayoutUnit LayoutListBox::itemHeight() const {
diff --git a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
index 4cfd8afc..ccc679d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
@@ -65,12 +65,16 @@
 
 LayoutSize LayoutListMarker::imageBulletSize() const {
   ASSERT(isImage());
+  const SimpleFontData* fontData = style()->font().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return LayoutSize();
 
   // FIXME: This is a somewhat arbitrary default width. Generated images for
   // markers really won't become particularly useful until we support the CSS3
   // marker pseudoclass to allow control over the width and height of the
   // marker box.
-  LayoutUnit bulletWidth = style()->getFontMetrics().ascent() / LayoutUnit(2);
+  LayoutUnit bulletWidth = fontData->getFontMetrics().ascent() / LayoutUnit(2);
   return m_image->imageSize(*this, style()->effectiveZoom(),
                             LayoutSize(bulletWidth, bulletWidth));
 }
@@ -141,8 +145,11 @@
     setWidth(imageSize.width());
     setHeight(imageSize.height());
   } else {
+    const SimpleFontData* fontData = style()->font().primaryFont();
+    DCHECK(fontData);
     setLogicalWidth(minPreferredLogicalWidth());
-    setLogicalHeight(LayoutUnit(style()->getFontMetrics().height()));
+    setLogicalHeight(
+        LayoutUnit(fontData ? fontData->getFontMetrics().height() : 0));
   }
 
   setMarginStart(LayoutUnit());
@@ -234,6 +241,10 @@
   }
 
   const Font& font = style()->font();
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
 
   LayoutUnit logicalWidth;
   switch (getListStyleCategory()) {
@@ -241,7 +252,7 @@
       break;
     case ListStyleCategory::Symbol:
       logicalWidth =
-          LayoutUnit((font.getFontMetrics().ascent() * 2 / 3 + 1) / 2 + 2);
+          LayoutUnit((fontData->getFontMetrics().ascent() * 2 / 3 + 1) / 2 + 2);
       break;
     case ListStyleCategory::Language:
       logicalWidth = getWidthOfTextWithSuffix();
@@ -257,7 +268,11 @@
 }
 
 void LayoutListMarker::updateMargins() {
-  const FontMetrics& fontMetrics = style()->getFontMetrics();
+  const SimpleFontData* fontData = style()->font().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
+  const FontMetrics& fontMetrics = fontData->getFontMetrics();
 
   LayoutUnit marginStart;
   LayoutUnit marginEnd;
@@ -422,13 +437,18 @@
   }
 
   IntRect relativeRect;
+  const SimpleFontData* fontData = style()->font().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return relativeRect;
+
   switch (getListStyleCategory()) {
     case ListStyleCategory::None:
       return IntRect();
     case ListStyleCategory::Symbol: {
       // TODO(wkorman): Review and clean up/document the calculations below.
       // http://crbug.com/543193
-      const FontMetrics& fontMetrics = style()->getFontMetrics();
+      const FontMetrics& fontMetrics = fontData->getFontMetrics();
       int ascent = fontMetrics.ascent();
       int bulletWidth = (ascent * 2 / 3 + 1) / 2;
       relativeRect = IntRect(1, 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth,
@@ -436,7 +456,7 @@
     } break;
     case ListStyleCategory::Language:
       relativeRect = IntRect(0, 0, getWidthOfTextWithSuffix().toInt(),
-                             style()->font().getFontMetrics().height());
+                             fontData->getFontMetrics().height());
       break;
   }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
index 1bf8f99..76de767 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMenuList.cpp
@@ -155,7 +155,9 @@
 }
 
 void LayoutMenuList::updateInnerBlockHeight() {
-  m_innerBlockHeight = style()->getFontMetrics().height() +
+  const SimpleFontData* fontData = style()->font().primaryFont();
+  DCHECK(fontData);
+  m_innerBlockHeight = (fontData ? fontData->getFontMetrics().height() : 0) +
                        m_innerBlock->borderAndPaddingHeight();
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index d01f9f7..7e781b95 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -412,7 +412,10 @@
   return computedLogicalHeight.clampNegativeToZero();
 }
 
-void LayoutTable::layoutCaption(LayoutTableCaption& caption) {
+void LayoutTable::layoutCaption(LayoutTableCaption& caption,
+                                SubtreeLayoutScope& layouter) {
+  if (!caption.needsLayout())
+    markChildForPaginationRelayoutIfNeeded(caption, layouter);
   if (caption.needsLayout()) {
     // The margins may not be available but ensure the caption is at least
     // located beneath any previous sibling caption so that it does not
@@ -438,6 +441,20 @@
                    collapsedMarginAfterForChild(caption));
 }
 
+void LayoutTable::layoutSection(LayoutTableSection& section,
+                                SubtreeLayoutScope& layouter,
+                                LayoutUnit logicalLeft) {
+  section.setLogicalLocation(LayoutPoint(logicalLeft, logicalHeight()));
+  if (m_columnLogicalWidthChanged)
+    layouter.setChildNeedsLayout(&section);
+  if (!section.needsLayout())
+    markChildForPaginationRelayoutIfNeeded(section, layouter);
+  section.layoutIfNeeded();
+  int sectionLogicalHeight = section.calcRowLogicalHeight();
+  section.setLogicalHeight(LayoutUnit(sectionLogicalHeight));
+  setLogicalHeight(logicalHeight() + sectionLogicalHeight);
+}
+
 void LayoutTable::distributeExtraLogicalHeight(int extraLogicalHeight) {
   if (extraLogicalHeight <= 0)
     return;
@@ -513,10 +530,6 @@
 
   SubtreeLayoutScope layouter(*this);
 
-  // If any table section moved vertically, we will just issue paint
-  // invalidations for everything from that section down (it is quite unlikely
-  // that any of the following sections did not shift).
-  bool sectionMoved = false;
   {
     LayoutState state(*this, locationOffset());
     LayoutUnit oldLogicalWidth = logicalWidth();
@@ -537,48 +550,28 @@
     // if ( oldWidth != width() || columns.size() + 1 != columnPos.size() )
     m_tableLayout->layout();
 
-    LayoutUnit totalSectionLogicalHeight;
-    LayoutUnit oldTableLogicalTop;
-    for (unsigned i = 0; i < m_captions.size(); i++)
-      oldTableLogicalTop += m_captions[i]->logicalHeight() +
-                            m_captions[i]->marginBefore() +
-                            m_captions[i]->marginAfter();
-
-    bool collapsing = collapseBorders();
-
-    for (LayoutObject* child = firstChild(); child;
-         child = child->nextSibling()) {
-      if (!child->needsLayout() && child->isBox())
-        markChildForPaginationRelayoutIfNeeded(*toLayoutBox(child), layouter);
-      if (child->isTableSection()) {
-        LayoutTableSection* section = toLayoutTableSection(child);
-        if (m_columnLogicalWidthChanged)
-          layouter.setChildNeedsLayout(section);
-        section->layoutIfNeeded();
-        totalSectionLogicalHeight += section->calcRowLogicalHeight();
-        if (collapsing)
-          section->recalcOuterBorder();
-        ASSERT(!section->needsLayout());
-      } else if (child->isLayoutTableCol()) {
-        child->layoutIfNeeded();
-        ASSERT(!child->needsLayout());
-      } else {
-        // FIXME: We should never have other type of children (they should be
-        // wrapped in an anonymous table section) but our code is too crazy and
-        // this can happen in practice. Until this is fixed, let's make sure we
-        // don't leave non laid out children in the tree.
-        child->layoutIfNeeded();
-      }
+    // Lay out top captions.
+    // FIXME: Collapse caption margin.
+    for (unsigned i = 0; i < m_captions.size(); i++) {
+      if (m_captions[i]->style()->captionSide() == ECaptionSide::Bottom)
+        continue;
+      layoutCaption(*m_captions[i], layouter);
     }
 
-    // FIXME: Collapse caption margin.
-    if (!m_captions.isEmpty()) {
-      for (unsigned i = 0; i < m_captions.size(); i++) {
-        if (m_captions[i]->style()->captionSide() == ECaptionSide::Bottom)
-          continue;
-        layoutCaption(*m_captions[i]);
-      }
-      sectionMoved = logicalHeight() != oldTableLogicalTop;
+    LayoutTableSection* topSection = this->topSection();
+    LayoutTableSection* bottomSection = this->bottomSection();
+
+    // This is the border-before edge of the "table box", relative to the "table
+    // wrapper box", i.e. right after all top captions.
+    // https://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#model
+    LayoutUnit tableBoxLogicalTop = logicalHeight();
+
+    bool collapsing = collapseBorders();
+    if (collapsing) {
+      // Need to set up the table borders before we can position the sections.
+      for (LayoutTableSection* section = topSection; section;
+           section = sectionBelow(section))
+        section->recalcOuterBorder();
     }
 
     LayoutUnit borderAndPaddingBefore =
@@ -586,7 +579,39 @@
     LayoutUnit borderAndPaddingAfter =
         borderAfter() + (collapsing ? LayoutUnit() : paddingAfter());
 
-    setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
+    setLogicalHeight(tableBoxLogicalTop + borderAndPaddingBefore);
+
+    LayoutUnit sectionLogicalLeft = LayoutUnit(
+        style()->isLeftToRightDirection() ? borderStart() : borderEnd());
+    if (!collapsing) {
+      sectionLogicalLeft +=
+          style()->isLeftToRightDirection() ? paddingStart() : paddingEnd();
+    }
+
+    // Lay out table header group.
+    if (LayoutTableSection* section = header())
+      layoutSection(*section, layouter, sectionLogicalLeft);
+
+    // Lay out table body groups, and column groups.
+    for (LayoutObject* child = firstChild(); child;
+         child = child->nextSibling()) {
+      if (child->isTableSection()) {
+        if (child != header() && child != footer()) {
+          LayoutTableSection& section = *toLayoutTableSection(child);
+          layoutSection(section, layouter, sectionLogicalLeft);
+        }
+      } else if (child->isLayoutTableCol()) {
+        child->layoutIfNeeded();
+      } else {
+        DCHECK(child->isTableCaption());
+      }
+    }
+
+    // Lay out table footer.
+    if (LayoutTableSection* section = footer())
+      layoutSection(*section, layouter, sectionLogicalLeft);
+
+    setLogicalHeight(tableBoxLogicalTop + borderAndPaddingBefore);
 
     LayoutUnit computedLogicalHeight;
 
@@ -616,11 +641,16 @@
           std::max(computedLogicalHeight, computedMinLogicalHeight);
     }
 
+    LayoutUnit totalSectionLogicalHeight;
+    if (topSection) {
+      totalSectionLogicalHeight =
+          bottomSection->logicalBottom() - topSection->logicalTop();
+    }
+
     distributeExtraLogicalHeight(
         floorToInt(computedLogicalHeight - totalSectionLogicalHeight));
 
     bool isPaginated = view()->layoutState()->isPaginated();
-    LayoutTableSection* topSection = this->topSection();
     LayoutUnit logicalOffset =
         topSection ? topSection->logicalTop() : LayoutUnit();
     for (LayoutTableSection* section = topSection; section;
@@ -652,25 +682,12 @@
       setLogicalHeight(logicalHeight() + computedLogicalHeight);
     }
 
-    LayoutUnit sectionLogicalLeft = LayoutUnit(
-        style()->isLeftToRightDirection() ? borderStart() : borderEnd());
-    if (!collapsing)
-      sectionLogicalLeft +=
-          style()->isLeftToRightDirection() ? paddingStart() : paddingEnd();
-
     // position the table sections
     LayoutTableSection* section = topSection;
     while (section) {
-      if (!sectionMoved && section->logicalTop() != logicalHeight())
-        sectionMoved = true;
       section->setLogicalLocation(
           LayoutPoint(sectionLogicalLeft, logicalHeight()));
 
-      // As we may skip invalidation on the table, we need to ensure that
-      // sections are invalidated when they moved.
-      if (sectionMoved && !section->selfNeedsLayout())
-        section->setMayNeedPaintInvalidation();
-
       setLogicalHeight(logicalHeight() + section->logicalHeight());
 
       section->updateLayerTransformAfterLayout();
@@ -681,10 +698,11 @@
 
     setLogicalHeight(logicalHeight() + borderAndPaddingAfter);
 
+    // Lay out bottom captions.
     for (unsigned i = 0; i < m_captions.size(); i++) {
       if (m_captions[i]->style()->captionSide() != ECaptionSide::Bottom)
         continue;
-      layoutCaption(*m_captions[i]);
+      layoutCaption(*m_captions[i], layouter);
     }
 
     updateLogicalHeight();
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.h b/third_party/WebKit/Source/core/layout/LayoutTable.h
index bb904c8..5cc61bed 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.h
@@ -480,7 +480,10 @@
   void addOverflowFromChildren() override;
 
   void recalcSections() const;
-  void layoutCaption(LayoutTableCaption&);
+  void layoutCaption(LayoutTableCaption&, SubtreeLayoutScope&);
+  void layoutSection(LayoutTableSection&,
+                     SubtreeLayoutScope&,
+                     LayoutUnit logicalLeft);
 
   void distributeExtraLogicalHeight(int extraLogicalHeight);
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index f8802d1..f4681d9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -1183,7 +1183,8 @@
       // fragmented differently, which could change its height and thus violate
       // the requested alignment. Give up instead of risking circular
       // dependencies and unstable layout.
-      if (crossesPageBoundary(rowLogicalTop, LayoutUnit(rHeight)))
+      if (state.isPaginated() &&
+          crossesPageBoundary(rowLogicalTop, LayoutUnit(rHeight)))
         cellVerticalAlign = VerticalAlignTop;
       else
         cellVerticalAlign = cell->style()->verticalAlign();
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index 4b8ed0a4..a524f21 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1316,9 +1316,15 @@
     m_lastLineLineMinWidth = currMaxWidth;
   }
 
+  const SimpleFontData* fontData = f.primaryFont();
+  DCHECK(fontData);
+
   GlyphOverflow glyphOverflow;
-  glyphOverflow.setFromBounds(glyphBounds, f.getFontMetrics().floatAscent(),
-                              f.getFontMetrics().floatDescent(), m_maxWidth);
+  if (fontData) {
+    glyphOverflow.setFromBounds(
+        glyphBounds, fontData->getFontMetrics().floatAscent(),
+        fontData->getFontMetrics().floatDescent(), m_maxWidth);
+  }
   // We shouldn't change our mind once we "know".
   ASSERT(!m_knownToHaveNoOverflowAndNoFallbackFonts ||
          (fallbackFonts.isEmpty() && glyphOverflow.isApproximatelyZero()));
@@ -1715,6 +1721,11 @@
   if (!textLength())
     return 0;
 
+  const SimpleFontData* fontData = f.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return 0;
+
   float w;
   if (&f == &style()->font()) {
     if (!style()->preserveNewline() && !from && len == textLength()) {
@@ -1726,8 +1737,8 @@
               0, *fallbackFonts, *glyphBounds);
         else
           *glyphBounds =
-              FloatRect(0, -f.getFontMetrics().floatAscent(), m_maxWidth,
-                        f.getFontMetrics().floatHeight());
+              FloatRect(0, -fontData->getFontMetrics().floatAscent(),
+                        m_maxWidth, fontData->getFontMetrics().floatHeight());
         w = m_maxWidth;
       } else {
         w = maxLogicalWidth();
diff --git a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
index e8d3640..6b113b37 100644
--- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
+++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
@@ -253,11 +253,7 @@
       (flow.style(lineInfo.isFirstLine())->lineHeight() !=
            parent.style(lineInfo.isFirstLine())->lineHeight() ||
        flow.style()->verticalAlign() != parent.style()->verticalAlign() ||
-       !parent.style()
-            ->font()
-            .getFontMetrics()
-            .hasIdenticalAscentDescentAndLineGap(
-                flow.style()->font().getFontMetrics())))
+       !parent.style()->hasIdenticalAscentDescentAndLineGap(flow.styleRef())))
     return true;
   return false;
 }
diff --git a/third_party/WebKit/Source/core/layout/line/InlineBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineBox.cpp
index 5bd9c1c..9cf7c19 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineBox.cpp
@@ -146,21 +146,22 @@
   if (hasVirtualLogicalHeight())
     return virtualLogicalHeight();
 
-  if (getLineLayoutItem().isText())
-    return m_bitfields.isText() ? LayoutUnit(getLineLayoutItem()
-                                                 .style(isFirstLineStyle())
-                                                 ->getFontMetrics()
-                                                 .height())
-                                : LayoutUnit();
+  const SimpleFontData* fontData =
+      getLineLayoutItem().style(isFirstLineStyle())->font().primaryFont();
+  if (getLineLayoutItem().isText()) {
+    DCHECK(fontData);
+    return m_bitfields.isText() && fontData
+               ? LayoutUnit(fontData->getFontMetrics().height())
+               : LayoutUnit();
+  }
   if (getLineLayoutItem().isBox() && parent())
     return isHorizontal() ? LineLayoutBox(getLineLayoutItem()).size().height()
                           : LineLayoutBox(getLineLayoutItem()).size().width();
 
   ASSERT(isInlineFlowBox());
   LineLayoutBoxModel flowObject = boxModelObject();
-  const FontMetrics& fontMetrics =
-      getLineLayoutItem().style(isFirstLineStyle())->getFontMetrics();
-  LayoutUnit result(fontMetrics.height());
+  DCHECK(fontData);
+  LayoutUnit result(fontData ? fontData->getFontMetrics().height() : 0);
   if (parent())
     result += flowObject.borderAndPaddingLogicalHeight();
   return result;
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
index 2043c77..ab112b6 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -690,8 +690,12 @@
     FontBaseline baselineType) {
   bool isRootBox = isRootInlineBox();
   if (isRootBox) {
-    const FontMetrics& fontMetrics =
-        getLineLayoutItem().style(isFirstLineStyle())->getFontMetrics();
+    const SimpleFontData* fontData =
+        getLineLayoutItem().style(isFirstLineStyle())->font().primaryFont();
+    DCHECK(fontData);
+    if (!fontData)
+      return;
+    const FontMetrics& fontMetrics = fontData->getFontMetrics();
     // RootInlineBoxes are always placed at pixel boundaries in their logical y
     // direction. Not doing so results in incorrect layout of text decorations,
     // most notably underlines.
@@ -740,8 +744,15 @@
     LayoutUnit boxHeightIncludingMargins = boxHeight;
     LayoutUnit borderPaddingHeight;
     if (curr->isText() || curr->isInlineFlowBox()) {
-      const FontMetrics& fontMetrics =
-          curr->getLineLayoutItem().style(isFirstLineStyle())->getFontMetrics();
+      const SimpleFontData* fontData = curr->getLineLayoutItem()
+                                           .style(isFirstLineStyle())
+                                           ->font()
+                                           .primaryFont();
+      DCHECK(fontData);
+      if (!fontData)
+        continue;
+
+      const FontMetrics& fontMetrics = fontData->getFontMetrics();
       newLogicalTop += curr->baselinePosition(baselineType) -
                        fontMetrics.ascent(baselineType);
       if (curr->isInlineFlowBox()) {
diff --git a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
index 9bf22c9c..5a1625b 100644
--- a/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp
@@ -730,7 +730,12 @@
 
   if (verticalAlign != VerticalAlignBaseline) {
     const Font& font = parent.style(firstLine)->font();
-    const FontMetrics& fontMetrics = font.getFontMetrics();
+    const SimpleFontData* fontData = font.primaryFont();
+    DCHECK(fontData);
+    if (!fontData)
+      return LayoutUnit();
+
+    const FontMetrics& fontMetrics = fontData->getFontMetrics();
     int fontSize = font.getFontDescription().computedPixelSize();
 
     LineDirectionMode lineDirection =
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
index 562830e..e2292d2 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
@@ -60,7 +60,7 @@
       is_new_fc_(false) {
   physical_space_ =
       new NGPhysicalConstraintSpace(size.ConvertToPhysical(writing_mode));
-  for (const NGExclusion& exclusion : other.PhysicalSpace()->Exclusions()) {
+  for (const auto& exclusion : other.PhysicalSpace()->Exclusions()) {
     physical_space_->AddExclusion(exclusion);
   }
 }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_test.cc
index 00d9ac9..04022dd 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space_test.cc
@@ -70,8 +70,8 @@
   auto* physical_space = new NGPhysicalConstraintSpace(physical_size);
 
   // Add a 100x100 exclusion in the top right corner.
-  physical_space->AddExclusion(NGExclusion(LayoutUnit(0), LayoutUnit(600),
-                                           LayoutUnit(100), LayoutUnit(500)));
+  physical_space->AddExclusion(new NGExclusion(
+      LayoutUnit(0), LayoutUnit(600), LayoutUnit(100), LayoutUnit(500)));
 
   auto* space =
       new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space);
@@ -95,8 +95,8 @@
   auto* physical_space = new NGPhysicalConstraintSpace(physical_size);
 
   // Add a 100x100 exclusion in the top left corner.
-  physical_space->AddExclusion(NGExclusion(LayoutUnit(0), LayoutUnit(100),
-                                           LayoutUnit(100), LayoutUnit(0)));
+  physical_space->AddExclusion(new NGExclusion(LayoutUnit(0), LayoutUnit(100),
+                                               LayoutUnit(100), LayoutUnit(0)));
 
   auto* space =
       new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space);
@@ -113,70 +113,97 @@
   EXPECT_EQ("(null)", OpportunityToString(iterator->Next()));
 }
 
+// Verifies that Layout Opportunity iterator produces 7 layout opportunities
+// from 4 start points created by 2 CSS exclusions positioned in the middle of
+// the main constraint space.
+//
+// Test case visual representation:
+//
 //         100  200  300  400  500
-//     +----|----|----|----|----|----+
+//     (1)--|----|----|-(2)|----|-(3)+
 //  50 |                             |
 // 100 |                             |
 // 150 |                             |
 // 200 |       **********            |
 // 250 |       **********            |
-// 300 |                             |
+// 300 (4)                           |
 // 350 |                        ***  |
 //     +-----------------------------+
+//
+// Expected:
+//   Layout opportunity iterator generates the next opportunities:
+//   - 1st Start Point: 0,0 600x200; 0,0 150x400
+//   - 2nd Start Point: 250,0 350x350; 250,0 250x400
+//   - 3rd Start Point: 550,0 50x400
+//   - 4th Start Point: 0,300 600x50; 0,300 500x100
 TEST(NGConstraintSpaceTest, LayoutOpportunitiesTwoInMiddle) {
   NGPhysicalSize physical_size;
   physical_size.width = LayoutUnit(600);
   physical_size.height = LayoutUnit(400);
   auto* physical_space = new NGPhysicalConstraintSpace(physical_size);
 
-  // Add a 200x100 exclusion at 150x200
-  physical_space->AddExclusion(NGExclusion(LayoutUnit(200), LayoutUnit(250),
-                                           LayoutUnit(300), LayoutUnit(150)));
-  // Add a 50x50 exclusion at 500x350
-  physical_space->AddExclusion(NGExclusion(LayoutUnit(350), LayoutUnit(550),
-                                           LayoutUnit(400), LayoutUnit(500)));
+  // Add exclusions
+  physical_space->AddExclusion(new NGExclusion(
+      LayoutUnit(200), LayoutUnit(250), LayoutUnit(300), LayoutUnit(150)));
+  physical_space->AddExclusion(new NGExclusion(
+      LayoutUnit(350), LayoutUnit(550), LayoutUnit(400), LayoutUnit(500)));
 
   auto* space =
       new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space);
   bool for_inline_or_bfc = true;
   auto* iterator = space->LayoutOpportunities(NGClearNone, for_inline_or_bfc);
 
-  // First opportunity should be above the first exclusion.
+  // 1st Start point
   EXPECT_EQ("0,0 600x200", OpportunityToString(iterator->Next()));
-
-  // Second opportunity should be full height to the left.
   EXPECT_EQ("0,0 150x400", OpportunityToString(iterator->Next()));
 
-  // Third opportunity should be to the left of the first exclusion. This is a
-  // subset of the second opportunity but has a different location and might
-  // have a different alignment.
-  EXPECT_EQ("0,200 150x200", OpportunityToString(iterator->Next()));
+  // 2nd Start point
+  EXPECT_EQ("250,0 350x350", OpportunityToString(iterator->Next()));
+  EXPECT_EQ("250,0 250x400", OpportunityToString(iterator->Next()));
 
-  // Fourth opportunity should be to the right of the first exclusion extending
-  // down until the top of the second exclusion.
-  EXPECT_EQ("250,200 350x150", OpportunityToString(iterator->Next()));
+  // 3rd Start point
+  EXPECT_EQ("550,0 50x400", OpportunityToString(iterator->Next()));
 
-  // Fifth opportunity should be to the right of the first exclusion until the
-  // left edge of the second exclusion and extending all the way down.
-  EXPECT_EQ("250,200 250x200", OpportunityToString(iterator->Next()));
-
-  // Sixth opportunity should be below first exclusion with full width.
+  // 4th Start point
   EXPECT_EQ("0,300 600x50", OpportunityToString(iterator->Next()));
-
-  // Seventh opportunity should be below first exclusion until the left edge of
-  // the second exclusion extending all the way down.
   EXPECT_EQ("0,300 500x100", OpportunityToString(iterator->Next()));
 
-  // Eight exclusion should be to the left of the last exclusion.
-  EXPECT_EQ("0,350 500x50", OpportunityToString(iterator->Next()));
+  // Iterator is exhausted.
+  EXPECT_EQ("(null)", OpportunityToString(iterator->Next()));
+}
 
-  // Ninth exclusion should be to the right of the last exclusion.
-  EXPECT_EQ("550,350 50x50", OpportunityToString(iterator->Next()));
+// Verifies that Layout Opportunity iterator ignores the exclusion that is not
+// within constraint space.
+//
+// Test case visual representation:
+//
+//         100  200  300  400  500
+//     +----|----|----|----|----|----+
+//  50 |                             |
+// 100 |                             |
+//     +-----------------------------+
+//      ***  <- Exclusion
+//
+// Expected:
+//   Layout opportunity iterator generates only one opportunity that equals to
+//   available constraint space, i.e. 0,0 600x200
+TEST(NGConstraintSpaceTest, LayoutOpportunitiesWithOutOfBoundsExclusions) {
+  NGPhysicalSize physical_size;
+  physical_size.width = LayoutUnit(600);
+  physical_size.height = LayoutUnit(100);
 
-  // There should be no tenth opportunity.
+  auto* physical_space = new NGPhysicalConstraintSpace(physical_size);
+  physical_space->AddExclusion(new NGExclusion(LayoutUnit(150), LayoutUnit(100),
+                                               LayoutUnit(200), LayoutUnit(0)));
+  auto* space =
+      new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space);
+
+  bool for_inline_or_bfc = true;
+  auto* iterator = space->LayoutOpportunities(NGClearNone, for_inline_or_bfc);
+
+  EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next()));
   EXPECT_EQ("(null)", OpportunityToString(iterator->Next()));
 }
 
 }  // namespace
-
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
index a590453..7697763 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
@@ -9,219 +9,227 @@
 #include "wtf/NonCopyingSort.h"
 
 namespace blink {
+namespace {
+
+// Collects all opportunities from leaves of Layout Opportunity spatial tree.
+void CollectAllOpportunities(const NGLayoutOpportunityTreeNode* node,
+                             NGLayoutOpportunities& opportunities) {
+  if (!node)
+    return;
+  if (node->IsLeafNode())
+    opportunities.append(node->space);
+  CollectAllOpportunities(node->left, opportunities);
+  CollectAllOpportunities(node->bottom, opportunities);
+  CollectAllOpportunities(node->right, opportunities);
+}
+
+// Whether 2 edges overlap with each other.
+bool IsOverlapping(const NGEdge& edge1, const NGEdge& edge2) {
+  return std::max(edge1.start, edge2.start) <= std::min(edge1.end, edge2.end);
+}
+
+// Whether the exclusion is out of bounds of the LayoutNG constraint space.
+bool IsExclusionWithinSpace(const NGConstraintSpace& space,
+                            const NGExclusion& exclusion) {
+  LayoutUnit left = space.Offset().inline_offset;
+  LayoutUnit top = space.Offset().block_offset;
+  LayoutUnit right = left + space.Size().inline_size;
+  LayoutUnit bottom = top + space.Size().block_size;
+
+  return !(exclusion.Right() <= left || exclusion.Bottom() <= top ||
+           exclusion.Left() >= right || exclusion.Top() >= bottom);
+}
+
+// Creates the *BOTTOM* positioned Layout Opportunity tree node by splitting
+// the parent node with the exclusion.
+//
+// @param parent_node Node that needs to be split.
+// @param exclusion Exclusion existed in the parent node constraint space.
+// @return New node or nullptr if the new block size == 0.
+NGLayoutOpportunityTreeNode* CreateBottomNGLayoutOpportunityTreeNode(
+    const NGLayoutOpportunityTreeNode* parent_node,
+    const NGExclusion& exclusion) {
+  const NGConstraintSpace& parent_space = *parent_node->space;
+  LayoutUnit left = parent_space.Offset().inline_offset;
+  LayoutUnit top = exclusion.Bottom();
+  LayoutUnit right = left + parent_space.Size().inline_size;
+  LayoutUnit bottom =
+      parent_space.Offset().block_offset + parent_space.Size().block_size;
+
+  NGEdge exclusion_edge = {exclusion.Left(), exclusion.Right()};
+  LayoutUnit block_size = bottom - top;
+  if (block_size > 0) {
+    auto* space =
+        new NGConstraintSpace(parent_space, NGLogicalOffset(left, top),
+                              NGLogicalSize(right - left, block_size));
+    return new NGLayoutOpportunityTreeNode(space, exclusion_edge);
+  }
+  return nullptr;
+}
+
+// Creates the *LEFT* positioned Layout Opportunity tree node by splitting
+// the parent node with the exclusion.
+//
+// @param parent_node Node that needs to be split.
+// @param exclusion Exclusion existed in the parent node constraint space.
+// @return New node or nullptr if the new inline size == 0 or the parent's
+// exclusion edge doesn't limit the new node's constraint space.
+NGLayoutOpportunityTreeNode* CreateLeftNGLayoutOpportunityTreeNode(
+    const NGLayoutOpportunityTreeNode* parent_node,
+    const NGExclusion& exclusion) {
+  const NGConstraintSpace& parent_space = *parent_node->space;
+  LayoutUnit left = parent_space.Offset().inline_offset;
+  LayoutUnit top = parent_space.Offset().block_offset;
+  LayoutUnit right = exclusion.Left();
+  LayoutUnit bottom = top + parent_space.Size().block_size;
+
+  NGEdge node_edge = {left, right};
+  LayoutUnit inline_size = right - left;
+  if (inline_size > 0 &&
+      IsOverlapping(parent_node->exclusion_edge, node_edge)) {
+    auto* space =
+        new NGConstraintSpace(parent_space, NGLogicalOffset(left, top),
+                              NGLogicalSize(inline_size, bottom - top));
+    return new NGLayoutOpportunityTreeNode(space);
+  }
+  return nullptr;
+}
+
+// Creates the *RIGHT* positioned Layout Opportunity tree node by splitting
+// the parent node with the exclusion.
+//
+// @param parent_node Node that needs to be split.
+// @param exclusion Exclusion existed in the parent node constraint space.
+// @return New node or nullptr if the new inline size == 0 or the parent's
+// exclusion edge doesn't limit the new node's constraint space.
+NGLayoutOpportunityTreeNode* CreateRightNGLayoutOpportunityTreeNode(
+    const NGLayoutOpportunityTreeNode* parent_node,
+    const NGExclusion& exclusion) {
+  const NGConstraintSpace& parent_space = *parent_node->space;
+  LayoutUnit left = exclusion.Right();
+  LayoutUnit top = parent_space.Offset().block_offset;
+  LayoutUnit right =
+      parent_space.Offset().inline_offset + parent_space.Size().inline_size;
+  LayoutUnit bottom = top + parent_space.Size().block_size;
+
+  NGEdge node_edge = {left, right};
+  LayoutUnit inline_size = right - left;
+  if (inline_size > 0 &&
+      IsOverlapping(parent_node->exclusion_edge, node_edge)) {
+    auto* space =
+        new NGConstraintSpace(parent_space, NGLogicalOffset(left, top),
+                              NGLogicalSize(inline_size, bottom - top));
+    return new NGLayoutOpportunityTreeNode(space);
+  }
+  return nullptr;
+}
+
+// Gets/Creates the "TOP" positioned constraint space by splitting
+// the parent node with the exclusion.
+//
+// @param parent_node Node that needs to be split.
+// @param exclusion Exclusion existed in the parent node constraint space.
+// @return New node or nullptr if the new block size == 0.
+NGConstraintSpace* GetTopSpace(const NGConstraintSpace& space,
+                               const NGExclusion& exclusion) {
+  LayoutUnit left = space.Offset().inline_offset;
+  LayoutUnit top = space.Offset().block_offset;
+  LayoutUnit right = left + space.Size().inline_size;
+  LayoutUnit bottom = exclusion.Top();
+
+  LayoutUnit block_size = bottom - top;
+  if (block_size > 0)
+    return new NGConstraintSpace(space, NGLogicalOffset(left, top),
+                                 NGLogicalSize(right - left, block_size));
+  return nullptr;
+}
+
+// Inserts the exclusion into the Layout Opportunity tree.
+void InsertExclusion(NGLayoutOpportunityTreeNode* node,
+                     const NGExclusion* exclusion,
+                     NGLayoutOpportunities& opportunities) {
+  // Base case: exclusion is not in the node's constraint space.
+  if (!IsExclusionWithinSpace(*node->space, *exclusion))
+    return;
+
+  if (node->exclusion) {
+    InsertExclusion(node->left, exclusion, opportunities);
+    InsertExclusion(node->bottom, exclusion, opportunities);
+    InsertExclusion(node->right, exclusion, opportunities);
+    return;
+  }
+
+  // Split the current node.
+  node->left = CreateLeftNGLayoutOpportunityTreeNode(node, *exclusion);
+  node->right = CreateRightNGLayoutOpportunityTreeNode(node, *exclusion);
+  node->bottom = CreateBottomNGLayoutOpportunityTreeNode(node, *exclusion);
+
+  if (auto* topSpace = GetTopSpace(*node->space, *exclusion))
+    opportunities.append(topSpace);
+  node->exclusion = exclusion;
+}
+
+// Compares exclusions by their top position.
+bool CompareNGExclusionsByTopAsc(const Member<const NGExclusion>& lhs,
+                                 const Member<const NGExclusion>& rhs) {
+  return rhs->Top() > lhs->Top();
+}
+
+// Compares Layout Opportunities by Start Point.
+// Start point is a TopLeft position from where inline content can potentially
+// start positioning itself.
+bool CompareNGLayoutOpportunitesByStartPoint(
+    const Member<const NGLayoutOpportunity>& lhs,
+    const Member<const NGLayoutOpportunity>& rhs) {
+  // sort by TOP.
+  if (rhs->Offset().block_offset > lhs->Offset().block_offset) {
+    return true;
+  }
+  if (rhs->Offset().block_offset < lhs->Offset().block_offset) {
+    return false;
+  }
+
+  // TOP is the same -> Sort by LEFT
+  if (rhs->Offset().inline_offset > lhs->Offset().inline_offset) {
+    return true;
+  }
+  if (rhs->Offset().inline_offset < lhs->Offset().inline_offset) {
+    return false;
+  }
+
+  // TOP and LEFT are the same -> Sort by width
+  return rhs->Size().inline_size < lhs->Size().inline_size;
+}
+
+}  // namespace
 
 NGLayoutOpportunityIterator::NGLayoutOpportunityIterator(
     NGConstraintSpace* space,
     unsigned clear,
     bool for_inline_or_bfc)
-    : constraint_space_(space),
-      clear_(clear),
-      for_inline_or_bfc_(for_inline_or_bfc),
-      current_x_(0),
-      current_y_(0) {
-  FilterExclusions();
-  if (!IsValidPosition())
-    NextPosition();
-  ComputeOpportunitiesForPosition();
-}
+    : constraint_space_(space) {
+  // TODO(chrome-layout-team): Combine exclusions that shadow each other.
+  auto exclusions = constraint_space_->PhysicalSpace()->Exclusions();
+  DCHECK(std::is_sorted(exclusions.begin(), exclusions.end(),
+                        &CompareNGExclusionsByTopAsc))
+      << "Exclusions are expected to be sorted by TOP";
 
-static inline bool AscendingTopLeftCompare(const NGExclusion& a,
-                                           const NGExclusion& b) {
-  if (a.Top() < b.Top())
-    return true;
-  if (a.Top() > b.Top())
-    return false;
-  return a.Left() < b.Left();
-}
-
-void NGLayoutOpportunityIterator::FilterExclusions() {
-  filtered_exclusions_.clear();
-  for (const auto& item : constraint_space_->PhysicalSpace()->Exclusions())
-    filtered_exclusions_.append(item);
-  nonCopyingSort(filtered_exclusions_.begin(), filtered_exclusions_.end(),
-                 AscendingTopLeftCompare);
-
-  // TODO(eae): Writing modes.
-  LayoutUnit left = constraint_space_->Offset().inline_offset;
-  LayoutUnit top = constraint_space_->Offset().block_offset;
-  LayoutUnit right = left + constraint_space_->Size().inline_size;
-  LayoutUnit bottom = top + constraint_space_->Size().block_size;
-
-  size_t i = filtered_exclusions_.size();
-  while (i--) {
-    const NGExclusion& exclusion = filtered_exclusions_[i];
-
-    // Remove items fully outside the view of the current constraint space.
-    if (exclusion.Right() < left || exclusion.Bottom() < top ||
-        exclusion.Left() > right || exclusion.Top() > bottom)
-      filtered_exclusions_.remove(i);
+  opportunity_tree_root_ = new NGLayoutOpportunityTreeNode(space);
+  for (const auto exclusion : exclusions) {
+    InsertExclusion(opportunity_tree_root_, exclusion, opportunities_);
   }
+  CollectAllOpportunities(opportunity_tree_root_, opportunities_);
+  std::sort(opportunities_.begin(), opportunities_.end(),
+            &CompareNGLayoutOpportunitesByStartPoint);
+  opportunity_iter_ = opportunities_.begin();
 }
 
-NGConstraintSpace* NGLayoutOpportunityIterator::Next() {
-  if (current_opportunities_.isEmpty() && NextPosition())
-    ComputeOpportunitiesForPosition();
-
-  if (!current_opportunities_.isEmpty()) {
-    NGConstraintSpace* opportunity = current_opportunities_.last();
-    current_opportunities_.removeLast();
-    return opportunity;
-  }
-
-  return nullptr;
-}
-
-static inline bool DescendingWidthCompare(const NGConstraintSpace* a,
-                                          const NGConstraintSpace* b) {
-  return a->Size().inline_size < b->Size().inline_size;
-}
-
-bool NGLayoutOpportunityIterator::NextPosition() {
-  LayoutUnit right = constraint_space_->Size().inline_size;
-  LayoutUnit bottom = constraint_space_->Size().block_size;
-
-  while (current_y_ < bottom) {
-    // Try to find a start position to the right of the current position by
-    // identifying the leftmost applicable right edge.
-    LayoutUnit minRight = right;
-    for (const NGExclusion& exclusion : filtered_exclusions_) {
-      if (exclusion.Top() <= current_y_ && exclusion.Bottom() > current_y_ &&
-          exclusion.Right() > current_x_ && exclusion.Right() < minRight)
-        minRight = exclusion.Right();
-    }
-    current_x_ = minRight;
-
-    // If no valid position was found to the right move down to the next "line".
-    // Reset current_x_ and set current_y_ to the top of the next exclusion down
-    // or the bottom of the closest exclusion, whichever is closest.
-    if (current_x_ == right) {
-      LayoutUnit minBottom = bottom;
-      for (const NGExclusion& exclusion : filtered_exclusions_) {
-        if (exclusion.Top() > current_y_ && exclusion.Top() < minBottom)
-          minBottom = exclusion.Top();
-        if (exclusion.Bottom() > current_y_ && exclusion.Bottom() < minBottom)
-          minBottom = exclusion.Bottom();
-      }
-      current_x_ = LayoutUnit();
-      current_y_ = minBottom;
-    }
-    if (IsValidPosition())
-      return true;
-  }
-
-  return false;
-}
-
-// Checks whether the current position is within an exclusion.
-bool NGLayoutOpportunityIterator::IsValidPosition() {
-  for (const NGExclusion& exclusion : filtered_exclusions_) {
-    if (exclusion.Top() >= current_y_ && exclusion.Bottom() < current_y_ &&
-        exclusion.Left() >= current_x_ && exclusion.Right() < current_x_) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-void NGLayoutOpportunityIterator::FilterForPosition(Vector<NGExclusion>& out) {
-  out.clear();
-  for (const auto& item : filtered_exclusions_)
-    out.append(item);
-  nonCopyingSort(out.begin(), out.end(), AscendingTopLeftCompare);
-
-  size_t len = out.size();
-  for (size_t i = 0; i < len; i++) {
-    const NGExclusion& exclusion = out[i];
-
-    // Remove items above OR to the left of the start offset as they have no
-    // effect on layout opportunities within this view.
-    if (exclusion.Right() <= current_x_ || exclusion.Bottom() <= current_y_) {
-      out.remove(i);
-      len--;
-      continue;
-    }
-
-    // Remove items below AND to the right of the current exclusions as they're
-    // occluded and won't affect the layout opportunities.
-    for (size_t j = out.size() - 1; j > i; j--) {
-      const NGExclusion& item = out[j];
-      if (item.Top() > exclusion.Top() && item.Left() >= exclusion.Left()) {
-        out.remove(j);
-        len--;
-      }
-    }
-  }
-}
-
-void NGLayoutOpportunityIterator::ComputeOpportunitiesForPosition() {
-  current_opportunities_.clear();
-
-  Vector<NGExclusion> exclusions_for_position;
-  FilterForPosition(exclusions_for_position);
-
-  // TODO(eae): Filter based on clear_ and for_inline_or_bfc_. Return early for
-  // now to make it clear neither are supported yet.
-  if (clear_ != NGClearNone || !for_inline_or_bfc_) {
-    return;
-  }
-
-  // TODO(eae): Writing modes.
-  LayoutUnit left = current_x_;
-  LayoutUnit top = current_y_;
-  LayoutUnit right = constraint_space_->Size().inline_size;
-  LayoutUnit bottom = constraint_space_->Size().block_size;
-
-  // Compute opportunity for the full width from the start position to the right
-  // edge of the NGConstraintSpace.
-  LayoutUnit opportunityHeight =
-      heightForOpportunity(exclusions_for_position, left, top, right, bottom);
-  if (opportunityHeight && right > left)
-    addLayoutOpportunity(left, top, right, opportunityHeight + top);
-
-  // Compute the maximum available height between the current position and the
-  // left edge of each exclusion. The distance between the current horizontal
-  // position and the left edge of the exclusion determines the width of the
-  // opportunity.
-  for (const NGExclusion& exclusion : exclusions_for_position) {
-    if (exclusion.Right() > current_x_ && exclusion.Bottom() > current_y_) {
-      opportunityHeight = heightForOpportunity(exclusions_for_position, left,
-                                               top, exclusion.Left(), bottom);
-      if (opportunityHeight && exclusion.Left() > left)
-        addLayoutOpportunity(left, top, exclusion.Left(),
-                             opportunityHeight + top);
-    }
-  }
-
-  nonCopyingSort(current_opportunities_.begin(), current_opportunities_.end(),
-                 DescendingWidthCompare);
-}
-
-// For the given 2D range (opportunity), this will return a height which makes
-// it bounded by the highest exclusion in the filtered exclusion list within the
-// range. Returns 0-height for an invalid opportunity (which has zero area).
-LayoutUnit NGLayoutOpportunityIterator::heightForOpportunity(
-    const Vector<NGExclusion>& exclusions_for_position,
-    LayoutUnit left,
-    LayoutUnit top,
-    LayoutUnit right,
-    LayoutUnit bottom) {
-  LayoutUnit lowestBottom = bottom;
-  for (const NGExclusion& exclusion : exclusions_for_position) {
-    if (exclusion.Left() < right && exclusion.Right() > left &&
-        exclusion.Bottom() > top && exclusion.Top() <= lowestBottom)
-      lowestBottom = exclusion.Top();
-  }
-  return std::max(lowestBottom - top, LayoutUnit());
-}
-
-void NGLayoutOpportunityIterator::addLayoutOpportunity(LayoutUnit left,
-                                                       LayoutUnit top,
-                                                       LayoutUnit right,
-                                                       LayoutUnit bottom) {
-  current_opportunities_.append(
-      new NGConstraintSpace(*constraint_space_, NGLogicalOffset(left, top),
-                            NGLogicalSize(right - left, bottom - top)));
+const NGConstraintSpace* NGLayoutOpportunityIterator::Next() {
+  if (opportunity_iter_ == opportunities_.end())
+    return nullptr;
+  auto* opportunity = opportunity_iter_->get();
+  opportunity_iter_++;
+  return opportunity;
 }
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.h
index ddcc899..58040ac 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.h
@@ -7,51 +7,40 @@
 
 #include "core/CoreExport.h"
 #include "core/layout/ng/ng_constraint_space.h"
+#include "core/layout/ng/ng_layout_opportunity_tree_node.h"
+#include "core/layout/ng/ng_units.h"
 #include "platform/heap/Handle.h"
 #include "wtf/text/WTFString.h"
 #include "wtf/Vector.h"
 
 namespace blink {
 
+typedef const NGConstraintSpace NGLayoutOpportunity;
+typedef HeapVector<Member<const NGLayoutOpportunity>> NGLayoutOpportunities;
+
 class CORE_EXPORT NGLayoutOpportunityIterator final
-    : public GarbageCollectedFinalized<NGLayoutOpportunityIterator> {
+    : public GarbageCollected<NGLayoutOpportunityIterator> {
  public:
   NGLayoutOpportunityIterator(NGConstraintSpace* space,
                               unsigned clear,
                               bool for_inline_or_bfc);
-  ~NGLayoutOpportunityIterator() {}
 
-  NGConstraintSpace* Next();
+  // Gets the next Layout Opportunity or nullptr if the search is exhausted.
+  // TODO(chrome-layout-team): Refactor with using C++ <iterator> library.
+  NGLayoutOpportunity* Next();
 
   DEFINE_INLINE_VIRTUAL_TRACE() {
     visitor->trace(constraint_space_);
-    visitor->trace(current_opportunities_);
+    visitor->trace(opportunities_);
+    visitor->trace(opportunity_tree_root_);
   }
 
  private:
-  void FilterExclusions();
-  bool NextPosition();
-  bool IsValidPosition();
-  void FilterForPosition(Vector<NGExclusion>&);
-  void ComputeOpportunitiesForPosition();
-  LayoutUnit heightForOpportunity(const Vector<NGExclusion>&,
-                                  LayoutUnit left,
-                                  LayoutUnit top,
-                                  LayoutUnit right,
-                                  LayoutUnit bottom);
-  void addLayoutOpportunity(LayoutUnit left,
-                            LayoutUnit top,
-                            LayoutUnit right,
-                            LayoutUnit bottom);
-
   Member<NGConstraintSpace> constraint_space_;
-  unsigned clear_;
-  bool for_inline_or_bfc_;
-  Vector<NGExclusion> filtered_exclusions_;
-  HeapVector<Member<NGConstraintSpace>> current_opportunities_;
 
-  LayoutUnit current_x_;
-  LayoutUnit current_y_;
+  NGLayoutOpportunities opportunities_;
+  Vector<Member<NGLayoutOpportunity>>::const_iterator opportunity_iter_;
+  Member<NGLayoutOpportunityTreeNode> opportunity_tree_root_;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_tree_node.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_tree_node.h
new file mode 100644
index 0000000..e3947244
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_tree_node.h
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NGLayoutOpportunityTreeNode_h
+#define NGLayoutOpportunityTreeNode_h
+
+#include "platform/heap/Handle.h"
+#include "core/layout/ng/ng_units.h"
+
+namespace blink {
+
+// 3 node R-Tree that represents available space(left, bottom, right) or
+// layout opportunity after the parent spatial rectangle is split by the
+// exclusion rectangle.
+struct NGLayoutOpportunityTreeNode
+    : public GarbageCollected<NGLayoutOpportunityTreeNode> {
+  // Default constructor.
+  // Creates a Layout Opportunity tree node that is limited by it's own edge
+  // from above.
+  // @param space Constraint space associated with this node.
+  NGLayoutOpportunityTreeNode(const NGConstraintSpace* space) : space(space) {
+    exclusion_edge.start = space->Offset().inline_offset;
+    exclusion_edge.end = exclusion_edge.start + space->Size().inline_size;
+  }
+
+  // Constructor that creates a node with explicitly set exclusion edge.
+  // @param space Constraint space associated with this node.
+  // @param exclusion_edge Edge that limits this node's space from above.
+  NGLayoutOpportunityTreeNode(NGConstraintSpace* space, NGEdge exclusion_edge)
+      : space(space), exclusion_edge(exclusion_edge) {}
+
+  // Constraint space that is associated with this node.
+  Member<const NGConstraintSpace> space;
+
+  // Children of the node.
+  Member<NGLayoutOpportunityTreeNode> left;
+  Member<NGLayoutOpportunityTreeNode> bottom;
+  Member<NGLayoutOpportunityTreeNode> right;
+
+  // Exclusion that split apart this layout opportunity.
+  Member<const NGExclusion> exclusion;
+
+  // Edge that limits this layout opportunity from above.
+  NGEdge exclusion_edge;
+
+  // Whether this node is a leaf node.
+  // The node is a leaf if it doen't have an exclusion that splits it apart.
+  bool IsLeafNode() const { return !exclusion; }
+
+  DEFINE_INLINE_TRACE() {
+    visitor->trace(space);
+    visitor->trace(left);
+    visitor->trace(bottom);
+    visitor->trace(right);
+    visitor->trace(exclusion);
+  }
+};
+
+}  // namespace blink
+#endif  // NGLayoutOpportunityTreeNode_h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.cc
index 1b24d8c..3d2b96796 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.cc
@@ -24,13 +24,13 @@
       width_direction_fragmentation_type_(FragmentNone),
       height_direction_fragmentation_type_(FragmentNone) {}
 
-void NGPhysicalConstraintSpace::AddExclusion(const NGExclusion exclusion,
+void NGPhysicalConstraintSpace::AddExclusion(const NGExclusion* exclusion,
                                              unsigned options) {
   exclusions_.append(exclusion);
 }
 
-const Vector<NGExclusion>& NGPhysicalConstraintSpace::Exclusions(
-    unsigned options) const {
+const HeapVector<Member<const NGExclusion>>&
+NGPhysicalConstraintSpace::Exclusions(unsigned options) const {
   // TODO(layout-ng): Filter based on options? Perhaps layout Opportunities
   // should filter instead?
   return exclusions_;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.h b/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.h
index 15a7c7c..de9b943 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_constraint_space.h
@@ -27,7 +27,7 @@
   FragmentRegion
 };
 
-struct NGExclusion {
+struct NGExclusion : public GarbageCollected<NGExclusion> {
   NGExclusion(LayoutUnit top,
               LayoutUnit right,
               LayoutUnit bottom,
@@ -41,6 +41,7 @@
   LayoutUnit Right() const { return rect.size.width + rect.location.left; }
   LayoutUnit Bottom() const { return rect.size.height + rect.location.top; }
   LayoutUnit Left() const { return rect.location.left; }
+
   String ToString() const {
     return String::format("%s,%s %sx%s",
                           rect.location.left.toString().ascii().data(),
@@ -49,6 +50,8 @@
                           rect.size.height.toString().ascii().data());
   }
   NGPhysicalRect rect;
+
+  DEFINE_INLINE_TRACE() {}
 };
 
 // The NGPhysicalConstraintSpace contains the underlying data for the
@@ -62,10 +65,11 @@
 
   NGPhysicalSize ContainerSize() const { return container_size_; }
 
-  void AddExclusion(const NGExclusion, unsigned options = 0);
-  const Vector<NGExclusion>& Exclusions(unsigned options = 0) const;
+  void AddExclusion(const NGExclusion*, unsigned options = 0);
+  const HeapVector<Member<const NGExclusion>>& Exclusions(
+      unsigned options = 0) const;
 
-  DEFINE_INLINE_TRACE() {}
+  DEFINE_INLINE_TRACE() { visitor->trace(exclusions_); }
 
  private:
   friend class NGConstraintSpace;
@@ -79,7 +83,7 @@
   unsigned width_direction_fragmentation_type_ : 2;
   unsigned height_direction_fragmentation_type_ : 2;
 
-  Vector<NGExclusion> exclusions_;
+  HeapVector<Member<const NGExclusion>> exclusions_;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_units.h b/third_party/WebKit/Source/core/layout/ng/ng_units.h
index 4554182..0d1e37c 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.h
@@ -158,6 +158,12 @@
   return stream << value.ToString();
 }
 
+// Struct to represent a simple edge that has start and end.
+struct NGEdge {
+  LayoutUnit start;
+  LayoutUnit end;
+};
+
 }  // namespace blink
 
 #endif  // NGUnits_h
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
index 126a293f..1366c87c9 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp
@@ -151,8 +151,11 @@
     return createPositionWithAffinity(0);
 
   ASSERT(m_scalingFactor);
+
+  const SimpleFontData* fontData = m_scaledFont.primaryFont();
+  DCHECK(fontData);
   float baseline =
-      m_scaledFont.getFontMetrics().floatAscent() / m_scalingFactor;
+      fontData ? fontData->getFontMetrics().floatAscent() / m_scalingFactor : 0;
 
   LayoutBlock* containingBlock = this->containingBlock();
   ASSERT(containingBlock);
@@ -287,8 +290,13 @@
       scaledFont().individualCharacterRanges(run);
   synthesizeGraphemeWidths(run, charRanges);
 
+  const SimpleFontData* fontData = scaledFont().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
+
   const float cachedFontHeight =
-      scaledFont().getFontMetrics().floatHeight() / m_scalingFactor;
+      fontData->getFontMetrics().floatHeight() / m_scalingFactor;
   const bool preserveWhiteSpace = styleRef().whiteSpace() == PRE;
   const unsigned runLength = run.length();
 
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
index 0a91c0cd..c5d87328 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp
@@ -125,9 +125,14 @@
   const Font& scaledFont = textLineLayout.scaledFont();
   FloatRect glyphOverflowBounds;
 
+  const SimpleFontData* fontData = scaledFont.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
+
   float width = scaledFont.width(run, nullptr, &glyphOverflowBounds);
-  float ascent = scaledFont.getFontMetrics().floatAscent();
-  float descent = scaledFont.getFontMetrics().floatDescent();
+  float ascent = fontData->getFontMetrics().floatAscent();
+  float descent = fontData->getFontMetrics().floatDescent();
   m_currentTextFragment.glyphOverflow.setFromBounds(glyphOverflowBounds, ascent,
                                                     descent, width);
   m_currentTextFragment.glyphOverflow.top /= scalingFactor;
@@ -135,7 +140,7 @@
   m_currentTextFragment.glyphOverflow.right /= scalingFactor;
   m_currentTextFragment.glyphOverflow.bottom /= scalingFactor;
 
-  float height = scaledFont.getFontMetrics().floatHeight();
+  float height = fontData->getFontMetrics().floatHeight();
   m_currentTextFragment.height = height / scalingFactor;
   m_currentTextFragment.width = width / scalingFactor;
 }
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
index 5467d5df..560d9716 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp
@@ -34,16 +34,21 @@
 float SVGTextLayoutEngineBaseline::calculateBaselineShift(
     const ComputedStyle& style) const {
   const SVGComputedStyle& svgStyle = style.svgStyle();
+  const SimpleFontData* fontData = m_font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return 0;
 
+  DCHECK(m_effectiveZoom);
   switch (svgStyle.baselineShift()) {
     case BS_LENGTH:
       return SVGLengthContext::valueForLength(
           svgStyle.baselineShiftValue(), style,
           m_font.getFontDescription().computedPixelSize() / m_effectiveZoom);
     case BS_SUB:
-      return -m_font.getFontMetrics().floatHeight() / 2 / m_effectiveZoom;
+      return -fontData->getFontMetrics().floatHeight() / 2 / m_effectiveZoom;
     case BS_SUPER:
-      return m_font.getFontMetrics().floatHeight() / 2 / m_effectiveZoom;
+      return fontData->getFontMetrics().floatHeight() / 2 / m_effectiveZoom;
     default:
       ASSERT_NOT_REACHED();
       return 0;
@@ -121,7 +126,12 @@
     ASSERT(baseline != AB_AUTO && baseline != AB_BASELINE);
   }
 
-  const FontMetrics& fontMetrics = m_font.getFontMetrics();
+  const SimpleFontData* fontData = m_font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return 0;
+
+  const FontMetrics& fontMetrics = fontData->getFontMetrics();
   float ascent = fontMetrics.floatAscent() / m_effectiveZoom;
   float descent = fontMetrics.floatDescent() / m_effectiveZoom;
   float xheight = fontMetrics.xHeight() / m_effectiveZoom;
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp b/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
index 9669d3e5..5501541 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp
@@ -466,10 +466,14 @@
     int startPosition) {
   const float scalingFactor = queryData->textLineLayout.scalingFactor();
   ASSERT(scalingFactor);
-  const float baseline =
-      queryData->textLineLayout.scaledFont().getFontMetrics().floatAscent() /
-      scalingFactor;
+  const SimpleFontData* fontData =
+      queryData->textLineLayout.scaledFont().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return FloatRect();
 
+  const float baseline =
+      fontData->getFontMetrics().floatAscent() / scalingFactor;
   float glyphOffsetInDirection =
       calculateGlyphRange(queryData, fragment, 0, startPosition);
   FloatPoint glyphPosition = logicalGlyphPositionToPhysical(
@@ -566,9 +570,15 @@
 
   const float scalingFactor = data->textLineLayout.scalingFactor();
   ASSERT(scalingFactor);
+
+  const SimpleFontData* fontData =
+      data->textLineLayout.scaledFont().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return false;
+
   const float baseline =
-      data->textLineLayout.scaledFont().getFontMetrics().floatAscent() /
-      scalingFactor;
+      fontData->getFontMetrics().floatAscent() / scalingFactor;
 
   // Test the query point against the bounds of the entire fragment first.
   if (!fragment.boundingBox(baseline).contains(data->position))
diff --git a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
index 966ec7c..7c0eb62 100644
--- a/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp
@@ -112,7 +112,12 @@
   ASSERT(scalingFactor);
 
   const Font& scaledFont = lineLayoutItem.scaledFont();
-  const FontMetrics& scaledFontMetrics = scaledFont.getFontMetrics();
+  const SimpleFontData* fontData = scaledFont.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return FloatRect();
+
+  const FontMetrics& scaledFontMetrics = fontData->getFontMetrics();
   FloatPoint textOrigin(fragment.x, fragment.y);
   if (scalingFactor != 1)
     textOrigin.scale(scalingFactor, scalingFactor);
@@ -257,11 +262,14 @@
 LayoutRect SVGInlineTextBox::calculateBoundaries() const {
   LineLayoutSVGInlineText lineLayoutItem =
       LineLayoutSVGInlineText(this->getLineLayoutItem());
+  const SimpleFontData* fontData = lineLayoutItem.scaledFont().primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return LayoutRect();
+
   float scalingFactor = lineLayoutItem.scalingFactor();
   ASSERT(scalingFactor);
-  LayoutUnit baseline(
-      lineLayoutItem.scaledFont().getFontMetrics().floatAscent() /
-      scalingFactor);
+  LayoutUnit baseline(fontData->getFontMetrics().floatAscent() / scalingFactor);
 
   LayoutRect textBoundingRect;
   for (const SVGTextFragment& fragment : m_textFragments)
@@ -296,11 +304,15 @@
       if (locationInContainer.intersects(rect)) {
         LineLayoutSVGInlineText lineLayoutItem =
             LineLayoutSVGInlineText(this->getLineLayoutItem());
-        ASSERT(lineLayoutItem.scalingFactor());
-        float baseline =
-            lineLayoutItem.scaledFont().getFontMetrics().floatAscent() /
-            lineLayoutItem.scalingFactor();
+        const SimpleFontData* fontData =
+            lineLayoutItem.scaledFont().primaryFont();
+        DCHECK(fontData);
+        if (!fontData)
+          return false;
 
+        DCHECK(lineLayoutItem.scalingFactor());
+        float baseline = fontData->getFontMetrics().floatAscent() /
+                         lineLayoutItem.scalingFactor();
         FloatPoint floatLocation = FloatPoint(locationInContainer.point());
         for (const SVGTextFragment& fragment : m_textFragments) {
           FloatQuad fragmentQuad = fragment.boundingQuad(baseline);
diff --git a/third_party/WebKit/Source/core/paint/EllipsisBoxPainter.cpp b/third_party/WebKit/Source/core/paint/EllipsisBoxPainter.cpp
index 021f5bc..28aa709d 100644
--- a/third_party/WebKit/Source/core/paint/EllipsisBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/EllipsisBoxPainter.cpp
@@ -58,13 +58,17 @@
     context.concatCTM(TextPainter::rotation(boxRect, TextPainter::Clockwise));
 
   const Font& font = style.font();
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
 
   TextPainter::Style textStyle = TextPainter::textPaintingStyle(
       m_ellipsisBox.getLineLayoutItem(), style, paintInfo);
   TextRun textRun = constructTextRun(font, m_ellipsisBox.ellipsisStr(), style,
                                      TextRun::AllowTrailingExpansion);
   LayoutPoint textOrigin(boxOrigin.x(),
-                         boxOrigin.y() + font.getFontMetrics().ascent());
+                         boxOrigin.y() + fontData->getFontMetrics().ascent());
   TextPainter textPainter(context, font, textRun, textOrigin, boxRect,
                           m_ellipsisBox.isHorizontal());
   textPainter.paint(0, m_ellipsisBox.ellipsisStr().length(),
diff --git a/third_party/WebKit/Source/core/paint/EmbeddedObjectPainter.cpp b/third_party/WebKit/Source/core/paint/EmbeddedObjectPainter.cpp
index 4af07c8..dadad9ff 100644
--- a/third_party/WebKit/Source/core/paint/EmbeddedObjectPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/EmbeddedObjectPainter.cpp
@@ -54,13 +54,14 @@
   context.clip(pixelSnappedIntRect(contentRect));
 
   Font font = replacementTextFont();
-  // TODO(trchen): Speculative fix for crbug.com/481880
-  // With last resort font, how could this ever be null?
-  ASSERT(font.primaryFont());
-  if (!font.primaryFont())
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
     return;
+
   TextRun textRun(m_layoutEmbeddedObject.unavailablePluginReplacementText());
-  FloatSize textGeometry(font.width(textRun), font.getFontMetrics().height());
+  FloatSize textGeometry(font.width(textRun),
+                         fontData->getFontMetrics().height());
 
   LayoutRect backgroundRect(
       0, 0,
@@ -84,7 +85,7 @@
   context.setFillColor(scaleAlpha(Color::black, replacementTextTextOpacity));
   context.drawBidiText(
       font, runInfo,
-      textRect.location() + FloatSize(0, font.getFontMetrics().ascent()));
+      textRect.location() + FloatSize(0, fontData->getFontMetrics().ascent()));
 }
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/FileUploadControlPainter.cpp b/third_party/WebKit/Source/core/paint/FileUploadControlPainter.cpp
index 8a48617..0dab0a9 100644
--- a/third_party/WebKit/Source/core/paint/FileUploadControlPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/FileUploadControlPainter.cpp
@@ -83,13 +83,15 @@
       textY = LayoutUnit(m_layoutFileUploadControl.baselinePosition(
           AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine));
     TextRunPaintInfo textRunPaintInfo(textRun);
+
+    const SimpleFontData* fontData =
+        m_layoutFileUploadControl.style()->font().primaryFont();
+    if (!fontData)
+      return;
     // FIXME: Shouldn't these offsets be rounded? crbug.com/350474
     textRunPaintInfo.bounds = FloatRect(
-        textX.toFloat(),
-        textY.toFloat() -
-            m_layoutFileUploadControl.style()->getFontMetrics().ascent(),
-        textWidth,
-        m_layoutFileUploadControl.style()->getFontMetrics().height());
+        textX.toFloat(), textY.toFloat() - fontData->getFontMetrics().ascent(),
+        textWidth, fontData->getFontMetrics().height());
 
     // Draw the filename.
     LayoutObjectDrawingRecorder recorder(
diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
index c38e8de..fd507fe 100644
--- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
@@ -185,9 +185,11 @@
 
   // Set our font.
   const Font& font = styleToUse.font();
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
 
-  LayoutPoint textOrigin(boxOrigin.x(),
-                         boxOrigin.y() + font.getFontMetrics().ascent());
+  int ascent = fontData ? fontData->getFontMetrics().ascent() : 0;
+  LayoutPoint textOrigin(boxOrigin.x(), boxOrigin.y() + ascent);
 
   // 1. Paint backgrounds behind text if needed. Examples of such backgrounds
   // include selection and composition highlights.
@@ -552,10 +554,14 @@
   // place the underline at the bottom of the text, but in larger fonts that's
   // not so good so we pin to two pixels under the baseline.
   int lineThickness = misspellingLineThickness;
-  int baseline = m_inlineTextBox.getLineLayoutItem()
-                     .style(m_inlineTextBox.isFirstLineStyle())
-                     ->getFontMetrics()
-                     .ascent();
+
+  const SimpleFontData* fontData =
+      m_inlineTextBox.getLineLayoutItem()
+          .style(m_inlineTextBox.isFirstLineStyle())
+          ->font()
+          .primaryFont();
+  DCHECK(fontData);
+  int baseline = fontData ? fontData->getFontMetrics().ascent() : 0;
   int descent = (m_inlineTextBox.logicalHeight() - baseline).toInt();
   int underlineOffset;
   if (descent <= (lineThickness + 2)) {
@@ -953,7 +959,9 @@
 
   const ComputedStyle& styleToUse =
       textBoxLayoutObject.styleRef(m_inlineTextBox.isFirstLineStyle());
-  float baseline = styleToUse.getFontMetrics().ascent();
+  const SimpleFontData* fontData = styleToUse.font().primaryFont();
+  DCHECK(fontData);
+  float baseline = fontData ? fontData->getFontMetrics().ascent() : 0;
 
   // Set the thick of the line to be 10% (or something else ?)of the computed
   // font size and not less than 1px.  Using computedFontSize should take care
@@ -961,9 +969,12 @@
 
   // Update Underline thickness, in case we have Faulty Font Metrics calculating
   // underline thickness by old method.
-  float textDecorationThickness =
-      styleToUse.getFontMetrics().underlineThickness();
-  int fontHeightInt = (int)(styleToUse.getFontMetrics().floatHeight() + 0.5);
+  float textDecorationThickness = 0.0;
+  int fontHeightInt = 0;
+  if (fontData) {
+    textDecorationThickness = fontData->getFontMetrics().underlineThickness();
+    fontHeightInt = (int)(fontData->getFontMetrics().floatHeight() + 0.5);
+  }
   if ((textDecorationThickness == 0.f) ||
       (textDecorationThickness >= (fontHeightInt >> 1)))
     textDecorationThickness =
@@ -977,9 +988,9 @@
   // Offset between lines - always non-zero, so lines never cross each other.
   float doubleOffset = textDecorationThickness + 1.f;
 
-  if (deco & TextDecorationUnderline) {
+  if ((deco & TextDecorationUnderline) && fontData) {
     const int underlineOffset = computeUnderlineOffset(
-        styleToUse.getTextUnderlinePosition(), styleToUse.getFontMetrics(),
+        styleToUse.getTextUnderlinePosition(), fontData->getFontMetrics(),
         &m_inlineTextBox, textDecorationThickness);
     paintAppliedDecoration(
         context, FloatPoint(localOrigin) + FloatPoint(0, underlineOffset),
@@ -1053,10 +1064,13 @@
   // thick.  If there's not enough space the underline will touch or overlap
   // characters.
   int lineThickness = 1;
-  int baseline = m_inlineTextBox.getLineLayoutItem()
-                     .style(m_inlineTextBox.isFirstLineStyle())
-                     ->getFontMetrics()
-                     .ascent();
+  const SimpleFontData* fontData =
+      m_inlineTextBox.getLineLayoutItem()
+          .style(m_inlineTextBox.isFirstLineStyle())
+          ->font()
+          .primaryFont();
+  DCHECK(fontData);
+  int baseline = fontData ? fontData->getFontMetrics().ascent() : 0;
   if (underline.thick() && m_inlineTextBox.logicalHeight() - baseline >= 2)
     lineThickness = 2;
 
@@ -1098,6 +1112,12 @@
       LayoutTheme::theme().platformTextSearchColor(marker->activeMatch());
   if (style.visitedDependentColor(CSSPropertyColor) == textColor)
     return;
+
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
+
   TextPainter::Style textStyle;
   textStyle.currentColor = textStyle.fillColor = textStyle.strokeColor =
       textStyle.emphasisMarkColor = textColor;
@@ -1107,7 +1127,7 @@
   LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(),
                                            m_inlineTextBox.logicalHeight()));
   LayoutPoint textOrigin(boxOrigin.x(),
-                         boxOrigin.y() + font.getFontMetrics().ascent());
+                         boxOrigin.y() + fontData->getFontMetrics().ascent());
   TextPainter textPainter(paintInfo.context, font, run, textOrigin, boxRect,
                           m_inlineTextBox.isHorizontal());
 
diff --git a/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp b/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
index 8676269..eb30da52 100644
--- a/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
@@ -130,9 +130,11 @@
 
   TextRunPaintInfo textRunPaintInfo(textRun);
   textRunPaintInfo.bounds = marker;
+  const SimpleFontData* fontData =
+      m_layoutListMarker.style()->font().primaryFont();
   IntPoint textOrigin = IntPoint(
       marker.x(),
-      marker.y() + m_layoutListMarker.style()->getFontMetrics().ascent());
+      marker.y() + (fontData ? fontData->getFontMetrics().ascent() : 0));
 
   // Text is not arbitrary. We can judge whether it's RTL from the first
   // character, and we only need to handle the direction RightToLeft for now.
diff --git a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
index 413e9ef..e94ddd0b 100644
--- a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
@@ -329,8 +329,13 @@
   if (thickness <= 0)
     return;
 
+  const SimpleFontData* fontData = scaledFont.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
+
   float decorationOffset = baselineOffsetForDecoration(
-      decoration, scaledFont.getFontMetrics(), thickness);
+      decoration, fontData->getFontMetrics(), thickness);
   FloatPoint decorationOrigin(fragment.x,
                               fragment.y - decorationOffset / scalingFactor);
 
@@ -449,7 +454,11 @@
   textRunPaintInfo.from = startPosition;
   textRunPaintInfo.to = endPosition;
 
-  float baseline = scaledFont.getFontMetrics().floatAscent();
+  const SimpleFontData* fontData = scaledFont.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
+  float baseline = fontData->getFontMetrics().floatAscent();
   textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - baseline,
                                       textSize.width(), textSize.height());
 
diff --git a/third_party/WebKit/Source/core/paint/TextPainter.cpp b/third_party/WebKit/Source/core/paint/TextPainter.cpp
index 274b395f..ee7d665 100644
--- a/third_party/WebKit/Source/core/paint/TextPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TextPainter.cpp
@@ -44,15 +44,17 @@
 void TextPainter::setEmphasisMark(const AtomicString& emphasisMark,
                                   TextEmphasisPosition position) {
   m_emphasisMark = emphasisMark;
+  const SimpleFontData* fontData = m_font.primaryFont();
+  DCHECK(fontData);
 
-  if (emphasisMark.isNull()) {
+  if (!fontData || emphasisMark.isNull()) {
     m_emphasisMarkOffset = 0;
   } else if (position == TextEmphasisPositionOver) {
-    m_emphasisMarkOffset = -m_font.getFontMetrics().ascent() -
+    m_emphasisMarkOffset = -fontData->getFontMetrics().ascent() -
                            m_font.emphasisMarkDescent(emphasisMark);
   } else {
     ASSERT(position == TextEmphasisPositionUnder);
-    m_emphasisMarkOffset = m_font.getFontMetrics().descent() +
+    m_emphasisMarkOffset = fontData->getFontMetrics().descent() +
                            m_font.emphasisMarkAscent(emphasisMark);
   }
 }
@@ -253,11 +255,16 @@
 }
 
 void TextPainter::paintEmphasisMarkForCombinedText() {
-  ASSERT(m_combinedText);
+  const SimpleFontData* fontData = m_font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return;
+
+  DCHECK(m_combinedText);
   TextRun placeholderTextRun(&ideographicFullStopCharacter, 1);
   FloatPoint emphasisMarkTextOrigin(m_textBounds.x().toFloat(),
                                     m_textBounds.y().toFloat() +
-                                        m_font.getFontMetrics().ascent() +
+                                        fontData->getFontMetrics().ascent() +
                                         m_emphasisMarkOffset);
   TextRunPaintInfo textRunPaintInfo(placeholderTextRun);
   textRunPaintInfo.bounds = FloatRect(m_textBounds);
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index dbacac5..7fbcc82 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1569,9 +1569,10 @@
                       (&hyphenMinusCharacter, 1));
   DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphenCharacter, 1));
   const SimpleFontData* primaryFont = font().primaryFont();
-  ASSERT(primaryFont);
-  return primaryFont->glyphForCharacter(hyphenCharacter) ? hyphenString
-                                                         : hyphenMinusString;
+  DCHECK(primaryFont);
+  return primaryFont && primaryFont->glyphForCharacter(hyphenCharacter)
+             ? hyphenString
+             : hyphenMinusString;
 }
 
 const AtomicString& ComputedStyle::textEmphasisMarkString() const {
@@ -1648,9 +1649,6 @@
 const Font& ComputedStyle::font() const {
   return m_styleInheritedData->font;
 }
-const FontMetrics& ComputedStyle::getFontMetrics() const {
-  return m_styleInheritedData->font.getFontMetrics();
-}
 const FontDescription& ComputedStyle::getFontDescription() const {
   return m_styleInheritedData->font.getFontDescription();
 }
@@ -1838,7 +1836,7 @@
   // Negative value means the line height is not set. Use the font's built-in
   // spacing, if avalible.
   if (lh.isNegative() && font().primaryFont())
-    return getFontMetrics().lineSpacing();
+    return font().primaryFont()->getFontMetrics().lineSpacing();
 
   if (lh.isPercentOrCalc())
     return minimumValueForLength(lh, LayoutUnit(computedFontSize())).toInt();
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index a00c082f..c1c73fbd 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -2514,7 +2514,6 @@
   // Font properties.
   const Font& font() const;
   void setFont(const Font&);
-  const FontMetrics& getFontMetrics() const;
   const FontDescription& getFontDescription() const;
   bool setFontDescription(const FontDescription&);
   bool hasIdenticalAscentDescentAndLineGap(const ComputedStyle& other) const;
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
index 2670221..bd4cf08 100644
--- a/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp
@@ -373,11 +373,12 @@
 
 float SVGLengthContext::convertValueFromUserUnitsToCHS(float value) const {
   const ComputedStyle* style = computedStyleForLengthResolving(m_context);
-  if (!style)
+  const SimpleFontData* fontData = style->font().primaryFont();
+  if (!style || !fontData)
     return 0;
 
   float zeroWidth =
-      style->getFontMetrics().zeroWidth() / style->effectiveZoom();
+      fontData->getFontMetrics().zeroWidth() / style->effectiveZoom();
   if (!zeroWidth)
     return 0;
 
@@ -386,22 +387,25 @@
 
 float SVGLengthContext::convertValueFromCHSToUserUnits(float value) const {
   const ComputedStyle* style = computedStyleForLengthResolving(m_context);
-  if (!style)
+  const SimpleFontData* fontData = style->font().primaryFont();
+  if (!style || !fontData)
     return 0;
 
-  return value * style->getFontMetrics().zeroWidth() / style->effectiveZoom();
+  return value * fontData->getFontMetrics().zeroWidth() /
+         style->effectiveZoom();
 }
 
 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const {
   const ComputedStyle* style = computedStyleForLengthResolving(m_context);
-  if (!style)
+  const SimpleFontData* fontData = style->font().primaryFont();
+  if (!style || !fontData)
     return 0;
 
   // Use of ceil allows a pixel match to the W3Cs expected output of
   // coords-units-03-b.svg, if this causes problems in real world cases maybe it
   // would be best to remove this.
   float xHeight =
-      ceilf(style->getFontMetrics().xHeight() / style->effectiveZoom());
+      ceilf(fontData->getFontMetrics().xHeight() / style->effectiveZoom());
   if (!xHeight)
     return 0;
 
@@ -410,14 +414,15 @@
 
 float SVGLengthContext::convertValueFromEXSToUserUnits(float value) const {
   const ComputedStyle* style = computedStyleForLengthResolving(m_context);
-  if (!style)
+  const SimpleFontData* fontData = style->font().primaryFont();
+  if (!style || !fontData)
     return 0;
 
   // Use of ceil allows a pixel match to the W3Cs expected output of
   // coords-units-03-b.svg, if this causes problems in real world cases maybe it
   // would be best to remove this.
   return value *
-         ceilf(style->getFontMetrics().xHeight() / style->effectiveZoom());
+         ceilf(fontData->getFontMetrics().xHeight() / style->effectiveZoom());
 }
 
 bool SVGLengthContext::determineViewport(FloatSize& viewportSize) const {
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index ecc4f0b..83402ec3 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -214,12 +214,6 @@
   return toLayoutBox(layoutObject)->getScrollableArea();
 }
 
-const char* Internals::internalsId = "internals";
-
-Internals* Internals::create(ScriptState* scriptState) {
-  return new Internals(scriptState);
-}
-
 Internals::~Internals() {}
 
 static RuntimeEnabledFeatures::Backup* sFeaturesBackup = nullptr;
@@ -253,8 +247,8 @@
   KeyboardEventManager::setCurrentCapsLockState(OverrideCapsLockState::Default);
 }
 
-Internals::Internals(ScriptState* scriptState)
-    : ContextLifecycleObserver(scriptState->getExecutionContext()),
+Internals::Internals(ExecutionContext* context)
+    : ContextLifecycleObserver(context),
       m_runtimeFlags(InternalRuntimeFlags::create()) {
   contextDocument()->fetcher()->enableIsPreloadedForTest();
 }
@@ -2601,7 +2595,13 @@
     return false;
   const ComputedStyle* itemStyle =
       select.itemComputedStyle(*select.listItems()[itemIndex]);
-  return itemStyle ? itemStyle->font().getFontMetrics().height() : 0;
+
+  if (itemStyle) {
+    const SimpleFontData* fontData = itemStyle->font().primaryFont();
+    DCHECK(fontData);
+    return fontData ? fontData->getFontMetrics().height() : 0;
+  }
+  return 0;
 }
 
 void Internals::resetTypeAheadSession(HTMLSelectElement* select) {
diff --git a/third_party/WebKit/Source/core/testing/Internals.h b/third_party/WebKit/Source/core/testing/Internals.h
index 3ce652a..609a47d 100644
--- a/third_party/WebKit/Source/core/testing/Internals.h
+++ b/third_party/WebKit/Source/core/testing/Internals.h
@@ -83,7 +83,9 @@
   USING_GARBAGE_COLLECTED_MIXIN(Internals);
 
  public:
-  static Internals* create(ScriptState*);
+  static Internals* create(ExecutionContext* context) {
+    return new Internals(context);
+  }
   virtual ~Internals();
 
   static void resetToConsistentState(Page*);
@@ -300,8 +302,6 @@
 
   bool isPageBoxVisible(Document*, int pageNumber);
 
-  static const char* internalsId;
-
   InternalSettings* settings() const;
   InternalRuntimeFlags* runtimeFlags() const;
   unsigned workerThreadCount() const;
@@ -531,7 +531,7 @@
   void crash();
 
  private:
-  explicit Internals(ScriptState*);
+  explicit Internals(ExecutionContext*);
   Document* contextDocument() const;
   LocalFrame* frame() const;
   Vector<String> iconURLs(Document*, int iconTypesMask) const;
diff --git a/third_party/WebKit/Source/core/testing/WorkerInternals.cpp b/third_party/WebKit/Source/core/testing/WorkerInternals.cpp
index 2fc6f03..6d6d19b 100644
--- a/third_party/WebKit/Source/core/testing/WorkerInternals.cpp
+++ b/third_party/WebKit/Source/core/testing/WorkerInternals.cpp
@@ -8,14 +8,9 @@
 
 namespace blink {
 
-// static
-WorkerInternals* WorkerInternals::create(ScriptState* scriptState) {
-  return new WorkerInternals(scriptState);
-}
-
 WorkerInternals::~WorkerInternals() {}
 
-WorkerInternals::WorkerInternals(ScriptState*) {}
+WorkerInternals::WorkerInternals() {}
 
 OriginTrialsTest* WorkerInternals::originTrialsTest() const {
   return OriginTrialsTest::create();
diff --git a/third_party/WebKit/Source/core/testing/WorkerInternals.h b/third_party/WebKit/Source/core/testing/WorkerInternals.h
index 740b919..8669efd 100644
--- a/third_party/WebKit/Source/core/testing/WorkerInternals.h
+++ b/third_party/WebKit/Source/core/testing/WorkerInternals.h
@@ -5,7 +5,6 @@
 #ifndef WorkerInternals_h
 #define WorkerInternals_h
 
-#include "bindings/core/v8/ScriptState.h"
 #include "bindings/core/v8/ScriptWrappable.h"
 #include "platform/heap/GarbageCollected.h"
 
@@ -18,14 +17,14 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static WorkerInternals* create(ScriptState*);
+  static WorkerInternals* create() { return new WorkerInternals(); }
   virtual ~WorkerInternals();
   OriginTrialsTest* originTrialsTest() const;
 
   DEFINE_INLINE_TRACE() {}
 
  private:
-  explicit WorkerInternals(ScriptState*);
+  explicit WorkerInternals();
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp b/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
index a4aaca8..1638d36 100644
--- a/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
+++ b/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp
@@ -42,21 +42,23 @@
 namespace WebCoreTestSupport {
 
 namespace {
+
 blink::InstallConditionalFeaturesFunction
     s_originalInstallConditionalFeaturesFunction = nullptr;
-}
 
 v8::Local<v8::Value> createInternalsObject(v8::Local<v8::Context> context) {
   ScriptState* scriptState = ScriptState::from(context);
   v8::Local<v8::Object> global = scriptState->context()->Global();
   ExecutionContext* executionContext = scriptState->getExecutionContext();
-  if (executionContext->isDocument())
-    return toV8(Internals::create(scriptState), global, scriptState->isolate());
-  if (executionContext->isWorkerGlobalScope())
-    return toV8(WorkerInternals::create(scriptState), global,
+  if (executionContext->isDocument()) {
+    return toV8(Internals::create(executionContext), global,
                 scriptState->isolate());
+  }
+  if (executionContext->isWorkerGlobalScope())
+    return toV8(WorkerInternals::create(), global, scriptState->isolate());
   return v8::Local<v8::Value>();
 }
+}
 
 void injectInternalsObject(v8::Local<v8::Context> context) {
   // Set conditional features installation function to
@@ -76,8 +78,7 @@
 
   global
       ->Set(scriptState->context(),
-            v8AtomicString(scriptState->isolate(), Internals::internalsId),
-            internals)
+            v8AtomicString(scriptState->isolate(), "internals"), internals)
       .ToChecked();
 }
 
diff --git a/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.h b/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.h
index 6592b10..4e86349 100644
--- a/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.h
+++ b/third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.h
@@ -26,28 +26,15 @@
 #ifndef WebCoreTestSupport_h
 #define WebCoreTestSupport_h
 
-// Normally we'd have:
-// #include <v8.h>
-// ...but this file is used in cases where we don't have V8 (e.g., Skia)
-namespace v8 {
-class Context;
-class Function;
-class Isolate;
-class Object;
-class Value;
-template <class T>
-class Local;
-}
+#include <v8.h>
 
 namespace blink {
 class ScriptState;
-class DOMWrapperWorld;
 struct WrapperTypeInfo;
 }
 
 namespace WebCoreTestSupport {
 
-v8::Local<v8::Value> createInternalsObject(v8::Local<v8::Context>);
 void injectInternalsObject(v8::Local<v8::Context>);
 void resetInternalsObject(v8::Local<v8::Context>);
 void installConditionalFeaturesForTests(
diff --git a/third_party/WebKit/Source/devtools/BUILD.gn b/third_party/WebKit/Source/devtools/BUILD.gn
index 766f69ba..cc76f43 100644
--- a/third_party/WebKit/Source/devtools/BUILD.gn
+++ b/third_party/WebKit/Source/devtools/BUILD.gn
@@ -10,6 +10,8 @@
   "front_end/Tests.js",
 ]
 devtools_core_base_files = [
+  "front_end/audits2_worker.js",
+  "front_end/audits2_worker.json",
   "front_end/inspector.js",
   "front_end/inspector.json",
   "front_end/formatter_worker.js",
@@ -304,6 +306,8 @@
   "front_end/accessibility/module.json",
   "front_end/animation/module.json",
   "front_end/audits/module.json",
+  "front_end/audits2/module.json",
+  "front_end/audits2_worker/module.json",
   "front_end/bindings/module.json",
   "front_end/cm_modes/module.json",
   "front_end/common/module.json",
@@ -380,6 +384,10 @@
   "front_end/audits/AuditRules.js",
   "front_end/audits/AuditsPanel.js",
 ]
+devtools_audits2_js_files = [ "front_end/audits2/Audits2Panel.js" ]
+devtools_audits2_worker_js_files =
+    [ "front_end/audits2_worker/Audits2Service.js" ]
+
 devtools_cm_modes_js_files = [
   "front_end/cm_modes/clike.js",
   "front_end/cm_modes/coffeescript.js",
@@ -867,6 +875,7 @@
 
 devtools_modules_js_files =
     devtools_accessibility_js_files + devtools_audits_js_files +
+    devtools_audits2_js_files + devtools_audits2_worker_js_files +
     devtools_animation_js_files + devtools_cm_modes_js_files +
     devtools_components_lazy_js_files + devtools_console_js_files +
     devtools_devices_js_files + devtools_diff_js_files +
@@ -911,6 +920,7 @@
 generated_bundled_modules = [
   "$resources_out_dir/animation/animation_module.js",
   "$resources_out_dir/audits/audits_module.js",
+  "$resources_out_dir/audits2/audits2_module.js",
   "$resources_out_dir/components_lazy/components_lazy_module.js",
   "$resources_out_dir/console/console_module.js",
   "$resources_out_dir/devices/devices_module.js",
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
new file mode 100644
index 0000000..e6ab2af
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
@@ -0,0 +1,39 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @constructor
+ * @extends {WebInspector.Panel}
+ */
+WebInspector.Audits2Panel = function()
+{
+    WebInspector.Panel.call(this, "audits2");
+    this.contentElement.classList.add("vbox");
+    this.contentElement.appendChild(createTextButton(WebInspector.UIString("Start"), this._start.bind(this)));
+    this.contentElement.appendChild(createTextButton(WebInspector.UIString("Stop"), this._stop.bind(this)));
+}
+
+WebInspector.Audits2Panel.prototype = {
+    _start: function()
+    {
+        this._backend().then(backend => backend ? backend.send("start") : undefined).then(console.error.bind(console, "STARTED"));
+    },
+
+    _stop: function()
+    {
+        this._backend().then(backend => backend ? backend.send("stop") : undefined).then(console.error.bind(console, "STOPPED"));
+    },
+
+    /**
+     * @return {!Promise<?WebInspector.ServiceManager.Service>}
+     */
+    _backend: function()
+    {
+        if (!this._backendPromise)
+            this._backendPromise = WebInspector.serviceManager.createAppService("audits2_worker", "Audits2Service", false);
+        return this._backendPromise;
+    },
+
+    __proto__: WebInspector.Panel.prototype
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/module.json b/third_party/WebKit/Source/devtools/front_end/audits2/module.json
new file mode 100644
index 0000000..5009b9b
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/audits2/module.json
@@ -0,0 +1,22 @@
+{
+    "extensions": [
+        {
+            "type": "view",
+            "location": "panel",
+            "id": "audits2",
+            "title": "Audits 2.0",
+            "order": 90,
+            "persistence": "closeable",
+            "className": "WebInspector.Audits2Panel"
+        }
+    ],
+    "dependencies": [
+        "sdk",
+        "ui",
+        "services"
+    ],
+    "experiment": "audits2",
+    "scripts": [
+        "Audits2Panel.js"
+    ]
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2_worker.js b/third_party/WebKit/Source/devtools/front_end/audits2_worker.js
new file mode 100644
index 0000000..703648c9
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/audits2_worker.js
@@ -0,0 +1,8 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Release build has Runtime.js bundled.
+if (!self.Runtime)
+    self.importScripts("Runtime.js");
+Runtime.startWorker("audits2_worker");
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2_worker.json b/third_party/WebKit/Source/devtools/front_end/audits2_worker.json
new file mode 100644
index 0000000..e864bae
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/audits2_worker.json
@@ -0,0 +1,8 @@
+{
+    "modules": [
+        { "name": "worker_service", "type": "autostart" },
+        { "name": "audits2_worker", "type": "autostart" }
+    ],
+
+    "has_html": false
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2_worker/Audits2Service.js b/third_party/WebKit/Source/devtools/front_end/audits2_worker/Audits2Service.js
new file mode 100644
index 0000000..957d7a1
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/audits2_worker/Audits2Service.js
@@ -0,0 +1,41 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @constructor
+ * @implements {Service}
+ */
+function Audits2Service()
+{
+}
+
+Audits2Service.prototype = {
+    /**
+     * @return {!Promise}
+     */
+    start: function()
+    {
+        console.error("WORKER START");
+        return Promise.resolve();
+    },
+
+    /**
+     * @return {!Promise}
+     */
+    stop: function()
+    {
+        console.error("WORKER STOP");
+        return Promise.resolve();
+    },
+
+    /**
+     * @override
+     */
+    dispose: function()
+    {
+        console.error("WORKER DISPOSE");
+    }
+}
+
+initializeWorkerService("Audits2Service", Audits2Service);
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2_worker/module.json b/third_party/WebKit/Source/devtools/front_end/audits2_worker/module.json
new file mode 100644
index 0000000..deeae14
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/audits2_worker/module.json
@@ -0,0 +1,8 @@
+{
+    "dependencies": [
+        "worker_service"
+    ],
+    "scripts": [
+        "Audits2Service.js"
+    ]
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
index b107648..23034700 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
@@ -237,7 +237,9 @@
             var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL(sourceURL, script);
             if (!uiSourceCode) {
                 var contentProvider = sourceMap.sourceContentProvider(sourceURL, WebInspector.resourceTypes.SourceMapScript);
-                uiSourceCode = this._networkProject.addFile(contentProvider, WebInspector.ResourceTreeFrame.fromScript(script), script.isContentScript());
+                var embeddedContent = sourceMap.embeddedContentByURL(sourceURL);
+                var embeddedContentLength = typeof embeddedContent === "string" ? embeddedContent.length : null;
+                uiSourceCode = this._networkProject.addFile(contentProvider, WebInspector.ResourceTreeFrame.fromScript(script), script.isContentScript(), embeddedContentLength);
                 uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] = script.sourceURL;
             }
             if (uiSourceCode) {
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/ContentProviderBasedProject.js b/third_party/WebKit/Source/devtools/front_end/bindings/ContentProviderBasedProject.js
index d62fb0e..16599a2e8 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/ContentProviderBasedProject.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/ContentProviderBasedProject.js
@@ -45,6 +45,8 @@
     workspace.addProject(this);
 }
 
+WebInspector.ContentProviderBasedProject._metadata = Symbol("ContentProviderBasedProject.Metadata");
+
 WebInspector.ContentProviderBasedProject.prototype = {
     /**
      * @override
@@ -64,7 +66,7 @@
      */
     requestMetadata: function(uiSourceCode)
     {
-        return Promise.resolve(/** @type {?WebInspector.UISourceCodeMetadata} */(null));
+        return Promise.resolve(uiSourceCode[WebInspector.ContentProviderBasedProject._metadata]);
     },
 
     /**
@@ -275,10 +277,12 @@
     /**
      * @param {!WebInspector.UISourceCode} uiSourceCode
      * @param {!WebInspector.ContentProvider} contentProvider
+     * @param {?WebInspector.UISourceCodeMetadata} metadata
      */
-    addUISourceCodeWithProvider: function(uiSourceCode, contentProvider)
+    addUISourceCodeWithProvider: function(uiSourceCode, contentProvider, metadata)
     {
         this._contentProviders[uiSourceCode.url()] = contentProvider;
+        uiSourceCode[WebInspector.ContentProviderBasedProject._metadata] = metadata;
         this.addUISourceCode(uiSourceCode, true);
     },
 
@@ -290,7 +294,7 @@
     addContentProvider: function(url, contentProvider)
     {
         var uiSourceCode = this.createUISourceCode(url, contentProvider.contentType());
-        this.addUISourceCodeWithProvider(uiSourceCode, contentProvider);
+        this.addUISourceCodeWithProvider(uiSourceCode, contentProvider, null);
         return uiSourceCode;
     },
 
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js
index 14b82d36..ab210f83 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/DefaultScriptMapping.js
@@ -107,7 +107,7 @@
         uiSourceCode[WebInspector.DefaultScriptMapping._scriptSymbol] = script;
         this._uiSourceCodeForScriptId.set(script.scriptId, uiSourceCode);
         this._scriptIdForUISourceCode.set(uiSourceCode, script.scriptId);
-        this._project.addUISourceCodeWithProvider(uiSourceCode, script);
+        this._project.addUISourceCodeWithProvider(uiSourceCode, script, null);
 
         this._debuggerWorkspaceBinding.setSourceMapping(this._debuggerModel.target(), uiSourceCode, this);
         this._debuggerWorkspaceBinding.pushSourceMapping(script, this);
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
index 59d20d4..5f8b5580 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
@@ -197,13 +197,15 @@
     /**
      * @param {!WebInspector.ContentProvider} contentProvider
      * @param {?WebInspector.ResourceTreeFrame} frame
-     * @param {boolean=} isContentScript
+     * @param {boolean} isContentScript
+     * @param {?number} contentSize
      * @return {!WebInspector.UISourceCode}
      */
-    addFile: function(contentProvider, frame, isContentScript)
+    addFile: function(contentProvider, frame, isContentScript, contentSize)
     {
         var uiSourceCode = this._createFile(contentProvider, frame, isContentScript || false);
-        this._addUISourceCodeWithProvider(uiSourceCode, contentProvider);
+        var metadata = typeof contentSize === "number" ? new WebInspector.UISourceCodeMetadata(null, contentSize) : null;
+        this._addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadata);
         return uiSourceCode;
     },
 
@@ -244,10 +246,11 @@
     /**
      * @param {!WebInspector.UISourceCode} uiSourceCode
      * @param {!WebInspector.ContentProvider} contentProvider
+     * @param {?WebInspector.UISourceCodeMetadata} metadata
      */
-    _addUISourceCodeWithProvider: function(uiSourceCode, contentProvider)
+    _addUISourceCodeWithProvider: function(uiSourceCode, contentProvider, metadata)
     {
-        /** @type {!WebInspector.ContentProviderBasedProject} */ (uiSourceCode.project()).addUISourceCodeWithProvider(uiSourceCode, contentProvider);
+        /** @type {!WebInspector.ContentProviderBasedProject} */ (uiSourceCode.project()).addUISourceCodeWithProvider(uiSourceCode, contentProvider, metadata);
     },
 
     /**
@@ -266,7 +269,8 @@
         }
         var uiSourceCode = this._createFile(script, WebInspector.ResourceTreeFrame.fromScript(script), script.isContentScript());
         uiSourceCode[WebInspector.NetworkProject._scriptSymbol] = script;
-        this._addUISourceCodeWithProvider(uiSourceCode, script);
+        var resource = WebInspector.ResourceTreeModel.resourceForURL(uiSourceCode.url());
+        this._addUISourceCodeWithProvider(uiSourceCode, script, this._resourceMetadata(resource));
     },
 
     /**
@@ -281,7 +285,8 @@
         var originalContentProvider = header.originalContentProvider();
         var uiSourceCode = this._createFile(originalContentProvider, WebInspector.ResourceTreeFrame.fromStyleSheet(header), false);
         uiSourceCode[WebInspector.NetworkProject._styleSheetSymbol] = header;
-        this._addUISourceCodeWithProvider(uiSourceCode, originalContentProvider);
+        var resource = WebInspector.ResourceTreeModel.resourceForURL(uiSourceCode.url());
+        this._addUISourceCodeWithProvider(uiSourceCode, originalContentProvider, this._resourceMetadata(resource));
     },
 
     /**
@@ -333,7 +338,7 @@
 
         var uiSourceCode = this._createFile(resource, WebInspector.ResourceTreeFrame.fromResource(resource), false);
         uiSourceCode[WebInspector.NetworkProject._resourceSymbol] = resource;
-        this._addUISourceCodeWithProvider(uiSourceCode, resource);
+        this._addUISourceCodeWithProvider(uiSourceCode, resource, this._resourceMetadata(resource));
     },
 
     /**
@@ -382,6 +387,17 @@
         return uiSourceCode;
     },
 
+    /**
+     * @param {?WebInspector.Resource} resource
+     * @return {?WebInspector.UISourceCodeMetadata}
+     */
+    _resourceMetadata: function(resource)
+    {
+        if (!resource || (typeof resource.contentSize() !== "number" && !resource.lastModified()))
+            return null;
+        return new WebInspector.UISourceCodeMetadata(resource.lastModified(), resource.contentSize());
+    },
+
     _dispose: function()
     {
         this._reset();
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
index f056446..ec0c7f1 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/SASSSourceMapping.js
@@ -56,7 +56,9 @@
         var sourceMap = this._cssModel.sourceMapForHeader(header);
         for (var sassURL of sourceMap.sourceURLs()) {
             var contentProvider = sourceMap.sourceContentProvider(sassURL, WebInspector.resourceTypes.SourceMapStyleSheet);
-            this._networkProject.addFile(contentProvider, WebInspector.ResourceTreeFrame.fromStyleSheet(header));
+            var embeddedContent = sourceMap.embeddedContentByURL(sassURL);
+            var embeddedContentLength = typeof embeddedContent === "string" ? embeddedContent.length : null;
+            this._networkProject.addFile(contentProvider, WebInspector.ResourceTreeFrame.fromStyleSheet(header), false, embeddedContentLength);
         }
         WebInspector.cssWorkspaceBinding.updateLocations(header);
     },
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js b/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js
index bf2eee5..ab9a7949 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/TempFile.js
@@ -393,7 +393,7 @@
 WebInspector.TempFile.ensureTempStorageCleared = function()
 {
     if (!WebInspector.TempFile._storageCleanerPromise) {
-        WebInspector.TempFile._storageCleanerPromise = WebInspector.serviceManager.createWorkerService("utility_shared_worker", "TempStorage", true).then(service => {
+        WebInspector.TempFile._storageCleanerPromise = WebInspector.serviceManager.createAppService("utility_shared_worker", "TempStorage", true).then(service => {
             if (service)
                 return service.send("clear");
         });
diff --git a/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js b/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js
index a57f6ee2..3566b3e7 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js
@@ -43,20 +43,15 @@
     this.folderPathComponents = "";
     this.lastPathComponent = "";
 
-    // RegExp groups:
-    // 1 - scheme (using the RFC3986 grammar)
-    // 2 - hostname
-    // 3 - ?port
-    // 4 - ?path
-    // 5 - ?fragment
-    var match = url.match(/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^\s\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);
+    var match = url.match(WebInspector.ParsedURL._urlRegex());
     if (match) {
         this.isValid = true;
         this.scheme = match[1].toLowerCase();
         this.host = match[2];
         this.port = match[3];
         this.path = match[4] || "/";
-        this.fragment = match[5];
+        this.queryParams = match[5] || "";
+        this.fragment = match[6];
     } else {
         if (this.url.startsWith("data:")) {
             this.scheme = "data";
@@ -69,21 +64,38 @@
         this.path = this.url;
     }
 
-    // First cut the query params.
-    var path = this.path;
-    var indexOfQuery = path.indexOf("?");
-    if (indexOfQuery !== -1) {
-        this.queryParams = path.substring(indexOfQuery + 1);
-        path = path.substring(0, indexOfQuery);
-    }
-
-    // Then take last path component.
-    var lastSlashIndex = path.lastIndexOf("/");
+    var lastSlashIndex = this.path.lastIndexOf("/");
     if (lastSlashIndex !== -1) {
-        this.folderPathComponents = path.substring(0, lastSlashIndex);
-        this.lastPathComponent = path.substring(lastSlashIndex + 1);
-    } else
-        this.lastPathComponent = path;
+        this.folderPathComponents = this.path.substring(0, lastSlashIndex);
+        this.lastPathComponent = this.path.substring(lastSlashIndex + 1);
+    } else {
+        this.lastPathComponent = this.path;
+    }
+}
+
+/**
+ * @return {!RegExp}
+ */
+WebInspector.ParsedURL._urlRegex = function()
+{
+    if (WebInspector.ParsedURL._urlRegexInstance)
+        return WebInspector.ParsedURL._urlRegexInstance;
+    // RegExp groups:
+    // 1 - scheme (using the RFC3986 grammar)
+    // 2 - hostname
+    // 3 - ?port
+    // 4 - ?path
+    // 5 - ?query
+    // 6 - ?fragment
+    var schemeRegex = /([A-Za-z][A-Za-z0-9+.-]*):\/\//;
+    var hostRegex = /([^\s\/:]*)/;
+    var portRegex = /(?::([\d]+))?/;
+    var pathRegex = /(\/[^#?]*)?/;
+    var queryRegex = /(?:\?([^#]*))?/;
+    var fragmentRegex = /(?:#(.*))?/;
+
+    WebInspector.ParsedURL._urlRegexInstance = new RegExp("^" + schemeRegex.source + hostRegex.source + portRegex.source + pathRegex.source + queryRegex.source + fragmentRegex.source + "$");
+    return WebInspector.ParsedURL._urlRegexInstance;
 }
 
 /**
@@ -169,63 +181,47 @@
  */
 WebInspector.ParsedURL.completeURL = function(baseURL, href)
 {
-    if (href) {
-        // Return special URLs as-is.
-        var trimmedHref = href.trim();
-        if (trimmedHref.startsWith("data:") || trimmedHref.startsWith("blob:") || trimmedHref.startsWith("javascript:"))
-            return href;
+    // Return special URLs as-is.
+    var trimmedHref = href.trim();
+    if (trimmedHref.startsWith("data:") || trimmedHref.startsWith("blob:") || trimmedHref.startsWith("javascript:"))
+        return href;
 
-        // Return absolute URLs as-is.
-        var parsedHref = trimmedHref.asParsedURL();
-        if (parsedHref && parsedHref.scheme)
-            return trimmedHref;
-    } else {
-        return baseURL;
-    }
+    // Return absolute URLs as-is.
+    var parsedHref = trimmedHref.asParsedURL();
+    if (parsedHref && parsedHref.scheme)
+        return trimmedHref;
 
     var parsedURL = baseURL.asParsedURL();
-    if (parsedURL) {
-        if (parsedURL.isDataURL())
-            return href;
-        var path = href;
+    if (!parsedURL)
+        return null;
 
-        var query = path.indexOf("?");
-        var postfix = "";
-        if (query !== -1) {
-            postfix = path.substring(query);
-            path = path.substring(0, query);
-        } else {
-            var fragment = path.indexOf("#");
-            if (fragment !== -1) {
-                postfix = path.substring(fragment);
-                path = path.substring(0, fragment);
-            }
-        }
+    if (parsedURL.isDataURL())
+        return href;
 
-        if (!path) {  // empty path, must be postfix
-            var basePath = parsedURL.path;
-            if (postfix.charAt(0) === "?") {
-                // A href of "?foo=bar" implies "basePath?foo=bar".
-                // With "basePath?a=b" and "?foo=bar" we should get "basePath?foo=bar".
-                var baseQuery = parsedURL.path.indexOf("?");
-                if (baseQuery !== -1)
-                    basePath = basePath.substring(0, baseQuery);
-            } // else it must be a fragment
-            return parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "") + basePath + postfix;
-        } else if (path.charAt(0) !== "/") {  // relative path
-            var prefix = parsedURL.path;
-            var prefixQuery = prefix.indexOf("?");
-            if (prefixQuery !== -1)
-                prefix = prefix.substring(0, prefixQuery);
-            prefix = prefix.substring(0, prefix.lastIndexOf("/")) + "/";
-            path = prefix + path;
-        } else if (path.length > 1 && path.charAt(1) === "/") {
-            // href starts with "//" which is a full URL with the protocol dropped (use the baseURL protocol).
-            return parsedURL.scheme + ":" + path + postfix;
-        }  // else absolute path
-        return parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "") + Runtime.normalizePath(path) + postfix;
+    if (href.length > 1 && href.charAt(0) === "/" && href.charAt(1) === "/") {
+        // href starts with "//" which is a full URL with the protocol dropped (use the baseURL protocol).
+        return parsedURL.scheme + ":" + href;
     }
-    return null;
+
+    var securityOrigin = parsedURL.securityOrigin();
+    var pathText = parsedURL.path;
+    var queryText = parsedURL.queryParams ? "?" + parsedURL.queryParams : "";
+
+    // Empty href resolves to a URL without fragment.
+    if (!href.length)
+        return securityOrigin + pathText + queryText;
+
+    if (href.charAt(0) === "#")
+        return securityOrigin + pathText + queryText + href;
+
+    if (href.charAt(0) === "?")
+        return securityOrigin + pathText + href;
+
+    var hrefPath = href.match(/^[^#?]*/)[0];
+    var hrefSuffix = href.substring(hrefPath.length);
+    if (hrefPath.charAt(0) !== "/")
+        hrefPath = parsedURL.folderPathComponents + "/" + hrefPath;
+    return securityOrigin + Runtime.normalizePath(hrefPath) + hrefSuffix;
 }
 
 WebInspector.ParsedURL.prototype = {
diff --git a/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js b/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js
index 17d24cc2..a8923ee 100644
--- a/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js
+++ b/third_party/WebKit/Source/devtools/front_end/components_lazy/LineLevelProfile.js
@@ -71,14 +71,18 @@
 
     _doUpdate: function()
     {
+        // TODO(alph): use scriptId instead of urls for the target.
         this._locationPool.disposeAll();
         WebInspector.workspace.uiSourceCodes().forEach(uiSourceCode => uiSourceCode.removeAllLineDecorations(WebInspector.LineLevelProfile.LineDecorator.type));
-        var debuggerModel = WebInspector.DebuggerModel.fromTarget(WebInspector.targetManager.mainTarget());
-        if (!debuggerModel)
-            return;
         for (var fileInfo of this._files) {
             var url = /** @type {string} */ (fileInfo[0]);
             var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
+            if (!uiSourceCode)
+                continue;
+            var target = WebInspector.NetworkProject.targetForUISourceCode(uiSourceCode) || WebInspector.targetManager.mainTarget();
+            var debuggerModel = target ? WebInspector.DebuggerModel.fromTarget(target) : null;
+            if (!debuggerModel)
+                continue;
             for (var lineInfo of fileInfo[1]) {
                 var line = lineInfo[0] - 1;
                 var time = lineInfo[1];
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
index f9e16d3..2380286 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -258,8 +258,7 @@
     targetAdded: function(target)
     {
         this._viewport.invalidate();
-        var hasMultipleCotexts = WebInspector.targetManager.targets(WebInspector.Target.Capability.JS).length > 1;
-        this._showAllMessagesCheckbox.element.classList.toggle("hidden", !hasMultipleCotexts);
+        this._updateAllMessagesCheckbox();
     },
 
     /**
@@ -268,6 +267,13 @@
      */
     targetRemoved: function(target)
     {
+        this._updateAllMessagesCheckbox();
+    },
+
+    _updateAllMessagesCheckbox: function()
+    {
+        var hasMultipleCotexts = WebInspector.targetManager.targets(WebInspector.Target.Capability.JS).length > 1;
+        this._showAllMessagesCheckbox.element.classList.toggle("hidden", !hasMultipleCotexts);
     },
 
     _registerWithMessageSink: function()
diff --git a/third_party/WebKit/Source/devtools/front_end/externs.js b/third_party/WebKit/Source/devtools/front_end/externs.js
index e7a94a56..6a6fc0df 100644
--- a/third_party/WebKit/Source/devtools/front_end/externs.js
+++ b/third_party/WebKit/Source/devtools/front_end/externs.js
@@ -592,7 +592,8 @@
 CodeMirror.TextMarker = function(doc, type) { }
 CodeMirror.TextMarker.prototype = {
     clear: function() { },
-    find: function() { }
+    find: function() { },
+    changed: function() { }
 }
 
 /** @constructor */
diff --git a/third_party/WebKit/Source/devtools/front_end/inspector.json b/third_party/WebKit/Source/devtools/front_end/inspector.json
index cbf2c57b..10d51e0f 100644
--- a/third_party/WebKit/Source/devtools/front_end/inspector.json
+++ b/third_party/WebKit/Source/devtools/front_end/inspector.json
@@ -23,6 +23,7 @@
         { "name": "profiler" },
         { "name": "resources", "condition": "!v8only" },
         { "name": "audits", "condition": "!v8only" },
+        { "name": "audits2", "condition": "!v8only" },
         { "name": "devices", "condition": "!v8only" },
         { "name": "security", "condition": "!v8only" },
         { "name": "console" },
diff --git a/third_party/WebKit/Source/devtools/front_end/layer_viewer/Layers3DView.js b/third_party/WebKit/Source/devtools/front_end/layer_viewer/Layers3DView.js
index acaea3bc..a1ec74fa 100644
--- a/third_party/WebKit/Source/devtools/front_end/layer_viewer/Layers3DView.js
+++ b/third_party/WebKit/Source/devtools/front_end/layer_viewer/Layers3DView.js
@@ -90,7 +90,8 @@
 /** @enum {symbol} */
 WebInspector.Layers3DView.Events = {
     LayerSnapshotRequested: Symbol("LayerSnapshotRequested"),
-    PaintProfilerRequested: Symbol("PaintProfilerRequested")
+    PaintProfilerRequested: Symbol("PaintProfilerRequested"),
+    ScaleChanged: Symbol("ScaleChanged")
 }
 
 /**
@@ -156,6 +157,7 @@
     setLayerTree: function(layerTree)
     {
         this._layerTree = layerTree;
+        delete this._oldTextureScale;
         this._textureManager.reset();
         this._update();
     },
@@ -305,7 +307,14 @@
         var scale = this._transformController.scale();
         var rotateX = this._transformController.rotateX();
         var rotateY = this._transformController.rotateY();
+
         this._scale = scale * viewScale;
+        var textureScale = Number.constrain(this._scale, 0.1, 1);
+        if (textureScale !== this._oldTextureScale) {
+            this._oldTextureScale = textureScale;
+            this._textureManager.setScale(textureScale);
+            this.dispatchEventToListeners(WebInspector.Layers3DView.Events.ScaleChanged, textureScale);
+        }
         var scaleAndRotationMatrix = new WebKitCSSMatrix().scale(scale, scale, scale).translate(canvasWidth / 2, canvasHeight / 2, 0)
             .rotate(rotateX, rotateY, 0).scale(viewScale, viewScale, viewScale).translate(-baseWidth / 2, -baseHeight / 2, 0);
 
@@ -665,7 +674,6 @@
         this._calculateRects();
         this._updateTransformAndConstraints();
 
-        this._textureManager.setScale(Number.constrain(0.1, 1, this._scale));
         gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
         gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
 
diff --git a/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js b/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js
index 3fe38609..85a665e 100644
--- a/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js
+++ b/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js
@@ -56,6 +56,8 @@
     this._minBarHeight = window.devicePixelRatio;
     this._barPaddingWidth = 2 * window.devicePixelRatio;
     this._outerBarWidth = this._innerBarWidth + this._barPaddingWidth;
+    this._pendingScale = 1;
+    this._scale = this._pendingScale;
 
     this._reset();
 }
@@ -91,7 +93,7 @@
         }
         this._selectionWindow.setEnabled(true);
         this._progressBanner.classList.remove("hidden");
-        snapshot.requestImage(null, null, 1, this._showImageCallback);
+        this._updateImage();
         snapshot.profile(clipRect, onProfileDone.bind(this));
         /**
          * @param {!Array.<!LayerTreeAgent.PaintProfile>=} profiles
@@ -106,6 +108,18 @@
         }
     },
 
+    /**
+     * @param {number} scale
+     */
+    setScale: function(scale)
+    {
+        var needsUpdate = scale > this._scale;
+        var predictiveGrowthFactor = 2;
+        this._pendingScale = Math.min(1, scale * predictiveGrowthFactor);
+        if (needsUpdate)
+            this._updateImage();
+    },
+
     _update: function()
     {
         this._canvas.width = this._canvasContainer.clientWidth * window.devicePixelRatio;
@@ -238,11 +252,15 @@
     _updateImage: function()
     {
         delete this._updateImageTimer;
+        var left = null;
+        var right = null;
         var window = this.selectionWindow();
-        if (!this._profiles || !this._profiles.length || !window)
-            return;
-
-        this._snapshot.requestImage(this._log[window.left].commandIndex, this._log[window.right - 1].commandIndex, 1, this._showImageCallback);
+        if (this._profiles && this._profiles.length && window) {
+            left = this._log[window.left].commandIndex;
+            right = this._log[window.right - 1].commandIndex;
+        }
+        var scale = this._pendingScale;
+        this._snapshot.requestImage(left, right, scale, image => { this._scale = scale; this._showImageCallback(image); });
     },
 
     _reset: function()
@@ -281,17 +299,24 @@
     {
         this._target = target;
         this._log = log;
+        /** @type {!Map<!WebInspector.PaintProfilerLogItem>} */
+        this._treeItemCache = new Map();
         this.updateWindow({left: 0, right: this._log.length});
     },
 
     /**
-      * @param {!TreeOutline} treeOutline
       * @param {!WebInspector.PaintProfilerLogItem} logItem
       */
-    _appendLogItem: function(treeOutline, logItem)
+    _appendLogItem: function(logItem)
     {
-        var treeElement = new WebInspector.LogTreeElement(this, logItem);
-        treeOutline.appendChild(treeElement);
+        var treeElement = this._treeItemCache.get(logItem);
+        if (!treeElement) {
+            treeElement = new WebInspector.LogTreeElement(this, logItem);
+            this._treeItemCache.set(logItem, treeElement);
+        } else if (treeElement.parent) {
+            return;
+        }
+        this._treeOutline.appendChild(treeElement);
     },
 
     /**
@@ -309,11 +334,25 @@
      */
     doUpdate: function()
     {
-        this._treeOutline.removeChildren();
-        if (!this._selectionWindow || !this._log.length)
+        if (!this._selectionWindow || !this._log.length) {
+            this._treeOutline.removeChildren();
             return Promise.resolve();
+        }
+        var root = this._treeOutline.rootElement();
+        for (;;) {
+            var child = root.firstChild();
+            if (!child || child._logItem.commandIndex >= this._selectionWindow.left)
+                break;
+            root.removeChildAtIndex(0);
+        }
+        for (;;) {
+            var child = root.lastChild();
+            if (!child || child._logItem.commandIndex < this._selectionWindow.right)
+                break;
+            root.removeChildAtIndex(root.children().length - 1);
+        }
         for (var i = this._selectionWindow.left, right = this._selectionWindow.right; i < right; ++i)
-            this._appendLogItem(this._treeOutline, this._log[i]);
+            this._appendLogItem(this._log[i]);
         return Promise.resolve();
     },
 
diff --git a/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js b/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js
index d79f213..33273269 100644
--- a/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js
+++ b/third_party/WebKit/Source/devtools/front_end/layers/LayerPaintProfilerView.js
@@ -52,6 +52,14 @@
         }
     },
 
+    /**
+     * @param {number} scale
+     */
+    setScale: function(scale)
+    {
+        this._paintProfilerView.setScale(scale);
+    },
+
     _onWindowChanged: function()
     {
         this._logTreeView.updateWindow(this._paintProfilerView.selectionWindow());
diff --git a/third_party/WebKit/Source/devtools/front_end/layers/LayersPanel.js b/third_party/WebKit/Source/devtools/front_end/layers/LayersPanel.js
index 541dbb4..7a7c44c 100644
--- a/third_party/WebKit/Source/devtools/front_end/layers/LayersPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/layers/LayersPanel.js
@@ -52,6 +52,7 @@
     this._layers3DView = new WebInspector.Layers3DView(this._layerViewHost);
     this._rightSplitWidget.setMainWidget(this._layers3DView);
     this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.LayerSnapshotRequested, this._onSnapshotRequested, this);
+    this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ScaleChanged, this._onScaleChanged, this);
 
     this._tabbedPane = new WebInspector.TabbedPane();
     this._rightSplitWidget.setSidebarWidget(this._tabbedPane);
@@ -157,5 +158,13 @@
         this._paintProfilerView.profileLayer(layer);
     },
 
+    /**
+     * @param {!WebInspector.Event} event
+     */
+    _onScaleChanged: function(event)
+    {
+        this._paintProfilerView.setScale(/** @type {number} */(event.data));
+    },
+
     __proto__: WebInspector.PanelWithSidebar.prototype
 }
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index b98c5f3..88677b8 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -81,6 +81,7 @@
     {
         Runtime.experiments.register("accessibilityInspection", "Accessibility Inspection");
         Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI themes");
+        Runtime.experiments.register("audits2", "Audits 2.0", true);
         Runtime.experiments.register("autoAttachToCrossProcessSubframes", "Auto-attach to cross-process subframes", true);
         Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox JavaScript frames on Timeline", true);
         Runtime.experiments.register("canvasNetworkTimeline", "Canvas based timeline in Network panel", true);
@@ -230,6 +231,9 @@
         WebInspector.inspectorView.createToolbars();
         InspectorFrontendHost.loadCompleted();
 
+        InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.EvaluateForTestInFrontend, this._evaluateForTestInFrontend, this);
+        InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspectedPage, this);
+
         var extensions = self.runtime.extensions(WebInspector.QueryParamHandler);
         for (var extension of extensions) {
             var value = Runtime.queryParam(extension.descriptor()["name"]);
@@ -297,6 +301,14 @@
             WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason);
         }
 
+        this._createMainTarget();
+        InspectorFrontendHost.readyForTest();
+        // Asynchronously run the extensions.
+        setTimeout(this._lateInitialization.bind(this), 100);
+    },
+
+    _createMainTarget: function()
+    {
         var capabilities =
             WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.DOM |
             WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log |
@@ -308,33 +320,21 @@
         else if (Runtime.queryParam("v8only"))
             capabilities = WebInspector.Target.Capability.JS;
 
-        this._mainTarget = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), capabilities, connection, null);
-        console.timeStamp("Main._mainTargetCreated");
-        this._registerShortcuts();
-
+        this._mainTarget = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), capabilities, this._mainConnection, null);
         this._mainTarget.registerInspectorDispatcher(this);
-        InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspectedPage, this);
-        InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.EvaluateForTestInFrontend, this._evaluateForTestInFrontend, this);
-
         this._mainTarget.runtimeAgent().runIfWaitingForDebugger();
-
         if (this._mainTarget.hasBrowserCapability())
             this._mainTarget.inspectorAgent().enable();
-        InspectorFrontendHost.readyForTest();
+        console.timeStamp("Main._mainTargetCreated");
+    },
 
-        // Asynchronously run the extensions.
-        setTimeout(lateInitialization.bind(this), 0);
-
-        /**
-         * @this {WebInspector.Main}
-         */
-        function lateInitialization()
-        {
-            console.timeStamp("Main.lateInitialization");
-            WebInspector.extensionServer.initializeExtensions();
-            if (Runtime.experiments.isEnabled("nodeDebugging"))
-                new WebInspector.RemoteLocationManager(this._mainTarget);
-        }
+    _lateInitialization: function()
+    {
+        console.timeStamp("Main._lateInitialization");
+        this._registerShortcuts();
+        WebInspector.extensionServer.initializeExtensions();
+        if (Runtime.experiments.isEnabled("nodeDebugging"))
+            new WebInspector.RemoteLocationManager(this._mainTarget);
     },
 
     _registerForwardedShortcuts: function()
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js
index 7994343..bf7a209 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js
@@ -395,7 +395,8 @@
         this._hoveredNode = node;
         if (this._hoveredNode)
             this._hoveredNode.element().classList.add("hover");
-        this._timelineColumn.setHoveredRequest(this._hoveredNode ? this._hoveredNode.request() : null);
+        if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
+            this._timelineColumn.setHoveredRequest(this._hoveredNode ? this._hoveredNode.request() : null);
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js
index 8623c8b3..9740047 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js
@@ -700,6 +700,7 @@
 
     updateDividersIfNeeded: function()
     {
+        // TODO(allada) Remove this code out when timeline canvas experiment is over.
         if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
             return;
         if (!this._networkLogView.isShowing()) {
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js
index 1aad77db..e69d5c2 100644
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js
@@ -249,6 +249,53 @@
             }
         }
         context.restore();
+        this._drawDividers(context);
+    },
+
+    _drawDividers: function(context)
+    {
+        context.save();
+        /** @const */
+        var minGridSlicePx = 64; // minimal distance between grid lines.
+        /** @const */
+        var fontSize = 10;
+
+        var drawableWidth = this._offsetWidth - this._leftPadding - this._rightPadding;
+        var timelineDuration = this._timelineDuration();
+        var dividersCount = drawableWidth / minGridSlicePx;
+        var gridSliceTime = timelineDuration / dividersCount;
+        var pixelsPerTime = drawableWidth / timelineDuration;
+
+        // Align gridSliceTime to a nearest round value.
+        // We allow spans that fit into the formula: span = (1|2|5)x10^n,
+        // e.g.: ...  .1  .2  .5  1  2  5  10  20  50  ...
+        // After a span has been chosen make grid lines at multiples of the span.
+
+        var logGridSliceTime = Math.ceil(Math.log(gridSliceTime) / Math.LN10);
+        gridSliceTime = Math.pow(10, logGridSliceTime);
+        if (gridSliceTime * pixelsPerTime >= 5 * minGridSlicePx)
+            gridSliceTime = gridSliceTime / 5;
+        if (gridSliceTime * pixelsPerTime >= 2 * minGridSlicePx)
+            gridSliceTime = gridSliceTime / 2;
+
+        context.lineWidth = 1;
+        context.strokeStyle = "rgba(0, 0, 0, .1)";
+        context.font = fontSize + "px sans-serif";
+        context.fillStyle = "#444"
+        gridSliceTime = gridSliceTime;
+        for (var position = gridSliceTime * pixelsPerTime; position < drawableWidth; position += gridSliceTime * pixelsPerTime) {
+            // Added .5 because canvas drawing points are between pixels.
+            var drawPosition = Math.floor(position) + this._leftPadding + .5;
+            context.beginPath();
+            context.moveTo(drawPosition, 0);
+            context.lineTo(drawPosition, this._offsetHeight);
+            context.stroke();
+            if (position <= gridSliceTime * pixelsPerTime)
+                continue;
+            var textData = Number.secondsToString(position / pixelsPerTime);
+            context.fillText(textData, drawPosition - context.measureText(textData).width - 2, Math.floor(this._networkLogView.headerHeight() - fontSize / 2));
+        }
+        context.restore();
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/platform/utilities.js b/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
index fb56ae4..f8353776 100644
--- a/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
+++ b/third_party/WebKit/Source/devtools/front_end/platform/utilities.js
@@ -408,6 +408,14 @@
 }
 
 /**
+ * @return {boolean}
+ */
+Date.prototype.isValid = function()
+{
+    return !isNaN(this.getTime())
+}
+
+/**
  * @return {string}
  */
 Date.prototype.toISO8601Compact = function()
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js b/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
index faf2c28d..c890ffb 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
@@ -55,6 +55,8 @@
         if (this._resourceTreeModel)
             return;
         var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
+        if (!resourceTreeModel)
+            return;
         this._resourceTreeModel = resourceTreeModel;
         this._updateManifest();
         resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._updateManifest, this);
@@ -66,6 +68,11 @@
      */
     targetRemoved: function(target)
     {
+        var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
+        if (!this._resourceTreeModel || this._resourceTreeModel !== resourceTreeModel)
+            return;
+        resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._updateManifest, this);
+        delete this._resourceTreeModel;
     },
 
     _updateManifest: function()
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
index 17d5166..0ed2041d 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
@@ -76,6 +76,18 @@
     },
 
     /**
+     * @override
+     * @param {!WebInspector.Target} target
+     */
+    targetRemoved: function(target)
+    {
+        if (this._target !== target)
+            return;
+        var securityOriginManager = WebInspector.SecurityOriginManager.fromTarget(target);
+        securityOriginManager.removeEventListener(WebInspector.SecurityOriginManager.Events.MainSecurityOriginChanged, this._originChanged, this);
+    },
+
+    /**
      * @param {!WebInspector.Event} event
      */
     _originChanged: function(event)
@@ -151,13 +163,5 @@
         }, 500);
     },
 
-    /**
-     * @override
-     * @param {!WebInspector.Target} target
-     */
-    targetRemoved: function(target)
-    {
-    },
-
     __proto__: WebInspector.VBox.prototype
 }
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
index 049bcf8..0e145364 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
@@ -19,6 +19,18 @@
     /** @type {!Map<!WebInspector.ServiceWorkerRegistration, !WebInspector.ServiceWorkersView.Section>} */
     this._sections = new Map();
 
+    this._toolbar.appendToolbarItem(WebInspector.NetworkConditionsSelector.createOfflineToolbarCheckbox());
+    var forceUpdate = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Update on reload"), WebInspector.UIString("Force update Service Worker on page reload"), WebInspector.settings.createSetting("serviceWorkerUpdateOnReload", false));
+    this._toolbar.appendToolbarItem(forceUpdate);
+    var fallbackToNetwork = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Bypass for network"), WebInspector.UIString("Bypass Service Worker and load resources from the network"), WebInspector.settings.createSetting("bypassServiceWorker", false));
+    this._toolbar.appendToolbarItem(fallbackToNetwork);
+    this._toolbar.appendSpacer();
+    this._showAllCheckbox = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Show all"), WebInspector.UIString("Show all Service Workers regardless of the origin"));
+    this._showAllCheckbox.inputElement.addEventListener("change", this._updateSectionVisibility.bind(this), false);
+    this._toolbar.appendToolbarItem(this._showAllCheckbox);
+
+    /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.EventDescriptor>>}*/
+    this._eventListeners = new Map();
     WebInspector.targetManager.observeTargets(this);
 }
 
@@ -29,34 +41,22 @@
      */
     targetAdded: function(target)
     {
-        var securityOriginManager = WebInspector.SecurityOriginManager.fromTarget(target);
-        if (this._manager || !target.serviceWorkerManager || !securityOriginManager)
+        if (this._manager || !target.serviceWorkerManager)
             return;
         this._manager = target.serviceWorkerManager;
         this._subTargetsManager = target.subTargetsManager;
-        this._securityOriginManager = securityOriginManager;
-
-        this._toolbar.appendToolbarItem(WebInspector.NetworkConditionsSelector.createOfflineToolbarCheckbox());
-        var forceUpdate = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Update on reload"), WebInspector.UIString("Force update Service Worker on page reload"), this._manager.forceUpdateOnReloadSetting());
-        this._toolbar.appendToolbarItem(forceUpdate);
-        var networkManager = target && WebInspector.NetworkManager.fromTarget(target);
-        if (networkManager) {
-            var fallbackToNetwork = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Bypass for network"), WebInspector.UIString("Bypass Service Worker and load resources from the network"), networkManager.bypassServiceWorkerSetting());
-            this._toolbar.appendToolbarItem(fallbackToNetwork);
-            this._toolbar.appendSpacer();
-        }
-        this._showAllCheckbox = new WebInspector.ToolbarCheckbox(WebInspector.UIString("Show all"), WebInspector.UIString("Show all Service Workers regardless of the origin"));
-        this._showAllCheckbox.inputElement.addEventListener("change", this._updateSectionVisibility.bind(this), false);
-        this._toolbar.appendToolbarItem(this._showAllCheckbox);
+        this._securityOriginManager = WebInspector.SecurityOriginManager.fromTarget(target);
 
         for (var registration of this._manager.registrations().values())
             this._updateRegistration(registration);
 
-        this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationUpdated, this._registrationUpdated, this);
-        this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationDeleted, this._registrationDeleted, this);
-        this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationErrorAdded, this._registrationErrorAdded, this);
-        securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.Events.SecurityOriginAdded, this._updateSectionVisibility, this);
-        securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.Events.SecurityOriginRemoved, this._updateSectionVisibility, this);
+        this._eventListeners.set(target, [
+            this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationUpdated, this._registrationUpdated, this),
+            this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationDeleted, this._registrationDeleted, this),
+            this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.RegistrationErrorAdded, this._registrationErrorAdded, this),
+            this._securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.Events.SecurityOriginAdded, this._updateSectionVisibility, this),
+            this._securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.Events.SecurityOriginRemoved, this._updateSectionVisibility, this),
+        ]);
     },
 
     /**
@@ -65,9 +65,13 @@
      */
     targetRemoved: function(target)
     {
-        if (this._manager !== target.serviceWorkerManager)
+        if (!this._manager || this._manager !== target.serviceWorkerManager)
             return;
+
+        WebInspector.EventTarget.removeEventListeners(this._eventListeners.get(target));
+        this._eventListeners.delete(target);
         this._manager = null;
+        this._subTargetsManager = null;
         this._securityOriginManager = null;
     },
 
diff --git a/third_party/WebKit/Source/devtools/front_end/sass/ASTSourceMap.js b/third_party/WebKit/Source/devtools/front_end/sass/ASTSourceMap.js
index 17939069..821f935 100644
--- a/third_party/WebKit/Source/devtools/front_end/sass/ASTSourceMap.js
+++ b/third_party/WebKit/Source/devtools/front_end/sass/ASTSourceMap.js
@@ -66,6 +66,17 @@
 
     /**
      * @override
+     * @param {string} sourceURL
+     * @return {?string}
+     */
+    embeddedContentByURL: function(sourceURL)
+    {
+        var model = this.modelForURL(sourceURL);
+        return model ? model.document.text.value() : "";
+    },
+
+    /**
+     * @override
      * @param {number} lineNumber
      * @param {number=} columnNumber
      * @return {?WebInspector.SourceMapEntry}
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
index 512dc3f..95464a9 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js
@@ -146,14 +146,6 @@
         WebInspector.moduleSetting("cacheDisabled").removeChangeListener(this._cacheDisabledSettingChanged, this);
     },
 
-    /**
-     * @return {!WebInspector.Setting}
-     */
-    bypassServiceWorkerSetting: function()
-    {
-        return this._bypassServiceWorkerSetting;
-    },
-
     _bypassServiceWorkerChanged: function()
     {
         this._networkAgent.setBypassServiceWorker(this._bypassServiceWorkerSetting.get());
@@ -364,6 +356,8 @@
             eventData.loaderId = loaderId;
             eventData.resourceType = resourceType;
             eventData.mimeType = response.mimeType;
+            var lastModifiedHeader = response.headers["last-modified"];
+            eventData.lastModified = lastModifiedHeader ? new Date(lastModifiedHeader) : null;
             this._manager.dispatchEventToListeners(WebInspector.NetworkManager.Events.RequestUpdateDropped, eventData);
             return;
         }
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js
index 6159aac..b1b04207 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/NetworkRequest.js
@@ -801,6 +801,14 @@
     },
 
     /**
+     * @return {string|undefined}
+     */
+    responseLastModified: function()
+    {
+        return this.responseHeaderValue("last-modified");
+    },
+
+    /**
      * @return {?Array.<!WebInspector.ServerTiming>}
      */
     get serverTimings()
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js b/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js
index 4db1ddc..bc515f9 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/Resource.js
@@ -38,8 +38,10 @@
  * @param {!NetworkAgent.LoaderId} loaderId
  * @param {!WebInspector.ResourceType} type
  * @param {string} mimeType
+ * @param {?Date} lastModified
+ * @param {?number} contentSize
  */
-WebInspector.Resource = function(target, request, url, documentURL, frameId, loaderId, type, mimeType)
+WebInspector.Resource = function(target, request, url, documentURL, frameId, loaderId, type, mimeType, lastModified, contentSize)
 {
     WebInspector.SDKObject.call(this, target);
     this._request = request;
@@ -50,6 +52,9 @@
     this._type = type || WebInspector.resourceTypes.Other;
     this._mimeType = mimeType;
 
+    this._lastModified = lastModified && lastModified.isValid() ? lastModified : null;
+    this._contentSize = contentSize;
+
     /** @type {?string} */ this._content;
     /** @type {boolean} */ this._contentEncoded;
     this._pendingContentCallbacks = [];
@@ -59,6 +64,29 @@
 
 WebInspector.Resource.prototype = {
     /**
+     * @return {?Date}
+     */
+    lastModified: function()
+    {
+        if (this._lastModified || !this._request)
+            return this._lastModified;
+        var lastModifiedHeader = this._request.responseLastModified();
+        var date = lastModifiedHeader ? new Date(lastModifiedHeader) : null;
+        this._lastModified = date && date.isValid() ? date : null;
+        return this._lastModified;
+    },
+
+    /**
+     * @return {?number}
+     */
+    contentSize: function()
+    {
+        if (typeof this._contentSize === "number" || !this._request)
+            return this._contentSize;
+        return this._request.resourceSize;
+    },
+
+    /**
      * @return {?WebInspector.NetworkRequest}
      */
     get request()
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
index 181514e4..1af3382 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
@@ -55,9 +55,6 @@
 
     this._pendingReloadOptions = null;
     this._reloadSuspensionCount = 0;
-    this._fireExecutionContextOrderChanged = target.runtimeModel.fireExecutionContextOrderChanged.bind(target.runtimeModel);
-
-    target.runtimeModel.setExecutionContextComparator(this._executionContextComparator.bind(this));
 }
 
 /** @enum {symbol} */
@@ -134,7 +131,8 @@
             this.target().setInspectedURL(mainFramePayload.frame.url);
         }
         this._cachedResourcesProcessed = true;
-        this._fireExecutionContextOrderChanged();
+        this.target().runtimeModel.setExecutionContextComparator(this._executionContextComparator.bind(this));
+        this.target().runtimeModel.fireExecutionContextOrderChanged();
         this.dispatchEventToListeners(WebInspector.ResourceTreeModel.Events.CachedResourcesLoaded);
     },
 
@@ -301,7 +299,7 @@
         if (frame._resourcesMap[url])
             return;
 
-        var resource = new WebInspector.Resource(this.target(), null, url, frame.url, frameId, event.data.loaderId, WebInspector.resourceTypes[event.data.resourceType], event.data.mimeType);
+        var resource = new WebInspector.Resource(this.target(), null, url, frame.url, frameId, event.data.loaderId, WebInspector.resourceTypes[event.data.resourceType], event.data.mimeType, event.data.lastModified, null);
         frame.addResource(resource);
     },
 
@@ -353,7 +351,7 @@
         var frame = new WebInspector.ResourceTreeFrame(this, parentFrame, framePayload.id, framePayload);
         this._addFrame(frame);
 
-        var frameResource = this._createResourceFromFramePayload(framePayload, framePayload.url, WebInspector.resourceTypes.Document, framePayload.mimeType);
+        var frameResource = this._createResourceFromFramePayload(framePayload, framePayload.url, WebInspector.resourceTypes.Document, framePayload.mimeType, null, null);
         frame.addResource(frameResource);
 
         for (var i = 0; frameTreePayload.childFrames && i < frameTreePayload.childFrames.length; ++i)
@@ -361,7 +359,7 @@
 
         for (var i = 0; i < frameTreePayload.resources.length; ++i) {
             var subresource = frameTreePayload.resources[i];
-            var resource = this._createResourceFromFramePayload(framePayload, subresource.url, WebInspector.resourceTypes[subresource.type], subresource.mimeType);
+            var resource = this._createResourceFromFramePayload(framePayload, subresource.url, WebInspector.resourceTypes[subresource.type], subresource.mimeType, subresource.lastModified || null, subresource.contentSize || null);
             frame.addResource(resource);
         }
     },
@@ -371,11 +369,14 @@
      * @param {string} url
      * @param {!WebInspector.ResourceType} type
      * @param {string} mimeType
+     * @param {?number} lastModifiedTime
+     * @param {?number} contentSize
      * @return {!WebInspector.Resource}
      */
-    _createResourceFromFramePayload: function(frame, url, type, mimeType)
+    _createResourceFromFramePayload: function(frame, url, type, mimeType, lastModifiedTime, contentSize)
     {
-        return new WebInspector.Resource(this.target(), null, url, frame.url, frame.id, frame.loaderId, type, mimeType);
+        var lastModified = typeof lastModifiedTime === "number" ? new Date(lastModifiedTime * 1000) : null;
+        return new WebInspector.Resource(this.target(), null, url, frame.url, frame.id, frame.loaderId, type, mimeType, lastModified, contentSize);
     },
 
     suspendReload: function()
@@ -694,19 +695,17 @@
 
     /**
      * @param {!WebInspector.NetworkRequest} request
-     * @return {!WebInspector.Resource}
      */
     _addRequest: function(request)
     {
         var resource = this._resourcesMap[request.url];
         if (resource && resource.request === request) {
             // Already in the tree, we just got an extra update.
-            return resource;
+            return;
         }
-        resource = new WebInspector.Resource(this.target(), request, request.url, request.documentURL, request.frameId, request.loaderId, request.resourceType(), request.mimeType);
+        resource = new WebInspector.Resource(this.target(), request, request.url, request.documentURL, request.frameId, request.loaderId, request.resourceType(), request.mimeType, null, null);
         this._resourcesMap[resource.url] = resource;
         this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.Events.ResourceAdded, resource);
-        return resource;
     },
 
     /**
@@ -726,16 +725,12 @@
      */
     resourceForURL: function(url)
     {
-        var result;
-        function filter(resource)
-        {
-            if (resource.url === url) {
-                result = resource;
-                return true;
-            }
-        }
-        this._callForFrameResources(filter);
-        return result || null;
+        var resource = this._resourcesMap[url] || null;
+        if (resource)
+            return resource;
+        for (var i = 0; !resource && i < this._childFrames.length; ++i)
+            resource = this._childFrames[i].resourceForURL(url);
+        return resource;
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
index be868e01..8f7686b 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
@@ -108,6 +108,12 @@
     sourceContentProvider: function(sourceURL, contentType) { },
 
     /**
+     * @param {string} sourceURL
+     * @return {?string}
+     */
+    embeddedContentByURL: function(sourceURL) { },
+
+    /**
      * @param {number} lineNumber in compiled resource
      * @param {number} columnNumber in compiled resource
      * @return {?WebInspector.SourceMapEntry}
@@ -265,6 +271,18 @@
 
     /**
      * @override
+     * @param {string} sourceURL
+     * @return {?string}
+     */
+    embeddedContentByURL: function(sourceURL)
+    {
+        if (!this._sourceInfos.has(sourceURL))
+            return null;
+        return this._sourceInfos.get(sourceURL).content;
+    },
+
+    /**
+     * @override
      * @return {boolean}
      */
     editable: function()
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
index dddad910..a98d55b 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
@@ -195,8 +195,6 @@
 
         /** @type {!WebInspector.ConsoleModel} */
         target.consoleModel = new WebInspector.ConsoleModel(target, logAgent);
-        /** @type {!WebInspector.RuntimeModel} */
-        target.runtimeModel = new WebInspector.RuntimeModel(target);
 
         var networkManager = null;
         var resourceTreeModel = null;
@@ -207,6 +205,9 @@
             new WebInspector.NetworkLog(target, resourceTreeModel, networkManager);
         }
 
+        /** @type {!WebInspector.RuntimeModel} */
+        target.runtimeModel = new WebInspector.RuntimeModel(target);
+
         if (target.hasJSCapability())
             new WebInspector.DebuggerModel(target);
 
@@ -308,6 +309,14 @@
         }
     },
 
+    removeAllTargets: function()
+    {
+        var targets = this._targets.slice();
+        for (var i = targets.length - 1; i >=0 ; --i)
+            this.removeTarget(targets[i]);
+        this._targets = [];
+    },
+
     /**
      * @param {number=} capabilitiesMask
      * @return {!Array.<!WebInspector.Target>}
diff --git a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
index 2248895..45c96b66 100644
--- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
@@ -26,6 +26,8 @@
     /** @type {!Map<!WebInspector.NetworkLogView.MixedContentFilterValues, number>} */
     this._filterRequestCounts = new Map();
 
+    /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.EventDescriptor>>}*/
+    this._eventListeners = new Map();
     WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Network);
 }
 
@@ -257,21 +259,33 @@
         if (this._target)
             return;
 
-        this._target = target;
-
-        var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._target);
+        var listeners = [];
+        var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
         if (resourceTreeModel) {
-            resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNavigated, this);
-            resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialShown, this._onInterstitialShown, this);
-            resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitialHidden, this);
+            listeners = listeners.concat([
+                resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNavigated, this),
+                resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialShown, this._onInterstitialShown, this),
+                resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitialHidden, this),
+            ]);
         }
 
         var networkManager = WebInspector.NetworkManager.fromTarget(target);
-        networkManager.addEventListener(WebInspector.NetworkManager.Events.ResponseReceived, this._onResponseReceived, this);
-        networkManager.addEventListener(WebInspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this);
+        if (networkManager) {
+            listeners = listeners.concat([
+                networkManager.addEventListener(WebInspector.NetworkManager.Events.ResponseReceived, this._onResponseReceived, this),
+                networkManager.addEventListener(WebInspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this),
+            ]);
+        }
 
         var securityModel = WebInspector.SecurityModel.fromTarget(target);
-        securityModel.addEventListener(WebInspector.SecurityModel.Events.SecurityStateChanged, this._onSecurityStateChanged, this);
+        if (securityModel) {
+            listeners = listeners.concat([
+                securityModel.addEventListener(WebInspector.SecurityModel.Events.SecurityStateChanged, this._onSecurityStateChanged, this)
+            ]);
+        }
+
+        this._target = target;
+        this._eventListeners.set(target, listeners);
     },
 
     /**
@@ -280,6 +294,13 @@
      */
     targetRemoved: function(target)
     {
+        if (this._target !== target)
+            return;
+
+        delete this._target;
+
+        WebInspector.EventTarget.removeEventListeners(this._eventListeners.get(target));
+        this._eventListeners.delete(target);
     },
 
     /**
@@ -865,7 +886,8 @@
         var table = new WebInspector.SecurityDetailsTable();
         connectionSection.appendChild(table.element());
         table.addRow("Protocol", originState.securityDetails.protocol);
-        table.addRow("Key Exchange", originState.securityDetails.keyExchange);
+        if (originState.securityDetails.keyExchange)
+            table.addRow("Key Exchange", originState.securityDetails.keyExchange);
         if (originState.securityDetails.keyExchangeGroup)
             table.addRow("Key Exchange Group", originState.securityDetails.keyExchangeGroup);
         table.addRow("Cipher", originState.securityDetails.cipher + (originState.securityDetails.mac ? " with " + originState.securityDetails.mac : ""));
diff --git a/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js b/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js
index 989056b..b2f53bc 100644
--- a/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/services/ServiceManager.js
@@ -30,12 +30,18 @@
     /**
      * @param {string} appName
      * @param {string} serviceName
-     * @param {boolean} isShared
+     * @param {boolean} isSharedWorker
      * @return {!Promise<?WebInspector.ServiceManager.Service>}
      */
-    createWorkerService: function(appName, serviceName, isShared)
+    createAppService: function(appName, serviceName, isSharedWorker)
     {
-        var connection = new WebInspector.ServiceManager.Connection(new WebInspector.ServiceManager.WorkerServicePort(appName, isShared));
+        var url = appName + ".js";
+        var remoteBase = Runtime.queryParam("remoteBase");
+        if (remoteBase)
+            url += "?remoteBase=" + remoteBase;
+
+        var worker = isSharedWorker ? new SharedWorker(url, appName) : new Worker(url);
+        var connection = new WebInspector.ServiceManager.Connection(new WebInspector.ServiceManager.WorkerServicePort(worker));
         return connection._createService(serviceName);
     }
 }
@@ -64,8 +70,10 @@
     _createService: function(serviceName)
     {
         return this._sendCommand(serviceName + ".create").then(result => {
-            if (!result)
+            if (!result) {
+                console.error("Could not initialize service: " + serviceName);
                 return null;
+            }
             var service = new WebInspector.ServiceManager.Service(this, serviceName, result.id);
             this._services.set(serviceName + ":" + result.id, service);
             return service;
@@ -308,13 +316,36 @@
 /**
  * @constructor
  * @implements {ServicePort}
- * @param {string} appName
- * @param {boolean} isSharedWorker
+ * @param {!Worker|!SharedWorker} worker
  */
-WebInspector.ServiceManager.WorkerServicePort = function(appName, isSharedWorker)
+WebInspector.ServiceManager.WorkerServicePort = function(worker)
 {
-    this._appName = appName;
-    this._isSharedWorker = isSharedWorker;
+    this._worker = worker;
+
+    var fulfill;
+    this._workerPromise = new Promise(resolve => fulfill = resolve);
+    this._isSharedWorker = worker instanceof SharedWorker;
+
+    if (this._isSharedWorker) {
+        this._worker.port.onmessage = onMessage.bind(this);
+        this._worker.port.onclose = this._closeHandler;
+    } else {
+        this._worker.onmessage = onMessage.bind(this);
+        this._worker.onclose = this._closeHandler;
+    }
+
+    /**
+     * @param {!Event} event
+     * @this {WebInspector.ServiceManager.WorkerServicePort}
+     */
+    function onMessage(event)
+    {
+        if (event.data === "workerReady") {
+            fulfill(true);
+            return;
+        }
+        this._messageHandler(event.data);
+    }
 }
 
 WebInspector.ServiceManager.WorkerServicePort.prototype = {
@@ -330,60 +361,13 @@
     },
 
     /**
-     * @return {!Promise<boolean>}
-     */
-    _open: function()
-    {
-        if (this._workerPromise)
-            return this._workerPromise;
-
-        var url = this._appName + ".js";
-        var remoteBase = Runtime.queryParam("remoteBase");
-        if (remoteBase)
-            url += "?remoteBase=" + remoteBase;
-
-        this._workerPromise = new Promise(promiseBody.bind(this));
-
-        /**
-         * @param {function(boolean)} fulfill
-         * @this {WebInspector.ServiceManager.WorkerServicePort}
-         */
-        function promiseBody(fulfill)
-        {
-            if (this._isSharedWorker) {
-                this._worker = new SharedWorker(url, this._appName);
-                this._worker.port.onmessage = onMessage.bind(this);
-                this._worker.port.onclose = this._closeHandler;
-            } else {
-                this._worker = new Worker(url);
-                this._worker.onmessage = onMessage.bind(this);
-                this._worker.onclose = this._closeHandler;
-            }
-
-            /**
-             * @param {!Event} event
-             * @this {WebInspector.ServiceManager.WorkerServicePort}
-             */
-            function onMessage(event)
-            {
-                if (event.data === "workerReady") {
-                    fulfill(true);
-                    return;
-                }
-                this._messageHandler(event.data);
-            }
-        }
-        return this._workerPromise;
-    },
-
-    /**
      * @override
      * @param {string} message
      * @return {!Promise<boolean>}
      */
     send: function(message)
     {
-        return this._open().then(() => {
+        return this._workerPromise.then(() => {
             try {
                 if (this._isSharedWorker)
                     this._worker.port.postMessage(message);
@@ -402,7 +386,7 @@
      */
     close: function()
     {
-        return this._open().then(() => {
+        return this._workerPromise.then(() => {
             if (this._worker)
                 this._worker.terminate();
             return false;
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
index 0e50915..4fc1966 100644
--- a/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
+++ b/third_party/WebKit/Source/devtools/front_end/text_editor/CodeMirrorTextEditor.js
@@ -1686,6 +1686,14 @@
             this._editor._updateDecorations(position.line);
     },
 
+    refresh: function()
+    {
+        this._marker.changed();
+        var position = this._marker.find();
+        if (position)
+            this._editor._updateDecorations(position.line);
+    },
+
     /**
      * @return {symbol}
      */
@@ -1695,12 +1703,12 @@
     },
 
     /**
-     * @return {!WebInspector.TextRange}
+     * @return {?WebInspector.TextRange}
      */
     position: function()
     {
         var pos = this._marker.find();
-        return WebInspector.TextRange.createFromLocation(pos.line, pos.ch);
+        return pos ? WebInspector.TextRange.createFromLocation(pos.line, pos.ch) : null;
     }
 }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js b/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
index 190b164..519aaad 100644
--- a/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
+++ b/third_party/WebKit/Source/devtools/front_end/text_editor/TextEditorAutocompleteController.js
@@ -23,7 +23,7 @@
     this._beforeChange = this._beforeChange.bind(this);
     this._mouseDown = this.clearAutocomplete.bind(this);
     this._codeMirror.on("changes", this._changes);
-
+    this._lastHintText = "";
     this._hintElement = createElementWithClass("span", "auto-complete-text");
 }
 
@@ -182,13 +182,15 @@
                 break;
             }
         }
-        if (singleCharInput && this._hintMarker)
-            this._hintElement.textContent = this._hintElement.textContent.substring(1);
-
-        if (singleCharDelete && this._hintMarker && this._lastPrefix) {
-            this._hintElement.textContent = this._lastPrefix.charAt(this._lastPrefix.length - 1) + this._hintElement.textContent;
-            this._lastPrefix = this._lastPrefix.substring(0, this._lastPrefix.length - 1);
+        if (this._prefixRange) {
+            if (singleCharInput)
+                this._prefixRange.endColumn++;
+            else if (singleCharDelete)
+                this._prefixRange.endColumn--;
+            if (singleCharDelete || singleCharInput)
+                this._setHint(this._lastHintText);
         }
+
         if (singleCharInput || singleCharDelete)
             setImmediate(this.autocomplete.bind(this));
         else
@@ -265,31 +267,44 @@
                 this._updateAnchorBox();
             this._suggestBox.updateSuggestions(this._anchorBox, wordsWithPrefix, 0, !this._isCursorAtEndOfLine(), prefix);
             this._onSuggestionsShownForTest(wordsWithPrefix);
-            this._addHintMarker(wordsWithPrefix[0].title);
+            this._setHint(wordsWithPrefix[0].title);
         }
     },
 
     /**
      * @param {string} hint
      */
-    _addHintMarker: function(hint)
+    _setHint: function(hint)
     {
-        this._clearHintMarker();
-        if (!this._isCursorAtEndOfLine())
+        if (!this._isCursorAtEndOfLine()) {
+            this._clearHint();
             return;
+        }
         var prefix = this._textEditor.text(this._prefixRange);
-        this._lastPrefix = prefix;
-        this._hintElement.textContent = hint.substring(prefix.length).split("\n")[0];
+        var suffix = hint.substring(prefix.length).split("\n")[0];
+        this._hintElement.textContent = suffix;
         var cursor = this._codeMirror.getCursor("to");
-        this._hintMarker = this._textEditor.addBookmark(cursor.line, cursor.ch, this._hintElement, WebInspector.TextEditorAutocompleteController.HintBookmark, true);
+        if (this._hintMarker) {
+            var position = this._hintMarker.position();
+            if (!position || !position.equal(WebInspector.TextRange.createFromLocation(cursor.line, cursor.ch))) {
+                this._hintMarker.clear();
+                this._hintMarker = null;
+            }
+        }
+
+        if (!this._hintMarker)
+            this._hintMarker = this._textEditor.addBookmark(cursor.line, cursor.ch, this._hintElement, WebInspector.TextEditorAutocompleteController.HintBookmark, true);
+        else if (this._lastHintText !== hint)
+            this._hintMarker.refresh();
+        this._lastHintText = hint;
     },
 
-    _clearHintMarker: function()
+    _clearHint: function()
     {
-        if (!this._hintMarker)
-            return;
-        this._hintMarker.clear();
-        delete this._hintMarker;
+        this._lastHintText = "";
+        this._hintElement.textContent = "";
+        if (this._hintMarker)
+            this._hintMarker.refresh();
     },
 
     /**
@@ -307,7 +322,7 @@
         this._suggestBox = null;
         this._prefixRange = null;
         this._anchorBox = null;
-        this._clearHintMarker();
+        this._clearHint();
         this._onSuggestionsHiddenForTest();
     },
 
@@ -362,7 +377,7 @@
     applySuggestion: function(suggestion, isIntermediateSuggestion)
     {
         this._currentSuggestion = suggestion;
-        this._addHintMarker(suggestion);
+        this._setHint(suggestion);
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
index 94e32e09..8043805 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -428,7 +428,7 @@
 
     case recordType.CompileScript:
     case recordType.EvaluateScript:
-        var url = eventData["url"];
+        var url = eventData && eventData["url"];
         if (url)
             detailsText = WebInspector.displayNameForURL(url) + ":" + (eventData["lineNumber"] + 1);
         break;
@@ -758,7 +758,7 @@
         break;
     case recordTypes.CompileScript:
     case recordTypes.EvaluateScript:
-        var url = eventData["url"];
+        var url = eventData && eventData["url"];
         if (url)
             contentHelper.appendLocationRow(WebInspector.UIString("Script"), url, eventData["lineNumber"], eventData["columnNumber"]);
         break;
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
index bf47f5a..b098408 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
@@ -50,6 +50,7 @@
 
 /**
  * @constructor
+ * @implements {WebInspector.StaticViewportControl.Provider}
  * @param {!WebInspector.SuggestBoxDelegate} suggestBoxDelegate
  * @param {number=} maxItemsHeight
  * @param {boolean=} captureEnter
@@ -63,7 +64,10 @@
     this._maxItemsHeight = maxItemsHeight;
     this._maybeHideBound = this._maybeHide.bind(this);
     this._container = createElementWithClass("div", "suggest-box-container");
-    this._element = this._container.createChild("div", "suggest-box");
+    this._viewport = new WebInspector.StaticViewportControl(this);
+    this._element = this._viewport.element;
+    this._element.classList.add("suggest-box");
+    this._container.appendChild(this._element);
     this._element.addEventListener("mousedown", this._onBoxMouseDown.bind(this), true);
     this._detailsPopup = this._container.createChild("div", "suggest-box details-popup monospace");
     this._detailsPopup.classList.add("hidden");
@@ -72,6 +76,14 @@
     this._asyncDetailsPromises = new Map();
     this._userInteracted = false;
     this._captureEnter = captureEnter;
+    /** @type {!Array<!Element>} */
+    this._elementList = [];
+    this._rowHeight = 17;
+    this._viewportWidth = "100vw";
+    this._hasVerticalScroll = false;
+    this._userEnteredText = "";
+    /** @type {!WebInspector.SuggestBox.Suggestions} */
+    this._items = [];
 }
 
 /**
@@ -102,8 +114,9 @@
     _updateBoxPosition: function(anchorBox)
     {
         console.assert(this._overlay);
-        if (this._lastAnchorBox && this._lastAnchorBox.equals(anchorBox))
+        if (this._lastAnchorBox && this._lastAnchorBox.equals(anchorBox) && this._lastItemCount === this.itemCount())
             return;
+        this._lastItemCount = this.itemCount();
         this._lastAnchorBox = anchorBox;
 
         // Position relative to main DevTools element.
@@ -121,10 +134,27 @@
         else
             this._overlay.setVerticalOffset(totalHeight - anchorBox.y, false);
 
-        /** const */ var rowHeight = 17;
-        /** const */ var spacer = 6;
-        var maxHeight = this._maxItemsHeight ? this._maxItemsHeight * rowHeight : Math.max(underHeight, aboveHeight) - spacer;
-        this._element.style.maxHeight = maxHeight + "px";
+        var spacer = 6;
+        var maxHeight = this._maxItemsHeight ? this._maxItemsHeight * this._rowHeight : Math.max(underHeight, aboveHeight) - spacer;
+        var height = this._rowHeight * this._items.length;
+        this._hasVerticalScroll = height > maxHeight;
+        this._element.style.height = Math.min(maxHeight, height) + "px";
+    },
+
+    _updateWidth: function()
+    {
+        if (this._hasVerticalScroll) {
+            this._element.style.width = "100vw";
+            return;
+        }
+        // If there are no scrollbars, set the width to the width of the largest row.
+        var maxIndex = 0;
+        for (var i = 0; i < this._items.length; i++) {
+            if (this._items[i].title.length > this._items[maxIndex].title.length)
+                maxIndex = i;
+        }
+        var element = /** @type {!Element} */ (this.itemElement(maxIndex));
+        this._element.style.width = WebInspector.measurePreferredSize(element, this._element).width + "px";
     },
 
     /**
@@ -157,6 +187,10 @@
         this._bodyElement.addEventListener("mousedown", this._maybeHideBound, true);
         this._overlay = new WebInspector.SuggestBox.Overlay();
         this._overlay.setContentElement(this._container);
+        var measuringElement = this._createItemElement("1", "12");
+        this._viewport.element.appendChild(measuringElement);
+        this._rowHeight = measuringElement.getBoundingClientRect().height;
+        measuringElement.remove();
     },
 
     hide: function()
@@ -182,6 +216,7 @@
 
     /**
      * @param {boolean=} isIntermediateSuggestion
+     * @return {boolean}
      */
     _applySuggestion: function(isIntermediateSuggestion)
     {
@@ -256,10 +291,10 @@
     /**
      * @param {string} prefix
      * @param {string} text
-     * @param {string|undefined} className
-     * @param {number} index
+     * @param {string=} className
+     * @return {!Element}
      */
-    _createItemElement: function(prefix, text, className, index)
+    _createItemElement: function(prefix, text, className)
     {
         var element = createElementWithClass("div", "suggest-box-content-item source-code " + (className || ""));
         element.tabIndex = -1;
@@ -285,14 +320,11 @@
         this._length = items.length;
         this._asyncDetailsPromises.clear();
         this._asyncDetailsCallback = asyncDetails;
-        this._element.removeChildren();
+        this._elementList = [];
         delete this._selectedElement;
 
-        for (var i = 0; i < items.length; ++i) {
-            var item = items[i];
-            var currentItemElement = this._createItemElement(userEnteredText, item.title, item.className, i);
-            this._element.appendChild(currentItemElement);
-        }
+        this._userEnteredText = userEnteredText;
+        this._items = items;
     },
 
     /**
@@ -334,14 +366,14 @@
         if (index < 0)
             return;
 
-        this._selectedElement = this._element.children[index];
+        this._selectedElement = this.itemElement(index);
         this._selectedElement.classList.add("selected");
         this._detailsPopup.classList.add("hidden");
         var elem = this._selectedElement;
         this._asyncDetails(index).then(showDetails.bind(this), function(){});
 
         if (scrollIntoView)
-            this._selectedElement.scrollIntoViewIfNeeded(false);
+            this._viewport.scrollItemIntoView(index);
 
         /**
          * @param {?{detail: string, description: string}} details
@@ -358,6 +390,7 @@
      * @param {!WebInspector.SuggestBox.Suggestions} completions
      * @param {boolean} canShowForSingleItem
      * @param {string} userEnteredText
+     * @return {boolean}
      */
     _canShowBox: function(completions, canShowForSingleItem, userEnteredText)
     {
@@ -375,10 +408,10 @@
     {
         if (this._rowCountPerViewport)
             return;
-        if (!this._element.firstChild)
+        if (!this._items.length)
             return;
 
-        this._rowCountPerViewport = Math.floor(this._element.offsetHeight / this._element.firstChild.offsetHeight);
+        this._rowCountPerViewport = Math.floor(this._element.getBoundingClientRect().height / this._rowHeight);
     },
 
     /**
@@ -396,6 +429,8 @@
             this._updateItems(completions, userEnteredText, asyncDetails);
             this._show();
             this._updateBoxPosition(anchorBox);
+            this._updateWidth();
+            this._viewport.refresh();
             this._selectItem(selectedIndex, selectedIndex > 0);
             delete this._rowCountPerViewport;
         } else {
@@ -474,6 +509,37 @@
         // Report the event as non-handled if there is no selected item,
         // to commit the input or handle it otherwise.
         return hasSelectedItem;
+    },
+
+    /**
+     * @override
+     * @param {number} index
+     * @return {number}
+     */
+    fastItemHeight: function(index)
+    {
+        return this._rowHeight;
+    },
+
+    /**
+     * @override
+     * @return {number}
+     */
+    itemCount: function()
+    {
+        return this._items.length;
+    },
+
+    /**
+     * @override
+     * @param {number} index
+     * @return {?Element}
+     */
+    itemElement: function(index)
+    {
+        if (!this._elementList[index])
+            this._elementList[index] = this._createItemElement(this._userEnteredText, this._items[index].title, this._items[index].className);
+        return this._elementList[index];
     }
 }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css b/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css
index f1a28e0..f70238d 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css
+++ b/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css
@@ -67,11 +67,6 @@
     background-color: #FFFFFF;
     pointer-events: auto;
     margin-left: -3px;
-    overflow-x: hidden;
-    overflow-y: auto;
-    display: flex;
-    flex-direction: column;
-    flex: 0 0 auto;
     box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05),
                 0 2px 4px rgba(0, 0, 0, 0.2),
                 0 2px 6px rgba(0, 0, 0, 0.1);
@@ -83,7 +78,6 @@
     overflow: hidden;
     text-overflow: ellipsis;
     border: 1px solid transparent;
-    flex: 0 0 auto;
     padding-right: 0;
     white-space: nowrap;
 }
diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
index 52f4f17..378bc4e 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/FlameChart.js
@@ -1238,22 +1238,16 @@
         var entryStartTimes = timelineData.entryStartTimes;
         var entryLevels = timelineData.entryLevels;
 
-        var titleIndices = new Uint32Array(entryTotalTimes.length);
-        var nextTitleIndex = 0;
-        var markerIndices = new Uint32Array(entryTotalTimes.length);
-        var nextMarkerIndex = 0;
+        var titleIndices = [];
+        var markerIndices = [];
         var textPadding = this._dataProvider.textPadding();
         var minTextWidth = 2 * textPadding + this._measureWidth(context, "\u2026");
         var barHeight = this._barHeight;
         var top = this._scrollTop;
         var minVisibleBarLevel = Math.max(this._visibleLevelOffsets.upperBound(top) - 1, 0);
 
-        function comparator(time, entryIndex)
-        {
-            return time - entryStartTimes[entryIndex];
-        }
-
-        var colorBuckets = {};
+        /** @type {!Map<string, !Array<number>>} */
+        var colorBuckets = new Map();
         for (var level = minVisibleBarLevel; level < this._dataProvider.maxStackDepth(); ++level) {
             if (this._levelToHeight(level) > top + height)
                 break;
@@ -1262,12 +1256,12 @@
 
             // Entries are ordered by start time within a level, so find the last visible entry.
             var levelIndexes = this._timelineLevels[level];
-            var rightIndexOnLevel = levelIndexes.lowerBound(timeWindowRight, comparator) - 1;
+            var rightIndexOnLevel = levelIndexes.lowerBound(timeWindowRight, (time, entryIndex) => time - entryStartTimes[entryIndex]) - 1;
             var lastDrawOffset = Infinity;
             for (var entryIndexOnLevel = rightIndexOnLevel; entryIndexOnLevel >= 0; --entryIndexOnLevel) {
                 var entryIndex = levelIndexes[entryIndexOnLevel];
                 var entryStartTime = entryStartTimes[entryIndex];
-                var entryOffsetRight = entryStartTime + (isNaN(entryTotalTimes[entryIndex]) ? 0 : entryTotalTimes[entryIndex]);
+                var entryOffsetRight = entryStartTime + (entryTotalTimes[entryIndex] || 0);
                 if (entryOffsetRight <= timeWindowLeft)
                     break;
 
@@ -1278,49 +1272,47 @@
                 lastDrawOffset = barX;
 
                 var color = this._dataProvider.entryColor(entryIndex);
-                var bucket = colorBuckets[color];
+                var bucket = colorBuckets.get(color);
                 if (!bucket) {
                     bucket = [];
-                    colorBuckets[color] = bucket;
+                    colorBuckets.set(color, bucket);
                 }
                 bucket.push(entryIndex);
             }
         }
 
-        var colors = Object.keys(colorBuckets);
-        // We don't use for-in here because it couldn't be optimized.
+        var colors = colorBuckets.keysArray();
+        // We don't use for-of here because it's slow.
         for (var c = 0; c < colors.length; ++c) {
             var color = colors[c];
-            context.fillStyle = color;
-            context.strokeStyle = color;
-            var indexes = colorBuckets[color];
-
-            // First fill the boxes.
+            var indexes = colorBuckets.get(color);
             context.beginPath();
+            context.fillStyle = color;
             for (var i = 0; i < indexes.length; ++i) {
                 var entryIndex = indexes[i];
                 var entryStartTime = entryStartTimes[entryIndex];
                 var barX = this._timeToPositionClipped(entryStartTime);
-                var barRight = this._timeToPositionClipped(entryStartTime + entryTotalTimes[entryIndex]);
-                var barWidth = Math.max(barRight - barX, 1);
+                var duration = entryTotalTimes[entryIndex];
                 var barLevel = entryLevels[entryIndex];
                 var barY = this._levelToHeight(barLevel);
-                if (isNaN(entryTotalTimes[entryIndex])) {
+                if (isNaN(duration)) {
                     context.moveTo(barX + this._markerRadius, barY + barHeight / 2);
                     context.arc(barX, barY + barHeight / 2, this._markerRadius, 0, Math.PI * 2);
-                    markerIndices[nextMarkerIndex++] = entryIndex;
-                } else {
-                    context.rect(barX, barY, barWidth - 0.4, barHeight - 1);
-                    if (barWidth > minTextWidth || this._dataProvider.forceDecoration(entryIndex))
-                        titleIndices[nextTitleIndex++] = entryIndex;
+                    markerIndices.push(entryIndex);
+                    continue;
                 }
+                var barRight = this._timeToPositionClipped(entryStartTime + duration);
+                var barWidth = Math.max(barRight - barX, 1);
+                context.rect(barX, barY, barWidth - 0.4, barHeight - 1);
+                if (barWidth > minTextWidth || this._dataProvider.forceDecoration(entryIndex))
+                    titleIndices.push(entryIndex);
             }
             context.fill();
         }
 
         context.strokeStyle = "rgba(0, 0, 0, 0.2)";
         context.beginPath();
-        for (var m = 0; m < nextMarkerIndex; ++m) {
+        for (var m = 0; m < markerIndices.length; ++m) {
             var entryIndex = markerIndices[m];
             var entryStartTime = entryStartTimes[entryIndex];
             var barX = this._timeToPositionClipped(entryStartTime);
@@ -1334,7 +1326,7 @@
         context.textBaseline = "alphabetic";
         var textBaseHeight = this._barHeight - this._dataProvider.textBaseline();
 
-        for (var i = 0; i < nextTitleIndex; ++i) {
+        for (var i = 0; i < titleIndices.length; ++i) {
             var entryIndex = titleIndices[i];
             var entryStartTime = entryStartTimes[entryIndex];
             var barX = this._timeToPositionClipped(entryStartTime);
diff --git a/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js b/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js
index ab1016b..fce7a5e 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui_lazy/TimelineGrid.js
@@ -52,6 +52,7 @@
  */
 WebInspector.TimelineGrid.calculateDividerOffsets = function(calculator, freeZoneAtLeft)
 {
+    // TODO(allada) Remove this code out when timeline canvas experiment is over.
     /** @const */ var minGridSlicePx = 64; // minimal distance between grid lines.
 
     var clientWidth = calculator.computePosition(calculator.maximumBoundary());
diff --git a/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js b/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js
index 5512e77..fe4ff44 100644
--- a/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js
+++ b/third_party/WebKit/Source/devtools/front_end/worker_service/ServiceDispatcher.js
@@ -140,7 +140,7 @@
 
 /**
  * @constructor
- * @param {!Port} port
+ * @param {!Port|!Worker} port
  * @implements {ServicePort}
  */
 function WorkerServicePort(port)
@@ -200,6 +200,22 @@
  * @param {string} serviceName
  * @param {function(new:Service)} constructor
  */
+function initializeWorkerService(serviceName, constructor)
+{
+    services.set(serviceName, constructor);
+    if (!dispatchers.length) {
+        var worker = /** @type {!Object} */(self);
+        var servicePort = new WorkerServicePort(/** @type {!Worker} */(worker));
+        var dispatcher = new ServiceDispatcher(servicePort);
+        dispatchers.push(dispatcher);
+    }
+    dispatchers[0].registerObject(serviceName, constructor);
+}
+
+/**
+ * @param {string} serviceName
+ * @param {function(new:Service)} constructor
+ */
 function initializeSharedWorkerService(serviceName, constructor)
 {
     services.set(serviceName, constructor);
diff --git a/third_party/WebKit/Source/devtools/scripts/run_inspector_tests.sh b/third_party/WebKit/Source/devtools/scripts/run_inspector_tests.sh
index 093ffe24..8482cb76 100755
--- a/third_party/WebKit/Source/devtools/scripts/run_inspector_tests.sh
+++ b/third_party/WebKit/Source/devtools/scripts/run_inspector_tests.sh
@@ -10,8 +10,23 @@
 CHROMIUM_ROOT_PATH=${SCRIPT_PATH}"/../../../../.."
 OUT_PATH=${CHROMIUM_ROOT_PATH}"/out/Release"
 RUN_LAYOUT_TEST_PATH=${CHROMIUM_ROOT_PATH}"/blink/tools/run_layout_tests.py"
+ALL_TESTS=" inspector** http/tests/inspector**"
+DEBUG_FLAG=" --additional-driver-flag='--debug-devtools'"
 
-INSPECTOR_TEST_SUITES="inspector inspector-protocol inspector-enabled http/tests/inspector"
+COMMAND=${RUN_LAYOUT_TEST_PATH}
 
-ninja -C ${OUT_PATH} -j 1000 chrome blink_tests
-${RUN_LAYOUT_TEST_PATH} ${INSPECTOR_TEST_SUITES} --child-processes=16 "$@"
+ninja -C ${OUT_PATH} devtools_frontend_resources
+if [ $1 == "-d" ]
+then
+    shift
+    COMMAND=${COMMAND}${DEBUG_FLAG}
+fi
+
+if [ $# -eq 0 ]
+then
+    COMMAND=${COMMAND}${ALL_TESTS}
+else
+    COMMAND=${COMMAND}" $@"
+fi
+
+${COMMAND}
diff --git a/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.idl b/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.idl
index 042ea17..94adc2e 100644
--- a/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.idl
+++ b/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.idl
@@ -6,6 +6,6 @@
     Constructor(DOMString type, optional BeforeInstallPromptEventInit eventInitDict)
 ] interface BeforeInstallPromptEvent : Event {
     readonly attribute sequence<DOMString> platforms;
-    [CallWith=ScriptState] readonly attribute Promise<DOMString> userChoice;
+    [CallWith=ScriptState] readonly attribute Promise<AppBannerPromptResult> userChoice;
     [CallWith=ScriptState] Promise<void> prompt();
 };
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index 34159d0..c0b3b7c 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -753,6 +753,10 @@
 
   canvas()->document().updateStyleAndLayoutTreeForNode(canvas());
   const Font& font = accessFont();
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
+    return metrics;
 
   TextDirection direction;
   if (state().getDirection() == CanvasRenderingContext2DState::DirectionInherit)
@@ -773,7 +777,7 @@
   metrics->setActualBoundingBoxRight(textBounds.maxX());
 
   // y direction
-  const FontMetrics& fontMetrics = font.getFontMetrics();
+  const FontMetrics& fontMetrics = fontData->getFontMetrics();
   const float ascent = fontMetrics.floatAscent();
   const float descent = fontMetrics.floatDescent();
   const float baselineY = getFontBaseline(fontMetrics);
@@ -829,10 +833,11 @@
         DisableDeferralReasonSubPixelTextAntiAliasingSupport);
 
   const Font& font = accessFont();
-  if (!font.primaryFont())
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  if (!fontData)
     return;
-
-  const FontMetrics& fontMetrics = font.getFontMetrics();
+  const FontMetrics& fontMetrics = fontData->getFontMetrics();
 
   // FIXME: Need to turn off font smoothing.
 
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
index e7c3f29..a3a6b0e 100644
--- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
+++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
@@ -292,36 +292,38 @@
     // TODO(mcasas): Should be using a mojo::StructTraits.
     MediaSettingsRange* iso = MediaSettingsRange::create(
         capabilities->iso->max, capabilities->iso->min,
-        capabilities->iso->current);
+        capabilities->iso->current, capabilities->iso->step);
     MediaSettingsRange* height = MediaSettingsRange::create(
         capabilities->height->max, capabilities->height->min,
-        capabilities->height->current);
+        capabilities->height->current, capabilities->height->step);
     MediaSettingsRange* width = MediaSettingsRange::create(
         capabilities->width->max, capabilities->width->min,
-        capabilities->width->current);
+        capabilities->width->current, capabilities->width->step);
     MediaSettingsRange* zoom = MediaSettingsRange::create(
         capabilities->zoom->max, capabilities->zoom->min,
-        capabilities->zoom->current);
-    MediaSettingsRange* exposureCompensation = MediaSettingsRange::create(
-        capabilities->exposure_compensation->max,
-        capabilities->exposure_compensation->min,
-        capabilities->exposure_compensation->current);
+        capabilities->zoom->current, capabilities->zoom->step);
+    MediaSettingsRange* exposureCompensation =
+        MediaSettingsRange::create(capabilities->exposure_compensation->max,
+                                   capabilities->exposure_compensation->min,
+                                   capabilities->exposure_compensation->current,
+                                   capabilities->exposure_compensation->step);
     MediaSettingsRange* colorTemperature =
         MediaSettingsRange::create(capabilities->color_temperature->max,
                                    capabilities->color_temperature->min,
-                                   capabilities->color_temperature->current);
+                                   capabilities->color_temperature->current,
+                                   capabilities->color_temperature->step);
     MediaSettingsRange* brightness = MediaSettingsRange::create(
         capabilities->brightness->max, capabilities->brightness->min,
-        capabilities->brightness->current);
+        capabilities->brightness->current, capabilities->brightness->step);
     MediaSettingsRange* contrast = MediaSettingsRange::create(
         capabilities->contrast->max, capabilities->contrast->min,
-        capabilities->contrast->current);
+        capabilities->contrast->current, capabilities->contrast->step);
     MediaSettingsRange* saturation = MediaSettingsRange::create(
         capabilities->saturation->max, capabilities->saturation->min,
-        capabilities->saturation->current);
+        capabilities->saturation->current, capabilities->saturation->step);
     MediaSettingsRange* sharpness = MediaSettingsRange::create(
         capabilities->sharpness->max, capabilities->sharpness->min,
-        capabilities->sharpness->current);
+        capabilities->sharpness->current, capabilities->sharpness->step);
     PhotoCapabilities* caps = PhotoCapabilities::create();
     caps->setIso(iso);
     caps->setImageHeight(height);
diff --git a/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.h b/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.h
index 5f40a9b..453d758f 100644
--- a/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.h
+++ b/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.h
@@ -14,23 +14,28 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static MediaSettingsRange* create(long max, long min, long current) {
-    return new MediaSettingsRange(max, min, current);
+  static MediaSettingsRange* create(long max,
+                                    long min,
+                                    long current,
+                                    long step) {
+    return new MediaSettingsRange(max, min, current, step);
   }
 
   long max() const { return m_max; }
   long min() const { return m_min; }
   long current() const { return m_current; }
+  long step() const { return m_step; }
 
   DEFINE_INLINE_TRACE() {}
 
  private:
-  MediaSettingsRange(long max, long min, long current)
-      : m_max(max), m_min(min), m_current(current) {}
+  MediaSettingsRange(long max, long min, long current, long step)
+      : m_max(max), m_min(min), m_current(current), m_step(step) {}
 
   long m_max;
   long m_min;
   long m_current;
+  long m_step;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.idl b/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.idl
index a34a831..48ca747 100644
--- a/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.idl
+++ b/third_party/WebKit/Source/modules/imagecapture/MediaSettingsRange.idl
@@ -10,4 +10,5 @@
     readonly attribute long max;
     readonly attribute long min;
     readonly attribute long current;
+    readonly attribute long step;
 };
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn
index 2da50d39..07ba9cb 100644
--- a/third_party/WebKit/Source/platform/BUILD.gn
+++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -1637,6 +1637,7 @@
     "fonts/FontCacheTest.cpp",
     "fonts/FontDescriptionTest.cpp",
     "fonts/FontPlatformDataTest.cpp",
+    "fonts/FontTest.cpp",
     "fonts/GlyphBufferTest.cpp",
     "fonts/GlyphPageTreeNodeTest.cpp",
     "fonts/OrientationIteratorTest.cpp",
diff --git a/third_party/WebKit/Source/platform/DragImage.cpp b/third_party/WebKit/Source/platform/DragImage.cpp
index 2731922..87b59f5 100644
--- a/third_party/WebKit/Source/platform/DragImage.cpp
+++ b/third_party/WebKit/Source/platform/DragImage.cpp
@@ -188,8 +188,16 @@
                                              float deviceScaleFactor) {
   const Font labelFont =
       deriveDragLabelFont(kDragLinkLabelFontSize, FontWeightBold, systemFont);
+  const SimpleFontData* labelFontData = labelFont.primaryFont();
+  DCHECK(labelFontData);
   const Font urlFont =
       deriveDragLabelFont(kDragLinkUrlFontSize, FontWeightNormal, systemFont);
+  const SimpleFontData* urlFontData = urlFont.primaryFont();
+  DCHECK(urlFontData);
+
+  if (!labelFontData || !urlFontData)
+    return nullptr;
+
   FontCachePurgePreventer fontCachePurgePreventer;
 
   bool drawURLString = true;
@@ -209,8 +217,8 @@
   TextRun labelRun(label.impl());
   TextRun urlRun(urlString.impl());
   IntSize labelSize(labelFont.width(labelRun),
-                    labelFont.getFontMetrics().ascent() +
-                        labelFont.getFontMetrics().descent());
+                    labelFontData->getFontMetrics().ascent() +
+                        labelFontData->getFontMetrics().descent());
 
   if (labelSize.width() > maxDragLabelStringWidthDIP) {
     labelSize.setWidth(maxDragLabelStringWidthDIP);
@@ -223,8 +231,8 @@
 
   if (drawURLString) {
     urlStringSize.setWidth(urlFont.width(urlRun));
-    urlStringSize.setHeight(urlFont.getFontMetrics().ascent() +
-                            urlFont.getFontMetrics().descent());
+    urlStringSize.setHeight(urlFontData->getFontMetrics().ascent() +
+                            urlFontData->getFontMetrics().descent());
     imageSize.setHeight(imageSize.height() + urlStringSize.height());
     if (urlStringSize.width() > maxDragLabelStringWidthDIP) {
       imageSize.setWidth(maxDragLabelStringWidthDIP);
@@ -260,9 +268,10 @@
     if (clipURLString)
       urlString = StringTruncator::centerTruncate(
           urlString, imageSize.width() - (kDragLabelBorderX * 2.0f), urlFont);
-    IntPoint textPos(kDragLabelBorderX,
-                     imageSize.height() - (kLabelBorderYOffset +
-                                           urlFont.getFontMetrics().descent()));
+    IntPoint textPos(
+        kDragLabelBorderX,
+        imageSize.height() -
+            (kLabelBorderYOffset + urlFontData->getFontMetrics().descent()));
     TextRun textRun(urlString);
     urlFont.drawText(buffer->canvas(), TextRunPaintInfo(textRun), textPos,
                      deviceScaleFactor, textPaint);
diff --git a/third_party/WebKit/Source/platform/exported/WebFont.cpp b/third_party/WebKit/Source/platform/exported/WebFont.cpp
index 018aac915..1af56a4 100644
--- a/third_party/WebKit/Source/platform/exported/WebFont.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebFont.cpp
@@ -44,24 +44,36 @@
   return WebFontDescription(m_private->getFont().getFontDescription());
 }
 
+static inline const SimpleFontData* getFontData(const Font& font) {
+  const SimpleFontData* fontData = font.primaryFont();
+  DCHECK(fontData);
+  return fontData;
+}
+
 int WebFont::ascent() const {
-  return m_private->getFont().getFontMetrics().ascent();
+  const SimpleFontData* fontData = getFontData(m_private->getFont());
+  return fontData ? fontData->getFontMetrics().ascent() : 0;
 }
 
 int WebFont::descent() const {
-  return m_private->getFont().getFontMetrics().descent();
+  const SimpleFontData* fontData = getFontData(m_private->getFont());
+  return fontData ? fontData->getFontMetrics().descent() : 0;
 }
 
 int WebFont::height() const {
-  return m_private->getFont().getFontMetrics().height();
+  const SimpleFontData* fontData = getFontData(m_private->getFont());
+  return fontData ? fontData->getFontMetrics().height() : 0;
 }
 
 int WebFont::lineSpacing() const {
-  return m_private->getFont().getFontMetrics().lineSpacing();
+  const SimpleFontData* fontData = getFontData(m_private->getFont());
+  return fontData ? fontData->getFontMetrics().lineSpacing() : 0;
 }
 
 float WebFont::xHeight() const {
-  return m_private->getFont().getFontMetrics().xHeight();
+  const SimpleFontData* fontData = m_private->getFont().primaryFont();
+  DCHECK(fontData);
+  return fontData ? fontData->getFontMetrics().xHeight() : 0;
 }
 
 void WebFont::drawText(WebCanvas* canvas,
diff --git a/third_party/WebKit/Source/platform/fonts/Font.cpp b/third_party/WebKit/Source/platform/fonts/Font.cpp
index 271ed83..72e1218 100644
--- a/third_party/WebKit/Source/platform/fonts/Font.cpp
+++ b/third_party/WebKit/Source/platform/fonts/Font.cpp
@@ -407,6 +407,76 @@
   }
 }
 
+static int getInterceptsFromBloberizer(const GlyphBuffer& glyphBuffer,
+                                       const Font* font,
+                                       const SkPaint& paint,
+                                       float deviceScaleFactor,
+                                       const std::tuple<float, float>& bounds,
+                                       SkScalar* interceptsBuffer) {
+  SkScalar boundsArray[2] = {std::get<0>(bounds), std::get<1>(bounds)};
+  GlyphBufferBloberizer bloberizer(glyphBuffer, font, deviceScaleFactor);
+  std::pair<sk_sp<SkTextBlob>, BlobRotation> blob;
+
+  int numIntervals = 0;
+  while (!bloberizer.done()) {
+    blob = bloberizer.next();
+    DCHECK(blob.first);
+
+    // GlyphBufferBloberizer splits for a new blob rotation, but does not split
+    // for a change in font. A TextBlob can contain runs with differing fonts
+    // and the getTextBlobIntercepts method handles multiple fonts for us. For
+    // upright in vertical blobs we currently have to bail, see crbug.com/655154
+    if (blob.second == BlobRotation::CCWRotation)
+      continue;
+
+    SkScalar* offsetInterceptsBuffer = nullptr;
+    if (interceptsBuffer)
+      offsetInterceptsBuffer = &interceptsBuffer[numIntervals];
+    numIntervals += paint.getTextBlobIntercepts(blob.first.get(), boundsArray,
+                                                offsetInterceptsBuffer);
+  }
+  return numIntervals;
+}
+
+void Font::getTextIntercepts(const TextRunPaintInfo& runInfo,
+                             float deviceScaleFactor,
+                             const SkPaint& paint,
+                             const std::tuple<float, float>& bounds,
+                             Vector<TextIntercept>& intercepts) const {
+  if (shouldSkipDrawing())
+    return;
+
+  if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) {
+    SkScalar boundsArray[2] = {std::get<0>(bounds), std::get<1>(bounds)};
+    int numIntervals = paint.getTextBlobIntercepts(
+        runInfo.cachedTextBlob->get(), boundsArray, nullptr);
+    if (!numIntervals)
+      return;
+    DCHECK_EQ(numIntervals % 2, 0);
+    intercepts.resize(numIntervals / 2);
+    paint.getTextBlobIntercepts(runInfo.cachedTextBlob->get(), boundsArray,
+                                reinterpret_cast<SkScalar*>(intercepts.data()));
+    return;
+  }
+
+  GlyphBuffer glyphBuffer;
+  buildGlyphBuffer(runInfo, glyphBuffer);
+
+  // Get the number of intervals, without copying the actual values by
+  // specifying nullptr for the buffer, following the Skia allocation model for
+  // retrieving text intercepts.
+  int numIntervals = getInterceptsFromBloberizer(
+      glyphBuffer, this, paint, deviceScaleFactor, bounds, nullptr);
+  if (!numIntervals)
+    return;
+  DCHECK_EQ(numIntervals % 2, 0);
+  intercepts.resize(numIntervals / 2);
+
+  getInterceptsFromBloberizer(glyphBuffer, this, paint, deviceScaleFactor,
+                              bounds,
+                              reinterpret_cast<SkScalar*>(intercepts.data()));
+}
+
 static inline FloatRect pixelSnappedSelectionRect(FloatRect rect) {
   // Using roundf() rather than ceilf() for the right edge as a compromise to
   // ensure correct caret positioning.
@@ -725,7 +795,9 @@
   // Even system fallback can fail; use the missing glyph in that case.
   // FIXME: It would be nicer to use the missing glyph from the last resort font
   // instead.
-  ASSERT(primaryFont());
+  DCHECK(primaryFont());
+  if (!primaryFont())
+    return GlyphData();
   GlyphData data = primaryFont()->missingGlyphData();
   if (variant == NormalVariant) {
     page->setGlyphDataForCharacter(c, data.glyph, data.fontData);
diff --git a/third_party/WebKit/Source/platform/fonts/Font.h b/third_party/WebKit/Source/platform/fonts/Font.h
index bff7ab2..691f28a 100644
--- a/third_party/WebKit/Source/platform/fonts/Font.h
+++ b/third_party/WebKit/Source/platform/fonts/Font.h
@@ -101,6 +101,23 @@
                          float deviceScaleFactor,
                          const SkPaint&) const;
 
+  struct TextIntercept {
+    float m_begin, m_end;
+  };
+
+  // Compute the text intercepts along the axis of the advance and write them
+  // into the specified Vector of TextIntercepts. The number of those is zero or
+  // a multiple of two, and is at most the number of glyphs * 2 in the TextRun
+  // part of TextRunPaintInfo. Specify bounds for the upper and lower extend of
+  // a line crossing through the text, parallel to the baseline.
+  // TODO(drott): crbug.com/655154 Fix this for
+  // upright in vertical.
+  void getTextIntercepts(const TextRunPaintInfo&,
+                         float deviceScaleFactor,
+                         const SkPaint&,
+                         const std::tuple<float, float>& bounds,
+                         Vector<TextIntercept>&) const;
+
   // Glyph bounds will be the minimum rect containing all glyph strokes, in
   // coordinates using (<text run x position>, <baseline position>) as the
   // origin.
@@ -123,22 +140,23 @@
   Vector<CharacterRange> individualCharacterRanges(const TextRun&) const;
 
   // Metrics that we query the FontFallbackList for.
-  const FontMetrics& getFontMetrics() const {
-    RELEASE_ASSERT(primaryFont());
-    return primaryFont()->getFontMetrics();
-  }
   float spaceWidth() const {
-    return primaryFont()->spaceWidth() + getFontDescription().letterSpacing();
+    DCHECK(primaryFont());
+    return (primaryFont() ? primaryFont()->spaceWidth() : 0) +
+           getFontDescription().letterSpacing();
   }
-  float tabWidth(const SimpleFontData&, const TabSize&, float position) const;
+  float tabWidth(const SimpleFontData*, const TabSize&, float position) const;
   float tabWidth(const TabSize& tabSize, float position) const {
-    return tabWidth(*primaryFont(), tabSize, position);
+    return tabWidth(primaryFont(), tabSize, position);
   }
 
   int emphasisMarkAscent(const AtomicString&) const;
   int emphasisMarkDescent(const AtomicString&) const;
   int emphasisMarkHeight(const AtomicString&) const;
 
+  // This may fail and return a nullptr in case the last resort font cannot be
+  // loaded. This *should* not happen but in reality it does ever now and then
+  // when, for whatever reason, the last resort font cannot be loaded.
   const SimpleFontData* primaryFont() const;
   const FontData* fontDataAt(unsigned) const;
 
@@ -244,10 +262,12 @@
   return m_fontFallbackList ? m_fontFallbackList->getFontSelector() : 0;
 }
 
-inline float Font::tabWidth(const SimpleFontData& fontData,
+inline float Font::tabWidth(const SimpleFontData* fontData,
                             const TabSize& tabSize,
                             float position) const {
-  float baseTabWidth = tabSize.getPixelSize(fontData.spaceWidth());
+  if (!fontData)
+    return getFontDescription().letterSpacing();
+  float baseTabWidth = tabSize.getPixelSize(fontData->spaceWidth());
   if (!baseTabWidth)
     return getFontDescription().letterSpacing();
   float distanceToTabStop = baseTabWidth - fmodf(position, baseTabWidth);
@@ -255,7 +275,7 @@
   // Let the minimum width be the half of the space width so that it's always
   // recognizable.  if the distance to the next tab stop is less than that,
   // advance an additional tab stop.
-  if (distanceToTabStop < fontData.spaceWidth() / 2)
+  if (distanceToTabStop < fontData->spaceWidth() / 2)
     distanceToTabStop += baseTabWidth;
 
   return distanceToTabStop;
diff --git a/third_party/WebKit/Source/platform/fonts/FontTest.cpp b/third_party/WebKit/Source/platform/fonts/FontTest.cpp
new file mode 100644
index 0000000..29a0f58
--- /dev/null
+++ b/third_party/WebKit/Source/platform/fonts/FontTest.cpp
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/fonts/Font.h"
+
+#include "platform/testing/FontTestHelpers.h"
+#include "platform/testing/UnitTestHelpers.h"
+#include "platform/text/TextRun.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using blink::testing::createTestFont;
+
+namespace blink {
+
+static inline String fontPath(String relativePath) {
+  return testing::blinkRootDir() + "/Source/platform/testing/data/" +
+         relativePath;
+}
+
+TEST(FontTest, TextIntercepts) {
+  Font font = createTestFont("Ahem", fontPath("Ahem.woff"), 16);
+  // A sequence of LATIN CAPITAL LETTER E WITH ACUTE and LATIN SMALL LETTER P
+  // characters. E ACUTES are squares above the baseline in Ahem, while p's
+  // are rectangles below the baseline.
+  UChar ahemAboveBelowBaselineString[] = {0xc9, 0x70, 0xc9, 0x70, 0xc9,
+                                          0x70, 0xc9, 0x70, 0xc9};
+  TextRun ahemAboveBelowBaseline(ahemAboveBelowBaselineString, 9);
+  TextRunPaintInfo textRunPaintInfo(ahemAboveBelowBaseline);
+  SkPaint defaultPaint;
+  float deviceScaleFactor = 1;
+
+  std::tuple<float, float> belowBaselineBounds = std::make_tuple(2, 4);
+  Vector<Font::TextIntercept> textIntercepts;
+  // 4 intercept ranges for below baseline p glyphs in the test string
+  font.getTextIntercepts(textRunPaintInfo, deviceScaleFactor, defaultPaint,
+                         belowBaselineBounds, textIntercepts);
+  EXPECT_EQ(textIntercepts.size(), 4u);
+  for (auto textIntercept : textIntercepts) {
+    EXPECT_GT(textIntercept.m_end, textIntercept.m_begin);
+  }
+
+  std::tuple<float, float> aboveBaselineBounds = std::make_tuple(-4, -2);
+  // 5 intercept ranges for the above baseline E ACUTE glyphs
+  font.getTextIntercepts(textRunPaintInfo, deviceScaleFactor, defaultPaint,
+                         aboveBaselineBounds, textIntercepts);
+  EXPECT_EQ(textIntercepts.size(), 5u);
+  for (auto textIntercept : textIntercepts) {
+    EXPECT_GT(textIntercept.m_end, textIntercept.m_begin);
+  }
+}
+
+}  // namespace blink
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp
index 44f614c..26a3c259 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.cpp
@@ -389,7 +389,7 @@
   float position = textRun.xPos() + positionOffset;
   float startPosition = position;
   for (unsigned i = 0; i < count; i++) {
-    float advance = font->tabWidth(*fontData, textRun.getTabSize(), position);
+    float advance = font->tabWidth(fontData, textRun.getTabSize(), position);
     run->m_glyphData[i].characterIndex = i;
     run->setGlyphAndPositions(i, fontData->spaceGlyph(), advance, 0, 0);
     position += advance;
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.cpp b/third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.cpp
index 1d84840..5d32c54 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.cpp
@@ -84,7 +84,7 @@
   ASSERT(fontData);
 
   if (UNLIKELY(character == tabulationCharacter && m_textRun.allowTabs()))
-    return m_font->tabWidth(*fontData, m_textRun.getTabSize(),
+    return m_font->tabWidth(fontData, m_textRun.getTabSize(),
                             m_textRun.xPos() + m_runWidthSoFar);
 
   float width = fontData->widthForGlyph(glyphData.glyph);
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
index 6a81225..367f71af 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -243,7 +243,6 @@
   gpu::gles2::GLES2Interface* sharedGL = provider->contextGL();
 
   gpu::Mailbox mailbox;
-  IntSize textureSize(textureImage->width(), textureImage->height());
 
   // Contexts may be in a different share group. We must transfer the texture
   // through a mailbox first.
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
index 58a98254..7f8cce7 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -5,12 +5,7 @@
 #include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h"
 
 #include "cc/output/compositor_frame.h"
-#include "cc/output/delegated_frame_data.h"
-#include "cc/quads/render_pass.h"
-#include "cc/quads/shared_quad_state.h"
-#include "cc/quads/solid_color_draw_quad.h"
 #include "cc/quads/texture_draw_quad.h"
-#include "cc/resources/returned_resource.h"
 #include "gpu/command_buffer/client/gles2_interface.h"
 #include "platform/Histogram.h"
 #include "platform/graphics/gpu/SharedGpuContext.h"
@@ -183,6 +178,7 @@
   // TODO(crbug.com/646022): making this overlay-able.
   resource.is_overlay_candidate = false;
 
+  bool yflipped = false;
   OffscreenCanvasCommitType commitType;
   DEFINE_THREAD_SAFE_STATIC_LOCAL(
       EnumerationHistogram, commitTypeHistogram,
@@ -194,6 +190,7 @@
       // Case 1: both canvas and compositor are gpu accelerated.
       commitType = CommitGPUCanvasGPUCompositing;
       setTransferableResourceToStaticBitmapImage(resource, image);
+      yflipped = true;
     } else {
       // Case 2: canvas is accelerated but --disable-gpu-compositing is
       // specified, or WebGL's commit is called with SwiftShader. The latter
@@ -208,6 +205,7 @@
       // Case 3: canvas is not gpu-accelerated, but compositor is
       commitType = CommitSoftwareCanvasGPUCompositing;
       setTransferableResourceToSharedGPUContext(resource, image);
+      yflipped = true;
     } else {
       // Case 4: both canvas and compositor are not gpu accelerated.
       commitType = CommitSoftwareCanvasSoftwareCompositing;
@@ -230,7 +228,6 @@
   const gfx::PointF uvTopLeft(0.f, 0.f);
   const gfx::PointF uvBottomRight(1.f, 1.f);
   float vertexOpacity[4] = {1.f, 1.f, 1.f, 1.f};
-  const bool yflipped = false;
   // TODO(crbug.com/645994): this should be true when using style
   // "image-rendering: pixelated".
   const bool nearestNeighbor = false;
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h
index be7e907..d08640bc 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h
@@ -11,7 +11,6 @@
 #include "mojo/public/cpp/bindings/binding.h"
 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h"
 #include "platform/graphics/StaticBitmapImage.h"
-#include "wtf/Compiler.h"
 #include <memory>
 
 namespace blink {
diff --git a/third_party/WebKit/Source/platform/network/ResourceResponse.h b/third_party/WebKit/Source/platform/network/ResourceResponse.h
index 4932461..0daca5d 100644
--- a/third_party/WebKit/Source/platform/network/ResourceResponse.h
+++ b/third_party/WebKit/Source/platform/network/ResourceResponse.h
@@ -104,6 +104,8 @@
     SecurityDetails() : validFrom(0), validTo(0) {}
     // All strings are human-readable values.
     String protocol;
+    // keyExchange is the empty string if not applicable for the connection's
+    // protocol.
     String keyExchange;
     // keyExchangeGroup is the empty string if not applicable for the
     // connection's key exchange.
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
index 7f397c2..70ea218 100644
--- a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
+++ b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
@@ -258,7 +258,9 @@
   const ComputedStyle& menuStyle = ownerElement.computedStyle()
                                        ? *ownerElement.computedStyle()
                                        : *ownerElement.ensureComputedStyle();
-  info.itemHeight = menuStyle.font().getFontMetrics().height();
+  const SimpleFontData* fontData = menuStyle.font().primaryFont();
+  DCHECK(fontData);
+  info.itemHeight = fontData ? fontData->getFontMetrics().height() : 0;
   info.itemFontSize =
       static_cast<int>(menuStyle.font().getFontDescription().computedSize());
   info.selectedIndex = toExternalPopupMenuItemIndex(
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
index 33992d4..1511ee1 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -30,7 +30,6 @@
 
 #include "web/WebFrameWidgetImpl.h"
 
-#include "core/InputTypeNames.h"
 #include "core/editing/EditingUtilities.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
@@ -41,7 +40,6 @@
 #include "core/frame/RemoteFrame.h"
 #include "core/frame/Settings.h"
 #include "core/frame/VisualViewport.h"
-#include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLTextAreaElement.h"
 #include "core/input/EventHandler.h"
 #include "core/layout/LayoutView.h"
@@ -598,138 +596,18 @@
   return PlainTextRange::create(*editable, range);
 }
 
-// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
-// code needs to be refactored  (http://crbug.com/629721).
 WebTextInputInfo WebFrameWidgetImpl::textInputInfo() {
-  WebTextInputInfo info;
-
   LocalFrame* focused = focusedLocalFrameInWidget();
   if (!focused)
-    return info;
-
-  FrameSelection& selection = focused->selection();
-  if (!selection.isAvailable()) {
-    // plugins/mouse-capture-inside-shadow.html reaches here.
-    return info;
-  }
-  Element* element = selection.selection().rootEditableElement();
-  if (!element)
-    return info;
-
-  info.inputMode = inputModeOfFocusedElement();
-
-  info.type = textInputType();
-  info.flags = textInputFlags();
-  if (info.type == WebTextInputTypeNone)
-    return info;
-
-  if (!focused->editor().canEdit())
-    return info;
-
-  // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
-  // needs to be audited.  see http://crbug.com/590369 for more details.
-  focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
-
-  DocumentLifecycle::DisallowTransitionScope disallowTransition(
-      focused->document()->lifecycle());
-
-  // Emits an object replacement character for each replaced element so that
-  // it is exposed to IME and thus could be deleted by IME on android.
-  info.value = plainText(EphemeralRange::rangeOfContents(*element),
-                         TextIteratorEmitsObjectReplacementCharacter);
-
-  if (info.value.isEmpty())
-    return info;
-
-  EphemeralRange firstRange = firstEphemeralRangeOf(selection.selection());
-  if (firstRange.isNotNull()) {
-    PlainTextRange plainTextRange(PlainTextRange::create(*element, firstRange));
-    if (plainTextRange.isNotNull()) {
-      info.selectionStart = plainTextRange.start();
-      info.selectionEnd = plainTextRange.end();
-    }
-  }
-
-  EphemeralRange range =
-      focused->inputMethodController().compositionEphemeralRange();
-  if (range.isNotNull()) {
-    PlainTextRange plainTextRange(PlainTextRange::create(*element, range));
-    if (plainTextRange.isNotNull()) {
-      info.compositionStart = plainTextRange.start();
-      info.compositionEnd = plainTextRange.end();
-    }
-  }
-
-  return info;
+    return WebTextInputInfo();
+  return focused->inputMethodController().textInputInfo();
 }
 
-// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
-// code needs to be refactored  (http://crbug.com/629721).
 WebTextInputType WebFrameWidgetImpl::textInputType() {
-  LocalFrame* focusedFrame = focusedLocalFrameInWidget();
-  if (!focusedFrame)
+  LocalFrame* focused = focusedLocalFrameInWidget();
+  if (!focused)
     return WebTextInputTypeNone;
-
-  if (!focusedFrame->selection().isAvailable()) {
-    // "mouse-capture-inside-shadow.html" reaches here.
-    return WebTextInputTypeNone;
-  }
-
-  // It's important to preserve the equivalence of textInputInfo().type and
-  // textInputType(), so perform the same rootEditableElement() existence check
-  // here for consistency.
-  if (!focusedFrame->selection().selection().rootEditableElement())
-    return WebTextInputTypeNone;
-
-  Document* document = focusedFrame->document();
-  if (!document)
-    return WebTextInputTypeNone;
-
-  Element* element = document->focusedElement();
-  if (!element)
-    return WebTextInputTypeNone;
-
-  if (isHTMLInputElement(*element)) {
-    HTMLInputElement& input = toHTMLInputElement(*element);
-    const AtomicString& type = input.type();
-
-    if (input.isDisabledOrReadOnly())
-      return WebTextInputTypeNone;
-
-    if (type == InputTypeNames::password)
-      return WebTextInputTypePassword;
-    if (type == InputTypeNames::search)
-      return WebTextInputTypeSearch;
-    if (type == InputTypeNames::email)
-      return WebTextInputTypeEmail;
-    if (type == InputTypeNames::number)
-      return WebTextInputTypeNumber;
-    if (type == InputTypeNames::tel)
-      return WebTextInputTypeTelephone;
-    if (type == InputTypeNames::url)
-      return WebTextInputTypeURL;
-    if (type == InputTypeNames::text)
-      return WebTextInputTypeText;
-
-    return WebTextInputTypeNone;
-  }
-
-  if (isHTMLTextAreaElement(*element)) {
-    if (toHTMLTextAreaElement(*element).isDisabledOrReadOnly())
-      return WebTextInputTypeNone;
-    return WebTextInputTypeTextArea;
-  }
-
-  if (element->isHTMLElement()) {
-    if (toHTMLElement(element)->isDateTimeFieldElement())
-      return WebTextInputTypeDateTimeField;
-  }
-
-  document->updateStyleAndLayoutTree();
-  if (hasEditableStyle(*element))
-    return WebTextInputTypeContentEditable;
-
-  return WebTextInputTypeNone;
+  return focused->inputMethodController().textInputType();
 }
 
 WebColor WebFrameWidgetImpl::backgroundColor() const {
@@ -1447,81 +1325,6 @@
   return nullptr;
 }
 
-WebString WebFrameWidgetImpl::inputModeOfFocusedElement() const {
-  if (!RuntimeEnabledFeatures::inputModeAttributeEnabled())
-    return WebString();
-
-  Element* element = focusedElement();
-  if (!element)
-    return WebString();
-
-  if (isHTMLInputElement(*element)) {
-    const HTMLInputElement& input = toHTMLInputElement(*element);
-    if (input.supportsInputModeAttribute())
-      return input.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
-    return WebString();
-  }
-  if (isHTMLTextAreaElement(*element)) {
-    const HTMLTextAreaElement& textarea = toHTMLTextAreaElement(*element);
-    return textarea.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
-  }
-
-  return WebString();
-}
-
-int WebFrameWidgetImpl::textInputFlags() const {
-  Element* element = focusedElement();
-  if (!element)
-    return WebTextInputFlagNone;
-
-  DEFINE_STATIC_LOCAL(AtomicString, autocompleteString, ("autocomplete"));
-  DEFINE_STATIC_LOCAL(AtomicString, autocorrectString, ("autocorrect"));
-  int flags = 0;
-
-  const AtomicString& autocomplete = element->getAttribute(autocompleteString);
-  if (autocomplete == "on")
-    flags |= WebTextInputFlagAutocompleteOn;
-  else if (autocomplete == "off")
-    flags |= WebTextInputFlagAutocompleteOff;
-
-  const AtomicString& autocorrect = element->getAttribute(autocorrectString);
-  if (autocorrect == "on")
-    flags |= WebTextInputFlagAutocorrectOn;
-  else if (autocorrect == "off")
-    flags |= WebTextInputFlagAutocorrectOff;
-
-  SpellcheckAttributeState spellcheck = element->spellcheckAttributeState();
-  if (spellcheck == SpellcheckAttributeTrue)
-    flags |= WebTextInputFlagSpellcheckOn;
-  else if (spellcheck == SpellcheckAttributeFalse)
-    flags |= WebTextInputFlagSpellcheckOff;
-
-  if (isHTMLTextFormControlElement(element)) {
-    HTMLTextFormControlElement* formElement =
-        static_cast<HTMLTextFormControlElement*>(element);
-    if (formElement->supportsAutocapitalize()) {
-      DEFINE_STATIC_LOCAL(const AtomicString, none, ("none"));
-      DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters"));
-      DEFINE_STATIC_LOCAL(const AtomicString, words, ("words"));
-      DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences"));
-
-      const AtomicString& autocapitalize = formElement->autocapitalize();
-      if (autocapitalize == none)
-        flags |= WebTextInputFlagAutocapitalizeNone;
-      else if (autocapitalize == characters)
-        flags |= WebTextInputFlagAutocapitalizeCharacters;
-      else if (autocapitalize == words)
-        flags |= WebTextInputFlagAutocapitalizeWords;
-      else if (autocapitalize == sentences)
-        flags |= WebTextInputFlagAutocapitalizeSentences;
-      else
-        NOTREACHED();
-    }
-  }
-
-  return flags;
-}
-
 LocalFrame* WebFrameWidgetImpl::focusedLocalFrameAvailableForIme() const {
   if (!m_imeAcceptEvents)
     return nullptr;
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
index 17382976..562865e 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
@@ -212,10 +212,6 @@
 
   WebPlugin* focusedPluginIfInputMethodSupported(LocalFrame*) const;
 
-  WebString inputModeOfFocusedElement() const;
-
-  int textInputFlags() const;
-
   LocalFrame* focusedLocalFrameAvailableForIme() const;
 
   WebWidgetClient* m_client;
diff --git a/third_party/WebKit/Source/web/WebTestingSupport.cpp b/third_party/WebKit/Source/web/WebTestingSupport.cpp
index da1f5964..9f4966c 100644
--- a/third_party/WebKit/Source/web/WebTestingSupport.cpp
+++ b/third_party/WebKit/Source/web/WebTestingSupport.cpp
@@ -32,12 +32,6 @@
 
 namespace blink {
 
-v8::Local<v8::Value> WebTestingSupport::createInternalsObject(
-    v8::Local<v8::Context> context) {
-  V8InternalsPartial::initialize();
-  return WebCoreTestSupport::createInternalsObject(context);
-}
-
 void WebTestingSupport::injectInternalsObject(WebLocalFrame* frame) {
   V8InternalsPartial::initialize();
   v8::HandleScope handleScope(v8::Isolate::GetCurrent());
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index f045dbe7..e7656d4 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -32,7 +32,6 @@
 
 #include "core/CSSValueKeywords.h"
 #include "core/HTMLNames.h"
-#include "core/InputTypeNames.h"
 #include "core/clipboard/DataObject.h"
 #include "core/dom/Document.h"
 #include "core/dom/Fullscreen.h"
@@ -61,7 +60,6 @@
 #include "core/frame/TopControls.h"
 #include "core/frame/UseCounter.h"
 #include "core/frame/VisualViewport.h"
-#include "core/html/HTMLInputElement.h"
 #include "core/html/HTMLMediaElement.h"
 #include "core/html/HTMLPlugInElement.h"
 #include "core/html/HTMLTextAreaElement.h"
@@ -2541,215 +2539,18 @@
   return PlainTextRange::create(*editable, range);
 }
 
-// TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
-// well. This code needs to be refactored  (http://crbug.com/629721).
 WebTextInputInfo WebViewImpl::textInputInfo() {
-  WebTextInputInfo info;
-
   LocalFrame* focused = focusedLocalFrameInWidget();
   if (!focused)
-    return info;
-
-  FrameSelection& selection = focused->selection();
-  if (!selection.isAvailable()) {
-    // plugins/mouse-capture-inside-shadow.html reaches here.
-    return info;
-  }
-  Element* element = selection.selection().rootEditableElement();
-  if (!element)
-    return info;
-
-  info.inputMode = inputModeOfFocusedElement();
-
-  info.type = textInputType();
-  info.flags = textInputFlags();
-  if (info.type == WebTextInputTypeNone)
-    return info;
-
-  if (!focused->editor().canEdit())
-    return info;
-
-  // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets
-  // needs to be audited.  see http://crbug.com/590369 for more details.
-  focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
-
-  DocumentLifecycle::DisallowTransitionScope disallowTransition(
-      focused->document()->lifecycle());
-
-  // Emits an object replacement character for each replaced element so that
-  // it is exposed to IME and thus could be deleted by IME on android.
-  info.value = plainText(EphemeralRange::rangeOfContents(*element),
-                         TextIteratorEmitsObjectReplacementCharacter);
-
-  if (info.value.isEmpty())
-    return info;
-
-  EphemeralRange firstRange = firstEphemeralRangeOf(selection.selection());
-  if (firstRange.isNotNull()) {
-    PlainTextRange plainTextRange(PlainTextRange::create(*element, firstRange));
-    if (plainTextRange.isNotNull()) {
-      info.selectionStart = plainTextRange.start();
-      info.selectionEnd = plainTextRange.end();
-    }
-  }
-
-  EphemeralRange range =
-      focused->inputMethodController().compositionEphemeralRange();
-  if (range.isNotNull()) {
-    PlainTextRange plainTextRange(PlainTextRange::create(*element, range));
-    if (plainTextRange.isNotNull()) {
-      info.compositionStart = plainTextRange.start();
-      info.compositionEnd = plainTextRange.end();
-    }
-  }
-
-  return info;
+    return WebTextInputInfo();
+  return focused->inputMethodController().textInputInfo();
 }
 
-// TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
-// well. This code needs to be refactored  (http://crbug.com/629721).
 WebTextInputType WebViewImpl::textInputType() {
-  LocalFrame* focusedFrame = focusedLocalFrameInWidget();
-  if (!focusedFrame)
+  LocalFrame* focused = focusedLocalFrameInWidget();
+  if (!focused)
     return WebTextInputTypeNone;
-
-  if (!focusedFrame->selection().isAvailable()) {
-    // "mouse-capture-inside-shadow.html" reaches here.
-    return WebTextInputTypeNone;
-  }
-
-  // It's important to preserve the equivalence of textInputInfo().type and
-  // textInputType(), so perform the same rootEditableElement() existence check
-  // here for consistency.
-  if (!focusedFrame->selection().selection().rootEditableElement())
-    return WebTextInputTypeNone;
-
-  Document* document = focusedFrame->document();
-  if (!document)
-    return WebTextInputTypeNone;
-
-  Element* element = document->focusedElement();
-  if (!element)
-    return WebTextInputTypeNone;
-
-  if (isHTMLInputElement(*element)) {
-    HTMLInputElement& input = toHTMLInputElement(*element);
-    const AtomicString& type = input.type();
-
-    if (input.isDisabledOrReadOnly())
-      return WebTextInputTypeNone;
-
-    if (type == InputTypeNames::password)
-      return WebTextInputTypePassword;
-    if (type == InputTypeNames::search)
-      return WebTextInputTypeSearch;
-    if (type == InputTypeNames::email)
-      return WebTextInputTypeEmail;
-    if (type == InputTypeNames::number)
-      return WebTextInputTypeNumber;
-    if (type == InputTypeNames::tel)
-      return WebTextInputTypeTelephone;
-    if (type == InputTypeNames::url)
-      return WebTextInputTypeURL;
-    if (type == InputTypeNames::text)
-      return WebTextInputTypeText;
-
-    return WebTextInputTypeNone;
-  }
-
-  if (isHTMLTextAreaElement(*element)) {
-    if (toHTMLTextAreaElement(*element).isDisabledOrReadOnly())
-      return WebTextInputTypeNone;
-    return WebTextInputTypeTextArea;
-  }
-
-  if (element->isHTMLElement()) {
-    if (toHTMLElement(element)->isDateTimeFieldElement())
-      return WebTextInputTypeDateTimeField;
-  }
-
-  document->updateStyleAndLayoutTree();
-  if (hasEditableStyle(*element))
-    return WebTextInputTypeContentEditable;
-
-  return WebTextInputTypeNone;
-}
-
-// TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
-// well. This code needs to be refactored  (http://crbug.com/629721).
-int WebViewImpl::textInputFlags() {
-  Element* element = focusedElement();
-  if (!element)
-    return WebTextInputFlagNone;
-
-  DEFINE_STATIC_LOCAL(AtomicString, autocompleteString, ("autocomplete"));
-  DEFINE_STATIC_LOCAL(AtomicString, autocorrectString, ("autocorrect"));
-  int flags = 0;
-
-  const AtomicString& autocomplete = element->getAttribute(autocompleteString);
-  if (autocomplete == "on")
-    flags |= WebTextInputFlagAutocompleteOn;
-  else if (autocomplete == "off")
-    flags |= WebTextInputFlagAutocompleteOff;
-
-  const AtomicString& autocorrect = element->getAttribute(autocorrectString);
-  if (autocorrect == "on")
-    flags |= WebTextInputFlagAutocorrectOn;
-  else if (autocorrect == "off")
-    flags |= WebTextInputFlagAutocorrectOff;
-
-  SpellcheckAttributeState spellcheck = element->spellcheckAttributeState();
-  if (spellcheck == SpellcheckAttributeTrue)
-    flags |= WebTextInputFlagSpellcheckOn;
-  else if (spellcheck == SpellcheckAttributeFalse)
-    flags |= WebTextInputFlagSpellcheckOff;
-
-  if (isHTMLTextFormControlElement(element)) {
-    HTMLTextFormControlElement* formElement =
-        static_cast<HTMLTextFormControlElement*>(element);
-    if (formElement->supportsAutocapitalize()) {
-      DEFINE_STATIC_LOCAL(const AtomicString, none, ("none"));
-      DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters"));
-      DEFINE_STATIC_LOCAL(const AtomicString, words, ("words"));
-      DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences"));
-
-      const AtomicString& autocapitalize = formElement->autocapitalize();
-      if (autocapitalize == none)
-        flags |= WebTextInputFlagAutocapitalizeNone;
-      else if (autocapitalize == characters)
-        flags |= WebTextInputFlagAutocapitalizeCharacters;
-      else if (autocapitalize == words)
-        flags |= WebTextInputFlagAutocapitalizeWords;
-      else if (autocapitalize == sentences)
-        flags |= WebTextInputFlagAutocapitalizeSentences;
-      else
-        NOTREACHED();
-    }
-  }
-
-  return flags;
-}
-
-WebString WebViewImpl::inputModeOfFocusedElement() {
-  if (!RuntimeEnabledFeatures::inputModeAttributeEnabled())
-    return WebString();
-
-  Element* element = focusedElement();
-  if (!element)
-    return WebString();
-
-  if (isHTMLInputElement(*element)) {
-    const HTMLInputElement& input = toHTMLInputElement(*element);
-    if (input.supportsInputModeAttribute())
-      return input.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
-    return WebString();
-  }
-  if (isHTMLTextAreaElement(*element)) {
-    const HTMLTextAreaElement& textarea = toHTMLTextAreaElement(*element);
-    return textarea.fastGetAttribute(HTMLNames::inputmodeAttr).lower();
-  }
-
-  return WebString();
+  return focused->inputMethodController().textInputType();
 }
 
 // TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h
index f695834..2625883 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.h
+++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -553,10 +553,6 @@
   explicit WebViewImpl(WebViewClient*, WebPageVisibilityState);
   ~WebViewImpl() override;
 
-  int textInputFlags();
-
-  WebString inputModeOfFocusedElement();
-
   // Returns true if the event was actually processed.
   bool keyEventDefault(const WebKeyboardEvent&);
 
diff --git a/third_party/WebKit/public/platform/InterfaceProvider.h b/third_party/WebKit/public/platform/InterfaceProvider.h
index 70d79501..7557145 100644
--- a/third_party/WebKit/public/platform/InterfaceProvider.h
+++ b/third_party/WebKit/public/platform/InterfaceProvider.h
@@ -13,7 +13,7 @@
 
 // Implementations of blink::InterfaceProvider should be thread safe. As such it
 // is okay to call |getInterface| from any thread, without the thread hopping
-// that would have been necesary with shell::InterfaceProvider.
+// that would have been necesary with service_manager::InterfaceProvider.
 class BLINK_PLATFORM_EXPORT InterfaceProvider {
  public:
   virtual void getInterface(const char* name,
diff --git a/third_party/WebKit/public/platform/WebURLResponse.h b/third_party/WebKit/public/platform/WebURLResponse.h
index d0be07f..a78f777 100644
--- a/third_party/WebKit/public/platform/WebURLResponse.h
+++ b/third_party/WebKit/public/platform/WebURLResponse.h
@@ -114,6 +114,8 @@
           sctList(sctList) {}
     // All strings are human-readable values.
     WebString protocol;
+    // keyExchange is the empty string if not applicable for the connection's
+    // protocol.
     WebString keyExchange;
     // keyExchangeGroup is the empty string if not applicable for the
     // connection's key exchange.
diff --git a/third_party/WebKit/public/web/WebTestingSupport.h b/third_party/WebKit/public/web/WebTestingSupport.h
index 8f06c78f..f91d938 100644
--- a/third_party/WebKit/public/web/WebTestingSupport.h
+++ b/third_party/WebKit/public/web/WebTestingSupport.h
@@ -34,7 +34,6 @@
 
 class WebTestingSupport {
  public:
-  static v8::Local<v8::Value> createInternalsObject(v8::Local<v8::Context>);
   static void injectInternalsObject(WebLocalFrame*);
   static void resetInternalsObject(WebLocalFrame*);
   static void injectInternalsObject(v8::Local<v8::Context>);
diff --git a/third_party/boringssl/BUILD.generated.gni b/third_party/boringssl/BUILD.generated.gni
index 6fd6c528..27b10e38 100644
--- a/third_party/boringssl/BUILD.generated.gni
+++ b/third_party/boringssl/BUILD.generated.gni
@@ -8,6 +8,7 @@
   "err_data.c",
   "src/crypto/aes/aes.c",
   "src/crypto/aes/internal.h",
+  "src/crypto/aes/key_wrap.c",
   "src/crypto/aes/mode_wrappers.c",
   "src/crypto/asn1/a_bitstr.c",
   "src/crypto/asn1/a_bool.c",
@@ -563,4 +564,5 @@
   "read_pem",
   "server",
   "spki",
+  "ssl_ctx_api",
 ]
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
index afe9e0d7..ed3754ce 100644
--- a/third_party/boringssl/BUILD.gn
+++ b/third_party/boringssl/BUILD.gn
@@ -203,6 +203,8 @@
         libfuzzer_options = [ "max_len=4096" ]
       } else if ("spki" == fuzzer) {
         libfuzzer_options = [ "max_len=1024" ]
+      } else if ("ssl_ctx_api" == fuzzer) {
+        libfuzzer_options = [ "max_len=256" ]
       }
     }
   }
diff --git a/third_party/boringssl/err_data.c b/third_party/boringssl/err_data.c
index c1257cdc..001145d 100644
--- a/third_party/boringssl/err_data.c
+++ b/third_party/boringssl/err_data.c
@@ -178,42 +178,42 @@
     0x28340c19,
     0x283480ac,
     0x283500ea,
-    0x2c3228ca,
-    0x2c32a8d8,
-    0x2c3328ea,
-    0x2c33a8fc,
-    0x2c342910,
-    0x2c34a922,
-    0x2c35293d,
-    0x2c35a94f,
-    0x2c362962,
+    0x2c322910,
+    0x2c32a91e,
+    0x2c332930,
+    0x2c33a942,
+    0x2c342956,
+    0x2c34a968,
+    0x2c352983,
+    0x2c35a995,
+    0x2c3629a8,
     0x2c36832d,
-    0x2c37296f,
-    0x2c37a981,
-    0x2c382994,
-    0x2c38a9ab,
-    0x2c3929b9,
-    0x2c39a9c9,
-    0x2c3a29db,
-    0x2c3aa9ef,
-    0x2c3b2a00,
-    0x2c3baa1f,
-    0x2c3c2a33,
-    0x2c3caa49,
-    0x2c3d2a62,
-    0x2c3daa7f,
-    0x2c3e2a90,
-    0x2c3eaa9e,
-    0x2c3f2ab6,
-    0x2c3faace,
-    0x2c402adb,
+    0x2c3729b5,
+    0x2c37a9c7,
+    0x2c3829da,
+    0x2c38a9f1,
+    0x2c3929ff,
+    0x2c39aa0f,
+    0x2c3a2a21,
+    0x2c3aaa35,
+    0x2c3b2a46,
+    0x2c3baa65,
+    0x2c3c2a79,
+    0x2c3caa8f,
+    0x2c3d2aa8,
+    0x2c3daac5,
+    0x2c3e2ad6,
+    0x2c3eaae4,
+    0x2c3f2afc,
+    0x2c3fab14,
+    0x2c402b21,
     0x2c4090e7,
-    0x2c412aec,
-    0x2c41aaff,
+    0x2c412b32,
+    0x2c41ab45,
     0x2c4210c0,
-    0x2c42ab10,
+    0x2c42ab56,
     0x2c430720,
-    0x2c43aa11,
+    0x2c43aa57,
     0x30320000,
     0x30328015,
     0x3033001f,
@@ -429,74 +429,74 @@
     0x405b1e9e,
     0x405b9eaf,
     0x405c1ec2,
-    0x405c9ed3,
-    0x405d1ee0,
-    0x405d9ef7,
-    0x405e1f17,
+    0x405c9ee3,
+    0x405d1ef0,
+    0x405d9f07,
+    0x405e1f27,
     0x405e8a95,
-    0x405f1f38,
-    0x405f9f45,
-    0x40601f53,
-    0x40609f75,
-    0x40611f9d,
-    0x40619fb2,
-    0x40621fc9,
-    0x40629fda,
-    0x40631feb,
-    0x4063a000,
-    0x40642017,
-    0x4064a043,
-    0x4065205e,
-    0x4065a075,
-    0x4066208d,
-    0x4066a0b7,
-    0x406720e2,
-    0x4067a103,
-    0x40682116,
-    0x4068a137,
-    0x40692169,
-    0x4069a197,
-    0x406a21b8,
-    0x406aa1d8,
-    0x406b2360,
-    0x406ba383,
-    0x406c2399,
-    0x406ca5c5,
-    0x406d25f4,
-    0x406da61c,
-    0x406e264a,
-    0x406ea662,
-    0x406f2681,
-    0x406fa696,
-    0x407026a9,
-    0x4070a6c6,
+    0x405f1f48,
+    0x405f9f55,
+    0x40601f63,
+    0x40609f85,
+    0x40611fad,
+    0x40619fc2,
+    0x40621fd9,
+    0x40629fea,
+    0x40631ffb,
+    0x4063a010,
+    0x40642027,
+    0x4064a053,
+    0x4065206e,
+    0x4065a085,
+    0x4066209d,
+    0x4066a0c7,
+    0x406720f2,
+    0x4067a113,
+    0x40682126,
+    0x4068a147,
+    0x40692179,
+    0x4069a1a7,
+    0x406a21c8,
+    0x406aa1e8,
+    0x406b2370,
+    0x406ba393,
+    0x406c23a9,
+    0x406ca60b,
+    0x406d263a,
+    0x406da662,
+    0x406e2690,
+    0x406ea6a8,
+    0x406f26c7,
+    0x406fa6dc,
+    0x407026ef,
+    0x4070a70c,
     0x40710800,
-    0x4071a6d8,
-    0x407226eb,
-    0x4072a704,
-    0x4073271c,
+    0x4071a71e,
+    0x40722731,
+    0x4072a74a,
+    0x40732762,
     0x4073936d,
-    0x40742730,
-    0x4074a74a,
-    0x4075275b,
-    0x4075a76f,
-    0x4076277d,
+    0x40742776,
+    0x4074a790,
+    0x407527a1,
+    0x4075a7b5,
+    0x407627c3,
     0x407691aa,
-    0x407727a2,
-    0x4077a7c4,
-    0x407827df,
-    0x4078a818,
-    0x4079282f,
-    0x4079a845,
-    0x407a2851,
-    0x407aa864,
-    0x407b2879,
-    0x407ba88b,
-    0x407c28a0,
-    0x407ca8a9,
-    0x407d2152,
+    0x407727e8,
+    0x4077a80a,
+    0x40782825,
+    0x4078a85e,
+    0x40792875,
+    0x4079a88b,
+    0x407a2897,
+    0x407aa8aa,
+    0x407b28bf,
+    0x407ba8d1,
+    0x407c28e6,
+    0x407ca8ef,
+    0x407d2162,
     0x407d9c57,
-    0x407e27f4,
+    0x407e283a,
     0x407e9e16,
     0x407f1a67,
     0x407f9887,
@@ -504,42 +504,45 @@
     0x40809a8f,
     0x40811cd9,
     0x40819c08,
-    0x40822635,
+    0x4082267b,
     0x4082986d,
     0x40831df1,
-    0x4083a028,
+    0x4083a038,
     0x40841aa3,
     0x40849e4e,
-    0x41f4228b,
-    0x41f9231d,
-    0x41fe2210,
-    0x41fea3ec,
-    0x41ff24dd,
-    0x420322a4,
-    0x420822c6,
-    0x4208a302,
-    0x420921f4,
-    0x4209a33c,
-    0x420a224b,
-    0x420aa22b,
-    0x420b226b,
-    0x420ba2e4,
-    0x420c24f9,
-    0x420ca3b9,
-    0x420d23d3,
-    0x420da40a,
-    0x42122424,
-    0x421724c0,
-    0x4217a466,
-    0x421c2488,
-    0x421f2443,
-    0x42212510,
-    0x422624a3,
-    0x422b25a9,
-    0x422ba572,
-    0x422c2591,
-    0x422ca54c,
-    0x422d252b,
+    0x40851ed3,
+    0x41f4229b,
+    0x41f9232d,
+    0x41fe2220,
+    0x41fea3fc,
+    0x41ff24ed,
+    0x420322b4,
+    0x420822d6,
+    0x4208a312,
+    0x42092204,
+    0x4209a34c,
+    0x420a225b,
+    0x420aa23b,
+    0x420b227b,
+    0x420ba2f4,
+    0x420c2509,
+    0x420ca3c9,
+    0x420d23e3,
+    0x420da41a,
+    0x42122434,
+    0x421724d0,
+    0x4217a476,
+    0x421c2498,
+    0x421f2453,
+    0x42212520,
+    0x422624b3,
+    0x422b25ef,
+    0x422ba59d,
+    0x422c25d7,
+    0x422ca55c,
+    0x422d253b,
+    0x422da5bc,
+    0x422e2582,
     0x4432072b,
     0x4432873a,
     0x44330746,
@@ -582,69 +585,69 @@
     0x4c3d136d,
     0x4c3d937c,
     0x4c3e1389,
-    0x50322b22,
-    0x5032ab31,
-    0x50332b3c,
-    0x5033ab4c,
-    0x50342b65,
-    0x5034ab7f,
-    0x50352b8d,
-    0x5035aba3,
-    0x50362bb5,
-    0x5036abcb,
-    0x50372be4,
-    0x5037abf7,
-    0x50382c0f,
-    0x5038ac20,
-    0x50392c35,
-    0x5039ac49,
-    0x503a2c69,
-    0x503aac7f,
-    0x503b2c97,
-    0x503baca9,
-    0x503c2cc5,
-    0x503cacdc,
-    0x503d2cf5,
-    0x503dad0b,
-    0x503e2d18,
-    0x503ead2e,
-    0x503f2d40,
+    0x50322b68,
+    0x5032ab77,
+    0x50332b82,
+    0x5033ab92,
+    0x50342bab,
+    0x5034abc5,
+    0x50352bd3,
+    0x5035abe9,
+    0x50362bfb,
+    0x5036ac11,
+    0x50372c2a,
+    0x5037ac3d,
+    0x50382c55,
+    0x5038ac66,
+    0x50392c7b,
+    0x5039ac8f,
+    0x503a2caf,
+    0x503aacc5,
+    0x503b2cdd,
+    0x503bacef,
+    0x503c2d0b,
+    0x503cad22,
+    0x503d2d3b,
+    0x503dad51,
+    0x503e2d5e,
+    0x503ead74,
+    0x503f2d86,
     0x503f8382,
-    0x50402d53,
-    0x5040ad63,
-    0x50412d7d,
-    0x5041ad8c,
-    0x50422da6,
-    0x5042adc3,
-    0x50432dd3,
-    0x5043ade3,
-    0x50442df2,
+    0x50402d99,
+    0x5040ada9,
+    0x50412dc3,
+    0x5041add2,
+    0x50422dec,
+    0x5042ae09,
+    0x50432e19,
+    0x5043ae29,
+    0x50442e38,
     0x5044843f,
-    0x50452e06,
-    0x5045ae24,
-    0x50462e37,
-    0x5046ae4d,
-    0x50472e5f,
-    0x5047ae74,
-    0x50482e9a,
-    0x5048aea8,
-    0x50492ebb,
-    0x5049aed0,
-    0x504a2ee6,
-    0x504aaef6,
-    0x504b2f16,
-    0x504baf29,
-    0x504c2f4c,
-    0x504caf7a,
-    0x504d2f8c,
-    0x504dafa9,
-    0x504e2fc4,
-    0x504eafe0,
-    0x504f2ff2,
-    0x504fb009,
-    0x50503018,
+    0x50452e4c,
+    0x5045ae6a,
+    0x50462e7d,
+    0x5046ae93,
+    0x50472ea5,
+    0x5047aeba,
+    0x50482ee0,
+    0x5048aeee,
+    0x50492f01,
+    0x5049af16,
+    0x504a2f2c,
+    0x504aaf3c,
+    0x504b2f5c,
+    0x504baf6f,
+    0x504c2f92,
+    0x504cafc0,
+    0x504d2fd2,
+    0x504dafef,
+    0x504e300a,
+    0x504eb026,
+    0x504f3038,
+    0x504fb04f,
+    0x5050305e,
     0x505086ef,
-    0x5051302b,
+    0x50513071,
     0x58320ec9,
     0x68320e8b,
     0x68328c25,
@@ -1079,6 +1082,7 @@
     "NO_RENEGOTIATION\0"
     "NO_REQUIRED_DIGEST\0"
     "NO_SHARED_CIPHER\0"
+    "NO_SHARED_GROUP\0"
     "NULL_SSL_CTX\0"
     "NULL_SSL_METHOD_PASSED\0"
     "OLD_SESSION_CIPHER_NOT_RETURNED\0"
@@ -1139,7 +1143,9 @@
     "TLSV1_ALERT_USER_CANCELLED\0"
     "TLSV1_BAD_CERTIFICATE_HASH_VALUE\0"
     "TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE\0"
+    "TLSV1_CERTIFICATE_REQUIRED\0"
     "TLSV1_CERTIFICATE_UNOBTAINABLE\0"
+    "TLSV1_UNKNOWN_PSK_IDENTITY\0"
     "TLSV1_UNRECOGNIZED_NAME\0"
     "TLSV1_UNSUPPORTED_EXTENSION\0"
     "TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST\0"
diff --git a/third_party/boringssl/linux-x86_64/crypto/ec/p256-x86_64-asm.S b/third_party/boringssl/linux-x86_64/crypto/ec/p256-x86_64-asm.S
index 4abce6f9..8a18859 100644
--- a/third_party/boringssl/linux-x86_64/crypto/ec/p256-x86_64-asm.S
+++ b/third_party/boringssl/linux-x86_64/crypto/ec/p256-x86_64-asm.S
@@ -625,6 +625,8 @@
 	movq	%r9,%rsi
 	adcq	$0,%rdx
 
+
+
 	subq	$-1,%r8
 	movq	%r10,%rax
 	sbbq	%r12,%r9
diff --git a/third_party/boringssl/mac-x86_64/crypto/ec/p256-x86_64-asm.S b/third_party/boringssl/mac-x86_64/crypto/ec/p256-x86_64-asm.S
index 1cd0cc3..62dc474 100644
--- a/third_party/boringssl/mac-x86_64/crypto/ec/p256-x86_64-asm.S
+++ b/third_party/boringssl/mac-x86_64/crypto/ec/p256-x86_64-asm.S
@@ -624,6 +624,8 @@
 	movq	%r9,%rsi
 	adcq	$0,%rdx
 
+
+
 	subq	$-1,%r8
 	movq	%r10,%rax
 	sbbq	%r12,%r9
diff --git a/third_party/boringssl/win-x86_64/crypto/ec/p256-x86_64-asm.asm b/third_party/boringssl/win-x86_64/crypto/ec/p256-x86_64-asm.asm
index a2e4075..45df829 100644
--- a/third_party/boringssl/win-x86_64/crypto/ec/p256-x86_64-asm.asm
+++ b/third_party/boringssl/win-x86_64/crypto/ec/p256-x86_64-asm.asm
@@ -673,6 +673,8 @@
 	mov	rsi,r9
 	adc	rdx,0
 
+
+
 	sub	r8,-1
 	mov	rax,r10
 	sbb	r9,r12
diff --git a/third_party/libxml/README.chromium b/third_party/libxml/README.chromium
index 98ce1d93..24b749b 100644
--- a/third_party/libxml/README.chromium
+++ b/third_party/libxml/README.chromium
@@ -1,6 +1,6 @@
 Name: libxml
 URL: http://xmlsoft.org
-Version: bdec2183f34b37ee89ae1d330c6ad2bb4d76605f
+Version: 3169602058bd2d04913909e869c61d1540bc7fb4
 License: MIT
 License File: src/Copyright
 Security Critical: yes
diff --git a/third_party/libxml/src/libxml2.spec b/third_party/libxml/src/libxml2.spec
index 256ac618f..fe8a30b 100644
--- a/third_party/libxml/src/libxml2.spec
+++ b/third_party/libxml/src/libxml2.spec
@@ -194,6 +194,6 @@
 %endif # with_python3
 
 %changelog
-* Thu May 26 2016 Daniel Veillard <veillard@redhat.com>
+* Wed Oct 12 2016 Daniel Veillard <veillard@redhat.com>
 - upstream release 2.9.4 see http://xmlsoft.org/news.html
 
diff --git a/third_party/libxml/src/relaxng.c b/third_party/libxml/src/relaxng.c
index 56a3344..3d3e69c 100644
--- a/third_party/libxml/src/relaxng.c
+++ b/third_party/libxml/src/relaxng.c
@@ -2088,6 +2088,7 @@
                          const xmlChar * arg2)
 {
     char msg[1000];
+    xmlChar *result;
 
     if (arg1 == NULL)
         arg1 = BAD_CAST "";
@@ -2215,7 +2216,7 @@
         snprintf(msg, 1000, "Unknown error code %d\n", err);
     }
     msg[1000 - 1] = 0;
-    xmlChar *result = xmlCharStrdup(msg);
+    result = xmlCharStrdup(msg);
     return (xmlEscapeFormatString(&result));
 }
 
diff --git a/third_party/libxml/src/runtest.c b/third_party/libxml/src/runtest.c
index bb74d2a8..18615773 100644
--- a/third_party/libxml/src/runtest.c
+++ b/third_party/libxml/src/runtest.c
@@ -2317,10 +2317,19 @@
 static xmlDocPtr xpathDocument;
 
 static void
+ignoreGenericError(void *ctx ATTRIBUTE_UNUSED,
+        const char *msg ATTRIBUTE_UNUSED, ...) {
+}
+
+static void
 testXPath(const char *str, int xptr, int expr) {
+    xmlGenericErrorFunc handler = ignoreGenericError;
     xmlXPathObjectPtr res;
     xmlXPathContextPtr ctxt;
 
+    /* Don't print generic errors to stderr. */
+    initGenericErrorDefaultFunc(&handler);
+
     nb_tests++;
 #if defined(LIBXML_XPTR_ENABLED)
     if (xptr) {
@@ -2349,6 +2358,9 @@
     xmlXPathDebugDumpObject(xpathOutput, res, 0);
     xmlXPathFreeObject(res);
     xmlXPathFreeContext(ctxt);
+
+    /* Reset generic error handler. */
+    initGenericErrorDefaultFunc(NULL);
 }
 
 /**
diff --git a/third_party/libxml/src/xmlschemas.c b/third_party/libxml/src/xmlschemas.c
index e1b3a4f..d42afb7 100644
--- a/third_party/libxml/src/xmlschemas.c
+++ b/third_party/libxml/src/xmlschemas.c
@@ -3168,8 +3168,8 @@
 		"valid.");
 	}
 	if (expected) {
-	    msg = xmlStrcat(msg, BAD_CAST " Expected is '");
 	    xmlChar *expectedEscaped = xmlCharStrdup(expected);
+	    msg = xmlStrcat(msg, BAD_CAST " Expected is '");
 	    msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped));
 	    FREE_AND_NULL(expectedEscaped);
 	    msg = xmlStrcat(msg, BAD_CAST "'.\n");
@@ -27391,6 +27391,7 @@
     * attributes yet.
     */
     if (nb_attributes != 0) {
+	int valueLen, k, l;
 	xmlChar *value;
 
         for (j = 0, i = 0; i < nb_attributes; i++, j += 5) {
@@ -27400,12 +27401,31 @@
 	    * libxml2 differs from normal SAX here in that it escapes all ampersands
 	    * as &#38; instead of delivering the raw converted string. Changing the
 	    * behavior at this point would break applications that use this API, so
-	    * we are forced to work around it. There is no danger of accidentally
-	    * decoding some entity other than &#38; in this step because without
-	    * unescaped ampersands there can be no other entities in the string.
+	    * we are forced to work around it.
 	    */
-	    value = xmlStringLenDecodeEntities(vctxt->parserCtxt, attributes[j+3],
-		attributes[j+4] - attributes[j+3], XML_SUBSTITUTE_REF, 0, 0, 0);
+	    valueLen = attributes[j+4] - attributes[j+3];
+	    value = xmlMallocAtomic(valueLen + 1);
+	    if (value == NULL) {
+		xmlSchemaVErrMemory(vctxt,
+		    "allocating string for decoded attribute",
+		    NULL);
+		goto internal_error;
+	    }
+	    for (k = 0, l = 0; k < valueLen; l++) {
+		if (k < valueLen - 4 &&
+		    attributes[j+3][k+0] == '&' &&
+		    attributes[j+3][k+1] == '#' &&
+		    attributes[j+3][k+2] == '3' &&
+		    attributes[j+3][k+3] == '8' &&
+		    attributes[j+3][k+4] == ';') {
+		    value[l] = '&';
+		    k += 5;
+		} else {
+		    value[l] = attributes[j+3][k];
+		    k++;
+		}
+	    }
+	    value[l] = '\0';
 	    /*
 	    * TODO: Set the node line.
 	    */
diff --git a/third_party/libxml/src/xpath.c b/third_party/libxml/src/xpath.c
index a0d993a..7c24a82 100644
--- a/third_party/libxml/src/xpath.c
+++ b/third_party/libxml/src/xpath.c
@@ -14008,9 +14008,14 @@
                 xmlNodeSetPtr oldset;
                 int i, j;
 
-                if (op->ch1 != -1)
+                if (op->ch1 != -1) {
                     total +=
                         xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
+                    CHECK_ERROR0;
+                }
+                if (ctxt->value == NULL) {
+                    XP_ERROR0(XPATH_INVALID_OPERAND);
+                }
                 if (op->ch2 == -1)
                     return (total);
 
diff --git a/third_party/libxslt/README.chromium b/third_party/libxslt/README.chromium
index c8384c2..7d02fb6 100644
--- a/third_party/libxslt/README.chromium
+++ b/third_party/libxslt/README.chromium
@@ -1,6 +1,6 @@
 Name: libxslt
 URL: http://xmlsoft.org/XSLT
-Version: 87c3d9ea214fc0503fd8130b6dd97431d69cc066
+Version: 8345634c5482ca04293ae1862d52fa9dd764aeca
 Security Critical: yes
 License: MIT
 License File: Copyright
diff --git a/third_party/libxslt/config.h.in b/third_party/libxslt/config.h.in
index d2a0cca..8f7d8c0 100644
--- a/third_party/libxslt/config.h.in
+++ b/third_party/libxslt/config.h.in
@@ -12,6 +12,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
 /* Define if fabs is there */
 #undef HAVE_FABS
 
@@ -147,8 +150,7 @@
 /* Define to 1 if you have the `_stat' function. */
 #undef HAVE__STAT
 
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
 #undef LT_OBJDIR
 
 /* Name of package */
diff --git a/third_party/libxslt/configure b/third_party/libxslt/configure
old mode 100644
new mode 100755
index 29fbd56..2e702779
--- a/third_party/libxslt/configure
+++ b/third_party/libxslt/configure
@@ -3705,7 +3705,7 @@
 
 LIBXSLT_MAJOR_VERSION=1
 LIBXSLT_MINOR_VERSION=1
-LIBXSLT_MICRO_VERSION=28
+LIBXSLT_MICRO_VERSION=29
 PACKAGE=libxslt
 LIBEXSLT_MAJOR_VERSION=0
 LIBEXSLT_MINOR_VERSION=8
@@ -13301,6 +13301,18 @@
 
 done
 
+for ac_header in errno.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default"
+if test "x$ac_cv_header_errno_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_ERRNO_H 1
+_ACEOF
+
+fi
+
+done
+
 for ac_func in stat _stat
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
diff --git a/third_party/libxslt/configure.in b/third_party/libxslt/configure.in
index 7e03d117..8bdf45a 100644
--- a/third_party/libxslt/configure.in
+++ b/third_party/libxslt/configure.in
@@ -11,7 +11,7 @@
 dnl
 LIBXSLT_MAJOR_VERSION=1
 LIBXSLT_MINOR_VERSION=1
-LIBXSLT_MICRO_VERSION=28
+LIBXSLT_MICRO_VERSION=29
 PACKAGE=libxslt
 LIBEXSLT_MAJOR_VERSION=0
 LIBEXSLT_MINOR_VERSION=8
@@ -235,6 +235,7 @@
 
 AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
 AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h)
+AC_CHECK_HEADERS(errno.h)
 AC_CHECK_FUNCS(stat _stat)
 AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
   [M_LIBS="-lm"; AC_DEFINE([HAVE_POW],[], [Define if pow is there])]))
diff --git a/third_party/libxslt/libexslt/common.c b/third_party/libxslt/libexslt/common.c
index 451a60d..91be04fd 100644
--- a/third_party/libxslt/libexslt/common.c
+++ b/third_party/libxslt/libexslt/common.c
@@ -60,12 +60,6 @@
 	    xsltTransformError(tctxt, NULL, tctxt->inst,
 		"exsltNodeSetFunction: Failed to create a node set object.\n");
 	    tctxt->state = XSLT_STATE_STOPPED;
-	} else {
-	    /*
-	     * Mark it as a function result in order to avoid garbage
-	     * collecting of tree fragments
-	     */
-	    xsltExtensionInstructionResultRegister(tctxt, obj);
 	}
 	if (strval != NULL)
 	    xmlFree (strval);
diff --git a/third_party/libxslt/libexslt/date.c b/third_party/libxslt/libexslt/date.c
index 87c48487..3af6f7fd 100644
--- a/third_party/libxslt/libexslt/date.c
+++ b/third_party/libxslt/libexslt/date.c
@@ -47,6 +47,9 @@
 
 #include <string.h>
 
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
 #ifdef HAVE_MATH_H
 #include <math.h>
 #endif
@@ -752,21 +755,55 @@
 exsltDateCurrent (void)
 {
     struct tm localTm, gmTm;
+#ifndef HAVE_GMTIME_R
+    struct tm *tb = NULL;
+#endif
     time_t secs;
     int local_s, gm_s;
     exsltDateValPtr ret;
+#ifdef HAVE_ERRNO_H
+    char *source_date_epoch;
+#endif /* HAVE_ERRNO_H */
+    int override = 0;
 
     ret = exsltDateCreateDate(XS_DATETIME);
     if (ret == NULL)
         return NULL;
 
-    /* get current time */
-    secs    = time(NULL);
-#if HAVE_LOCALTIME_R
-    localtime_r(&secs, &localTm);
+#ifdef HAVE_ERRNO_H
+    /*
+     * Allow the date and time to be set externally by an exported
+     * environment variable to enable reproducible builds.
+     */
+    source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+    if (source_date_epoch) {
+        errno = 0;
+	secs = (time_t) strtol (source_date_epoch, NULL, 10);
+	if (errno == 0) {
+#if HAVE_GMTIME_R
+	    if (gmtime_r(&secs, &localTm) != NULL)
+	        override = 1;
 #else
-    localTm = *localtime(&secs);
+	    tb = gmtime(&secs);
+	    if (tb != NULL) {
+	        localTm = *tb;
+		override = 1;
+	    }
 #endif
+        }
+    }
+#endif /* HAVE_ERRNO_H */
+
+    if (override == 0) {
+    /* get current time */
+	secs    = time(NULL);
+
+#if HAVE_LOCALTIME_R
+	localtime_r(&secs, &localTm);
+#else
+	localTm = *localtime(&secs);
+#endif
+    }
 
     /* get real year, not years since 1900 */
     ret->value.date.year = localTm.tm_year + 1900;
@@ -783,7 +820,9 @@
 #if HAVE_GMTIME_R
     gmtime_r(&secs, &gmTm);
 #else
-    gmTm = *gmtime(&secs);
+    tb = gmtime(&secs);
+    if (tb != NULL)
+        gmTm = *tb;
 #endif
     ret->value.date.tz_flag = 0;
 #if 0
diff --git a/third_party/libxslt/libexslt/dynamic.c b/third_party/libxslt/libexslt/dynamic.c
index 7b95fc5e..4a4944e 100644
--- a/third_party/libxslt/libexslt/dynamic.c
+++ b/third_party/libxslt/libexslt/dynamic.c
@@ -216,7 +216,6 @@
                                 xmlXPathNodeSetAddUnique(ret->nodesetval,
                                                          cur);
                             }
-			    xsltExtensionInstructionResultRegister(tctxt, ret);
                         }
                         break;
                     case XPATH_NUMBER:
@@ -239,7 +238,6 @@
                                 xmlXPathNodeSetAddUnique(ret->nodesetval,
                                                          cur);
                             }
-			    xsltExtensionInstructionResultRegister(tctxt, ret);
                         }
                         break;
                     case XPATH_STRING:
@@ -257,7 +255,6 @@
                                 xmlXPathNodeSetAddUnique(ret->nodesetval,
                                                          cur);
                             }
-			    xsltExtensionInstructionResultRegister(tctxt, ret);
                         }
                         break;
 		    default:
diff --git a/third_party/libxslt/libexslt/functions.c b/third_party/libxslt/libexslt/functions.c
index 0795a13..b49fbe6c3 100644
--- a/third_party/libxslt/libexslt/functions.c
+++ b/third_party/libxslt/libexslt/functions.c
@@ -35,7 +35,6 @@
     xmlHashTablePtr funcs;	/* pointer to the stylesheet module data */
     xmlXPathObjectPtr result;	/* returned by func:result */
     int error;			/* did an error occur? */
-    xmlDocPtr RVT;   /* result tree fragment */
 };
 
 typedef struct _exsltFuncResultPreComp exsltFuncResultPreComp;
@@ -57,8 +56,6 @@
 				       int nargs);
 static exsltFuncFunctionData *exsltFuncNewFunctionData(void);
 
-#define MAX_FUNC_RECURSION 1000
-
 /*static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result";*/
 
 /**
@@ -333,14 +330,6 @@
 			 "param == NULL\n");
 	return;
     }
-    if (tctxt->funcLevel > MAX_FUNC_RECURSION) {
-	xsltGenericError(xsltGenericErrorContext,
-			 "{%s}%s: detected a recursion\n",
-			 ctxt->context->functionURI, ctxt->context->function);
-	ctxt->error = XPATH_MEMORY_ERROR;
-	return;
-    }
-    tctxt->funcLevel++;
 
     /*
      * We have a problem with the evaluation of function parameters.
@@ -424,10 +413,16 @@
 	xsltFreeStackElemList(params);
 
     if (data->error != 0)
-	goto error;
+	return;
 
     if (data->result != NULL) {
 	ret = data->result;
+        /*
+        * IMPORTANT: This enables previously tree fragments marked as
+        * being results of a function, to be garbage-collected after
+        * the calling process exits.
+        */
+        xsltFlagRVTs(tctxt, ret, XSLT_RVT_LOCAL);
     } else
 	ret = xmlXPathNewCString("");
 
@@ -446,19 +441,10 @@
 			 "executing a function\n",
 			 ctxt->context->functionURI, ctxt->context->function);
 	xmlFreeNode(fake);
-	goto error;
+	return;
     }
     xmlFreeNode(fake);
     valuePush(ctxt, ret);
-
-error:
-    /*
-    * IMPORTANT: This enables previously tree fragments marked as
-    * being results of a function, to be garbage-collected after
-    * the calling process exits.
-    */
-    xsltExtensionInstructionResultFinalize(tctxt);
-    tctxt->funcLevel--;
 }
 
 
@@ -724,7 +710,7 @@
 	* Mark it as a function result in order to avoid garbage
 	* collecting of tree fragments before the function exits.
 	*/
-	xsltExtensionInstructionResultRegister(ctxt, ret);
+	xsltFlagRVTs(ctxt, ret, XSLT_RVT_FUNC_RESULT);
     } else if (inst->children != NULL) {
 	/* If the func:result element does not have a select attribute
 	 * and has non-empty content (i.e. the func:result element has
@@ -741,7 +727,8 @@
 	    data->error = 1;
 	    return;
 	}
-	xsltRegisterLocalRVT(ctxt, container);
+        /* Mark as function result. */
+        container->psvi = XSLT_RVT_FUNC_RESULT;
 
 	oldInsert = ctxt->insert;
 	ctxt->insert = (xmlNodePtr) container;
@@ -756,11 +743,6 @@
 	    data->error = 1;
 	} else {
 	    ret->boolval = 0; /* Freeing is not handled there anymore */
-	    /*
-	    * Mark it as a function result in order to avoid garbage
-	    * collecting of tree fragments before the function exits.
-	    */
-	    xsltExtensionInstructionResultRegister(ctxt, ret);
 	}
     } else {
 	/* If the func:result element has empty content and does not
diff --git a/third_party/libxslt/libexslt/strings.c b/third_party/libxslt/libexslt/strings.c
index f5f2d3c..62f76fb 100644
--- a/third_party/libxslt/libexslt/strings.c
+++ b/third_party/libxslt/libexslt/strings.c
@@ -111,11 +111,6 @@
                 xmlAddChild((xmlNodePtr) container, node);
 	        xmlXPathNodeSetAddUnique(ret->nodesetval, node);
             }
-	    /*
-	     * Mark it as a function result in order to avoid garbage
-	     * collecting of tree fragments
-	     */
-	    xsltExtensionInstructionResultRegister(tctxt, ret);
         }
     }
 
@@ -222,11 +217,6 @@
 		xmlAddChild((xmlNodePtr) container, node);
 		xmlXPathNodeSetAddUnique(ret->nodesetval, node);
 	    }
-	    /*
-	     * Mark it as a function result in order to avoid garbage
-	     * collecting of tree fragments
-	     */
-	    xsltExtensionInstructionResultRegister(tctxt, ret);
         }
     }
 
@@ -543,7 +533,6 @@
         return(-1);
     }
 
-    xsltExtensionInstructionResultRegister(tctxt, ret);
     valuePush(ctxt, ret);
 
     return(0);
diff --git a/third_party/libxslt/libxslt.spec.in b/third_party/libxslt/libxslt.spec.in
index e72d0724..96c0ca6 100644
--- a/third_party/libxslt/libxslt.spec.in
+++ b/third_party/libxslt/libxslt.spec.in
@@ -1,7 +1,7 @@
 Summary: Library providing the GNOME XSLT engine
 Name: libxslt
 Version: @VERSION@
-Release: 1
+Release: 1%{?dist}%{?extra_release}
 License: MIT
 Group: Development/Libraries
 Source: ftp://xmlsoft.org/XSLT/libxslt-%{version}.tar.gz
@@ -66,8 +66,11 @@
 
 %makeinstall
 
-rm -fr $RPM_BUILD_ROOT%{_libdir}/*.la \
-       $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/libxsltmod*a
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}{,-python}-%{version}
+
+%check
+make check
 
 %clean
 rm -fr %{buildroot}
diff --git a/third_party/libxslt/libxslt/attributes.c b/third_party/libxslt/libxslt/attributes.c
index 8440b10..9165ab1 100644
--- a/third_party/libxslt/libxslt/attributes.c
+++ b/third_party/libxslt/libxslt/attributes.c
@@ -55,14 +55,6 @@
 #endif
 
 /*
- * TODO: merge attribute sets from different import precedence.
- *       all this should be precomputed just before the transformation
- *       starts or at first hit with a cache in the context.
- *       The simple way for now would be to not allow redefinition of
- *       attributes once generated in the output tree, possibly costlier.
- */
-
-/*
  * Useful macros
  */
 #ifdef IS_BLANK
@@ -75,6 +67,10 @@
 #define IS_BLANK_NODE(n)						\
     (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
 
+#define ATTRSET_UNRESOLVED 0
+#define ATTRSET_RESOLVING  1
+#define ATTRSET_RESOLVED   2
+
 
 /*
  * The in-memory structure corresponding to an XSLT Attribute in
@@ -87,10 +83,36 @@
 struct _xsltAttrElem {
     struct _xsltAttrElem *next;/* chained list */
     xmlNodePtr attr;	/* the xsl:attribute definition */
-    const xmlChar *set; /* or the attribute set */
-    const xmlChar *ns;  /* and its namespace */
 };
 
+typedef struct _xsltUseAttrSet xsltUseAttrSet;
+typedef xsltUseAttrSet *xsltUseAttrSetPtr;
+struct _xsltUseAttrSet {
+    struct _xsltUseAttrSet *next; /* chained list */
+    const xmlChar *ncname;
+    const xmlChar *ns;
+};
+
+typedef struct _xsltAttrSet xsltAttrSet;
+typedef xsltAttrSet *xsltAttrSetPtr;
+struct _xsltAttrSet {
+    int state;
+    xsltAttrElemPtr attrs; /* list head */
+    xsltUseAttrSetPtr useAttrSets; /* list head */
+};
+
+typedef struct _xsltAttrSetContext xsltAttrSetContext;
+typedef xsltAttrSetContext *xsltAttrSetContextPtr;
+struct _xsltAttrSetContext {
+    xsltStylesheetPtr topStyle;
+    xsltStylesheetPtr style;
+};
+
+static void
+xsltResolveAttrSet(xsltAttrSetPtr set, xsltStylesheetPtr topStyle,
+                   xsltStylesheetPtr style, const xmlChar *name,
+                   const xmlChar *ns, int depth);
+
 /************************************************************************
  *									*
  *			XSLT Attribute handling				*
@@ -148,11 +170,6 @@
     }
 }
 
-#ifdef XSLT_REFACTORED
-    /*
-    * This was moved to xsltParseStylesheetAttributeSet().
-    */
-#else
 /**
  * xsltAddAttrElemList:
  * @list:  an XSLT AttrElem list
@@ -173,9 +190,7 @@
     cur = list;
     while (cur != NULL) {
 	next = cur->next;
-	if (cur->attr == attr)
-	    return(cur);
-	if (cur->next == NULL) {
+	if (next == NULL) {
 	    cur->next = xsltNewAttrElem(attr);
 	    return(list);
 	}
@@ -183,92 +198,174 @@
     }
     return(list);
 }
-#endif /* XSLT_REFACTORED */
 
 /**
- * xsltMergeAttrElemList:
- * @list:  an XSLT AttrElem list
- * @old:  another XSLT AttrElem list
+ * xsltNewUseAttrSet:
+ * @ncname:  local name
+ * @ns:  namespace URI
  *
- * Add all the attributes from list @old to list @list,
- * but drop redefinition of existing values.
+ * Create a new XSLT UseAttrSet
  *
- * Returns the new list pointer
+ * Returns the newly allocated xsltUseAttrSetPtr or NULL in case of error.
  */
-static xsltAttrElemPtr
-xsltMergeAttrElemList(xsltStylesheetPtr style,
-		      xsltAttrElemPtr list, xsltAttrElemPtr old) {
+static xsltUseAttrSetPtr
+xsltNewUseAttrSet(const xmlChar *ncname, const xmlChar *ns) {
+    xsltUseAttrSetPtr cur;
+
+    cur = (xsltUseAttrSetPtr) xmlMalloc(sizeof(xsltUseAttrSet));
+    if (cur == NULL) {
+        xsltGenericError(xsltGenericErrorContext,
+		"xsltNewUseAttrSet : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltUseAttrSet));
+    cur->ncname = ncname;
+    cur->ns = ns;
+    return(cur);
+}
+
+/**
+ * xsltFreeUseAttrSet:
+ * @use:  an XSLT UseAttrSet
+ *
+ * Free up the memory allocated by @use
+ */
+static void
+xsltFreeUseAttrSet(xsltUseAttrSetPtr use) {
+    xmlFree(use);
+}
+
+/**
+ * xsltFreeUseAttrSetList:
+ * @list:  an XSLT UseAttrSet list
+ *
+ * Free up the memory allocated by @list
+ */
+static void
+xsltFreeUseAttrSetList(xsltUseAttrSetPtr list) {
+    xsltUseAttrSetPtr next;
+
+    while (list != NULL) {
+	next = list->next;
+	xsltFreeUseAttrSet(list);
+	list = next;
+    }
+}
+
+/**
+ * xsltAddUseAttrSetList:
+ * @list:  a xsltUseAttrSet list
+ * @ncname:  local name
+ * @ns:  namespace URI
+ *
+ * Add the use-attribute-set name to the list.
+ *
+ * Returns the new list pointer.
+ */
+static xsltUseAttrSetPtr
+xsltAddUseAttrSetList(xsltUseAttrSetPtr list, const xmlChar *ncname,
+                      const xmlChar *ns) {
+    xsltUseAttrSetPtr next, cur;
+
+    if (ncname == NULL)
+        return(list);
+    if (list == NULL)
+	return(xsltNewUseAttrSet(ncname, ns));
+    cur = list;
+    while (cur != NULL) {
+        if ((cur->ncname == ncname) && (cur->ns == ns))
+            return(list);
+	next = cur->next;
+	if (next == NULL) {
+	    cur->next = xsltNewUseAttrSet(ncname, ns);
+	    return(list);
+	}
+	cur = next;
+    }
+    return(list);
+}
+
+/**
+ * xsltNewAttrSet:
+ *
+ * Create a new attribute set.
+ *
+ * Returns the newly allocated xsltAttrSetPtr or NULL in case of error.
+ */
+static xsltAttrSetPtr
+xsltNewAttrSet() {
+    xsltAttrSetPtr cur;
+
+    cur = (xsltAttrSetPtr) xmlMalloc(sizeof(xsltAttrSet));
+    if (cur == NULL) {
+        xsltGenericError(xsltGenericErrorContext,
+		"xsltNewAttrSet : malloc failed\n");
+	return(NULL);
+    }
+    memset(cur, 0, sizeof(xsltAttrSet));
+    return(cur);
+}
+
+/**
+ * xsltFreeAttrSet:
+ * @set:  an attribute set
+ *
+ * Free memory allocated by @set
+ */
+static void
+xsltFreeAttrSet(xsltAttrSetPtr set) {
+    if (set == NULL)
+        return;
+
+    xsltFreeAttrElemList(set->attrs);
+    xsltFreeUseAttrSetList(set->useAttrSets);
+    xmlFree(set);
+}
+
+/**
+ * xsltMergeAttrSets:
+ * @set:  an attribute set
+ * @other:  another attribute set
+ *
+ * Add all the attributes from @other to @set,
+ * but drop redefinition of existing values.
+ */
+static void
+xsltMergeAttrSets(xsltAttrSetPtr set, xsltAttrSetPtr other) {
     xsltAttrElemPtr cur;
+    xsltAttrElemPtr old = other->attrs;
     int add;
 
     while (old != NULL) {
-	if ((old->attr == NULL) && (old->set == NULL)) {
-	    old = old->next;
-	    continue;
-	}
 	/*
 	 * Check that the attribute is not yet in the list
 	 */
-	cur = list;
+	cur = set->attrs;
 	add = 1;
 	while (cur != NULL) {
-	    if ((cur->attr == NULL) && (cur->set == NULL)) {
-		if (cur->next == NULL)
-		    break;
-		cur = cur->next;
-		continue;
-	    }
-	    if ((cur->set != NULL) && (cur->set == old->set)) {
-		add = 0;
-		break;
-	    }
-	    if (cur->set != NULL) {
-		if (cur->next == NULL)
-		    break;
-		cur = cur->next;
-		continue;
-	    }
-	    if (old->set != NULL) {
-		if (cur->next == NULL)
-		    break;
-		cur = cur->next;
-		continue;
-	    }
-	    if (cur->attr == old->attr) {
-		xsltGenericError(xsltGenericErrorContext,
-	     "xsl:attribute-set : use-attribute-sets recursion detected\n");
-		return(list);
-	    }
+            xsltStylePreCompPtr curComp = cur->attr->psvi;
+            xsltStylePreCompPtr oldComp = old->attr->psvi;
+
+            if ((curComp->name == oldComp->name) &&
+                (curComp->ns == oldComp->ns)) {
+                add = 0;
+                break;
+            }
 	    if (cur->next == NULL)
 		break;
             cur = cur->next;
 	}
 
 	if (add == 1) {
-	    /*
-	    * Changed to use the string-dict, rather than duplicating
-	    * @set and @ns; this fixes bug #340400.
-	    */
 	    if (cur == NULL) {
-		list = xsltNewAttrElem(old->attr);
-		if (old->set != NULL) {
-		    list->set = xmlDictLookup(style->dict, old->set, -1);
-		    if (old->ns != NULL)
-			list->ns = xmlDictLookup(style->dict, old->ns, -1);
-		}
+		set->attrs = xsltNewAttrElem(old->attr);
 	    } else if (add) {
 		cur->next = xsltNewAttrElem(old->attr);
-		if (old->set != NULL) {
-		    cur->next->set = xmlDictLookup(style->dict, old->set, -1);
-		    if (old->ns != NULL)
-			cur->next->ns = xmlDictLookup(style->dict, old->ns, -1);
-		}
 	    }
 	}
 
 	old = old->next;
     }
-    return(list);
 }
 
 /************************************************************************
@@ -289,9 +386,10 @@
 xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) {
     const xmlChar *ncname;
     const xmlChar *prefix;
+    const xmlChar *nsUri = NULL;
     xmlChar *value;
     xmlNodePtr child;
-    xsltAttrElemPtr attrItems;
+    xsltAttrSetPtr set;
 
     if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE))
 	return;
@@ -305,9 +403,29 @@
 	return;
     }
 
+    if (xmlValidateQName(value, 0)) {
+        xsltTransformError(NULL, style, cur,
+            "xsl:attribute-set : The name '%s' is not a valid QName.\n",
+            value);
+        style->errors++;
+        xmlFree(value);
+        return;
+    }
+
     ncname = xsltSplitQName(style->dict, value, &prefix);
     xmlFree(value);
     value = NULL;
+    if (prefix != NULL) {
+        xmlNsPtr ns = xmlSearchNs(style->doc, cur, prefix);
+        if (ns == NULL) {
+            xsltTransformError(NULL, style, cur,
+                "xsl:attribute-set : No namespace found for QName '%s:%s'\n",
+                prefix, ncname);
+            style->errors++;
+            return;
+        }
+        nsUri = ns->href;
+    }
 
     if (style->attributeSets == NULL) {
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
@@ -319,7 +437,13 @@
     if (style->attributeSets == NULL)
 	return;
 
-    attrItems = xmlHashLookup2(style->attributeSets, ncname, prefix);
+    set = xmlHashLookup2(style->attributeSets, ncname, nsUri);
+    if (set == NULL) {
+        set = xsltNewAttrSet();
+        if (set == NULL)
+            return;
+        xmlHashAddEntry2(style->attributeSets, ncname, nsUri, set);
+    }
 
     /*
     * Parse the content. Only xsl:attribute elements are allowed.
@@ -345,71 +469,36 @@
 		"xsl:attribute-set : unexpected child xsl:%s\n",
 		child->name);
 	} else {
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+	    xsltGenericDebug(xsltGenericDebugContext,
+		"add attribute to list %s\n", ncname);
+#endif
+            xsltStylePreCompute(style, child);
+            if (child->children != NULL) {
 #ifdef XSLT_REFACTORED
-	    xsltAttrElemPtr nextAttr, curAttr;
-
-	    /*
-	    * Process xsl:attribute
-	    * ---------------------
-	    */
-
-#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
-	    xsltGenericDebug(xsltGenericDebugContext,
-		"add attribute to list %s\n", ncname);
-#endif
-	    /*
-	    * The following was taken over from
-	    * xsltAddAttrElemList().
-	    */
-	    if (attrItems == NULL) {
-		attrItems = xsltNewAttrElem(child);
-	    } else {
-		curAttr = attrItems;
-		while (curAttr != NULL) {
-		    nextAttr = curAttr->next;
-		    if (curAttr->attr == child) {
-			/*
-			* URGENT TODO: Can somebody explain
-			*  why attrItems is set to curAttr
-			*  here? Is this somehow related to
-			*  avoidance of recursions?
-			*/
-			attrItems = curAttr;
-			goto next_child;
-		    }
-		    if (curAttr->next == NULL)
-			curAttr->next = xsltNewAttrElem(child);
-		    curAttr = nextAttr;
-		}
-	    }
-	    /*
-	    * Parse the xsl:attribute and its content.
-	    */
-	    xsltParseAnyXSLTElem(XSLT_CCTXT(style), child);
+                xsltParseSequenceConstructor(XSLT_CCTXT(style),
+                                             child->children);
 #else
-#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
-	    xsltGenericDebug(xsltGenericDebugContext,
-		"add attribute to list %s\n", ncname);
+                xsltParseTemplateContent(style, child);
 #endif
-	    /*
-	    * OLD behaviour:
-	    */
-	    attrItems = xsltAddAttrElemList(attrItems, child);
-#endif
+            }
+            if (child->psvi == NULL) {
+                xsltTransformError(NULL, style, child,
+                    "xsl:attribute-set : internal error, attribute %s not "
+                    "compiled\n", child->name);
+            }
+            else {
+	        set->attrs = xsltAddAttrElemList(set->attrs, child);
+            }
 	}
 
-#ifdef XSLT_REFACTORED
-next_child:
-#endif
 	child = child->next;
     }
 
     /*
-    * Process attribue "use-attribute-sets".
+    * Process attribute "use-attribute-sets".
     */
-    /* TODO check recursion */
-    value = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets",
-	NULL);
+    value = xmlGetNsProp(cur, BAD_CAST "use-attribute-sets", NULL);
     if (value != NULL) {
 	const xmlChar *curval, *endval;
 	curval = value;
@@ -423,21 +512,38 @@
 	    if (curval) {
 		const xmlChar *ncname2 = NULL;
 		const xmlChar *prefix2 = NULL;
-		xsltAttrElemPtr refAttrItems;
+                const xmlChar *nsUri2 = NULL;
 
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
 		xsltGenericDebug(xsltGenericDebugContext,
 		    "xsl:attribute-set : %s adds use %s\n", ncname, curval);
 #endif
+
+                if (xmlValidateQName(curval, 0)) {
+                    xsltTransformError(NULL, style, cur,
+                        "xsl:attribute-set : The name '%s' in "
+                        "use-attribute-sets is not a valid QName.\n", curval);
+                    style->errors++;
+                    xmlFree(value);
+                    return;
+                }
+
 		ncname2 = xsltSplitQName(style->dict, curval, &prefix2);
-		refAttrItems = xsltNewAttrElem(NULL);
-		if (refAttrItems != NULL) {
-		    refAttrItems->set = ncname2;
-		    refAttrItems->ns = prefix2;
-		    attrItems = xsltMergeAttrElemList(style,
-			attrItems, refAttrItems);
-		    xsltFreeAttrElem(refAttrItems);
-		}
+                if (prefix2 != NULL) {
+                    xmlNsPtr ns2 = xmlSearchNs(style->doc, cur, prefix2);
+                    if (ns2 == NULL) {
+                        xsltTransformError(NULL, style, cur,
+                            "xsl:attribute-set : No namespace found for QName "
+                            "'%s:%s' in use-attribute-sets\n",
+                            prefix2, ncname2);
+                        style->errors++;
+                        xmlFree(value);
+                        return;
+                    }
+                    nsUri2 = ns2->href;
+                }
+                set->useAttrSets = xsltAddUseAttrSetList(set->useAttrSets,
+                                                         ncname2, nsUri2);
 	    }
 	    curval = endval;
 	}
@@ -445,15 +551,6 @@
 	value = NULL;
     }
 
-    /*
-     * Update the value
-     */
-    /*
-    * TODO: Why is this dummy entry needed.?
-    */
-    if (attrItems == NULL)
-	attrItems = xsltNewAttrElem(NULL);
-    xmlHashUpdateEntry2(style->attributeSets, ncname, prefix, attrItems, NULL);
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
     xsltGenericDebug(xsltGenericDebugContext,
 	"updated attribute list %s\n", ncname);
@@ -461,143 +558,141 @@
 }
 
 /**
- * xsltGetSAS:
- * @style:  the XSLT stylesheet
- * @name:  the attribute list name
- * @ns:  the attribute list namespace
+ * xsltResolveUseAttrSets:
+ * @set: the attribute set
+ * @asctx:  the context for attribute set resolution
+ * @depth: recursion depth
  *
- * lookup an attribute set based on the style cascade
- *
- * Returns the attribute set or NULL
+ * Process "use-attribute-sets".
  */
-static xsltAttrElemPtr
-xsltGetSAS(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *ns) {
-    xsltAttrElemPtr values;
+static void
+xsltResolveUseAttrSets(xsltAttrSetPtr set, xsltStylesheetPtr topStyle,
+		       int depth) {
+    xsltStylesheetPtr cur;
+    xsltAttrSetPtr other;
+    xsltUseAttrSetPtr use = set->useAttrSets;
+    xsltUseAttrSetPtr next;
 
-    while (style != NULL) {
-	values = xmlHashLookup2(style->attributeSets, name, ns);
-	if (values != NULL)
-	    return(values);
-	style = xsltNextImport(style);
+    while (use != NULL) {
+        /*
+         * Iterate top stylesheet and all imports.
+         */
+        cur = topStyle;
+        while (cur != NULL) {
+            if (cur->attributeSets) {
+                other = xmlHashLookup2(cur->attributeSets, use->ncname,
+                                       use->ns);
+                if (other != NULL) {
+                    xsltResolveAttrSet(other, topStyle, cur, use->ncname,
+                                       use->ns, depth + 1);
+                    xsltMergeAttrSets(set, other);
+                    break;
+                }
+            }
+            cur = xsltNextImport(cur);
+        }
+
+        next = use->next;
+        /* Free useAttrSets early. */
+        xsltFreeUseAttrSet(use);
+        use = next;
     }
-    return(NULL);
+
+    set->useAttrSets = NULL;
 }
 
 /**
- * xsltResolveSASCallbackInt:
- * @style:  the XSLT stylesheet
+ * xsltResolveAttrSet:
+ * @set: the attribute set
+ * @asctx:  the context for attribute set resolution
+ * @name: the local name of the attirbute set
+ * @ns: the namespace of the attribute set
+ * @depth: recursion depth
  *
  * resolve the references in an attribute set.
  */
 static void
-xsltResolveSASCallbackInt(xsltAttrElemPtr values, xsltStylesheetPtr style,
-	               const xmlChar *name, const xmlChar *ns,
-		       int depth) {
-    xsltAttrElemPtr tmp;
-    xsltAttrElemPtr refs;
+xsltResolveAttrSet(xsltAttrSetPtr set, xsltStylesheetPtr topStyle,
+                   xsltStylesheetPtr style, const xmlChar *name,
+                   const xmlChar *ns, int depth) {
+    xsltStylesheetPtr cur;
+    xsltAttrSetPtr other;
 
-    tmp = values;
-    if ((name == NULL) || (name[0] == 0))
+    if (set->state == ATTRSET_RESOLVED)
         return;
+    if (set->state == ATTRSET_RESOLVING) {
+	xsltTransformError(NULL, topStyle, NULL,
+            "xsl:attribute-set : use-attribute-sets recursion detected"
+            " on %s\n", name);
+        topStyle->errors++;
+        set->state = ATTRSET_RESOLVED;
+        return;
+    }
     if (depth > 100) {
-	xsltGenericError(xsltGenericErrorContext,
-	"xsl:attribute-set : use-attribute-sets recursion detected on %s\n",
-			 name);
+	xsltTransformError(NULL, topStyle, NULL,
+		"xsl:attribute-set : use-attribute-sets maximum recursion "
+		"depth exceeded on %s\n", name);
+        topStyle->errors++;
 	return;
     }
-    while (tmp != NULL) {
-	if (tmp->set != NULL) {
-	    /*
-	     * Check against cycles !
-	     */
-	    if ((xmlStrEqual(name, tmp->set)) && (xmlStrEqual(ns, tmp->ns))) {
-		xsltGenericError(xsltGenericErrorContext,
-     "xsl:attribute-set : use-attribute-sets recursion detected on %s\n",
-                                 name);
-	    } else {
-#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
-		xsltGenericDebug(xsltGenericDebugContext,
-			"Importing attribute list %s\n", tmp->set);
-#endif
 
-		refs = xsltGetSAS(style, tmp->set, tmp->ns);
-		if (refs == NULL) {
-		    xsltGenericError(xsltGenericErrorContext,
-     "xsl:attribute-set : use-attribute-sets %s reference missing %s\n",
-				     name, tmp->set);
-		} else {
-		    /*
-		     * recurse first for cleanup
-		     */
-		    xsltResolveSASCallbackInt(refs, style, name, ns, depth + 1);
-		    /*
-		     * Then merge
-		     */
-		    xsltMergeAttrElemList(style, values, refs);
-		    /*
-		     * Then suppress the reference
-		     */
-		    tmp->set = NULL;
-		    tmp->ns = NULL;
-		}
-	    }
-	}
-	tmp = tmp->next;
+    set->state = ATTRSET_RESOLVING;
+
+    xsltResolveUseAttrSets(set, topStyle, depth);
+
+    /* Merge imported sets. */
+    cur = xsltNextImport(style);
+    while (cur != NULL) {
+        if (cur->attributeSets != NULL) {
+            other = xmlHashLookup2(cur->attributeSets, name, ns);
+
+            if (other != NULL) {
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
+                xsltGenericDebug(xsltGenericDebugContext,
+                    "xsl:attribute-set : merging import for %s\n", name);
+#endif
+                xsltResolveUseAttrSets(other, topStyle, depth);
+                xsltMergeAttrSets(set, other);
+                xmlHashRemoveEntry2(cur->attributeSets, name, ns, NULL);
+                xsltFreeAttrSet(other);
+            }
+        }
+
+        cur = xsltNextImport(cur);
     }
+
+    set->state = ATTRSET_RESOLVED;
 }
 
 /**
- * xsltResolveSASCallback,:
- * @style:  the XSLT stylesheet
+ * xsltResolveSASCallback:
+ * @set: the attribute set
+ * @asctx:  the context for attribute set resolution
+ * @name: the local name of the attirbute set
+ * @ns: the namespace of the attribute set
  *
  * resolve the references in an attribute set.
  */
 static void
-xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style,
+xsltResolveSASCallback(xsltAttrSetPtr set, xsltAttrSetContextPtr asctx,
 	               const xmlChar *name, const xmlChar *ns,
 		       ATTRIBUTE_UNUSED const xmlChar *ignored) {
-    xsltResolveSASCallbackInt(values, style, name, ns, 1);
-}
+    xsltStylesheetPtr topStyle = asctx->topStyle;
+    xsltStylesheetPtr style = asctx->style;
 
-/**
- * xsltMergeSASCallback,:
- * @style:  the XSLT stylesheet
- *
- * Merge an attribute set from an imported stylesheet.
- */
-static void
-xsltMergeSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style,
-	               const xmlChar *name, const xmlChar *ns,
-		       ATTRIBUTE_UNUSED const xmlChar *ignored) {
-    int ret;
-    xsltAttrElemPtr topSet;
+    xsltResolveAttrSet(set, topStyle, style, name, ns, 1);
 
-    ret = xmlHashAddEntry2(style->attributeSets, name, ns, values);
-    if (ret < 0) {
-	/*
-	 * Add failed, this attribute set can be removed.
-	 */
-#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
-	xsltGenericDebug(xsltGenericDebugContext,
-		"attribute set %s present already in top stylesheet"
-		" - merging\n", name);
-#endif
-	topSet = xmlHashLookup2(style->attributeSets, name, ns);
-	if (topSet==NULL) {
+    /* Move attribute sets to top stylesheet. */
+    if (style != topStyle) {
+        /*
+         * This imported stylesheet won't be visited anymore. Don't bother
+         * removing the hash entry.
+         */
+        if (xmlHashAddEntry2(topStyle->attributeSets, name, ns, set) < 0) {
 	    xsltGenericError(xsltGenericErrorContext,
-	        "xsl:attribute-set : logic error merging from imports for"
-		" attribute-set %s\n", name);
-	} else {
-	    topSet = xsltMergeAttrElemList(style, topSet, values);
-	    xmlHashUpdateEntry2(style->attributeSets, name, ns, topSet, NULL);
-	}
-	xsltFreeAttrElemList(values);
-#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
-    } else {
-	xsltGenericDebug(xsltGenericDebugContext,
-		"attribute set %s moved to top stylesheet\n",
-		         name);
-#endif
+                "xsl:attribute-set : internal error, can't move imported "
+                " attribute set %s\n", name);
+        }
     }
 }
 
@@ -610,15 +705,14 @@
 void
 xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) {
     xsltStylesheetPtr cur;
+    xsltAttrSetContext asctx;
 
 #ifdef WITH_XSLT_DEBUG_ATTRIBUTES
     xsltGenericDebug(xsltGenericDebugContext,
 	    "Resolving attribute sets references\n");
 #endif
-    /*
-     * First aggregate all the attribute sets definitions from the imports
-     */
-    cur = xsltNextImport(style);
+    asctx.topStyle = style;
+    cur = style;
     while (cur != NULL) {
 	if (cur->attributeSets != NULL) {
 	    if (style->attributeSets == NULL) {
@@ -628,43 +722,37 @@
 #endif
 		style->attributeSets = xmlHashCreate(10);
 	    }
+            asctx.style = cur;
 	    xmlHashScanFull(cur->attributeSets,
-		(xmlHashScannerFull) xsltMergeSASCallback, style);
-	    /*
-	     * the attribute lists have either been migrated to style
-	     * or freed directly in xsltMergeSASCallback()
-	     */
-	    xmlHashFree(cur->attributeSets, NULL);
-	    cur->attributeSets = NULL;
+		(xmlHashScannerFull) xsltResolveSASCallback, &asctx);
+
+            if (cur != style) {
+                /*
+                 * the attribute lists have either been migrated to style
+                 * or freed directly in xsltResolveSASCallback()
+                 */
+                xmlHashFree(cur->attributeSets, NULL);
+                cur->attributeSets = NULL;
+            }
 	}
 	cur = xsltNextImport(cur);
     }
-
-    /*
-     * Then resolve all the references and computes the resulting sets
-     */
-    if (style->attributeSets != NULL) {
-	xmlHashScanFull(style->attributeSets,
-		(xmlHashScannerFull) xsltResolveSASCallback, style);
-    }
 }
 
 /**
- * xsltAttributeInternal:
+ * xsltAttribute:
  * @ctxt:  a XSLT process context
  * @node:  the current node in the source tree
  * @inst:  the xsl:attribute element
  * @comp:  precomputed information
- * @fromAttributeSet:  the attribute comes from an attribute-set
  *
  * Process the xslt attribute node on the source node
  */
-static void
-xsltAttributeInternal(xsltTransformContextPtr ctxt,
-		      xmlNodePtr contextNode,
-                      xmlNodePtr inst,
-		      xsltStylePreCompPtr castedComp,
-                      int fromAttributeSet)
+void
+xsltAttribute(xsltTransformContextPtr ctxt,
+	      xmlNodePtr contextNode,
+              xmlNodePtr inst,
+	      xsltStylePreCompPtr castedComp)
 {
 #ifdef XSLT_REFACTORED
     xsltStyleItemAttributePtr comp =
@@ -704,7 +792,7 @@
 
     if (comp == NULL) {
         xsltTransformError(ctxt, NULL, inst,
-	    "Internal error in xsltAttributeInternal(): "
+	    "Internal error in xsltAttribute(): "
 	    "The XSLT 'attribute' instruction was not compiled.\n");
         return;
     }
@@ -869,19 +957,6 @@
 	    nsName = ns->href;
     }
 
-    if (fromAttributeSet) {
-	/*
-	* This tries to ensure that xsl:attribute(s) coming
-	* from an xsl:attribute-set won't override attribute of
-	* literal result elements or of explicit xsl:attribute(s).
-	* URGENT TODO: This might be buggy, since it will miss to
-	*  overwrite two equal attributes both from attribute sets.
-	*/
-	attr = xmlHasNsProp(targetElem, name, nsName);
-	if (attr != NULL)
-	    return;
-    }
-
     /*
     * Find/create a matching ns-decl in the result tree.
     */
@@ -1032,21 +1107,6 @@
 }
 
 /**
- * xsltAttribute:
- * @ctxt:  a XSLT process context
- * @node:  the node in the source tree.
- * @inst:  the xslt attribute node
- * @comp:  precomputed information
- *
- * Process the xslt attribute node on the source node
- */
-void
-xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr node,
-	      xmlNodePtr inst, xsltStylePreCompPtr comp) {
-    xsltAttributeInternal(ctxt, node, inst, comp, 0);
-}
-
-/**
  * xsltApplyAttributeSet:
  * @ctxt:  the XSLT stylesheet
  * @node:  the node in the source tree.
@@ -1066,7 +1126,7 @@
     const xmlChar *ncname = NULL;
     const xmlChar *prefix = NULL;
     const xmlChar *curstr, *endstr;
-    xsltAttrElemPtr attrs;
+    xsltAttrSetPtr set;
     xsltStylesheetPtr style;
 
     if (attrSets == NULL) {
@@ -1103,15 +1163,32 @@
             endstr++;
         curstr = xmlDictLookup(ctxt->dict, curstr, endstr - curstr);
         if (curstr) {
-	    /*
-	    * TODO: Validate the QName.
-	    */
+            xmlNsPtr ns;
+            const xmlChar *nsUri = NULL;
 
-#ifdef WITH_XSLT_DEBUG_curstrUTES
+#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
             xsltGenericDebug(xsltGenericDebugContext,
-                             "apply curstrute set %s\n", curstr);
+                             "apply attribute set %s\n", curstr);
 #endif
+
+            if (xmlValidateQName(curstr, 0)) {
+                xsltTransformError(ctxt, NULL, inst,
+                    "The name '%s' in use-attribute-sets is not a valid "
+                    "QName.\n", curstr);
+                return;
+            }
+
             ncname = xsltSplitQName(ctxt->dict, curstr, &prefix);
+            if (prefix != NULL) {
+	        ns = xmlSearchNs(inst->doc, inst, prefix);
+                if (ns == NULL) {
+                    xsltTransformError(ctxt, NULL, inst,
+                        "use-attribute-set : No namespace found for QName "
+                        "'%s:%s'\n", prefix, ncname);
+                    return;
+                }
+                nsUri = ns->href;
+            }
 
             style = ctxt->style;
 
@@ -1120,27 +1197,28 @@
 		(style->attributeSets != NULL) &&
 		(ctxt->debugStatus != XSLT_DEBUG_NONE))
 	    {
-                attrs =
-                    xmlHashLookup2(style->attributeSets, ncname, prefix);
-                if ((attrs != NULL) && (attrs->attr != NULL))
-                    xslHandleDebugger(attrs->attr->parent, node, NULL,
+                set = xmlHashLookup2(style->attributeSets, ncname, nsUri);
+                if ((set != NULL) && (set->attrs != NULL) &&
+                    (set->attrs->attr != NULL))
+                    xslHandleDebugger(set->attrs->attr->parent, node, NULL,
 			ctxt);
             }
 #endif
 	    /*
-	    * Lookup the referenced curstrute-set.
+	    * Lookup the referenced attribute-set. All attribute sets were
+            * moved to the top stylesheet so there's no need to iterate
+            * imported stylesheets
 	    */
-            while (style != NULL) {
-                attrs =
-                    xmlHashLookup2(style->attributeSets, ncname, prefix);
-                while (attrs != NULL) {
-                    if (attrs->attr != NULL) {
-                        xsltAttributeInternal(ctxt, node, attrs->attr,
-			    attrs->attr->psvi, 1);
+            set = xmlHashLookup2(style->attributeSets, ncname, nsUri);
+            if (set != NULL) {
+                xsltAttrElemPtr cur = set->attrs;
+                while (cur != NULL) {
+                    if (cur->attr != NULL) {
+                        xsltAttribute(ctxt, node, cur->attr,
+                            cur->attr->psvi);
                     }
-                    attrs = attrs->next;
+                    cur = cur->next;
                 }
-                style = xsltNextImport(style);
             }
         }
         curstr = endstr;
@@ -1157,6 +1235,6 @@
 xsltFreeAttributeSetsHashes(xsltStylesheetPtr style) {
     if (style->attributeSets != NULL)
 	xmlHashFree((xmlHashTablePtr) style->attributeSets,
-		    (xmlHashDeallocator) xsltFreeAttrElemList);
+		    (xmlHashDeallocator) xsltFreeAttrSet);
     style->attributeSets = NULL;
 }
diff --git a/third_party/libxslt/libxslt/numbers.c b/third_party/libxslt/libxslt/numbers.c
index 3b932a59..e78c46b 100644
--- a/third_party/libxslt/libxslt/numbers.c
+++ b/third_party/libxslt/libxslt/numbers.c
@@ -616,25 +616,7 @@
 {
     int amount = 0;
     int cnt = 0;
-    xmlNodePtr cur;
-
-    /* select the starting node */
-    switch (node->type) {
-	case XML_ELEMENT_NODE:
-	    cur = node;
-	    break;
-	case XML_ATTRIBUTE_NODE:
-	    cur = ((xmlAttrPtr) node)->parent;
-	    break;
-	case XML_TEXT_NODE:
-	case XML_PI_NODE:
-	case XML_COMMENT_NODE:
-	    cur = node->parent;
-	    break;
-	default:
-	    cur = NULL;
-	    break;
-    }
+    xmlNodePtr cur = node;
 
     while (cur != NULL) {
 	/* process current node */
@@ -653,16 +635,25 @@
             (cur->type == XML_HTML_DOCUMENT_NODE))
 	    break; /* while */
 
-	while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) ||
-	       (cur->prev->type == XML_XINCLUDE_START) ||
-	       (cur->prev->type == XML_XINCLUDE_END)))
-	    cur = cur->prev;
-	if (cur->prev != NULL) {
-	    for (cur = cur->prev; cur->last != NULL; cur = cur->last);
-	} else {
-	    cur = cur->parent;
-	}
-
+        if (cur->type == XML_NAMESPACE_DECL) {
+            /*
+            * The XPath module stores the parent of a namespace node in
+            * the ns->next field.
+            */
+            cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
+        } else if (cur->type == XML_ATTRIBUTE_NODE) {
+            cur = cur->parent;
+        } else {
+            while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) ||
+                   (cur->prev->type == XML_XINCLUDE_START) ||
+                   (cur->prev->type == XML_XINCLUDE_END)))
+                cur = cur->prev;
+            if (cur->prev != NULL) {
+                for (cur = cur->prev; cur->last != NULL; cur = cur->last);
+            } else {
+                cur = cur->parent;
+            }
+        }
     }
 
     array[amount++] = (double) cnt;
diff --git a/third_party/libxslt/libxslt/preproc.c b/third_party/libxslt/libxslt/preproc.c
index 955b3b0..9a7de53 100644
--- a/third_party/libxslt/libxslt/preproc.c
+++ b/third_party/libxslt/libxslt/preproc.c
@@ -1418,9 +1418,6 @@
 	return;
     cur->psvi = comp;
 
-    if ((style == NULL) || (cur == NULL))
-	return;
-
     comp->numdata.doc = cur->doc;
     comp->numdata.node = cur;
     comp->numdata.value = xsltGetCNsProp(style, cur, (const xmlChar *)"value",
@@ -2343,7 +2340,7 @@
 	    xsltCheckInstructionElement(style, inst);
 	    inst->psvi = (void *) xsltDocumentComp(style, inst,
 				(xsltTransformFunction) xsltDocumentElem);
-	} else {
+	} else if ((style == NULL) || (style->forwards_compatible == 0)) {
 	    xsltTransformError(NULL, style, inst,
 		 "xsltStylePreCompute: unknown xsl:%s\n", inst->name);
 	    if (style != NULL) style->warnings++;
diff --git a/third_party/libxslt/libxslt/transform.c b/third_party/libxslt/libxslt/transform.c
index 8b86e2eb..b3fce80 100644
--- a/third_party/libxslt/libxslt/transform.c
+++ b/third_party/libxslt/libxslt/transform.c
@@ -56,6 +56,7 @@
 #ifdef WITH_XSLT_DEBUG
 #define WITH_XSLT_DEBUG_EXTRA
 #define WITH_XSLT_DEBUG_PROCESS
+#define WITH_XSLT_DEBUG_VARIABLE
 #endif
 
 #define XSLT_GENERATE_HTML_DOCTYPE
@@ -784,7 +785,7 @@
 xsltAddChild(xmlNodePtr parent, xmlNodePtr cur) {
    xmlNodePtr ret;
 
-   if ((cur == NULL) || (parent == NULL))
+   if (cur == NULL)
        return(NULL);
    if (parent == NULL) {
        xmlFreeNode(cur);
@@ -2020,6 +2021,9 @@
 
     /*
      * Handling of Elements: second pass, actual processing
+     *
+     * Note that params are passed to the next template. This matches
+     * XSLT 2.0 behavior but doesn't conform to XSLT 1.0.
      */
     oldSize = ctxt->xpathCtxt->contextSize;
     oldPos = ctxt->xpathCtxt->proximityPosition;
@@ -2299,30 +2303,28 @@
 {
     xmlDocPtr cur = ctxt->localRVT, tmp;
 
-    while ((cur != NULL) && (cur != base)) {
-	if (cur->psvi == (void *) ((long) 1)) {
-	    cur = (xmlDocPtr) cur->next;
-	} else {
-	    tmp = cur;
-	    cur = (xmlDocPtr) cur->next;
+    if (cur == base)
+        return;
+    if (cur->prev != NULL)
+        xsltTransformError(ctxt, NULL, NULL, "localRVT not head of list\n");
 
-	    if (tmp == ctxt->localRVT)
-		ctxt->localRVT = cur;
+    do {
+        tmp = cur;
+        cur = (xmlDocPtr) cur->next;
+        if (tmp->psvi == XSLT_RVT_LOCAL) {
+            xsltReleaseRVT(ctxt, tmp);
+        } else if (tmp->psvi == XSLT_RVT_GLOBAL) {
+            xsltRegisterPersistRVT(ctxt, tmp);
+        } else if (tmp->psvi != XSLT_RVT_FUNC_RESULT) {
+            xmlGenericError(xmlGenericErrorContext,
+                    "xsltReleaseLocalRVTs: Unexpected RVT flag %p\n",
+                    tmp->psvi);
+        }
+    } while (cur != base);
 
-	    /*
-	    * We need ctxt->localRVTBase for extension instructions
-	    * which return values (like EXSLT's function).
-	    */
-	    if (tmp == ctxt->localRVTBase)
-		ctxt->localRVTBase = cur;
-
-	    if (tmp->prev)
-		tmp->prev->next = (xmlNodePtr) cur;
-	    if (cur)
-		cur->prev = tmp->prev;
-	    xsltReleaseRVT(ctxt, tmp);
-	}
-    }
+    if (base != NULL)
+        base->prev = NULL;
+    ctxt->localRVT = base;
 }
 
 /**
@@ -2348,7 +2350,7 @@
     xmlNodePtr oldInsert, oldInst, oldCurInst, oldContextNode;
     xmlNodePtr cur, insert, copy = NULL;
     int level = 0, oldVarsNr;
-    xmlDocPtr oldLocalFragmentTop, oldLocalFragmentBase;
+    xmlDocPtr oldLocalFragmentTop;
 
 #ifdef XSLT_REFACTORED
     xsltStylePreCompPtr info;
@@ -2376,6 +2378,24 @@
         return;
     CHECK_STOPPED;
 
+    /*
+    * Check for infinite recursion: stop if the maximum of nested templates
+    * is excceeded. Adjust xsltMaxDepth if you need more.
+    */
+    if (ctxt->depth >= ctxt->maxTemplateDepth) {
+        xsltTransformError(ctxt, NULL, list,
+	    "xsltApplySequenceConstructor: A potential infinite template "
+            "recursion was detected.\n"
+	    "You can adjust xsltMaxDepth (--maxdepth) in order to "
+	    "raise the maximum number of nested template calls and "
+	    "variables/params (currently set to %d).\n",
+	    ctxt->maxTemplateDepth);
+        xsltDebug(ctxt, contextNode, list, NULL);
+	ctxt->state = XSLT_STATE_STOPPED;
+        return;
+    }
+    ctxt->depth++;
+
     oldLocalFragmentTop = ctxt->localRVT;
     oldInsert = insert = ctxt->insert;
     oldInst = oldCurInst = ctxt->inst;
@@ -2676,16 +2696,9 @@
 			cur->name));
 #endif
 		    ctxt->insert = insert;
-		    /*
-		    * We need the fragment base for extension instructions
-		    * which return values (like EXSLT's function).
-		    */
-		    oldLocalFragmentBase = ctxt->localRVTBase;
-		    ctxt->localRVTBase = NULL;
 
 		    func(ctxt, contextNode, cur, cur->psvi);
 
-		    ctxt->localRVTBase = oldLocalFragmentBase;
 		    /*
 		    * Cleanup temporary tree fragments.
 		    */
@@ -2749,12 +2762,9 @@
 		oldCurInst = ctxt->inst;
 		ctxt->inst = cur;
                 ctxt->insert = insert;
-		oldLocalFragmentBase = ctxt->localRVTBase;
-		ctxt->localRVTBase = NULL;
 
                 info->func(ctxt, contextNode, cur, (xsltElemPreCompPtr) info);
 
-		ctxt->localRVTBase = oldLocalFragmentBase;
 		/*
 		* Cleanup temporary tree fragments.
 		*/
@@ -2869,12 +2879,6 @@
 #endif
 
                 ctxt->insert = insert;
-		/*
-		* We need the fragment base for extension instructions
-		* which return values (like EXSLT's function).
-		*/
-		oldLocalFragmentBase = ctxt->localRVTBase;
-		ctxt->localRVTBase = NULL;
 
                 function(ctxt, contextNode, cur, cur->psvi);
 		/*
@@ -2883,7 +2887,6 @@
 		if (oldLocalFragmentTop != ctxt->localRVT)
 		    xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop);
 
-		ctxt->localRVTBase = oldLocalFragmentBase;
                 ctxt->insert = oldInsert;
 
             }
@@ -3025,6 +3028,8 @@
     ctxt->inst = oldInst;
     ctxt->insert = oldInsert;
 
+    ctxt->depth--;
+
 #ifdef WITH_DEBUGGER
     if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) {
         xslDropCall();
@@ -3059,7 +3064,7 @@
     long start = 0;
     xmlNodePtr cur;
     xsltStackElemPtr tmpParam = NULL;
-    xmlDocPtr oldUserFragmentTop, oldLocalFragmentTop;
+    xmlDocPtr oldUserFragmentTop;
 
 #ifdef XSLT_REFACTORED
     xsltStyleItemParamPtr iparam;
@@ -3091,23 +3096,6 @@
         return;
     CHECK_STOPPED;
 
-    /*
-    * Check for infinite recursion: stop if the maximum of nested templates
-    * is excceeded. Adjust xsltMaxDepth if you need more.
-    */
-    if (ctxt->templNr >= ctxt->maxTemplateDepth)
-    {
-        xsltTransformError(ctxt, NULL, list,
-	    "xsltApplyXSLTTemplate: A potential infinite template recursion "
-	    "was detected.\n"
-	    "You can adjust xsltMaxDepth (--maxdepth) in order to "
-	    "raise the maximum number of nested template calls and "
-	    "variables/params (currently set to %d).\n",
-	    ctxt->maxTemplateDepth);
-        xsltDebug(ctxt, contextNode, list, NULL);
-        return;
-    }
-
     if (ctxt->varsNr >= ctxt->maxTemplateVars)
 	{
         xsltTransformError(ctxt, NULL, list,
@@ -3117,12 +3105,12 @@
 	    "raise the maximum number of variables/params (currently set to %d).\n",
 	    ctxt->maxTemplateVars);
         xsltDebug(ctxt, contextNode, list, NULL);
+	ctxt->state = XSLT_STATE_STOPPED;
         return;
 	}
 
     oldUserFragmentTop = ctxt->tmpRVT;
     ctxt->tmpRVT = NULL;
-    oldLocalFragmentTop = ctxt->localRVT;
 
     /*
     * Initiate a distinct scope of local params/variables.
@@ -3224,31 +3212,6 @@
     ctxt->varsBase = oldVarsBase;
 
     /*
-    * Clean up remaining local tree fragments.
-    * This also frees fragments which are the result of
-    * extension instructions. Should normally not be hit; but
-    * just for the case xsltExtensionInstructionResultFinalize()
-    * was not called by the extension author.
-    */
-    if (oldLocalFragmentTop != ctxt->localRVT) {
-	xmlDocPtr curdoc = ctxt->localRVT, tmp;
-
-	do {
-	    tmp = curdoc;
-	    curdoc = (xmlDocPtr) curdoc->next;
-	    /* Need to housekeep localRVTBase */
-	    if (tmp == ctxt->localRVTBase)
-	        ctxt->localRVTBase = curdoc;
-	    if (tmp->prev)
-		tmp->prev->next = (xmlNodePtr) curdoc;
-	    if (curdoc)
-		curdoc->prev = tmp->prev;
-	    xsltReleaseRVT(ctxt, tmp);
-	} while (curdoc != oldLocalFragmentTop);
-    }
-    ctxt->localRVT = oldLocalFragmentTop;
-
-    /*
     * Release user-created fragments stored in the scope
     * of xsl:template. Note that this mechanism is deprecated:
     * user code should now use xsltRegisterLocalRVT() instead
@@ -3853,7 +3816,6 @@
 	xsltTransformError(ctxt, NULL, inst,
                          "xsltDocumentElem: unable to save to %s\n",
                          filename);
-	ctxt->state = XSLT_STATE_ERROR;
 #ifdef WITH_XSLT_DEBUG_EXTRA
     } else {
         xsltGenericDebug(xsltGenericDebugContext,
@@ -4718,6 +4680,10 @@
 
 	ctxt->currentTemplateRule = oldCurTemplRule;
     }
+    else {
+        /* Use built-in templates. */
+        xsltDefaultProcessOneNode(ctxt, contextNode, NULL);
+    }
 }
 
 /**
@@ -6040,6 +6006,9 @@
 
     xsltEvalGlobalVariables(ctxt);
 
+    /* Clean up any unused RVTs. */
+    xsltReleaseLocalRVTs(ctxt, NULL);
+
     ctxt->node = (xmlNodePtr) doc;
     ctxt->output = res;
     ctxt->insert = (xmlNodePtr) res;
@@ -6184,7 +6153,7 @@
     /*
      * Be pedantic.
      */
-    if ((ctxt != NULL) && (ctxt->state == XSLT_STATE_ERROR)) {
+    if ((ctxt != NULL) && (ctxt->state != XSLT_STATE_OK)) {
 	xmlFreeDoc(res);
 	res = NULL;
     }
diff --git a/third_party/libxslt/libxslt/variables.c b/third_party/libxslt/libxslt/variables.c
index 345123d6..e1a80ee 100644
--- a/third_party/libxslt/libxslt/variables.c
+++ b/third_party/libxslt/libxslt/variables.c
@@ -43,8 +43,8 @@
 const xmlChar *xsltComputingGlobalVarMarker =
  (const xmlChar *) " var/param being computed";
 
-#define XSLT_VAR_GLOBAL 1<<0
-#define XSLT_VAR_IN_SELECT 1<<1
+#define XSLT_VAR_GLOBAL (1<<0)
+#define XSLT_VAR_IN_SELECT (1<<1)
 #define XSLT_TCTXT_VARIABLE(c) ((xsltStackElemPtr) (c)->contextVariable)
 
 /************************************************************************
@@ -122,6 +122,9 @@
     if ((ctxt == NULL) || (RVT == NULL))
 	return(-1);
 
+    RVT->prev = NULL;
+    RVT->psvi = XSLT_RVT_VARIABLE;
+
     /*
     * We'll restrict the lifetime of user-created fragments
     * insinde an xsl:variable and xsl:param to the lifetime of the
@@ -159,15 +162,18 @@
     if ((ctxt == NULL) || (RVT == NULL))
 	return(-1);
 
+    RVT->prev = NULL;
+
     /*
     * When evaluating "select" expressions of xsl:variable
     * and xsl:param, we need to bind newly created tree fragments
-    * to the variable itself; otherwise the tragment will be
+    * to the variable itself; otherwise the fragment will be
     * freed before we leave the scope of a var.
     */
     if ((ctxt->contextVariable != NULL) &&
 	(XSLT_TCTXT_VARIABLE(ctxt)->flags & XSLT_VAR_IN_SELECT))
     {
+        RVT->psvi = XSLT_RVT_VARIABLE;
 	RVT->next = (xmlNodePtr) XSLT_TCTXT_VARIABLE(ctxt)->fragment;
 	XSLT_TCTXT_VARIABLE(ctxt)->fragment = RVT;
 	return(0);
@@ -177,19 +183,11 @@
     * If not reference by a returning instruction (like EXSLT's function),
     * then this fragment will be freed, when the instruction exits.
     */
+    RVT->psvi = XSLT_RVT_LOCAL;
     RVT->next = (xmlNodePtr) ctxt->localRVT;
     if (ctxt->localRVT != NULL)
 	ctxt->localRVT->prev = (xmlNodePtr) RVT;
     ctxt->localRVT = RVT;
-    /*
-    * We need to keep track of the first registered fragment
-    * for extension instructions which return fragments
-    * (e.g. EXSLT'S function), in order to let
-    * xsltExtensionInstructionResultFinalize() clear the
-    * preserving flag on the fragments.
-    */
-    if (ctxt->localRVTBase == NULL)
-	ctxt->localRVTBase = RVT;
     return(0);
 }
 
@@ -204,26 +202,16 @@
  * collector will free them after the function-calling process exits.
  *
  * Returns 0 in case of success and -1 in case of API or internal errors.
+ *
+ * This function is unsupported in newer releases of libxslt.
  */
 int
 xsltExtensionInstructionResultFinalize(xsltTransformContextPtr ctxt)
 {
-    xmlDocPtr cur;
-
-    if (ctxt == NULL)
-	return(-1);
-    if (ctxt->localRVTBase == NULL)
-	return(0);
-    /*
-    * Enable remaining local tree fragments to be freed
-    * by the fragment garbage collector.
-    */
-    cur = ctxt->localRVTBase;
-    do {
-	cur->psvi = NULL;
-	cur = (xmlDocPtr) cur->next;
-    } while (cur != NULL);
-    return(0);
+    xmlGenericError(xmlGenericErrorContext,
+            "xsltExtensionInstructionResultFinalize is unsupported "
+            "in this release of libxslt.\n");
+    return(-1);
 }
 
 /**
@@ -238,11 +226,35 @@
  * tree fragments (via xsltCreateRVT()) with xsltRegisterLocalRVT().
  *
  * Returns 0 in case of success and -1 in case of error.
+ *
+ * It isn't necessary to call this function in newer releases of
+ * libxslt.
  */
 int
 xsltExtensionInstructionResultRegister(xsltTransformContextPtr ctxt,
 				       xmlXPathObjectPtr obj)
 {
+    return(0);
+}
+
+/**
+ * xsltFlagRVTs:
+ * @ctxt: an XSLT transformation context
+ * @obj: an XPath object to be inspected for result tree fragments
+ * @val: the flag value
+ *
+ * Updates ownership information of RVTs in @obj according to @val.
+ *
+ * @val = XSLT_RVT_FUNC_RESULT for the result of an extension function, so its
+ *        RVTs won't be destroyed after leaving the returning scope.
+ * @val = XSLT_RVT_LOCAL for the result of an extension function to reset
+ *        the state of its RVTs after it was returned to a new scope.
+ * @val = XSLT_RVT_GLOBAL for parts of global variables.
+ *
+ * Returns 0 in case of success and -1 in case of error.
+ */
+int
+xsltFlagRVTs(xsltTransformContextPtr ctxt, xmlXPathObjectPtr obj, void *val) {
     int i;
     xmlNodePtr cur;
     xmlDocPtr doc;
@@ -275,36 +287,59 @@
 		doc = cur->doc;
 	    } else {
 		xsltTransformError(ctxt, NULL, ctxt->inst,
-		    "Internal error in "
-		    "xsltExtensionInstructionResultRegister(): "
+		    "Internal error in xsltFlagRVTs(): "
 		    "Cannot retrieve the doc of a namespace node.\n");
-		goto error;
+		return(-1);
 	    }
 	} else {
 	    doc = cur->doc;
 	}
 	if (doc == NULL) {
 	    xsltTransformError(ctxt, NULL, ctxt->inst,
-		"Internal error in "
-		"xsltExtensionInstructionResultRegister(): "
+		"Internal error in xsltFlagRVTs(): "
 		"Cannot retrieve the doc of a node.\n");
-	    goto error;
+	    return(-1);
 	}
-	if (doc->name && (doc->name[0] == ' ')) {
+	if (doc->name && (doc->name[0] == ' ') &&
+            doc->psvi != XSLT_RVT_GLOBAL) {
 	    /*
 	    * This is a result tree fragment.
-	    * We'll use the @psvi field for reference counting.
-	    * TODO: How do we know if this is a value of a
-	    *  global variable or a doc acquired via the
+	    * We store ownership information in the @psvi field.
+	    * TODO: How do we know if this is a doc acquired via the
 	    *  document() function?
 	    */
-	    doc->psvi = (void *) ((long) 1);
+#ifdef WITH_XSLT_DEBUG_VARIABLE
+            XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
+                "Flagging RVT %p: %p -> %p\n", doc, doc->psvi, val));
+#endif
+
+            if (val == XSLT_RVT_LOCAL) {
+                if (doc->psvi != XSLT_RVT_FUNC_RESULT) {
+		    xmlGenericError(xmlGenericErrorContext,
+                            "xsltFlagRVTs: Invalid transition %p => LOCAL\n",
+                            doc->psvi);
+                    return(-1);
+                }
+
+                xsltRegisterLocalRVT(ctxt, doc);
+            } else if (val == XSLT_RVT_GLOBAL) {
+                if (doc->psvi != XSLT_RVT_LOCAL) {
+		    xmlGenericError(xmlGenericErrorContext,
+                            "xsltFlagRVTs: Invalid transition %p => GLOBAL\n",
+                            doc->psvi);
+                    doc->psvi = XSLT_RVT_GLOBAL;
+                    return(-1);
+                }
+
+                /* Will be registered as persistant in xsltReleaseLocalRVTs. */
+                doc->psvi = XSLT_RVT_GLOBAL;
+            } else if (val == XSLT_RVT_FUNC_RESULT) {
+	        doc->psvi = val;
+            }
 	}
     }
 
     return(0);
-error:
-    return(-1);
 }
 
 /**
@@ -350,9 +385,9 @@
 	}
 
 	/*
-	* Reset the reference counter.
+	* Reset the ownership information.
 	*/
-	RVT->psvi = 0;
+	RVT->psvi = NULL;
 
 	RVT->next = (xmlNodePtr) ctxt->cache->RVT;
 	ctxt->cache->RVT = RVT;
@@ -391,6 +426,8 @@
 {
     if ((ctxt == NULL) || (RVT == NULL)) return(-1);
 
+    RVT->psvi = XSLT_RVT_GLOBAL;
+    RVT->prev = NULL;
     RVT->next = (xmlNodePtr) ctxt->persistRVT;
     if (ctxt->persistRVT != NULL)
 	ctxt->persistRVT->prev = (xmlNodePtr) RVT;
@@ -541,35 +578,21 @@
     /*
     * Release the list of temporary Result Tree Fragments.
     */
-    if (elem->fragment) {
+    if (elem->context) {
 	xmlDocPtr cur;
 
 	while (elem->fragment != NULL) {
 	    cur = elem->fragment;
 	    elem->fragment = (xmlDocPtr) cur->next;
 
-	    if (elem->context &&
-		(cur->psvi == (void *) ((long) 1)))
-	    {
-		/*
-		* This fragment is a result of an extension instruction
-		* (e.g. XSLT's function) and needs to be preserved until
-		* the instruction exits.
-		* Example: The fragment of the variable must not be freed
-		*  since it is returned by the EXSLT function:
-		*  <f:function name="foo">
-		*   <xsl:variable name="bar">
-		*     <bar/>
-		*   </xsl:variable>
-		*   <f:result select="$bar"/>
-		*  </f:function>
-		*
-		*/
-		xsltRegisterLocalRVT(elem->context, cur);
-	    } else {
+            if (cur->psvi == XSLT_RVT_VARIABLE) {
 		xsltReleaseRVT((xsltTransformContextPtr) elem->context,
 		    cur);
-	    }
+            } else if (cur->psvi != XSLT_RVT_FUNC_RESULT) {
+                xmlGenericError(xmlGenericErrorContext,
+                        "xsltFreeStackElem: Unexpected RVT flag %p\n",
+                        cur->psvi);
+            }
 	}
     }
     /*
@@ -963,6 +986,7 @@
 		* the Result Tree Fragment.
 		*/
 		variable->fragment = container;
+                container->psvi = XSLT_RVT_VARIABLE;
 
 		oldOutput = ctxt->output;
 		oldInsert = ctxt->insert;
@@ -1149,16 +1173,23 @@
 		xsltTransformError(ctxt, NULL, comp->inst,
 		    "Evaluating global variable %s failed\n", elem->name);
 	    ctxt->state = XSLT_STATE_STOPPED;
+            goto error;
+        }
+
+        /*
+         * Mark all RVTs that are referenced from result as part
+         * of this variable so they won't be freed too early.
+         */
+        xsltFlagRVTs(ctxt, result, XSLT_RVT_GLOBAL);
+
 #ifdef WITH_XSLT_DEBUG_VARIABLE
 #ifdef LIBXML_DEBUG_ENABLED
-	} else {
-	    if ((xsltGenericDebugContext == stdout) ||
-		(xsltGenericDebugContext == stderr))
-		xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
-					result, 0);
+	if ((xsltGenericDebugContext == stdout) ||
+	    (xsltGenericDebugContext == stderr))
+	    xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext,
+				    result, 0);
 #endif
 #endif
-	}
     } else {
 	if (elem->tree == NULL) {
 	    result = xmlXPathNewCString("");
@@ -1772,8 +1803,7 @@
     elem->tree = tree;
     elem->value = xsltEvalVariable(ctxt, elem,
 	(xsltStylePreCompPtr) comp);
-    if (elem->value != NULL)
-	elem->computed = 1;
+    elem->computed = 1;
     return(elem);
 }
 
diff --git a/third_party/libxslt/libxslt/variables.h b/third_party/libxslt/libxslt/variables.h
index 17b4c6f..f80eeab 100644
--- a/third_party/libxslt/libxslt/variables.h
+++ b/third_party/libxslt/libxslt/variables.h
@@ -35,6 +35,15 @@
     (ctxt)->xpathCtxt->extra = ctxt
 
 /*
+ * Flags for memory management of RVTs
+ */
+
+#define XSLT_RVT_LOCAL       ((void *)1)
+#define XSLT_RVT_VARIABLE    ((void *)2)
+#define XSLT_RVT_FUNC_RESULT ((void *)3)
+#define XSLT_RVT_GLOBAL      ((void *)4)
+
+/*
  * Interfaces for the variable module.
  */
 
diff --git a/third_party/libxslt/libxslt/xslt.c b/third_party/libxslt/libxslt/xslt.c
index bca91ee..d41a98d 100644
--- a/third_party/libxslt/libxslt/xslt.c
+++ b/third_party/libxslt/libxslt/xslt.c
@@ -810,9 +810,8 @@
 	    ctxt->extras = (xsltRuntimeExtraPtr)
 		xmlMalloc(ctxt->extrasMax * sizeof(xsltRuntimeExtra));
 	    if (ctxt->extras == NULL) {
-		xmlGenericError(xmlGenericErrorContext,
+		xsltTransformError(ctxt, NULL, NULL,
 			"xsltAllocateExtraCtxt: out of memory\n");
-		ctxt->state = XSLT_STATE_ERROR;
 		return(0);
 	    }
 	    for (i = 0;i < ctxt->extrasMax;i++) {
@@ -828,9 +827,8 @@
 	    tmp = (xsltRuntimeExtraPtr) xmlRealloc(ctxt->extras,
 		            ctxt->extrasMax * sizeof(xsltRuntimeExtra));
 	    if (tmp == NULL) {
-		xmlGenericError(xmlGenericErrorContext,
+		xsltTransformError(ctxt, NULL, NULL,
 			"xsltAllocateExtraCtxt: out of memory\n");
-		ctxt->state = XSLT_STATE_ERROR;
 		return(0);
 	    }
 	    ctxt->extras = tmp;
@@ -3424,7 +3422,7 @@
 #ifdef XSLT_REFACTORED
 #else
 static void
-xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur)
+xsltPreprocessStylesheet(xsltStylesheetPtr style, xmlNodePtr cur)
 {
     xmlNodePtr deleteNode, styleelem;
     int internalize = 0;
@@ -3455,7 +3453,7 @@
 	if (deleteNode != NULL) {
 #ifdef WITH_XSLT_DEBUG_BLANKS
 	    xsltGenericDebug(xsltGenericDebugContext,
-	     "xsltPrecomputeStylesheet: removing ignorable blank node\n");
+	     "xsltPreprocessStylesheet: removing ignorable blank node\n");
 #endif
 	    xmlUnlinkNode(deleteNode);
 	    xmlFreeNode(deleteNode);
@@ -3495,7 +3493,6 @@
 	    }
 	    if (IS_XSLT_ELEM(cur)) {
 		exclPrefixes = 0;
-		xsltStylePreCompute(style, cur);
 		if (IS_XSLT_NAME(cur, "text")) {
 		    for (;exclPrefixes > 0;exclPrefixes--)
 			exclPrefixPop(style);
@@ -3546,7 +3543,7 @@
 	     * going back
 	     */
 	    if (exclPrefixes > 0) {
-		xsltPrecomputeStylesheet(style, cur->children);
+		xsltPreprocessStylesheet(style, cur->children);
 		for (;exclPrefixes > 0;exclPrefixes--)
 		    exclPrefixPop(style);
 		goto skip_children;
@@ -3617,7 +3614,7 @@
     if (deleteNode != NULL) {
 #ifdef WITH_XSLT_DEBUG_PARSING
 	xsltGenericDebug(xsltGenericDebugContext,
-	 "xsltPrecomputeStylesheet: removing ignorable blank node\n");
+	 "xsltPreprocessStylesheet: removing ignorable blank node\n");
 #endif
 	xmlUnlinkNode(deleteNode);
 	xmlFreeNode(deleteNode);
@@ -4862,10 +4859,12 @@
 	    delete = NULL;
 	}
 	if (IS_XSLT_ELEM(cur)) {
+            xsltStylePreCompute(style, cur);
+
 	    if (IS_XSLT_NAME(cur, "text")) {
 		/*
 		* TODO: Processing of xsl:text should be moved to
-		*   xsltPrecomputeStylesheet(), since otherwise this
+		*   xsltPreprocessStylesheet(), since otherwise this
 		*   will be performed for every multiply included
 		*   stylesheet; i.e. this here is not skipped with
 		*   the use of the style->nopreproc flag.
@@ -6054,7 +6053,7 @@
 	if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
             (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
 	    xsltTransformError(NULL, style, top,
-		"xsl:version: only 1.0 features are supported\n");
+		"xsl:version: only 1.1 features are supported\n");
 	    if (style != NULL) {
                 style->forwards_compatible = 1;
                 style->warnings++;
@@ -6125,31 +6124,31 @@
 	    xsltTransformError(NULL, style, cur,
 			"xsltParseStylesheetTop: ignoring misplaced import element\n");
 	    if (style != NULL) style->errors++;
-    } else if (IS_XSLT_NAME(cur, "include")) {
+        } else if (IS_XSLT_NAME(cur, "include")) {
 	    if (xsltParseStylesheetInclude(style, cur) != 0)
 		if (style != NULL) style->errors++;
-    } else if (IS_XSLT_NAME(cur, "strip-space")) {
+        } else if (IS_XSLT_NAME(cur, "strip-space")) {
 	    xsltParseStylesheetStripSpace(style, cur);
-    } else if (IS_XSLT_NAME(cur, "preserve-space")) {
+        } else if (IS_XSLT_NAME(cur, "preserve-space")) {
 	    xsltParseStylesheetPreserveSpace(style, cur);
-    } else if (IS_XSLT_NAME(cur, "output")) {
+        } else if (IS_XSLT_NAME(cur, "output")) {
 	    xsltParseStylesheetOutput(style, cur);
-    } else if (IS_XSLT_NAME(cur, "key")) {
+        } else if (IS_XSLT_NAME(cur, "key")) {
 	    xsltParseStylesheetKey(style, cur);
-    } else if (IS_XSLT_NAME(cur, "decimal-format")) {
+        } else if (IS_XSLT_NAME(cur, "decimal-format")) {
 	    xsltParseStylesheetDecimalFormat(style, cur);
-    } else if (IS_XSLT_NAME(cur, "attribute-set")) {
+        } else if (IS_XSLT_NAME(cur, "attribute-set")) {
 	    xsltParseStylesheetAttributeSet(style, cur);
-    } else if (IS_XSLT_NAME(cur, "variable")) {
+        } else if (IS_XSLT_NAME(cur, "variable")) {
 	    xsltParseGlobalVariable(style, cur);
-    } else if (IS_XSLT_NAME(cur, "param")) {
+        } else if (IS_XSLT_NAME(cur, "param")) {
 	    xsltParseGlobalParam(style, cur);
-    } else if (IS_XSLT_NAME(cur, "template")) {
+        } else if (IS_XSLT_NAME(cur, "template")) {
 #ifdef WITH_XSLT_DEBUG_PARSING
 	    templates++;
 #endif
 	    xsltParseStylesheetTemplate(style, cur);
-    } else if (IS_XSLT_NAME(cur, "namespace-alias")) {
+        } else if (IS_XSLT_NAME(cur, "namespace-alias")) {
 	    xsltNamespaceAlias(style, cur);
 	} else {
             if ((style != NULL) && (style->forwards_compatible == 0)) {
@@ -6158,13 +6157,6 @@
 			cur->name);
 	        if (style != NULL) style->errors++;
 	    }
-	    else {
-                /* do Forwards-Compatible Processing */
-	        xsltTransformError(NULL, style, cur,
-			"xsltParseStylesheetTop: ignoring unknown %s element\n",
-			cur->name);
-	        if (style != NULL) style->warnings++;
-            }
 	}
 	cur = cur->next;
     }
@@ -6408,7 +6400,7 @@
 	ret->literal_result = 1;
     }
     if (!ret->nopreproc) {
-	xsltPrecomputeStylesheet(ret, cur);
+	xsltPreprocessStylesheet(ret, cur);
     }
     if (ret->literal_result == 0) {
 	xsltParseStylesheetTop(ret, cur);
@@ -6431,10 +6423,11 @@
 		"xsltParseStylesheetProcess : document is stylesheet\n");
 #endif
 
-	if (!xmlStrEqual(prop, (const xmlChar *)"1.0")) {
+	if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
+            (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
 	    xsltTransformError(NULL, ret, cur,
-		"xsl:version: only 1.0 features are supported\n");
-	     /* TODO set up compatibility when not XSLT 1.0 */
+		"xsl:version: only 1.1 features are supported\n");
+            ret->forwards_compatible = 1;
 	    ret->warnings++;
 	}
 	xmlFree(prop);
diff --git a/third_party/libxslt/libxslt/xsltInternals.h b/third_party/libxslt/libxslt/xsltInternals.h
index 7123ace..060b1783 100644
--- a/third_party/libxslt/libxslt/xsltInternals.h
+++ b/third_party/libxslt/libxslt/xsltInternals.h
@@ -1783,9 +1783,9 @@
     xmlDocPtr localRVT; /* list of local tree fragments; will be freed when
 			   the instruction which created the fragment
                            exits */
-    xmlDocPtr localRVTBase;
+    xmlDocPtr localRVTBase; /* Obsolete */
     int keyInitLevel;   /* Needed to catch recursive keys issues */
-    int funcLevel;      /* Needed to catch recursive functions issues */
+    int depth;          /* Needed to catch recursions */
     int maxTemplateDepth;
     int maxTemplateVars;
 };
@@ -1906,6 +1906,11 @@
 XSLTPUBFUN int XSLTCALL
 			xsltExtensionInstructionResultFinalize(
 						 xsltTransformContextPtr ctxt);
+XSLTPUBFUN int XSLTCALL
+			xsltFlagRVTs(
+						 xsltTransformContextPtr ctxt,
+						 xmlXPathObjectPtr obj,
+						 void *val);
 XSLTPUBFUN void XSLTCALL
 			xsltFreeRVTs		(xsltTransformContextPtr ctxt);
 XSLTPUBFUN void XSLTCALL
diff --git a/third_party/libxslt/libxslt/xsltconfig.h b/third_party/libxslt/libxslt/xsltconfig.h
index c92ef01..8824750 100644
--- a/third_party/libxslt/libxslt/xsltconfig.h
+++ b/third_party/libxslt/libxslt/xsltconfig.h
@@ -20,21 +20,21 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBXSLT_DOTTED_VERSION "1.1.28"
+#define LIBXSLT_DOTTED_VERSION "1.1.29"
 
 /**
  * LIBXSLT_VERSION:
  *
  * the version number: 1.2.3 value is 10203
  */
-#define LIBXSLT_VERSION 10128
+#define LIBXSLT_VERSION 10129
 
 /**
  * LIBXSLT_VERSION_STRING:
  *
  * the version number string, 1.2.3 value is "10203"
  */
-#define LIBXSLT_VERSION_STRING "10128"
+#define LIBXSLT_VERSION_STRING "10129"
 
 /**
  * LIBXSLT_VERSION_EXTRA:
diff --git a/third_party/libxslt/libxslt/xsltutils.c b/third_party/libxslt/libxslt/xsltutils.c
index 1646c44..c250ccfa 100644
--- a/third_party/libxslt/libxslt/xsltutils.c
+++ b/third_party/libxslt/libxslt/xsltutils.c
@@ -457,9 +457,8 @@
 	} else if (xmlStrEqual(prop, (const xmlChar *)"no")) {
 	    terminate = 0;
 	} else {
-	    error(errctx,
+	    xsltTransformError(ctxt, NULL, inst,
 		"xsl:message : terminate expecting 'yes' or 'no'\n");
-	    ctxt->state = XSLT_STATE_ERROR;
 	}
 	xmlFree(prop);
     }
@@ -622,7 +621,8 @@
     void *errctx = xsltGenericErrorContext;
 
     if (ctxt != NULL) {
-	ctxt->state = XSLT_STATE_ERROR;
+        if (ctxt->state == XSLT_STATE_OK)
+	    ctxt->state = XSLT_STATE_ERROR;
 	if (ctxt->error != NULL) {
 	    error = ctxt->error;
 	    errctx = ctxt->errctx;
@@ -715,7 +715,8 @@
     char * str;
 
     if (ctxt != NULL) {
-	ctxt->state = XSLT_STATE_ERROR;
+        if (ctxt->state == XSLT_STATE_OK)
+	    ctxt->state = XSLT_STATE_ERROR;
 	if (ctxt->error != NULL) {
 	    error = ctxt->error;
 	    errctx = ctxt->errctx;
diff --git a/third_party/libxslt/libxslt/xsltwin32config.h b/third_party/libxslt/libxslt/xsltwin32config.h
index c89e1ec..35c714e 100644
--- a/third_party/libxslt/libxslt/xsltwin32config.h
+++ b/third_party/libxslt/libxslt/xsltwin32config.h
@@ -23,21 +23,21 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBXSLT_DOTTED_VERSION "1.1.28"
+#define LIBXSLT_DOTTED_VERSION "1.1.29"
 
 /**
  * LIBXSLT_VERSION:
  *
  * the version number: 1.2.3 value is 1002003
  */
-#define LIBXSLT_VERSION 10128
+#define LIBXSLT_VERSION 10129
 
 /**
  * LIBXSLT_VERSION_STRING:
  *
  * the version number string, 1.2.3 value is "1002003"
  */
-#define LIBXSLT_VERSION_STRING "10128"
+#define LIBXSLT_VERSION_STRING "10129"
 
 /**
  * LIBXSLT_VERSION_EXTRA:
diff --git a/third_party/libxslt/linux/Makefile b/third_party/libxslt/linux/Makefile
index 3c6d6c7..bf20ed0 100644
--- a/third_party/libxslt/linux/Makefile
+++ b/third_party/libxslt/linux/Makefile
@@ -226,14 +226,14 @@
 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
-ACLOCAL = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing aclocal-1.14
+ACLOCAL = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing aclocal-1.14
 AMTAR = $${TAR-tar}
 AM_DEFAULT_VERBOSITY = 0
 AR = ar
 AS = as
-AUTOCONF = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoconf
-AUTOHEADER = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoheader
-AUTOMAKE = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing automake-1.14
+AUTOCONF = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoconf
+AUTOHEADER = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoheader
+AUTOMAKE = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing automake-1.14
 AWK = gawk
 CC = gcc
 CCDEPMODE = depmode=gcc3
@@ -254,7 +254,7 @@
 EXEEXT = 
 EXSLT_INCLUDEDIR = -I${includedir}
 EXSLT_LIBDIR = -L${libdir}
-EXSLT_LIBS = -lexslt -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm -lgcrypt
+EXSLT_LIBS = -lexslt -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm -lgcrypt
 EXTRA_LIBS = 
 FGREP = /bin/grep -F
 GREP = /bin/grep
@@ -279,23 +279,23 @@
 LIBOBJS = 
 LIBS = 
 LIBTOOL = $(SHELL) $(top_builddir)/libtool
-LIBXML_CFLAGS = -I/usr/local/google/work/cb/src/third_party/libxml/linux/include
-LIBXML_LIBS = -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl
+LIBXML_CFLAGS = -I/usr/local/google/work/ca/src/third_party/libxml/linux/include
+LIBXML_LIBS = -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl
 LIBXML_REQUIRED_VERSION = 2.6.27
 LIBXML_SRC = ../../libxml/linux/
 LIBXSLT_DEFAULT_PLUGINS_PATH = /usr/local/lib/libxslt-plugins
 LIBXSLT_MAJOR_MINOR_VERSION = 1.1
 LIBXSLT_MAJOR_VERSION = 1
-LIBXSLT_MICRO_VERSION = 28
+LIBXSLT_MICRO_VERSION = 29
 LIBXSLT_MINOR_VERSION = 1
-LIBXSLT_VERSION = 1.1.28
+LIBXSLT_VERSION = 1.1.29
 LIBXSLT_VERSION_EXTRA = 
-LIBXSLT_VERSION_INFO = 2:28:1
-LIBXSLT_VERSION_NUMBER = 10128
+LIBXSLT_VERSION_INFO = 2:29:1
+LIBXSLT_VERSION_NUMBER = 10129
 LIPO = 
 LN_S = ln -s
 LTLIBOBJS = 
-MAKEINFO = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing makeinfo
+MAKEINFO = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing makeinfo
 MANIFEST_TOOL = :
 MKDIR_P = /bin/mkdir -p
 MV = /bin/mv
@@ -323,7 +323,7 @@
 PYTHON_SUBDIR = python
 PYTHON_VERSION = 2.7
 RANLIB = ranlib
-RELDATE = Sat May 14 2016
+RELDATE = Wed Oct 12 2016
 RM = /bin/rm
 SED = /bin/sed
 SET_MAKE = 
@@ -331,7 +331,7 @@
 STRIP = strip
 TAR = /bin/tar
 THREAD_LIBS = -lpthread
-VERSION = 1.1.28
+VERSION = 1.1.29
 VERSION_SCRIPT_FLAGS = -Wl,--version-script=
 WIN32_EXTRA_LDFLAGS = 
 WIN32_EXTRA_LIBADD = 
@@ -342,18 +342,18 @@
 WITH_TRIO = 0
 WITH_XSLT_DEBUG = 0
 XMLLINT = /usr/bin/xmllint
-XML_CONFIG = /usr/local/google/work/cb/src/third_party/libxml/linux/xml2-config
+XML_CONFIG = /usr/local/google/work/ca/src/third_party/libxml/linux/xml2-config
 XSLTPROC = /usr/bin/xsltproc
 XSLTPROCDV = 
 XSLT_INCLUDEDIR = -I${includedir}
 XSLT_LIBDIR = -L${libdir}
-XSLT_LIBS = -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm
+XSLT_LIBS = -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm
 XSLT_LOCALE_WINAPI = 0
 XSLT_LOCALE_XLOCALE = 1
-abs_builddir = /usr/local/google/work/cb/src/third_party/libxslt/linux
-abs_srcdir = /usr/local/google/work/cb/src/third_party/libxslt/linux/..
-abs_top_builddir = /usr/local/google/work/cb/src/third_party/libxslt/linux
-abs_top_srcdir = /usr/local/google/work/cb/src/third_party/libxslt/linux/..
+abs_builddir = /usr/local/google/work/ca/src/third_party/libxslt/linux
+abs_srcdir = /usr/local/google/work/ca/src/third_party/libxslt/linux/..
+abs_top_builddir = /usr/local/google/work/ca/src/third_party/libxslt/linux
+abs_top_srcdir = /usr/local/google/work/ca/src/third_party/libxslt/linux/..
 ac_ct_AR = ar
 ac_ct_CC = gcc
 ac_ct_DUMPBIN = 
@@ -382,7 +382,7 @@
 htmldir = ${docdir}
 includedir = ${prefix}/include
 infodir = ${datarootdir}/info
-install_sh = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/install-sh
+install_sh = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/install-sh
 libdir = ${exec_prefix}/lib
 libexecdir = ${exec_prefix}/libexec
 localedir = ${datarootdir}/locale
diff --git a/third_party/libxslt/linux/config.h b/third_party/libxslt/linux/config.h
index 9f3dd5d..b0f908e 100644
--- a/third_party/libxslt/linux/config.h
+++ b/third_party/libxslt/linux/config.h
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #define HAVE_DLFCN_H 1
 
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
 /* Define if fabs is there */
 #define HAVE_FABS /**/
 
@@ -148,8 +151,7 @@
 /* Define to 1 if you have the `_stat' function. */
 /* #undef HAVE__STAT */
 
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
 #define LT_OBJDIR ".libs/"
 
 /* Name of package */
@@ -199,7 +201,7 @@
 
 
 /* Version number of package */
-#define VERSION "1.1.28"
+#define VERSION "1.1.29"
 
 /* Define if debugging support is enabled */
 /* #undef WITH_DEBUGGER */
diff --git a/third_party/libxslt/linux/config.log b/third_party/libxslt/linux/config.log
index a76c6d8..f0c2668 100644
--- a/third_party/libxslt/linux/config.log
+++ b/third_party/libxslt/linux/config.log
@@ -10,11 +10,11 @@
 ## Platform. ##
 ## --------- ##
 
-hostname = kittyhawk.tok.corp.google.com
+hostname = REDACTED
 uname -m = x86_64
-uname -r = 3.13.0-83-generic
+uname -r = 3.13.0-96-generic
 uname -s = Linux
-uname -v = #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016
+uname -v = #143-Ubuntu SMP Mon Aug 29 20:15:20 UTC 2016
 
 /usr/bin/uname -p = unknown
 /bin/uname -X     = unknown
@@ -52,7 +52,7 @@
 configure:2473: result: gcc
 configure:2702: checking for C compiler version
 configure:2711: gcc --version >&5
-gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
+gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
 Copyright (C) 2013 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -63,9 +63,9 @@
 COLLECT_GCC=gcc
 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
 Target: x86_64-linux-gnu
-Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
 Thread model: posix
-gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1) 
+gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
 configure:2722: $? = 0
 configure:2711: gcc -V >&5
 gcc: error: unrecognized command line option '-V'
@@ -319,7 +319,7 @@
 configure:4686: result: gcc
 configure:4915: checking for C compiler version
 configure:4924: gcc --version >&5
-gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4
+gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
 Copyright (C) 2013 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -330,9 +330,9 @@
 COLLECT_GCC=gcc
 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
 Target: x86_64-linux-gnu
-Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
+Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
 Thread model: posix
-gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1) 
+gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
 configure:4935: $? = 0
 configure:4924: gcc -V >&5
 gcc: error: unrecognized command line option '-V'
@@ -386,7 +386,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | /* end confdefs.h.  */
 | #include <ac_nonexistent.h>
 configure:5349: checking for rm
@@ -619,7 +619,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -699,7 +699,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -748,7 +748,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -828,7 +828,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -887,7 +887,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -968,7 +968,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -1028,7 +1028,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -1110,7 +1110,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -1172,16 +1172,26 @@
 configure:13294: result: yes
 configure:13294: checking for stdarg.h
 configure:13294: result: yes
-configure:13307: checking for stat
-configure:13307: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13307: $? = 0
-configure:13307: result: yes
-configure:13307: checking for _stat
-configure:13307: gcc -o conftest -g -O2   conftest.c  >&5
-/tmp/ccypx5ac.o: In function `main':
-/usr/local/google/work/cb/src/third_party/libxslt/linux/conftest.c:80: undefined reference to `_stat'
+configure:13306: checking errno.h usability
+configure:13306: gcc -c -g -O2  conftest.c >&5
+configure:13306: $? = 0
+configure:13306: result: yes
+configure:13306: checking errno.h presence
+configure:13306: gcc -E  conftest.c
+configure:13306: $? = 0
+configure:13306: result: yes
+configure:13306: checking for errno.h
+configure:13306: result: yes
+configure:13319: checking for stat
+configure:13319: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13319: $? = 0
+configure:13319: result: yes
+configure:13319: checking for _stat
+configure:13319: gcc -o conftest -g -O2   conftest.c  >&5
+/tmp/ccMuFRfj.o: In function `main':
+/usr/local/google/work/ca/src/third_party/libxslt/linux/conftest.c:81: undefined reference to `_stat'
 collect2: error: ld returned 1 exit status
-configure:13307: $? = 1
+configure:13319: $? = 1
 configure: failed program was:
 | /* confdefs.h */
 | #define PACKAGE_NAME ""
@@ -1206,7 +1216,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -1226,6 +1236,7 @@
 | #define HAVE_SYS_STAT_H 1
 | #define HAVE_SYS_SELECT_H 1
 | #define HAVE_STDARG_H 1
+| #define HAVE_ERRNO_H 1
 | #define HAVE_STAT 1
 | /* end confdefs.h.  */
 | /* Define _stat to an innocuous variant, in case <limits.h> declares _stat.
@@ -1266,16 +1277,16 @@
 |   ;
 |   return 0;
 | }
-configure:13307: result: no
-configure:13316: checking for pow
-configure:13316: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:69:6: warning: conflicting types for built-in function 'pow' [enabled by default]
+configure:13319: result: no
+configure:13328: checking for pow
+configure:13328: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:70:6: warning: conflicting types for built-in function 'pow' [enabled by default]
  char pow ();
       ^
-/tmp/ccrPu6rh.o: In function `main':
-/usr/local/google/work/cb/src/third_party/libxslt/linux/conftest.c:80: undefined reference to `pow'
+/tmp/ccCmsAqo.o: In function `main':
+/usr/local/google/work/ca/src/third_party/libxslt/linux/conftest.c:81: undefined reference to `pow'
 collect2: error: ld returned 1 exit status
-configure:13316: $? = 1
+configure:13328: $? = 1
 configure: failed program was:
 | /* confdefs.h */
 | #define PACKAGE_NAME ""
@@ -1300,7 +1311,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -1320,6 +1331,7 @@
 | #define HAVE_SYS_STAT_H 1
 | #define HAVE_SYS_SELECT_H 1
 | #define HAVE_STDARG_H 1
+| #define HAVE_ERRNO_H 1
 | #define HAVE_STAT 1
 | /* end confdefs.h.  */
 | /* Define pow to an innocuous variant, in case <limits.h> declares pow.
@@ -1360,23 +1372,23 @@
 |   ;
 |   return 0;
 | }
-configure:13316: result: no
-configure:13320: checking for pow in -lm
-configure:13345: gcc -o conftest -g -O2   conftest.c -lm   >&5
-conftest.c:53:6: warning: conflicting types for built-in function 'pow' [enabled by default]
+configure:13328: result: no
+configure:13332: checking for pow in -lm
+configure:13357: gcc -o conftest -g -O2   conftest.c -lm   >&5
+conftest.c:54:6: warning: conflicting types for built-in function 'pow' [enabled by default]
  char pow ();
       ^
-configure:13345: $? = 0
-configure:13354: result: yes
-configure:13365: checking for floor
-configure:13365: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:70:6: warning: conflicting types for built-in function 'floor' [enabled by default]
+configure:13357: $? = 0
+configure:13366: result: yes
+configure:13377: checking for floor
+configure:13377: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:71:6: warning: conflicting types for built-in function 'floor' [enabled by default]
  char floor ();
       ^
-/tmp/ccKNWiSn.o: In function `main':
-/usr/local/google/work/cb/src/third_party/libxslt/linux/conftest.c:81: undefined reference to `floor'
+/tmp/ccmX0exx.o: In function `main':
+/usr/local/google/work/ca/src/third_party/libxslt/linux/conftest.c:82: undefined reference to `floor'
 collect2: error: ld returned 1 exit status
-configure:13365: $? = 1
+configure:13377: $? = 1
 configure: failed program was:
 | /* confdefs.h */
 | #define PACKAGE_NAME ""
@@ -1401,7 +1413,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -1421,6 +1433,7 @@
 | #define HAVE_SYS_STAT_H 1
 | #define HAVE_SYS_SELECT_H 1
 | #define HAVE_STDARG_H 1
+| #define HAVE_ERRNO_H 1
 | #define HAVE_STAT 1
 | #define HAVE_POW /**/
 | /* end confdefs.h.  */
@@ -1462,23 +1475,23 @@
 |   ;
 |   return 0;
 | }
-configure:13365: result: no
-configure:13369: checking for floor in -lm
-configure:13394: gcc -o conftest -g -O2   conftest.c -lm   >&5
-conftest.c:54:6: warning: conflicting types for built-in function 'floor' [enabled by default]
+configure:13377: result: no
+configure:13381: checking for floor in -lm
+configure:13406: gcc -o conftest -g -O2   conftest.c -lm   >&5
+conftest.c:55:6: warning: conflicting types for built-in function 'floor' [enabled by default]
  char floor ();
       ^
-configure:13394: $? = 0
-configure:13403: result: yes
-configure:13414: checking for fabs
-configure:13414: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:71:6: warning: conflicting types for built-in function 'fabs' [enabled by default]
+configure:13406: $? = 0
+configure:13415: result: yes
+configure:13426: checking for fabs
+configure:13426: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:72:6: warning: conflicting types for built-in function 'fabs' [enabled by default]
  char fabs ();
       ^
-/tmp/ccWT8GXy.o: In function `main':
-/usr/local/google/work/cb/src/third_party/libxslt/linux/conftest.c:82: undefined reference to `fabs'
+/tmp/cc40eoAH.o: In function `main':
+/usr/local/google/work/ca/src/third_party/libxslt/linux/conftest.c:83: undefined reference to `fabs'
 collect2: error: ld returned 1 exit status
-configure:13414: $? = 1
+configure:13426: $? = 1
 configure: failed program was:
 | /* confdefs.h */
 | #define PACKAGE_NAME ""
@@ -1503,7 +1516,7 @@
 | #define _POSIX_PTHREAD_SEMANTICS 1
 | #define _TANDEM_SOURCE 1
 | #define PACKAGE "libxslt"
-| #define VERSION "1.1.28"
+| #define VERSION "1.1.29"
 | #define STDC_HEADERS 1
 | #define HAVE_DLFCN_H 1
 | #define LT_OBJDIR ".libs/"
@@ -1523,6 +1536,7 @@
 | #define HAVE_SYS_STAT_H 1
 | #define HAVE_SYS_SELECT_H 1
 | #define HAVE_STDARG_H 1
+| #define HAVE_ERRNO_H 1
 | #define HAVE_STAT 1
 | #define HAVE_POW /**/
 | #define HAVE_FLOOR /**/
@@ -1565,129 +1579,129 @@
 |   ;
 |   return 0;
 | }
-configure:13414: result: no
-configure:13418: checking for fabs in -lm
-configure:13443: gcc -o conftest -g -O2   conftest.c -lm   >&5
-conftest.c:55:6: warning: conflicting types for built-in function 'fabs' [enabled by default]
+configure:13426: result: no
+configure:13430: checking for fabs in -lm
+configure:13455: gcc -o conftest -g -O2   conftest.c -lm   >&5
+conftest.c:56:6: warning: conflicting types for built-in function 'fabs' [enabled by default]
  char fabs ();
       ^
-configure:13443: $? = 0
-configure:13452: result: yes
-configure:13466: checking for gettimeofday
-configure:13466: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13466: $? = 0
-configure:13466: result: yes
-configure:13478: checking for mktime
+configure:13455: $? = 0
+configure:13464: result: yes
+configure:13478: checking for gettimeofday
 configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
 configure:13478: $? = 0
 configure:13478: result: yes
-configure:13478: checking for localtime
-configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13478: $? = 0
-configure:13478: result: yes
-configure:13478: checking for localtime_r
-configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13478: $? = 0
-configure:13478: result: yes
-configure:13478: checking for asctime
-configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13478: $? = 0
-configure:13478: result: yes
-configure:13478: checking for time
-configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13478: $? = 0
-configure:13478: result: yes
-configure:13478: checking for gmtime
-configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13478: $? = 0
-configure:13478: result: yes
-configure:13478: checking for gmtime_r
-configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13478: $? = 0
-configure:13478: result: yes
-configure:13478: checking for ftime
-configure:13478: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13478: $? = 0
-configure:13478: result: yes
-configure:13491: checking for printf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:81:6: warning: conflicting types for built-in function 'printf' [enabled by default]
+configure:13490: checking for mktime
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13490: checking for localtime
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13490: checking for localtime_r
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13490: checking for asctime
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13490: checking for time
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13490: checking for gmtime
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13490: checking for gmtime_r
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13490: checking for ftime
+configure:13490: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13490: $? = 0
+configure:13490: result: yes
+configure:13503: checking for printf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:82:6: warning: conflicting types for built-in function 'printf' [enabled by default]
  char printf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13491: checking for sprintf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:82:6: warning: conflicting types for built-in function 'sprintf' [enabled by default]
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13503: checking for sprintf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:83:6: warning: conflicting types for built-in function 'sprintf' [enabled by default]
  char sprintf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13491: checking for fprintf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:83:6: warning: conflicting types for built-in function 'fprintf' [enabled by default]
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13503: checking for fprintf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:84:6: warning: conflicting types for built-in function 'fprintf' [enabled by default]
  char fprintf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13491: checking for snprintf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:84:6: warning: conflicting types for built-in function 'snprintf' [enabled by default]
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13503: checking for snprintf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:85:6: warning: conflicting types for built-in function 'snprintf' [enabled by default]
  char snprintf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13491: checking for vfprintf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:85:6: warning: conflicting types for built-in function 'vfprintf' [enabled by default]
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13503: checking for vfprintf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:86:6: warning: conflicting types for built-in function 'vfprintf' [enabled by default]
  char vfprintf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13491: checking for vsprintf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:86:6: warning: conflicting types for built-in function 'vsprintf' [enabled by default]
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13503: checking for vsprintf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:87:6: warning: conflicting types for built-in function 'vsprintf' [enabled by default]
  char vsprintf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13491: checking for vsnprintf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:87:6: warning: conflicting types for built-in function 'vsnprintf' [enabled by default]
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13503: checking for vsnprintf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:88:6: warning: conflicting types for built-in function 'vsnprintf' [enabled by default]
  char vsnprintf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13491: checking for sscanf
-configure:13491: gcc -o conftest -g -O2   conftest.c  >&5
-conftest.c:88:6: warning: conflicting types for built-in function 'sscanf' [enabled by default]
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13503: checking for sscanf
+configure:13503: gcc -o conftest -g -O2   conftest.c  >&5
+conftest.c:89:6: warning: conflicting types for built-in function 'sscanf' [enabled by default]
  char sscanf ();
       ^
-configure:13491: $? = 0
-configure:13491: result: yes
-configure:13505: checking for clock_gettime
-configure:13505: gcc -o conftest -g -O2   conftest.c  >&5
-configure:13505: $? = 0
-configure:13505: result: yes
-configure:13576: checking for perl
-configure:13592: found /usr/bin/perl
-configure:13604: result: perl
-configure:13650: checking for python
-configure:13668: found /usr/bin/python
-configure:13680: result: /usr/bin/python
-configure:13823: checking for libgcrypt-config
-configure:13841: found /usr/bin/libgcrypt-config
-configure:13853: result: /usr/bin/libgcrypt-config
-configure:13999: checking for libxml libraries >= 2.6.27
-configure:14148: checking for xml2-config
-configure:14166: found /usr/bin/xml2-config
-configure:14178: result: /usr/bin/xml2-config
-configure:14245: result: 2.9.3 found
-configure:14274: checking whether shared libraries will be built (required for plugins)
-configure:14285: result: yes
-configure:14497: checking that generated files are newer than configure
-configure:14503: result: done
-configure:14542: creating ./config.status
+configure:13503: $? = 0
+configure:13503: result: yes
+configure:13517: checking for clock_gettime
+configure:13517: gcc -o conftest -g -O2   conftest.c  >&5
+configure:13517: $? = 0
+configure:13517: result: yes
+configure:13588: checking for perl
+configure:13604: found /usr/bin/perl
+configure:13616: result: perl
+configure:13662: checking for python
+configure:13680: found /usr/bin/python
+configure:13692: result: /usr/bin/python
+configure:13835: checking for libgcrypt-config
+configure:13853: found /usr/bin/libgcrypt-config
+configure:13865: result: /usr/bin/libgcrypt-config
+configure:14011: checking for libxml libraries >= 2.6.27
+configure:14160: checking for xml2-config
+configure:14178: found /usr/bin/xml2-config
+configure:14190: result: /usr/bin/xml2-config
+configure:14257: result: 2.9.4 found
+configure:14286: checking whether shared libraries will be built (required for plugins)
+configure:14297: result: yes
+configure:14509: checking that generated files are newer than configure
+configure:14515: result: done
+configure:14554: creating ./config.status
 
 ## ---------------------- ##
 ## Running config.status. ##
@@ -1702,53 +1716,53 @@
   CONFIG_COMMANDS = 
   $ ./config.status 
 
-on kittyhawk.tok.corp.google.com
+on REDACTED
 
-config.status:1238: creating Makefile
-config.status:1238: creating libxslt.pc
-config.status:1238: creating libexslt.pc
-config.status:1238: creating libxslt/Makefile
-config.status:1238: creating libxslt/xsltconfig.h
-config.status:1238: creating libxslt/xsltwin32config.h
-config.status:1238: creating libexslt/Makefile
-config.status:1238: creating libexslt/exsltconfig.h
-config.status:1238: creating xsltproc/Makefile
-config.status:1238: creating python/Makefile
-config.status:1238: creating python/tests/Makefile
-config.status:1238: creating tests/Makefile
-config.status:1238: creating tests/docs/Makefile
-config.status:1238: creating tests/REC1/Makefile
-config.status:1238: creating tests/REC2/Makefile
-config.status:1238: creating tests/REC/Makefile
-config.status:1238: creating tests/general/Makefile
-config.status:1238: creating tests/reports/Makefile
-config.status:1238: creating tests/extensions/Makefile
-config.status:1238: creating tests/namespaces/Makefile
-config.status:1238: creating tests/keys/Makefile
-config.status:1238: creating tests/numbers/Makefile
-config.status:1238: creating tests/documents/Makefile
-config.status:1238: creating tests/xmlspec/Makefile
-config.status:1238: creating tests/multiple/Makefile
-config.status:1238: creating tests/xinclude/Makefile
-config.status:1238: creating tests/XSLTMark/Makefile
-config.status:1238: creating tests/docbook/Makefile
-config.status:1238: creating tests/exslt/Makefile
-config.status:1238: creating tests/exslt/common/Makefile
-config.status:1238: creating tests/exslt/functions/Makefile
-config.status:1238: creating tests/exslt/math/Makefile
-config.status:1238: creating tests/exslt/saxon/Makefile
-config.status:1238: creating tests/exslt/sets/Makefile
-config.status:1238: creating tests/exslt/strings/Makefile
-config.status:1238: creating tests/exslt/date/Makefile
-config.status:1238: creating tests/exslt/dynamic/Makefile
-config.status:1238: creating tests/exslt/crypto/Makefile
-config.status:1238: creating tests/plugins/Makefile
-config.status:1238: creating doc/Makefile
-config.status:1238: creating xslt-config
-config.status:1238: creating libxslt.spec
-config.status:1238: creating config.h
-config.status:1452: executing depfiles commands
-config.status:1452: executing libtool commands
+config.status:1240: creating Makefile
+config.status:1240: creating libxslt.pc
+config.status:1240: creating libexslt.pc
+config.status:1240: creating libxslt/Makefile
+config.status:1240: creating libxslt/xsltconfig.h
+config.status:1240: creating libxslt/xsltwin32config.h
+config.status:1240: creating libexslt/Makefile
+config.status:1240: creating libexslt/exsltconfig.h
+config.status:1240: creating xsltproc/Makefile
+config.status:1240: creating python/Makefile
+config.status:1240: creating python/tests/Makefile
+config.status:1240: creating tests/Makefile
+config.status:1240: creating tests/docs/Makefile
+config.status:1240: creating tests/REC1/Makefile
+config.status:1240: creating tests/REC2/Makefile
+config.status:1240: creating tests/REC/Makefile
+config.status:1240: creating tests/general/Makefile
+config.status:1240: creating tests/reports/Makefile
+config.status:1240: creating tests/extensions/Makefile
+config.status:1240: creating tests/namespaces/Makefile
+config.status:1240: creating tests/keys/Makefile
+config.status:1240: creating tests/numbers/Makefile
+config.status:1240: creating tests/documents/Makefile
+config.status:1240: creating tests/xmlspec/Makefile
+config.status:1240: creating tests/multiple/Makefile
+config.status:1240: creating tests/xinclude/Makefile
+config.status:1240: creating tests/XSLTMark/Makefile
+config.status:1240: creating tests/docbook/Makefile
+config.status:1240: creating tests/exslt/Makefile
+config.status:1240: creating tests/exslt/common/Makefile
+config.status:1240: creating tests/exslt/functions/Makefile
+config.status:1240: creating tests/exslt/math/Makefile
+config.status:1240: creating tests/exslt/saxon/Makefile
+config.status:1240: creating tests/exslt/sets/Makefile
+config.status:1240: creating tests/exslt/strings/Makefile
+config.status:1240: creating tests/exslt/date/Makefile
+config.status:1240: creating tests/exslt/dynamic/Makefile
+config.status:1240: creating tests/exslt/crypto/Makefile
+config.status:1240: creating tests/plugins/Makefile
+config.status:1240: creating doc/Makefile
+config.status:1240: creating xslt-config
+config.status:1240: creating libxslt.spec
+config.status:1240: creating config.h
+config.status:1454: executing depfiles commands
+config.status:1454: executing libtool commands
 
 ## ---------------- ##
 ## Cache variables. ##
@@ -1799,6 +1813,7 @@
 ac_cv_func_vsprintf=yes
 ac_cv_header_ansidecl_h=no
 ac_cv_header_dlfcn_h=yes
+ac_cv_header_errno_h=yes
 ac_cv_header_float_h=yes
 ac_cv_header_fp_class_h=no
 ac_cv_header_ieeefp_h=no
@@ -1890,7 +1905,7 @@
 ## Output variables. ##
 ## ----------------- ##
 
-ACLOCAL='${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing aclocal-1.14'
+ACLOCAL='${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing aclocal-1.14'
 AMDEPBACKSLASH='\'
 AMDEP_FALSE='#'
 AMDEP_TRUE=''
@@ -1901,9 +1916,9 @@
 AM_V='$(V)'
 AR='ar'
 AS='as'
-AUTOCONF='${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoconf'
-AUTOHEADER='${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoheader'
-AUTOMAKE='${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing automake-1.14'
+AUTOCONF='${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoconf'
+AUTOHEADER='${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoheader'
+AUTOMAKE='${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing automake-1.14'
 AWK='gawk'
 CC='gcc'
 CCDEPMODE='depmode=gcc3'
@@ -1924,7 +1939,7 @@
 EXEEXT=''
 EXSLT_INCLUDEDIR='-I${includedir}'
 EXSLT_LIBDIR='-L${libdir}'
-EXSLT_LIBS='-lexslt -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm -lgcrypt'
+EXSLT_LIBS='-lexslt -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm -lgcrypt'
 EXTRA_LIBS=''
 FGREP='/bin/grep -F'
 GREP='/bin/grep'
@@ -1948,23 +1963,23 @@
 LIBOBJS=''
 LIBS=''
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-LIBXML_CFLAGS='-I/usr/local/google/work/cb/src/third_party/libxml/linux/include'
-LIBXML_LIBS='-L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl'
+LIBXML_CFLAGS='-I/usr/local/google/work/ca/src/third_party/libxml/linux/include'
+LIBXML_LIBS='-L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl'
 LIBXML_REQUIRED_VERSION='2.6.27'
 LIBXML_SRC='../../libxml/linux/'
 LIBXSLT_DEFAULT_PLUGINS_PATH='/usr/local/lib/libxslt-plugins'
 LIBXSLT_MAJOR_MINOR_VERSION='1.1'
 LIBXSLT_MAJOR_VERSION='1'
-LIBXSLT_MICRO_VERSION='28'
+LIBXSLT_MICRO_VERSION='29'
 LIBXSLT_MINOR_VERSION='1'
-LIBXSLT_VERSION='1.1.28'
+LIBXSLT_VERSION='1.1.29'
 LIBXSLT_VERSION_EXTRA=''
-LIBXSLT_VERSION_INFO='2:28:1'
-LIBXSLT_VERSION_NUMBER='10128'
+LIBXSLT_VERSION_INFO='2:29:1'
+LIBXSLT_VERSION_NUMBER='10129'
 LIPO=''
 LN_S='ln -s'
 LTLIBOBJS=''
-MAKEINFO='${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing makeinfo'
+MAKEINFO='${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing makeinfo'
 MANIFEST_TOOL=':'
 MKDIR_P='/bin/mkdir -p'
 MV='/bin/mv'
@@ -1992,7 +2007,7 @@
 PYTHON_SUBDIR='python'
 PYTHON_VERSION='2.7'
 RANLIB='ranlib'
-RELDATE='Sat May 14 2016'
+RELDATE='Wed Oct 12 2016'
 RM='/bin/rm'
 SED='/bin/sed'
 SET_MAKE=''
@@ -2002,7 +2017,7 @@
 THREAD_LIBS='-lpthread'
 USE_VERSION_SCRIPT_FALSE='#'
 USE_VERSION_SCRIPT_TRUE=''
-VERSION='1.1.28'
+VERSION='1.1.29'
 VERSION_SCRIPT_FLAGS='-Wl,--version-script='
 WIN32_EXTRA_LDFLAGS=''
 WIN32_EXTRA_LIBADD=''
@@ -2019,12 +2034,12 @@
 WITH_TRIO='0'
 WITH_XSLT_DEBUG='0'
 XMLLINT='/usr/bin/xmllint'
-XML_CONFIG='/usr/local/google/work/cb/src/third_party/libxml/linux/xml2-config'
+XML_CONFIG='/usr/local/google/work/ca/src/third_party/libxml/linux/xml2-config'
 XSLTPROC='/usr/bin/xsltproc'
 XSLTPROCDV=''
 XSLT_INCLUDEDIR='-I${includedir}'
 XSLT_LIBDIR='-L${libdir}'
-XSLT_LIBS='-lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm'
+XSLT_LIBS='-lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm'
 XSLT_LOCALE_WINAPI='0'
 XSLT_LOCALE_XLOCALE='1'
 ac_ct_AR='ar'
@@ -2060,7 +2075,7 @@
 htmldir='${docdir}'
 includedir='${prefix}/include'
 infodir='${datarootdir}/info'
-install_sh='${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/install-sh'
+install_sh='${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/install-sh'
 libdir='${exec_prefix}/lib'
 libexecdir='${exec_prefix}/libexec'
 localedir='${datarootdir}/locale'
@@ -2105,7 +2120,7 @@
 #define _POSIX_PTHREAD_SEMANTICS 1
 #define _TANDEM_SOURCE 1
 #define PACKAGE "libxslt"
-#define VERSION "1.1.28"
+#define VERSION "1.1.29"
 #define STDC_HEADERS 1
 #define HAVE_DLFCN_H 1
 #define LT_OBJDIR ".libs/"
@@ -2125,6 +2140,7 @@
 #define HAVE_SYS_STAT_H 1
 #define HAVE_SYS_SELECT_H 1
 #define HAVE_STDARG_H 1
+#define HAVE_ERRNO_H 1
 #define HAVE_STAT 1
 #define HAVE_POW /**/
 #define HAVE_FLOOR /**/
diff --git a/third_party/libxslt/linux/libexslt.pc b/third_party/libxslt/linux/libexslt.pc
index 39c79f10..080c0836 100644
--- a/third_party/libxslt/linux/libexslt.pc
+++ b/third_party/libxslt/linux/libexslt.pc
@@ -8,5 +8,5 @@
 Version: 0.8.17
 Description: EXSLT Extension library
 Requires: libxml-2.0
-Libs: -L${libdir} -lexslt -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm -lgcrypt
+Libs: -L${libdir} -lexslt -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm -lgcrypt
 Cflags: -I${includedir}
diff --git a/third_party/libxslt/linux/libexslt/Makefile b/third_party/libxslt/linux/libexslt/Makefile
index 5915228..f2b2d30 100644
--- a/third_party/libxslt/linux/libexslt/Makefile
+++ b/third_party/libxslt/linux/libexslt/Makefile
@@ -199,14 +199,14 @@
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing aclocal-1.14
+ACLOCAL = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing aclocal-1.14
 AMTAR = $${TAR-tar}
 AM_DEFAULT_VERBOSITY = 0
 AR = ar
 AS = as
-AUTOCONF = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoconf
-AUTOHEADER = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoheader
-AUTOMAKE = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing automake-1.14
+AUTOCONF = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoconf
+AUTOHEADER = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoheader
+AUTOMAKE = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing automake-1.14
 AWK = gawk
 CC = gcc
 CCDEPMODE = depmode=gcc3
@@ -227,7 +227,7 @@
 EXEEXT = 
 EXSLT_INCLUDEDIR = -I${includedir}
 EXSLT_LIBDIR = -L${libdir}
-EXSLT_LIBS = -lexslt -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm -lgcrypt
+EXSLT_LIBS = -lexslt -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm -lgcrypt
 EXTRA_LIBS = 
 FGREP = /bin/grep -F
 GREP = /bin/grep
@@ -252,23 +252,23 @@
 LIBOBJS = 
 LIBS = 
 LIBTOOL = $(SHELL) $(top_builddir)/libtool
-LIBXML_CFLAGS = -I/usr/local/google/work/cb/src/third_party/libxml/linux/include
-LIBXML_LIBS = -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl
+LIBXML_CFLAGS = -I/usr/local/google/work/ca/src/third_party/libxml/linux/include
+LIBXML_LIBS = -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl
 LIBXML_REQUIRED_VERSION = 2.6.27
 LIBXML_SRC = ../../libxml/linux/
 LIBXSLT_DEFAULT_PLUGINS_PATH = /usr/local/lib/libxslt-plugins
 LIBXSLT_MAJOR_MINOR_VERSION = 1.1
 LIBXSLT_MAJOR_VERSION = 1
-LIBXSLT_MICRO_VERSION = 28
+LIBXSLT_MICRO_VERSION = 29
 LIBXSLT_MINOR_VERSION = 1
-LIBXSLT_VERSION = 1.1.28
+LIBXSLT_VERSION = 1.1.29
 LIBXSLT_VERSION_EXTRA = 
-LIBXSLT_VERSION_INFO = 2:28:1
-LIBXSLT_VERSION_NUMBER = 10128
+LIBXSLT_VERSION_INFO = 2:29:1
+LIBXSLT_VERSION_NUMBER = 10129
 LIPO = 
 LN_S = ln -s
 LTLIBOBJS = 
-MAKEINFO = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing makeinfo
+MAKEINFO = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing makeinfo
 MANIFEST_TOOL = :
 MKDIR_P = /bin/mkdir -p
 MV = /bin/mv
@@ -296,7 +296,7 @@
 PYTHON_SUBDIR = python
 PYTHON_VERSION = 2.7
 RANLIB = ranlib
-RELDATE = Sat May 14 2016
+RELDATE = Wed Oct 12 2016
 RM = /bin/rm
 SED = /bin/sed
 SET_MAKE = 
@@ -304,7 +304,7 @@
 STRIP = strip
 TAR = /bin/tar
 THREAD_LIBS = -lpthread
-VERSION = 1.1.28
+VERSION = 1.1.29
 VERSION_SCRIPT_FLAGS = -Wl,--version-script=
 WIN32_EXTRA_LDFLAGS = 
 WIN32_EXTRA_LIBADD = 
@@ -315,18 +315,18 @@
 WITH_TRIO = 0
 WITH_XSLT_DEBUG = 0
 XMLLINT = /usr/bin/xmllint
-XML_CONFIG = /usr/local/google/work/cb/src/third_party/libxml/linux/xml2-config
+XML_CONFIG = /usr/local/google/work/ca/src/third_party/libxml/linux/xml2-config
 XSLTPROC = /usr/bin/xsltproc
 XSLTPROCDV = 
 XSLT_INCLUDEDIR = -I${includedir}
 XSLT_LIBDIR = -L${libdir}
-XSLT_LIBS = -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm
+XSLT_LIBS = -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm
 XSLT_LOCALE_WINAPI = 0
 XSLT_LOCALE_XLOCALE = 1
-abs_builddir = /usr/local/google/work/cb/src/third_party/libxslt/linux/libexslt
-abs_srcdir = /usr/local/google/work/cb/src/third_party/libxslt/linux/../libexslt
-abs_top_builddir = /usr/local/google/work/cb/src/third_party/libxslt/linux
-abs_top_srcdir = /usr/local/google/work/cb/src/third_party/libxslt/linux/..
+abs_builddir = /usr/local/google/work/ca/src/third_party/libxslt/linux/libexslt
+abs_srcdir = /usr/local/google/work/ca/src/third_party/libxslt/linux/../libexslt
+abs_top_builddir = /usr/local/google/work/ca/src/third_party/libxslt/linux
+abs_top_srcdir = /usr/local/google/work/ca/src/third_party/libxslt/linux/..
 ac_ct_AR = ar
 ac_ct_CC = gcc
 ac_ct_DUMPBIN = 
@@ -355,7 +355,7 @@
 htmldir = ${docdir}
 includedir = ${prefix}/include
 infodir = ${datarootdir}/info
-install_sh = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/install-sh
+install_sh = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/install-sh
 libdir = ${exec_prefix}/lib
 libexecdir = ${exec_prefix}/libexec
 localedir = ${datarootdir}/locale
diff --git a/third_party/libxslt/linux/libexslt/exsltconfig.h b/third_party/libxslt/linux/libexslt/exsltconfig.h
index 448fc9a..beb14f5 100644
--- a/third_party/libxslt/linux/libexslt/exsltconfig.h
+++ b/third_party/libxslt/linux/libexslt/exsltconfig.h
@@ -18,7 +18,7 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBEXSLT_DOTTED_VERSION "1.1.28"
+#define LIBEXSLT_DOTTED_VERSION "1.1.29"
 
 /**
  * LIBEXSLT_VERSION:
diff --git a/third_party/libxslt/linux/libxslt.pc b/third_party/libxslt/linux/libxslt.pc
index 3b0563c..ea9e06bc 100644
--- a/third_party/libxslt/linux/libxslt.pc
+++ b/third_party/libxslt/linux/libxslt.pc
@@ -5,8 +5,8 @@
 
 
 Name: libxslt
-Version: 1.1.28
+Version: 1.1.29
 Description: XSLT library version 2.
 Requires: libxml-2.0
-Libs: -L${libdir} -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm 
+Libs: -L${libdir} -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm 
 Cflags: -I${includedir}
diff --git a/third_party/libxslt/linux/libxslt.spec b/third_party/libxslt/linux/libxslt.spec
index 810750f..71e1aee 100644
--- a/third_party/libxslt/linux/libxslt.spec
+++ b/third_party/libxslt/linux/libxslt.spec
@@ -1,7 +1,7 @@
 Summary: Library providing the GNOME XSLT engine
 Name: libxslt
-Version: 1.1.28
-Release: 1
+Version: 1.1.29
+Release: 1%{?dist}%{?extra_release}
 License: MIT
 Group: Development/Libraries
 Source: ftp://xmlsoft.org/XSLT/libxslt-%{version}.tar.gz
@@ -66,8 +66,11 @@
 
 %makeinstall
 
-rm -fr $RPM_BUILD_ROOT%{_libdir}/*.la \
-       $RPM_BUILD_ROOT%{_libdir}/python*/site-packages/libxsltmod*a
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
+rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}{,-python}-%{version}
+
+%check
+make check
 
 %clean
 rm -fr %{buildroot}
@@ -126,5 +129,5 @@
 %doc python/tests/*.xsl
 
 %changelog
-* Sat May 14 2016 Daniel Veillard <veillard@redhat.com>
-- upstream release 1.1.28 see http://xmlsoft.org/XSLT/news.html
+* Wed Oct 12 2016 Daniel Veillard <veillard@redhat.com>
+- upstream release 1.1.29 see http://xmlsoft.org/XSLT/news.html
diff --git a/third_party/libxslt/linux/libxslt/Makefile b/third_party/libxslt/linux/libxslt/Makefile
index 50b345a..10b6cad 100644
--- a/third_party/libxslt/linux/libxslt/Makefile
+++ b/third_party/libxslt/linux/libxslt/Makefile
@@ -202,14 +202,14 @@
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing aclocal-1.14
+ACLOCAL = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing aclocal-1.14
 AMTAR = $${TAR-tar}
 AM_DEFAULT_VERBOSITY = 0
 AR = ar
 AS = as
-AUTOCONF = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoconf
-AUTOHEADER = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing autoheader
-AUTOMAKE = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing automake-1.14
+AUTOCONF = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoconf
+AUTOHEADER = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing autoheader
+AUTOMAKE = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing automake-1.14
 AWK = gawk
 CC = gcc
 CCDEPMODE = depmode=gcc3
@@ -230,7 +230,7 @@
 EXEEXT = 
 EXSLT_INCLUDEDIR = -I${includedir}
 EXSLT_LIBDIR = -L${libdir}
-EXSLT_LIBS = -lexslt -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm -lgcrypt
+EXSLT_LIBS = -lexslt -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm -lgcrypt
 EXTRA_LIBS = 
 FGREP = /bin/grep -F
 GREP = /bin/grep
@@ -255,23 +255,23 @@
 LIBOBJS = 
 LIBS = 
 LIBTOOL = $(SHELL) $(top_builddir)/libtool
-LIBXML_CFLAGS = -I/usr/local/google/work/cb/src/third_party/libxml/linux/include
-LIBXML_LIBS = -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl
+LIBXML_CFLAGS = -I/usr/local/google/work/ca/src/third_party/libxml/linux/include
+LIBXML_LIBS = -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl
 LIBXML_REQUIRED_VERSION = 2.6.27
 LIBXML_SRC = ../../libxml/linux/
 LIBXSLT_DEFAULT_PLUGINS_PATH = /usr/local/lib/libxslt-plugins
 LIBXSLT_MAJOR_MINOR_VERSION = 1.1
 LIBXSLT_MAJOR_VERSION = 1
-LIBXSLT_MICRO_VERSION = 28
+LIBXSLT_MICRO_VERSION = 29
 LIBXSLT_MINOR_VERSION = 1
-LIBXSLT_VERSION = 1.1.28
+LIBXSLT_VERSION = 1.1.29
 LIBXSLT_VERSION_EXTRA = 
-LIBXSLT_VERSION_INFO = 2:28:1
-LIBXSLT_VERSION_NUMBER = 10128
+LIBXSLT_VERSION_INFO = 2:29:1
+LIBXSLT_VERSION_NUMBER = 10129
 LIPO = 
 LN_S = ln -s
 LTLIBOBJS = 
-MAKEINFO = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/missing makeinfo
+MAKEINFO = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/missing makeinfo
 MANIFEST_TOOL = :
 MKDIR_P = /bin/mkdir -p
 MV = /bin/mv
@@ -299,7 +299,7 @@
 PYTHON_SUBDIR = python
 PYTHON_VERSION = 2.7
 RANLIB = ranlib
-RELDATE = Sat May 14 2016
+RELDATE = Wed Oct 12 2016
 RM = /bin/rm
 SED = /bin/sed
 SET_MAKE = 
@@ -307,7 +307,7 @@
 STRIP = strip
 TAR = /bin/tar
 THREAD_LIBS = -lpthread
-VERSION = 1.1.28
+VERSION = 1.1.29
 VERSION_SCRIPT_FLAGS = -Wl,--version-script=
 WIN32_EXTRA_LDFLAGS = 
 WIN32_EXTRA_LIBADD = 
@@ -318,18 +318,18 @@
 WITH_TRIO = 0
 WITH_XSLT_DEBUG = 0
 XMLLINT = /usr/bin/xmllint
-XML_CONFIG = /usr/local/google/work/cb/src/third_party/libxml/linux/xml2-config
+XML_CONFIG = /usr/local/google/work/ca/src/third_party/libxml/linux/xml2-config
 XSLTPROC = /usr/bin/xsltproc
 XSLTPROCDV = 
 XSLT_INCLUDEDIR = -I${includedir}
 XSLT_LIBDIR = -L${libdir}
-XSLT_LIBS = -lxslt -L/usr/local/google/work/cb/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -lm -ldl -lm
+XSLT_LIBS = -lxslt -L/usr/local/google/work/ca/src/third_party/libxml/linux -L/usr/local/lib -lxml2 -lz -licui18n -licuuc -licudata -lm -ldl -lm
 XSLT_LOCALE_WINAPI = 0
 XSLT_LOCALE_XLOCALE = 1
-abs_builddir = /usr/local/google/work/cb/src/third_party/libxslt/linux/libxslt
-abs_srcdir = /usr/local/google/work/cb/src/third_party/libxslt/linux/../libxslt
-abs_top_builddir = /usr/local/google/work/cb/src/third_party/libxslt/linux
-abs_top_srcdir = /usr/local/google/work/cb/src/third_party/libxslt/linux/..
+abs_builddir = /usr/local/google/work/ca/src/third_party/libxslt/linux/libxslt
+abs_srcdir = /usr/local/google/work/ca/src/third_party/libxslt/linux/../libxslt
+abs_top_builddir = /usr/local/google/work/ca/src/third_party/libxslt/linux
+abs_top_srcdir = /usr/local/google/work/ca/src/third_party/libxslt/linux/..
 ac_ct_AR = ar
 ac_ct_CC = gcc
 ac_ct_DUMPBIN = 
@@ -358,7 +358,7 @@
 htmldir = ${docdir}
 includedir = ${prefix}/include
 infodir = ${datarootdir}/info
-install_sh = ${SHELL} /usr/local/google/work/cb/src/third_party/libxslt/install-sh
+install_sh = ${SHELL} /usr/local/google/work/ca/src/third_party/libxslt/install-sh
 libdir = ${exec_prefix}/lib
 libexecdir = ${exec_prefix}/libexec
 localedir = ${datarootdir}/locale
diff --git a/third_party/libxslt/linux/libxslt/xsltwin32config.h b/third_party/libxslt/linux/libxslt/xsltwin32config.h
index d781201..34402d6 100644
--- a/third_party/libxslt/linux/libxslt/xsltwin32config.h
+++ b/third_party/libxslt/linux/libxslt/xsltwin32config.h
@@ -23,21 +23,21 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBXSLT_DOTTED_VERSION "1.1.28"
+#define LIBXSLT_DOTTED_VERSION "1.1.29"
 
 /**
  * LIBXSLT_VERSION:
  *
  * the version number: 1.2.3 value is 1002003
  */
-#define LIBXSLT_VERSION 10128
+#define LIBXSLT_VERSION 10129
 
 /**
  * LIBXSLT_VERSION_STRING:
  *
  * the version number string, 1.2.3 value is "1002003"
  */
-#define LIBXSLT_VERSION_STRING "10128"
+#define LIBXSLT_VERSION_STRING "10129"
 
 /**
  * LIBXSLT_VERSION_EXTRA:
diff --git a/third_party/libxslt/mac/config.h b/third_party/libxslt/mac/config.h
index ded5e75..c775e508 100644
--- a/third_party/libxslt/mac/config.h
+++ b/third_party/libxslt/mac/config.h
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #define HAVE_DLFCN_H 1
 
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
 /* Define if fabs is there */
 /* #undef HAVE_FABS */
 
@@ -198,7 +201,7 @@
 
 
 /* Version number of package */
-#define VERSION "1.1.28"
+#define VERSION "1.1.29"
 
 /* Define if debugging support is enabled */
 /* #undef WITH_DEBUGGER */
diff --git a/third_party/sqlite/README.chromium b/third_party/sqlite/README.chromium
index 6c3667a..1b265d6e 100644
--- a/third_party/sqlite/README.chromium
+++ b/third_party/sqlite/README.chromium
@@ -38,8 +38,8 @@
   ./google_generate_amalgamation.sh
 to regenerate sqlite3.c.  The code in src/ is much easier to edit, and the
 SQLite test framework can easily be run.  During development it may be
-convenient to modify sqlite.gyp (or BUILD.gn) based on src/main.mk to just pull
-in the src/ files rather than sqlite3.c.
+convenient to modify BUILD.gn based on src/main.mk to just pull in the src/
+files rather than sqlite3.c.
 
 Once your patch is complete, squash it down into a reasonable CL, then
 re-generate the patches.  This is a truncated version of the import flow.  The
@@ -200,7 +200,7 @@
 TODO(shess): It is basically impossible to trybot the entire change, it takes
 forever to upload and sqlite3.c breaks things because it's too large.  I have a
 nasty Perl script to break up sqlite3.c into pieces which are then included by a
-single .c file, but there must be a better way.  Perhaps just have sqlite.gyp
+single .c file, but there must be a better way.  Perhaps just have BUILD.gn
 include all the .c files directly?
 
 Note that things can be broken down differently, if you prefer.  For instance,
diff --git a/third_party/sqlite/google_generate_amalgamation.sh b/third_party/sqlite/google_generate_amalgamation.sh
index fe7ee8ae..cf21cd1 100755
--- a/third_party/sqlite/google_generate_amalgamation.sh
+++ b/third_party/sqlite/google_generate_amalgamation.sh
@@ -10,7 +10,6 @@
 cd bld
 ../configure
 FILES="sqlite3.h sqlite3.c"
-# Add any options from sqlite.gyp referenced by parse.y or mkkeywordhash.c.
 OPTS=""
 make "OPTS=$OPTS" $FILES
 cp -f $FILES ../../amalgamation
diff --git a/tools/determinism/compare_build_artifacts.py b/tools/determinism/compare_build_artifacts.py
index c6e58c1..9407db6a 100755
--- a/tools/determinism/compare_build_artifacts.py
+++ b/tools/determinism/compare_build_artifacts.py
@@ -137,7 +137,6 @@
     'mojo_public_bindings_unittests',
     'mojo_public_system_unittests',
     'mojo_runner_host_unittests',
-    'mojo_shell_unittests',
     'mojo_system_unittests',
     'nacl_loader_unittests',
     'native_theme_unittests',
@@ -152,6 +151,7 @@
     'remoting_start_host',
     'remoting_unittests',
     'sandbox_mac_unittests',
+    'service_manager_unittests',
     'shell_dialogs_unittests',
     'skia_unittests',
     'snapshot_unittests',
diff --git a/tools/gn/args.cc b/tools/gn/args.cc
index 9aaafb08..72480f5 100644
--- a/tools/gn/args.cc
+++ b/tools/gn/args.cc
@@ -269,6 +269,8 @@
   static const char kX64[] = "x64";
   static const char kArm[] = "arm";
   static const char kMips[] = "mipsel";
+  static const char kS390X[] = "s390x";
+  static const char kPPC64[] = "ppc64";
   const char* arch = nullptr;
 
   // Set the host CPU architecture based on the underlying OS, not
@@ -282,8 +284,12 @@
     arch = kArm;
   else if (os_arch == "mips")
     arch = kMips;
+  else if (os_arch == "s390x")
+    arch = kS390X;
+  else if (os_arch == "mips")
+    arch = kPPC64;
   else
-    CHECK(false) << "OS architecture not handled.";
+    CHECK(false) << "OS architecture not handled. (" << os_arch << ")";
 
   // Save the OS and architecture as build arguments that are implicitly
   // declared. This is so they can be overridden in a toolchain build args
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 9fc1c766..b86757a 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -299,7 +299,7 @@
 
   # //base/allocator/allocator_extension.cc needs this macro defined,
   # otherwise there would be link errors.
-  cflags.extend(['-DNO_TCMALLOC'])
+  cflags.extend(['-DNO_TCMALLOC', '-D__STDC_FORMAT_MACROS'])
 
   if is_posix:
     if options.debug:
diff --git a/tools/grit/grit_rule.gni b/tools/grit/grit_rule.gni
index 37c9db5..19cb9e50 100644
--- a/tools/grit/grit_rule.gni
+++ b/tools/grit/grit_rule.gni
@@ -277,12 +277,6 @@
     "enable_themes",
   ]
 }
-if (enable_app_list) {
-  grit_defines += [
-    "-D",
-    "enable_app_list",
-  ]
-}
 if (enable_webrtc) {
   grit_defines += [
     "-D",
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 03d51e69..4d4969e 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -13920,6 +13920,18 @@
   </summary>
 </histogram>
 
+<histogram
+    name="Event.Latency.ScrollUpdate.Touch.TimeToFirstScrollUpdateSwapBegin2"
+    units="microseconds">
+  <owner>tdresser@chromium.org</owner>
+  <summary>
+    Time between initial creation of a touch event and the start of the frame
+    swap on the GPU service caused by the generated ScrollUpdate gesture event
+    if that ScrollUpdate is the first such event in a given scroll gesture event
+    sequence. If no swap was induced by the event, no recording is made.
+  </summary>
+</histogram>
+
 <histogram name="Event.Latency.ScrollUpdate.Touch.TimeToHandled2"
     units="microseconds">
   <owner>tdresser@chromium.org</owner>
@@ -13931,6 +13943,16 @@
   </summary>
 </histogram>
 
+<histogram name="Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2"
+    units="microseconds">
+  <owner>tdresser@chromium.org</owner>
+  <summary>
+    Time between initial creation of a touch event and start of the frame swap
+    on the GPU service caused by the generated ScrollUpdate gesture event. If no
+    swap was induced by the event, no recording is made.
+  </summary>
+</histogram>
+
 <histogram name="Event.Latency.ScrollUpdate.TouchToHandled"
     units="microseconds">
   <owner>rbyers@chromium.org</owner>
@@ -13984,6 +14006,18 @@
   </summary>
 </histogram>
 
+<histogram
+    name="Event.Latency.ScrollUpdate.Wheel.TimeToFirstScrollUpdateSwapBegin2"
+    units="microseconds">
+  <owner>tdresser@chromium.org</owner>
+  <summary>
+    Time between initial creation of a wheel event and the start of the frame
+    swap on the GPU service caused by the generated ScrollUpdate gesture event
+    if that ScrollUpdate is the first such event in a given scroll gesture event
+    sequence. If no swap was induced by the event, no recording is made.
+  </summary>
+</histogram>
+
 <histogram name="Event.Latency.ScrollUpdate.Wheel.TimeToHandled2"
     units="microseconds">
   <owner>tdresser@chromium.org</owner>
@@ -13998,6 +14032,10 @@
 <histogram name="Event.Latency.Touch.TimeToFirstScrollUpdateSwapBegin2"
     units="microseconds">
   <owner>tdresser@chromium.org</owner>
+  <obsolete>
+    Replaced by
+    Event.Latency.ScrollUpdate.Touch.TimeToFirstScrollUpdateSwapBegin2.
+  </obsolete>
   <summary>
     Time between initial creation of a touch event and the start of the frame
     swap on the GPU service caused by the generated ScrollUpdate gesture event
@@ -14009,6 +14047,9 @@
 <histogram name="Event.Latency.Touch.TimeToScrollUpdateSwapBegin2"
     units="microseconds">
   <owner>tdresser@chromium.org</owner>
+  <obsolete>
+    Replaced by Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2.
+  </obsolete>
   <summary>
     Time between initial creation of a touch event and start of the frame swap
     on the GPU service caused by the generated ScrollUpdate gesture event. If no
@@ -14035,8 +14076,9 @@
     units="microseconds">
   <owner>rbyers@chromium.org</owner>
   <obsolete>
-    To be replaced by Event.Latency.Touch.TimeToFirstScrollUpdateSwapBegin2 in
-    M56. https://crbug.com/649754
+    To be replaced by
+    Event.Latency.ScrollUpdate.Touch.TimeToFirstScrollUpdateSwapBegin2 in M56.
+    https://crbug.com/649754
   </obsolete>
   <summary>
     Time between initial creation of a touch event and the start of the frame
@@ -14062,7 +14104,8 @@
     units="microseconds">
   <owner>rbyers@chromium.org</owner>
   <obsolete>
-    To be replaced by Event.Latency.Touch.TimeToScrollUpdateSwapBegin2 in M56.
+    To be replaced by
+    Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2 in M56.
     https://crbug.com/649754
   </obsolete>
   <summary>
@@ -14075,6 +14118,10 @@
 <histogram name="Event.Latency.Wheel.TimeToFirstScrollUpdateSwapBegin2"
     units="microseconds">
   <owner>tdresser@chromium.org</owner>
+  <obsolete>
+    Replaced by
+    Event.Latency.ScrollUpdate.Wheel.TimeToFirstScrollUpdateSwapBegin2.
+  </obsolete>
   <summary>
     Time between initial creation of a wheel event and the start of the frame
     swap on the GPU service caused by the generated ScrollUpdate gesture event
@@ -32354,6 +32401,20 @@
   </summary>
 </histogram>
 
+<histogram name="Net.QuicSession.PushedAndUnclaimedBytes" units="count">
+  <owner>zhongyi@chromium.org</owner>
+  <summary>
+    The number of bytes that is pushed but not used when the session is closed.
+  </summary>
+</histogram>
+
+<histogram name="Net.QuicSession.PushedBytes" units="count">
+  <owner>zhongyi@chromium.org</owner>
+  <summary>
+    The number of bytes that is pushed when the session is closed.
+  </summary>
+</histogram>
+
 <histogram name="Net.QuicSession.QuicVersion">
   <owner>rch@chromium.org</owner>
   <summary>Version of the QUIC protocol used for this connection.</summary>
@@ -36798,6 +36859,15 @@
   </summary>
 </histogram>
 
+<histogram name="NetworkTimeTracker.TimeQueryLatency" units="ms">
+  <owner>estark@chromium.org</owner>
+  <owner>mab@chromium.org</owner>
+  <summary>
+    NetworkTimeTracker makes periodic queries to obtain a secure timestamp over
+    the network. This histogram records the latency of each time query.
+  </summary>
+</histogram>
+
 <histogram name="NetworkTimeTracker.UpdateTimeFetchAttempted">
   <obsolete>
     Deprecated 08/2016 because it does not provide additional information beyond
@@ -40848,6 +40918,9 @@
 </histogram>
 
 <histogram name="PageLoad.Timing2.NavigationToFirstBackground" units="ms">
+  <obsolete>
+    deprecated in favor of PageLoad.AbortTiming.Background.*
+  </obsolete>
   <owner>bmcquade@chromium.org</owner>
   <owner>csharrison@chromium.org</owner>
   <summary>
@@ -49666,6 +49739,15 @@
   </summary>
 </histogram>
 
+<histogram name="Renderer4.ImageDecodeTaskDurationUs" units="microseconds">
+  <owner>vmpstr@chromium.org</owner>
+  <summary>
+    This metric records the duration of an image decode in the compositor. It is
+    recorded every time we decode an image. It is suffixed by the type of
+    rasterization we're in (either Gpu or Software).
+  </summary>
+</histogram>
+
 <histogram name="Renderer4.InvalidationRegionApproximateRectCount"
     units="rects">
   <owner>wiltzius@chromium.org</owner>
@@ -77521,6 +77603,9 @@
   <int value="17" label="Data Reduction Proxy"/>
   <int value="18" label="Precache"/>
   <int value="19" label="NTPTiles"/>
+  <int value="20" label="Feedback Uploader"/>
+  <int value="21" label="Tracing Uploader"/>
+  <int value="22" label="DOM Distiller"/>
 </enum>
 
 <enum name="DecodedImageOrientation" type="int">
@@ -89140,6 +89225,7 @@
   <int value="-428599163" label="NTPDownloadSuggestions:enabled"/>
   <int value="-418868128" label="enable-experimental-web-platform-features"/>
   <int value="-396994784" label="enable-vr-shell"/>
+  <int value="-395606844" label="enable-site-settings"/>
   <int value="-387606010" label="ArcBootCompletedBroadcast:enabled"/>
   <int value="-385337473" label="enable-fast-unload"/>
   <int value="-384589459" label="disable-supervised-user-safesites"/>
@@ -91949,7 +92035,7 @@
   <int value="0"
       label="NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC: accuracy of system clock is
              unknown because there is no information available from the
-             network about what time it is"/>
+             network about what time it is (OBSOLETE)"/>
   <int value="1"
       label="NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST: system clock is unknown
              because the system clock has fallen out of sync with the network
@@ -91963,6 +92049,23 @@
   <int value="4"
       label="NETWORK_CLOCK_STATE_CLOCK_IN_FUTURE: system clock is in the
              future relative to network time"/>
+  <int value="5"
+      label="NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT: accuracy of system
+             clock is unknown because there has not yet been any attempt to
+             query the network clock"/>
+  <int value="6"
+      label="NETWORK_CLOCK_STATE_UNKNOWN_NO_SUCCESSFUL_SYNC: accuracy of
+             system clock is unknown because one or more attempts to sync
+             with the network clock have failed"/>
+  <int value="7"
+      label="NETWORK_CLOCK_STATE_UNKNOWN_FIRST_SYNC_PENDING: accuracy of
+             system clock is unknown because the first attempt to sync with
+             the network clock is pending"/>
+  <int value="8"
+      label="NETWORK_CLOCK_STATE_UNKNOWN_SUBSEQUENT_SYNC_PENDING: accuracy of
+             system clock is unknown because one or more attempts to sync
+             with the network clock have failed, and a subsequent attempt is
+             pending"/>
 </enum>
 
 <enum name="NetworkConnectionIPType" type="int">
@@ -99409,6 +99512,17 @@
   <int value="196" label="TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256"/>
   <int value="197" label="TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256"/>
   <int value="255" label="TLS_EMPTY_RENEGOTIATION_INFO_SCSV"/>
+  <int value="4865" label="TLS_AES_128_GCM_SHA256"/>
+  <int value="4866" label="TLS_AES_256_GCM_SHA384"/>
+  <int value="4867" label="TLS_CHACHA20_POLY1305_SHA256"/>
+  <int value="5815"
+      label="TLS_CECPQ1_RSA_WITH_CHACHA20_POLY1305_SHA256 (experimental)"/>
+  <int value="5816"
+      label="TLS_CECPQ1_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (experimental)"/>
+  <int value="5817"
+      label="TLS_CECPQ1_RSA_WITH_AES_256_GCM_SHA384 (experimental)"/>
+  <int value="5818"
+      label="TLS_CECPQ1_ECDSA_WITH_AES_256_GCM_SHA384 (experimental)"/>
   <int value="49153" label="TLS_ECDH_ECDSA_WITH_NULL_SHA"/>
   <int value="49154" label="TLS_ECDH_ECDSA_WITH_RC4_128_SHA"/>
   <int value="49155" label="TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA"/>
@@ -108041,7 +108155,11 @@
   <affected-histogram name="PageLoad.AbortTiming.Reload"/>
   <affected-histogram name="PageLoad.AbortTiming.Stop"/>
   <affected-histogram name="PageLoad.AbortTiming.UnknownNavigation"/>
-  <affected-histogram name="PageLoad.Timing2.NavigationToFirstBackground"/>
+  <affected-histogram name="PageLoad.Timing2.NavigationToFirstBackground">
+    <obsolete>
+      deprecated in favor of PageLoad.AbortTiming.Background.*
+    </obsolete>
+  </affected-histogram>
 </histogram_suffixes>
 
 <histogram_suffixes name="PageLoadMetricsCacheInfo" separator=".">
@@ -109027,6 +109145,7 @@
   <affected-histogram name="Compositing.Browser.RasterTask.RasterUs"/>
   <affected-histogram name="Compositing.Renderer.RasterTask.RasterPixelsPerMs"/>
   <affected-histogram name="Compositing.Renderer.RasterTask.RasterUs"/>
+  <affected-histogram name="Renderer4.ImageDecodeTaskDurationUs"/>
 </histogram_suffixes>
 
 <histogram_suffixes name="RemoteProcessWarmStartFast" separator="">
diff --git a/ui/accessibility/ax_enums.idl b/ui/accessibility/ax_enums.idl
index 89d38422..d845301 100644
--- a/ui/accessibility/ax_enums.idl
+++ b/ui/accessibility/ax_enums.idl
@@ -210,6 +210,7 @@
     expanded,
     focusable,
     haspopup,
+    // Grows horizontally, e.g. most toolbars and separators.
     horizontal,
     hovered,
     invisible,
@@ -224,6 +225,7 @@
     richly_editable,
     selectable,
     selected,
+    // Grows vertically, e.g. menu or combo box.
     vertical,
     visited
   };
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc
index 814f383c..ed9f8cc80 100644
--- a/ui/accessibility/platform/ax_platform_node_win.cc
+++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -511,6 +511,8 @@
   *states = IA2_STATE_OPAQUE;
   if (GetData().state & (1 << ui::AX_STATE_EDITABLE))
     *states |= IA2_STATE_EDITABLE;
+  if (GetData().state & (1 << ui::AX_STATE_VERTICAL))
+    *states |= IA2_STATE_VERTICAL;
 
   return S_OK;
 }
diff --git a/ui/android/BUILD.gn b/ui/android/BUILD.gn
index 5a363de..a80245be 100644
--- a/ui/android/BUILD.gn
+++ b/ui/android/BUILD.gn
@@ -164,6 +164,7 @@
     "java/src/org/chromium/ui/base/WindowAndroid.java",
     "java/src/org/chromium/ui/display/DisplayAndroid.java",
     "java/src/org/chromium/ui/display/DisplayAndroidManager.java",
+    "java/src/org/chromium/ui/display/DisplaySwitches.java",
     "java/src/org/chromium/ui/gfx/BitmapHelper.java",
     "java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
     "java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
diff --git a/ui/android/java/src/org/chromium/ui/base/ResourceBundle.java b/ui/android/java/src/org/chromium/ui/base/ResourceBundle.java
index adbf8af..c1965b4 100644
--- a/ui/android/java/src/org/chromium/ui/base/ResourceBundle.java
+++ b/ui/android/java/src/org/chromium/ui/base/ResourceBundle.java
@@ -4,18 +4,11 @@
 
 package org.chromium.ui.base;
 
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-
-import org.chromium.base.ResourceExtractor;
-import org.chromium.base.ThreadUtils;
+import org.chromium.base.BuildConfig;
 import org.chromium.base.annotations.CalledByNative;
 import org.chromium.base.annotations.JNINamespace;
-import org.chromium.base.annotations.SuppressFBWarnings;
 
-import java.io.File;
-import java.util.Locale;
+import java.util.Arrays;
 
 /**
  * This class provides the resource bundle related methods for the native
@@ -23,67 +16,10 @@
  */
 @JNINamespace("ui")
 public class ResourceBundle {
-    private static ResourceExtractor.ResourceEntry[] sActiveLocaleResources;
-
-    /**
-     * Applies the reverse mapping done by locale_pak_resources.py.
-     */
-    private static String toChromeLocaleName(String srcFileName) {
-        srcFileName = srcFileName.replace(".lpak", ".pak");
-        String[] parts = srcFileName.split("_");
-        if (parts.length > 1) {
-            int dotIdx = parts[1].indexOf('.');
-            return parts[0] + "-" + parts[1].substring(0, dotIdx).toUpperCase(Locale.ENGLISH)
-                    + parts[1].substring(dotIdx);
-        }
-        return srcFileName;
-    }
-
-    /**
-     * Initializes the list of locale packs for the active locale that are
-     * present within the apk.
-     *
-     * @param context Any context
-     * @param localePaksResId Resource ID locale_paks (generated by
-     *            locale_pak_resources.py)
-     */
-    @SuppressFBWarnings("LI_LAZY_INIT_UPDATE_STATIC")  // Not thread-safe.
-    public static void initializeLocalePaks(Context context, int localePaksResId) {
-        ThreadUtils.assertOnUiThread();
-        assert sActiveLocaleResources == null;
-        Resources resources = context.getResources();
-        TypedArray resIds = resources.obtainTypedArray(localePaksResId);
-        try {
-            int len = resIds.length();
-            sActiveLocaleResources = new ResourceExtractor.ResourceEntry[len];
-            for (int i = 0; i < len; ++i) {
-                int resId = resIds.getResourceId(i, 0);
-                String resPath = resources.getString(resId);
-                String srcBaseName = new File(resPath).getName();
-                String dstBaseName = toChromeLocaleName(srcBaseName);
-                sActiveLocaleResources[i] = new ResourceExtractor.ResourceEntry(resId, resPath,
-                        dstBaseName);
-            }
-        } finally {
-            resIds.recycle();
-        }
-    }
-
-    @SuppressFBWarnings("MS_EXPOSE_REP")  // Don't modify the array.
-    public static ResourceExtractor.ResourceEntry[] getActiveLocaleResources() {
-        return sActiveLocaleResources;
-    }
-
     @CalledByNative
     private static String getLocalePakResourcePath(String locale) {
-        if (sActiveLocaleResources == null) {
-            return null;
-        }
-        String fileName = locale + ".pak";
-        for (ResourceExtractor.ResourceEntry entry : sActiveLocaleResources) {
-            if (fileName.equals(entry.extractedFileName)) {
-                return entry.pathWithinApk;
-            }
+        if (Arrays.binarySearch(BuildConfig.UNCOMPRESSED_LOCALES, locale) >= 0) {
+            return "assets/" + locale + ".pak";
         }
         return null;
     }
diff --git a/ui/android/java/src/org/chromium/ui/display/DisplayAndroid.java b/ui/android/java/src/org/chromium/ui/display/DisplayAndroid.java
index c2d3dd3..075754c76 100644
--- a/ui/android/java/src/org/chromium/ui/display/DisplayAndroid.java
+++ b/ui/android/java/src/org/chromium/ui/display/DisplayAndroid.java
@@ -11,6 +11,9 @@
 import android.util.DisplayMetrics;
 import android.view.Display;
 
+import org.chromium.base.CommandLine;
+import org.chromium.base.Log;
+
 import java.util.WeakHashMap;
 
 /**
@@ -33,6 +36,8 @@
         void onRotationChanged(int rotation);
     }
 
+    private static final String TAG = "DisplayAndroid";
+
     private static final DisplayAndroidObserver[] EMPTY_OBSERVER_ARRAY =
             new DisplayAndroidObserver[0];
 
@@ -46,6 +51,37 @@
     private final DisplayMetrics mDisplayMetrics;
     private int mRotation;
 
+    // When this object exists, a positive value means that the forced DIP scale is set and
+    // the zero means it is not. The non existing object (i.e. null reference) means that
+    // the existence and value of the forced DIP scale has not yet been determined.
+    private static Float sForcedDIPScale;
+
+    private static boolean hasForcedDIPScale() {
+        if (sForcedDIPScale == null) {
+            String forcedScaleAsString = CommandLine.getInstance().getSwitchValue(
+                    DisplaySwitches.FORCE_DEVICE_SCALE_FACTOR);
+            if (forcedScaleAsString == null) {
+                sForcedDIPScale = Float.valueOf(0.0f);
+            } else {
+                boolean isInvalid = false;
+                try {
+                    sForcedDIPScale = Float.valueOf(forcedScaleAsString);
+                    // Negative values are discarded.
+                    if (sForcedDIPScale.floatValue() <= 0.0f) isInvalid = true;
+                } catch (NumberFormatException e) {
+                    // Strings that do not represent numbers are discarded.
+                    isInvalid = true;
+                }
+
+                if (isInvalid) {
+                    Log.w(TAG, "Ignoring invalid forced DIP scale '" + forcedScaleAsString + "'");
+                    sForcedDIPScale = Float.valueOf(0.0f);
+                }
+            }
+        }
+        return sForcedDIPScale.floatValue() > 0;
+    }
+
     private static DisplayAndroidManager getManager() {
         return DisplayAndroidManager.getInstance();
     }
@@ -98,7 +134,7 @@
     /**
      * @return A scaling factor for the Density Independent Pixel unit.
      */
-    public double getDIPScale() {
+    public float getDIPScale() {
         return mDisplayMetrics.density;
     }
 
@@ -147,6 +183,8 @@
         display.getSize(mSize);
         display.getMetrics(mDisplayMetrics);
 
+        if (hasForcedDIPScale()) mDisplayMetrics.density = sForcedDIPScale.floatValue();
+
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
             display.getRealSize(mPhysicalSize);
         }
diff --git a/ui/android/java/src/org/chromium/ui/display/DisplaySwitches.java b/ui/android/java/src/org/chromium/ui/display/DisplaySwitches.java
new file mode 100644
index 0000000..c64bfaa
--- /dev/null
+++ b/ui/android/java/src/org/chromium/ui/display/DisplaySwitches.java
@@ -0,0 +1,16 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.ui.display;
+
+/**
+ * Contains all of the command line switches that are specific to the display.
+ */
+public abstract class DisplaySwitches {
+    // Native switch - display_switches::kForceDeviceScaleFactor
+    public static final String FORCE_DEVICE_SCALE_FACTOR = "force-device-scale-factor";
+
+    // Prevent instantiation.
+    private DisplaySwitches() {}
+}
diff --git a/ui/android/java/src/org/chromium/ui/display/OWNERS b/ui/android/java/src/org/chromium/ui/display/OWNERS
new file mode 100644
index 0000000..57a0c64
--- /dev/null
+++ b/ui/android/java/src/org/chromium/ui/display/OWNERS
@@ -0,0 +1 @@
+boliu@chromium.org
diff --git a/ui/base/win/osk_display_manager.cc b/ui/base/win/osk_display_manager.cc
index 251f59c..c3abb9fc 100644
--- a/ui/base/win/osk_display_manager.cc
+++ b/ui/base/win/osk_display_manager.cc
@@ -237,11 +237,8 @@
 }
 
 void OnScreenKeyboardDetector::ClearObservers() {
-  base::ObserverListBase<OnScreenKeyboardObserver>::Iterator iter(&observers_);
-  for (OnScreenKeyboardObserver* observer = iter.GetNext(); observer;
-       observer = iter.GetNext()) {
-    RemoveObserver(observer);
-  }
+  for (auto& observer : observers_)
+    RemoveObserver(&observer);
 }
 
 // OnScreenKeyboardDisplayManager member definitions.
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index eced10a..1ee75e7 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -295,7 +295,8 @@
   // will also commit.  This should probably just redraw the screen
   // from damage and not commit.  ScheduleDraw/ScheduleRedraw need
   // better names.
-  host_->SetNeedsRedraw();
+  host_->SetNeedsRedrawRect(
+      gfx::Rect(host_->GetLayerTree()->device_viewport_size()));
   host_->SetNeedsCommit();
 }
 
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc
index 4fb3dc7..0a5bc53b 100644
--- a/ui/compositor/test/in_process_context_factory.cc
+++ b/ui/compositor/test/in_process_context_factory.cc
@@ -104,7 +104,7 @@
   void ApplyExternalStencil() override {}
 
  private:
-  void OnSwapBuffersComplete() { client_->DidSwapBuffersComplete(); }
+  void OnSwapBuffersComplete() { client_->DidReceiveSwapBuffersAck(); }
 
   base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_;
 
diff --git a/ui/gfx/vector_icons/BUILD.gn b/ui/gfx/vector_icons/BUILD.gn
index 0108979..e836348 100644
--- a/ui/gfx/vector_icons/BUILD.gn
+++ b/ui/gfx/vector_icons/BUILD.gn
@@ -82,6 +82,7 @@
     "menu_check.icon",
     "menu_radio_empty.icon",
     "menu_radio_selected.icon",
+    "microphone.icon",
     "midi.icon",
     "mixed_content.icon",
     "mode_edit.icon",
diff --git a/ui/gfx/vector_icons/microphone.icon b/ui/gfx/vector_icons/microphone.icon
new file mode 100644
index 0000000..8c7962a
--- /dev/null
+++ b/ui/gfx/vector_icons/microphone.icon
@@ -0,0 +1,24 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+MOVE_TO, 24, 30,
+R_CUBIC_TO, 3.31f, 0, 5.98f, -2.69f, 5.98f, -6,
+LINE_TO, 30, 12,
+R_CUBIC_TO, 0, -3.32f, -2.68f, -6, -6, -6,
+R_CUBIC_TO, -3.31f, 0, -6, 2.68f, -6, 6,
+R_V_LINE_TO, 12,
+R_CUBIC_TO, 0, 3.31f, 2.69f, 6, 6, 6,
+CLOSE,
+R_MOVE_TO, 10.6f, -6,
+R_CUBIC_TO, 0, 6, -5.07f, 10.2f, -10.6f, 10.2f,
+R_CUBIC_TO, -5.52f, 0, -10.6f, -4.2f, -10.6f, -10.2f,
+H_LINE_TO, 10,
+R_CUBIC_TO, 0, 6.83f, 5.44f, 12.47f, 12, 13.44f,
+V_LINE_TO, 44,
+R_H_LINE_TO, 4,
+R_V_LINE_TO, -6.56f,
+R_CUBIC_TO, 6.56f, -0.97f, 12, -6.61f, 12, -13.44f,
+R_H_LINE_TO, -3.4f,
+CLOSE,
+END
diff --git a/ui/ozone/platform/drm/BUILD.gn b/ui/ozone/platform/drm/BUILD.gn
index 87ff951..22f8265 100644
--- a/ui/ozone/platform/drm/BUILD.gn
+++ b/ui/ozone/platform/drm/BUILD.gn
@@ -126,7 +126,7 @@
     "//base",
     "//ipc",
     "//mojo/common:common_base",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/public/cpp:sources",
     "//skia",
     "//third_party/minigbm",
     "//ui/base",
diff --git a/ui/ozone/platform/drm/DEPS b/ui/ozone/platform/drm/DEPS
index ab6e967..ebc35bed 100644
--- a/ui/ozone/platform/drm/DEPS
+++ b/ui/ozone/platform/drm/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
   "+mojo/public",
-  "+services/shell",
+  "+services/service_manager",
   "+ui/display/util",
 ]
diff --git a/ui/ozone/platform/drm/cursor_proxy_mojo.cc b/ui/ozone/platform/drm/cursor_proxy_mojo.cc
index dc50767..692de69 100644
--- a/ui/ozone/platform/drm/cursor_proxy_mojo.cc
+++ b/ui/ozone/platform/drm/cursor_proxy_mojo.cc
@@ -4,11 +4,11 @@
 
 #include "ui/ozone/platform/drm/cursor_proxy_mojo.h"
 
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 
 namespace ui {
 
-CursorProxyMojo::CursorProxyMojo(shell::Connector* connector)
+CursorProxyMojo::CursorProxyMojo(service_manager::Connector* connector)
     : connector_(connector->Clone()) {
   connector->ConnectToInterface("service:ui", &main_cursor_ptr_);
 }
diff --git a/ui/ozone/platform/drm/cursor_proxy_mojo.h b/ui/ozone/platform/drm/cursor_proxy_mojo.h
index 8a67b91..33577aee 100644
--- a/ui/ozone/platform/drm/cursor_proxy_mojo.h
+++ b/ui/ozone/platform/drm/cursor_proxy_mojo.h
@@ -10,7 +10,7 @@
 #include "ui/ozone/platform/drm/host/drm_cursor.h"
 #include "ui/ozone/public/interfaces/device_cursor.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -23,7 +23,7 @@
 // priviledged process.
 class CursorProxyMojo : public DrmCursorProxy {
  public:
-  explicit CursorProxyMojo(shell::Connector* connector);
+  explicit CursorProxyMojo(service_manager::Connector* connector);
   ~CursorProxyMojo() override;
 
  private:
@@ -35,7 +35,7 @@
   void Move(gfx::AcceleratedWidget window, const gfx::Point& point) override;
   void InitializeOnEvdev() override;
 
-  std::unique_ptr<shell::Connector> connector_;
+  std::unique_ptr<service_manager::Connector> connector_;
 
   // Mojo implementation of the DrmCursorProxy.
   ui::ozone::mojom::DeviceCursorPtr main_cursor_ptr_;
diff --git a/ui/ozone/platform/drm/gpu/drm_thread.cc b/ui/ozone/platform/drm/gpu/drm_thread.cc
index dd635013f..c323227 100644
--- a/ui/ozone/platform/drm/gpu/drm_thread.cc
+++ b/ui/ozone/platform/drm/gpu/drm_thread.cc
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 #include "ui/ozone/platform/drm/gpu/drm_buffer.h"
 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h"
 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
diff --git a/ui/ozone/platform/drm/gpu/drm_thread.h b/ui/ozone/platform/drm/gpu/drm_thread.h
index 9dd42f7..cdf9148 100644
--- a/ui/ozone/platform/drm/gpu/drm_thread.h
+++ b/ui/ozone/platform/drm/gpu/drm_thread.h
@@ -14,7 +14,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/shell/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connection.h"
 #include "ui/gfx/native_pixmap_handle.h"
 #include "ui/gfx/native_widget_types.h"
 #include "ui/gfx/vsync_provider.h"
@@ -31,7 +31,7 @@
 class Rect;
 }
 
-namespace shell {
+namespace service_manager {
 class Connection;
 }
 
diff --git a/ui/ozone/platform/drm/gpu/drm_thread_proxy.h b/ui/ozone/platform/drm/gpu/drm_thread_proxy.h
index 83752113..1d3905a 100644
--- a/ui/ozone/platform/drm/gpu/drm_thread_proxy.h
+++ b/ui/ozone/platform/drm/gpu/drm_thread_proxy.h
@@ -12,7 +12,7 @@
 #include "ui/ozone/platform/drm/gpu/drm_thread.h"
 #include "ui/ozone/public/interfaces/device_cursor.mojom.h"
 
-namespace shell {
+namespace service_manager {
 class Connection;
 }
 
diff --git a/ui/ozone/platform/drm/ozone_platform_gbm.cc b/ui/ozone/platform/drm/ozone_platform_gbm.cc
index 9a97e0a..31e76f51 100644
--- a/ui/ozone/platform/drm/ozone_platform_gbm.cc
+++ b/ui/ozone/platform/drm/ozone_platform_gbm.cc
@@ -17,8 +17,8 @@
 #include "base/command_line.h"
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/interface_registry.h"
+#include "services/service_manager/public/cpp/interface_factory.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
 #include "ui/events/ozone/device/device_manager.h"
 #include "ui/events/ozone/evdev/event_factory_evdev.h"
@@ -80,7 +80,7 @@
 
 class OzonePlatformGbm
     : public OzonePlatform,
-      public shell::InterfaceFactory<ozone::mojom::DeviceCursor> {
+      public service_manager::InterfaceFactory<ozone::mojom::DeviceCursor> {
  public:
   OzonePlatformGbm() : using_mojo_(false), single_process_(false) {}
   ~OzonePlatformGbm() override {}
@@ -107,11 +107,11 @@
   std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
     return event_factory_ozone_->CreateSystemInputInjector();
   }
-  void AddInterfaces(shell::InterfaceRegistry* registry) override {
+  void AddInterfaces(service_manager::InterfaceRegistry* registry) override {
     registry->AddInterface<ozone::mojom::DeviceCursor>(this);
   }
-  // shell::InterfaceFactory<ozone::mojom::DeviceCursor> implementation.
-  void Create(const shell::Identity& remote_identity,
+  // service_manager::InterfaceFactory<ozone::mojom::DeviceCursor>:
+  void Create(const service_manager::Identity& remote_identity,
               ozone::mojom::DeviceCursorRequest request) override {
     if (drm_thread_proxy_)
       drm_thread_proxy_->AddBinding(std::move(request));
diff --git a/ui/ozone/public/ozone_platform.cc b/ui/ozone/public/ozone_platform.cc
index bbe44da..6f25a1b1 100644
--- a/ui/ozone/public/ozone_platform.cc
+++ b/ui/ozone/public/ozone_platform.cc
@@ -101,6 +101,7 @@
 IPC::MessageFilter* OzonePlatform::GetGpuMessageFilter() {
   return nullptr;
 }
-void OzonePlatform::AddInterfaces(shell::InterfaceRegistry* registry) {}
+void OzonePlatform::AddInterfaces(
+    service_manager::InterfaceRegistry* registry) {}
 
 }  // namespace ui
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h
index f530af37..93b08d22 100644
--- a/ui/ozone/public/ozone_platform.h
+++ b/ui/ozone/public/ozone_platform.h
@@ -18,7 +18,7 @@
 class MessageFilter;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 class InterfaceRegistry;
 }
@@ -60,7 +60,7 @@
     // Ozone may retain this pointer for later use. An Ozone platform embedder
     // must set this parameter in order for the Ozone platform implementation to
     // be able to use Mojo.
-    shell::Connector* connector = nullptr;
+    service_manager::Connector* connector = nullptr;
 
     // Setting this to true indicates that the platform implementation should
     // operate as a single process for platforms (i.e. drm) that are usually
@@ -108,12 +108,12 @@
   // Ozone platform implementations may also choose to expose mojo interfaces to
   // internal functionality. Embedders wishing to take advantage of ozone mojo
   // implementations must invoke AddInterfaces with a valid
-  // shell::InterfaceRegistry* pointer to export all Mojo interfaces defined
-  // within Ozone.
+  // service_manager::InterfaceRegistry* pointer to export all Mojo interfaces
+  // defined within Ozone.
   //
   // A default do-nothing implementation is provided to permit platform
   // implementations to opt out of implementing any Mojo interfaces.
-  virtual void AddInterfaces(shell::InterfaceRegistry* registry);
+  virtual void AddInterfaces(service_manager::InterfaceRegistry* registry);
 
  private:
   virtual void InitializeUI() = 0;
diff --git a/ui/resources/default_100_percent/common/signal_0_bar.png b/ui/resources/default_100_percent/common/signal_0_bar.png
index f68a8a72..1ea4b5d 100644
--- a/ui/resources/default_100_percent/common/signal_0_bar.png
+++ b/ui/resources/default_100_percent/common/signal_0_bar.png
Binary files differ
diff --git a/ui/resources/default_100_percent/common/signal_1_bar.png b/ui/resources/default_100_percent/common/signal_1_bar.png
index a33489c7..60d2dc4 100644
--- a/ui/resources/default_100_percent/common/signal_1_bar.png
+++ b/ui/resources/default_100_percent/common/signal_1_bar.png
Binary files differ
diff --git a/ui/resources/default_100_percent/common/signal_2_bar.png b/ui/resources/default_100_percent/common/signal_2_bar.png
index 375738f0..2ef5894 100644
--- a/ui/resources/default_100_percent/common/signal_2_bar.png
+++ b/ui/resources/default_100_percent/common/signal_2_bar.png
Binary files differ
diff --git a/ui/resources/default_100_percent/common/signal_3_bar.png b/ui/resources/default_100_percent/common/signal_3_bar.png
index 1cc3530..0fe3cd7 100644
--- a/ui/resources/default_100_percent/common/signal_3_bar.png
+++ b/ui/resources/default_100_percent/common/signal_3_bar.png
Binary files differ
diff --git a/ui/resources/default_100_percent/common/signal_4_bar.png b/ui/resources/default_100_percent/common/signal_4_bar.png
index 3862db0..b7d639b9 100644
--- a/ui/resources/default_100_percent/common/signal_4_bar.png
+++ b/ui/resources/default_100_percent/common/signal_4_bar.png
Binary files differ
diff --git a/ui/resources/default_200_percent/common/signal_0_bar.png b/ui/resources/default_200_percent/common/signal_0_bar.png
index 8476900..140260d 100644
--- a/ui/resources/default_200_percent/common/signal_0_bar.png
+++ b/ui/resources/default_200_percent/common/signal_0_bar.png
Binary files differ
diff --git a/ui/resources/default_200_percent/common/signal_1_bar.png b/ui/resources/default_200_percent/common/signal_1_bar.png
index da252a73..06e51c2 100644
--- a/ui/resources/default_200_percent/common/signal_1_bar.png
+++ b/ui/resources/default_200_percent/common/signal_1_bar.png
Binary files differ
diff --git a/ui/resources/default_200_percent/common/signal_2_bar.png b/ui/resources/default_200_percent/common/signal_2_bar.png
index a29c55c..cc42dbb9 100644
--- a/ui/resources/default_200_percent/common/signal_2_bar.png
+++ b/ui/resources/default_200_percent/common/signal_2_bar.png
Binary files differ
diff --git a/ui/resources/default_200_percent/common/signal_3_bar.png b/ui/resources/default_200_percent/common/signal_3_bar.png
index 10a2595..3a94ec5c 100644
--- a/ui/resources/default_200_percent/common/signal_3_bar.png
+++ b/ui/resources/default_200_percent/common/signal_3_bar.png
Binary files differ
diff --git a/ui/resources/default_200_percent/common/signal_4_bar.png b/ui/resources/default_200_percent/common/signal_4_bar.png
index 9111744..51d1da4 100644
--- a/ui/resources/default_200_percent/common/signal_4_bar.png
+++ b/ui/resources/default_200_percent/common/signal_4_bar.png
Binary files differ
diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc
index a126820..0612dff 100644
--- a/ui/views/controls/menu/menu_scroll_view_container.cc
+++ b/ui/views/controls/menu/menu_scroll_view_container.cc
@@ -260,8 +260,6 @@
     ui::AXViewState* state) {
   // Get the name from the submenu view.
   content_view_->GetAccessibleState(state);
-
-  // Now change the role.
   state->role = ui::AX_ROLE_MENU_BAR;
 }
 
diff --git a/ui/views/controls/menu/submenu_view.cc b/ui/views/controls/menu/submenu_view.cc
index a04d832..b09eadd 100644
--- a/ui/views/controls/menu/submenu_view.cc
+++ b/ui/views/controls/menu/submenu_view.cc
@@ -182,10 +182,13 @@
 }
 
 void SubmenuView::GetAccessibleState(ui::AXViewState* state) {
-  // Inherit most of the state from the parent menu item, except the role.
+  // Inherit most of the state from the parent menu item, except the role and
+  // the orientation.
   if (GetMenuItem())
     GetMenuItem()->GetAccessibleState(state);
   state->role = ui::AX_ROLE_MENU_LIST_POPUP;
+  // Menus in Chrome are always traversed in a vertical direction.
+  state->AddStateFlag(ui::AX_STATE_VERTICAL);
 }
 
 void SubmenuView::PaintChildren(const ui::PaintContext& context) {
diff --git a/ui/views/mus/BUILD.gn b/ui/views/mus/BUILD.gn
index e9fa218..91055ea 100644
--- a/ui/views/mus/BUILD.gn
+++ b/ui/views/mus/BUILD.gn
@@ -4,8 +4,8 @@
 
 import("//build/config/features.gni")
 import("//build/config/ui.gni")
-import("//services/shell/public/cpp/service.gni")
-import("//services/shell/public/service_manifest.gni")
+import("//services/service_manager/public/cpp/service.gni")
+import("//services/service_manager/public/service_manifest.gni")
 import("//testing/test.gni")
 import("//tools/grit/repack.gni")
 
@@ -64,8 +64,8 @@
     "//mojo/public/cpp/bindings",
     "//net",
     "//services/catalog/public/cpp",
-    "//services/shell/public/cpp",
-    "//services/shell/public/interfaces",
+    "//services/service_manager/public/cpp",
+    "//services/service_manager/public/interfaces",
     "//services/ui/public/cpp",
     "//services/ui/public/interfaces",
     "//skia",
@@ -131,9 +131,9 @@
     ":mus",
     "//base",
     "//base/test:test_support",
-    "//services/shell/background:lib",
-    "//services/shell/background/tests:test_support",
-    "//services/shell/public/cpp:sources",
+    "//services/service_manager/background:lib",
+    "//services/service_manager/background/tests:test_support",
+    "//services/service_manager/public/cpp:sources",
     "//services/ui/common:mus_common",
     "//testing/gtest",
     "//ui/aura",
@@ -172,7 +172,7 @@
     "//base/test:test_support",
     "//cc",
     "//net",
-    "//services/shell/background:main",  # Provides main().
+    "//services/service_manager/background:main",  # Provides main().
     "//services/ui/public/cpp",
     "//services/ui/public/cpp:internal_or_test",
     "//services/ui/public/cpp/tests:unittest_support",
@@ -250,7 +250,7 @@
     ":mus",
     ":test_support",
     "//base",
-    "//services/shell/background:main",  # Provides main().
+    "//services/service_manager/background:main",  # Provides main().
     "//testing/gmock",
     "//testing/gtest",
     "//ui/aura",
diff --git a/ui/views/mus/DEPS b/ui/views/mus/DEPS
index 83723b80..52eb513 100644
--- a/ui/views/mus/DEPS
+++ b/ui/views/mus/DEPS
@@ -9,7 +9,7 @@
   "+mojo/converters",
   "+mojo/public",
   "+services/catalog/public",
-  "+services/shell/public",
+  "+services/service_manager/public",
   "+services/ui",
   "+skia",
   "+ui/aura",
@@ -26,6 +26,6 @@
 
 specific_include_rules = {
   "views_mus_test_suite.cc": [
-    "+services/shell/background",
+    "+services/service_manager/background",
   ],
 }
diff --git a/ui/views/mus/aura_init.cc b/ui/views/mus/aura_init.cc
index 7499e86..937d6b3d 100644
--- a/ui/views/mus/aura_init.cc
+++ b/ui/views/mus/aura_init.cc
@@ -11,7 +11,7 @@
 #include "base/path_service.h"
 #include "build/build_config.h"
 #include "services/catalog/public/cpp/resource_loader.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/aura/env.h"
 #include "ui/base/ime/input_method_initializer.h"
 #include "ui/base/material_design/material_design_controller.h"
@@ -45,7 +45,7 @@
 
 }  // namespace
 
-AuraInit::AuraInit(shell::Connector* connector,
+AuraInit::AuraInit(service_manager::Connector* connector,
                    const std::string& resource_file,
                    const std::string& resource_file_200)
     : resource_file_(resource_file),
@@ -80,7 +80,7 @@
 #endif
 }
 
-void AuraInit::InitializeResources(shell::Connector* connector) {
+void AuraInit::InitializeResources(service_manager::Connector* connector) {
   // Resources may have already been initialized (e.g. when 'chrome --mash' is
   // used to launch the current app).
   if (ui::ResourceBundle::HasSharedInstance())
diff --git a/ui/views/mus/aura_init.h b/ui/views/mus/aura_init.h
index ac828327..45e8ea09 100644
--- a/ui/views/mus/aura_init.h
+++ b/ui/views/mus/aura_init.h
@@ -21,7 +21,7 @@
 class FontLoader;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -35,14 +35,14 @@
   // |resource_file| is the file to load strings and 1x icons from.
   // |resource_file_200| can be an empty string, otherwise it is the file to
   // load 2x icons from.
-  AuraInit(shell::Connector* connector,
+  AuraInit(service_manager::Connector* connector,
            const std::string& resource_file,
            const std::string& resource_file_200 = std::string());
 
   ~AuraInit();
 
  private:
-  void InitializeResources(shell::Connector* connector);
+  void InitializeResources(service_manager::Connector* connector);
 
 #if defined(OS_LINUX)
   sk_sp<font_service::FontLoader> font_loader_;
diff --git a/ui/views/mus/clipboard_mus.cc b/ui/views/mus/clipboard_mus.cc
index 5738e93..9dbfb72 100644
--- a/ui/views/mus/clipboard_mus.cc
+++ b/ui/views/mus/clipboard_mus.cc
@@ -13,7 +13,7 @@
 #include "base/strings/utf_string_conversions.h"
 #include "mojo/common/common_type_converters.h"
 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "ui/base/clipboard/custom_data_helper.h"
 #include "ui/gfx/codec/png_codec.h"
@@ -45,7 +45,7 @@
 
 ClipboardMus::~ClipboardMus() {}
 
-void ClipboardMus::Init(shell::Connector* connector) {
+void ClipboardMus::Init(service_manager::Connector* connector) {
   connector->ConnectToInterface("service:ui", &clipboard_);
 }
 
diff --git a/ui/views/mus/clipboard_mus.h b/ui/views/mus/clipboard_mus.h
index 9781a9a..9ba378b 100644
--- a/ui/views/mus/clipboard_mus.h
+++ b/ui/views/mus/clipboard_mus.h
@@ -9,7 +9,7 @@
 #include "ui/base/clipboard/clipboard.h"
 #include "ui/views/mus/mus_export.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -22,7 +22,7 @@
   ClipboardMus();
   ~ClipboardMus() override;
 
-  void Init(shell::Connector* connector);
+  void Init(service_manager::Connector* connector);
 
  private:
   bool HasMimeType(const mojo::Array<mojo::String>& available_types,
diff --git a/ui/views/mus/input_method_mus.cc b/ui/views/mus/input_method_mus.cc
index 8d5bb8b2..aceca35 100644
--- a/ui/views/mus/input_method_mus.cc
+++ b/ui/views/mus/input_method_mus.cc
@@ -27,7 +27,7 @@
 
 InputMethodMus::~InputMethodMus() {}
 
-void InputMethodMus::Init(shell::Connector* connector) {
+void InputMethodMus::Init(service_manager::Connector* connector) {
   connector->ConnectToInterface("service:ui", &ime_server_);
 }
 
diff --git a/ui/views/mus/input_method_mus.h b/ui/views/mus/input_method_mus.h
index aa5dd5d..b1f7475 100644
--- a/ui/views/mus/input_method_mus.h
+++ b/ui/views/mus/input_method_mus.h
@@ -9,7 +9,7 @@
 
 #include "base/macros.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/interfaces/ime.mojom.h"
 #include "ui/views/mus/mus_export.h"
 
@@ -27,7 +27,7 @@
                  ui::Window* window);
   ~InputMethodMus() override;
 
-  void Init(shell::Connector* connector);
+  void Init(service_manager::Connector* connector);
 
   // Overridden from ui::InputMethod:
   void OnFocus() override;
diff --git a/ui/views/mus/input_method_mus_unittest.cc b/ui/views/mus/input_method_mus_unittest.cc
index 1e31252..10e84c5 100644
--- a/ui/views/mus/input_method_mus_unittest.cc
+++ b/ui/views/mus/input_method_mus_unittest.cc
@@ -66,7 +66,7 @@
   InputMethodMusTest() : message_loop_(base::MessageLoop::TYPE_UI) {}
   ~InputMethodMusTest() override {}
 
-  shell::Connector* connector() {
+  service_manager::Connector* connector() {
     return WindowManagerConnection::Get()->connector();
   }
 
diff --git a/ui/views/mus/interactive_ui_tests_manifest.json b/ui/views/mus/interactive_ui_tests_manifest.json
index 0c32682..18ac1f45 100644
--- a/ui/views/mus/interactive_ui_tests_manifest.json
+++ b/ui/views/mus/interactive_ui_tests_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Views Mus Interactive UI Tests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/ui/views/mus/screen_mus.cc b/ui/views/mus/screen_mus.cc
index c983ae66..265bfbb 100644
--- a/ui/views/mus/screen_mus.cc
+++ b/ui/views/mus/screen_mus.cc
@@ -8,8 +8,8 @@
 
 #include "ui/views/mus/screen_mus.h"
 
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/aura/window.h"
 #include "ui/views/mus/native_widget_mus.h"
 #include "ui/views/mus/screen_mus_delegate.h"
@@ -41,7 +41,7 @@
 
 ScreenMus::~ScreenMus() {}
 
-void ScreenMus::Init(shell::Connector* connector) {
+void ScreenMus::Init(service_manager::Connector* connector) {
   connector->ConnectToInterface("service:ui", &display_manager_);
 
   display_manager_->AddObserver(
diff --git a/ui/views/mus/screen_mus.h b/ui/views/mus/screen_mus.h
index 8eff022..9866d0a 100644
--- a/ui/views/mus/screen_mus.h
+++ b/ui/views/mus/screen_mus.h
@@ -10,7 +10,7 @@
 #include "ui/display/screen_base.h"
 #include "ui/views/mus/mus_export.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -27,7 +27,7 @@
   explicit ScreenMus(ScreenMusDelegate* delegate);
   ~ScreenMus() override;
 
-  void Init(shell::Connector* connector);
+  void Init(service_manager::Connector* connector);
 
  private:
   // display::Screen:
diff --git a/ui/views/mus/unittests_manifest.json b/ui/views/mus/unittests_manifest.json
index 34924fb..b3d28c4 100644
--- a/ui/views/mus/unittests_manifest.json
+++ b/ui/views/mus/unittests_manifest.json
@@ -4,7 +4,7 @@
   "display_name": "Views Mus Unittests",
   "capabilities": {
     "required": {
-      "*": { "classes": [ "app" ] }
+      "*": [ "app" ]
     }
   }
 }
diff --git a/ui/views/mus/views_mus_test_suite.cc b/ui/views/mus/views_mus_test_suite.cc
index d23a2ee..a48bf40 100644
--- a/ui/views/mus/views_mus_test_suite.cc
+++ b/ui/views/mus/views_mus_test_suite.cc
@@ -13,10 +13,10 @@
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/simple_thread.h"
 #include "base/threading/thread.h"
-#include "services/shell/background/background_shell.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/service.h"
-#include "services/shell/public/cpp/service_context.h"
+#include "services/service_manager/background/background_shell.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "services/service_manager/public/cpp/service_context.h"
 #include "services/ui/common/switches.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/views/mus/window_manager_connection.h"
@@ -32,7 +32,7 @@
     cmd_line->AppendSwitch(name);
 }
 
-class DefaultService : public shell::Service {
+class DefaultService : public service_manager::Service {
  public:
   DefaultService() {}
   ~DefaultService() override {}
@@ -43,8 +43,8 @@
 
 class PlatformTestHelperMus : public PlatformTestHelper {
  public:
-  PlatformTestHelperMus(shell::Connector* connector,
-                        const shell::Identity& identity) {
+  PlatformTestHelperMus(service_manager::Connector* connector,
+                        const service_manager::Identity& identity) {
     // It is necessary to recreate the WindowManagerConnection for each test,
     // since a new MessageLoop is created for each test.
     connection_ = WindowManagerConnection::Create(connector, identity);
@@ -58,8 +58,8 @@
 };
 
 std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper(
-    const shell::Identity& identity,
-    const base::Callback<shell::Connector*(void)>& callback) {
+    const service_manager::Identity& identity,
+    const base::Callback<service_manager::Connector*(void)>& callback) {
   return base::MakeUnique<PlatformTestHelperMus>(callback.Run(), identity);
 }
 
@@ -67,7 +67,7 @@
 
 class ShellConnection {
  public:
-  ShellConnection() : thread_("Persistent shell connections") {
+  ShellConnection() : thread_("Persistent service_manager connections") {
     base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                              base::WaitableEvent::InitialState::NOT_SIGNALED);
     base::Thread::Options options;
@@ -83,7 +83,7 @@
     // been installed first. So delay the creation until the necessary
     // dependencies have been met.
     PlatformTestHelper::set_factory(base::Bind(
-        &CreatePlatformTestHelper, shell_identity_,
+        &CreatePlatformTestHelper, service_manager_identity_,
         base::Bind(&ShellConnection::GetConnector, base::Unretained(this))));
   }
 
@@ -97,40 +97,44 @@
   }
 
  private:
-  shell::Connector* GetConnector() {
-    shell_connector_.reset();
+  service_manager::Connector* GetConnector() {
+    service_manager_connector_.reset();
     base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                              base::WaitableEvent::InitialState::NOT_SIGNALED);
     thread_.task_runner()->PostTask(FROM_HERE,
                                     base::Bind(&ShellConnection::CloneConnector,
                                                base::Unretained(this), &wait));
     wait.Wait();
-    DCHECK(shell_connector_);
-    return shell_connector_.get();
+    DCHECK(service_manager_connector_);
+    return service_manager_connector_.get();
   }
 
   void CloneConnector(base::WaitableEvent* wait) {
-    shell_connector_ = shell_connection_->connector()->Clone();
+    service_manager_connector_ =
+        service_manager_connection_->connector()->Clone();
     wait->Signal();
   }
 
   void SetUpConnections(base::WaitableEvent* wait) {
-    background_shell_ = base::MakeUnique<shell::BackgroundShell>();
+    background_shell_ = base::MakeUnique<service_manager::BackgroundShell>();
     background_shell_->Init(nullptr);
     service_ = base::MakeUnique<DefaultService>();
-    shell_connection_ = base::MakeUnique<shell::ServiceContext>(
-        service_.get(), background_shell_->CreateServiceRequest(GetTestName()));
+    service_manager_connection_ =
+        base::MakeUnique<service_manager::ServiceContext>(
+            service_.get(),
+            background_shell_->CreateServiceRequest(GetTestName()));
 
     // ui/views/mus requires a WindowManager running, so launch test_wm.
-    shell::Connector* connector = shell_connection_->connector();
+    service_manager::Connector* connector =
+        service_manager_connection_->connector();
     connector->Connect("service:test_wm");
-    shell_connector_ = connector->Clone();
-    shell_identity_ = shell_connection_->identity();
+    service_manager_connector_ = connector->Clone();
+    service_manager_identity_ = service_manager_connection_->identity();
     wait->Signal();
   }
 
   void TearDownConnections(base::WaitableEvent* wait) {
-    shell_connection_.reset();
+    service_manager_connection_.reset();
     wait->Signal();
   }
 
@@ -144,11 +148,11 @@
   }
 
   base::Thread thread_;
-  std::unique_ptr<shell::BackgroundShell> background_shell_;
-  std::unique_ptr<shell::ServiceContext> shell_connection_;
+  std::unique_ptr<service_manager::BackgroundShell> background_shell_;
+  std::unique_ptr<service_manager::ServiceContext> service_manager_connection_;
   std::unique_ptr<DefaultService> service_;
-  std::unique_ptr<shell::Connector> shell_connector_;
-  shell::Identity shell_identity_;
+  std::unique_ptr<service_manager::Connector> service_manager_connector_;
+  service_manager::Identity service_manager_identity_;
 
   DISALLOW_COPY_AND_ASSIGN(ShellConnection);
 };
@@ -166,11 +170,11 @@
   EnsureCommandLineSwitch(ui::switches::kUseTestConfig);
 
   ViewsTestSuite::Initialize();
-  shell_connections_ = base::MakeUnique<ShellConnection>();
+  service_manager_connections_ = base::MakeUnique<ShellConnection>();
 }
 
 void ViewsMusTestSuite::Shutdown() {
-  shell_connections_.reset();
+  service_manager_connections_.reset();
   ViewsTestSuite::Shutdown();
 }
 
diff --git a/ui/views/mus/views_mus_test_suite.h b/ui/views/mus/views_mus_test_suite.h
index 0f801bf..8d167312 100644
--- a/ui/views/mus/views_mus_test_suite.h
+++ b/ui/views/mus/views_mus_test_suite.h
@@ -24,7 +24,7 @@
   void Initialize() override;
   void Shutdown() override;
 
-  std::unique_ptr<ShellConnection> shell_connections_;
+  std::unique_ptr<ShellConnection> service_manager_connections_;
 
   DISALLOW_COPY_AND_ASSIGN(ViewsMusTestSuite);
 };
diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc
index cde0c6f..75f7c382 100644
--- a/ui/views/mus/window_manager_connection.cc
+++ b/ui/views/mus/window_manager_connection.cc
@@ -11,8 +11,8 @@
 #include "base/lazy_instance.h"
 #include "base/memory/ptr_util.h"
 #include "base/threading/thread_local.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connection.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "services/ui/public/cpp/gpu_service.h"
 #include "services/ui/public/cpp/property_type_converters.h"
 #include "services/ui/public/cpp/window.h"
@@ -90,8 +90,8 @@
 
 // static
 std::unique_ptr<WindowManagerConnection> WindowManagerConnection::Create(
-    shell::Connector* connector,
-    const shell::Identity& identity,
+    service_manager::Connector* connector,
+    const service_manager::Identity& identity,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
   DCHECK(!lazy_tls_ptr.Pointer()->Get());
   WindowManagerConnection* connection =
@@ -139,8 +139,8 @@
 }
 
 WindowManagerConnection::WindowManagerConnection(
-    shell::Connector* connector,
-    const shell::Identity& identity,
+    service_manager::Connector* connector,
+    const service_manager::Identity& identity,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner)
     : connector_(connector), identity_(identity) {
   lazy_tls_ptr.Pointer()->Set(this);
diff --git a/ui/views/mus/window_manager_connection.h b/ui/views/mus/window_manager_connection.h
index 87aec11..e8aef93 100644
--- a/ui/views/mus/window_manager_connection.h
+++ b/ui/views/mus/window_manager_connection.h
@@ -14,14 +14,14 @@
 #include <vector>
 
 #include "base/macros.h"
-#include "services/shell/public/cpp/identity.h"
+#include "services/service_manager/public/cpp/identity.h"
 #include "services/ui/public/cpp/window_tree_client_delegate.h"
 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
 #include "ui/views/mus/mus_export.h"
 #include "ui/views/mus/screen_mus_delegate.h"
 #include "ui/views/widget/widget.h"
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -63,8 +63,8 @@
   // |io_task_runner| is used by the gpu service. If no task runner is provided,
   // then a new thread is created and used by ui::GpuService.
   static std::unique_ptr<WindowManagerConnection> Create(
-      shell::Connector* connector,
-      const shell::Identity& identity,
+      service_manager::Connector* connector,
+      const service_manager::Identity& identity,
       scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr);
   static WindowManagerConnection* Get();
   static bool Exists();
@@ -72,7 +72,7 @@
   PointerWatcherEventRouter* pointer_watcher_event_router() {
     return pointer_watcher_event_router_.get();
   }
-  shell::Connector* connector() { return connector_; }
+  service_manager::Connector* connector() { return connector_; }
   ui::GpuService* gpu_service() { return gpu_service_.get(); }
   ui::WindowTreeClient* client() { return client_.get(); }
 
@@ -90,8 +90,8 @@
   friend class test::WindowManagerConnectionTestApi;
 
   WindowManagerConnection(
-      shell::Connector* connector,
-      const shell::Identity& identity,
+      service_manager::Connector* connector,
+      const service_manager::Identity& identity,
       scoped_refptr<base::SingleThreadTaskRunner> task_runner);
 
   // ui::WindowTreeClientDelegate:
@@ -109,8 +109,8 @@
   // ui:OSExchangeDataProviderFactory::Factory:
   std::unique_ptr<OSExchangeData::Provider> BuildProvider() override;
 
-  shell::Connector* connector_;
-  shell::Identity identity_;
+  service_manager::Connector* connector_;
+  service_manager::Identity identity_;
   std::unique_ptr<ScreenMus> screen_;
   std::unique_ptr<ui::WindowTreeClient> client_;
   std::unique_ptr<ui::GpuService> gpu_service_;
diff --git a/ui/views/mus/window_tree_host_mus.cc b/ui/views/mus/window_tree_host_mus.cc
index 48ce26f..4af43f2 100644
--- a/ui/views/mus/window_tree_host_mus.cc
+++ b/ui/views/mus/window_tree_host_mus.cc
@@ -69,7 +69,7 @@
   DestroyDispatcher();
 }
 
-void WindowTreeHostMus::InitInputMethod(shell::Connector* connector) {
+void WindowTreeHostMus::InitInputMethod(service_manager::Connector* connector) {
   input_method_->Init(connector);
 }
 
diff --git a/ui/views/mus/window_tree_host_mus.h b/ui/views/mus/window_tree_host_mus.h
index 535aeb2..9afca03 100644
--- a/ui/views/mus/window_tree_host_mus.h
+++ b/ui/views/mus/window_tree_host_mus.h
@@ -6,7 +6,7 @@
 #define UI_VIEWS_MUS_WINDOW_TREE_HOST_MUS_H_
 
 #include "base/macros.h"
-#include "services/shell/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/connector.h"
 #include "ui/aura/window_tree_host_platform.h"
 #include "ui/views/mus/mus_export.h"
 
@@ -16,7 +16,7 @@
 class Window;
 }
 
-namespace shell {
+namespace service_manager {
 class Connector;
 }
 
@@ -32,7 +32,7 @@
   ~WindowTreeHostMus() override;
   NativeWidgetMus* native_widget() { return native_widget_; }
 
-  void InitInputMethod(shell::Connector* connector);
+  void InitInputMethod(service_manager::Connector* connector);
 
  private:
   // aura::WindowTreeHostPlatform: