diff --git a/AUTHORS b/AUTHORS
index 97e47b6..f5cf066f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -146,6 +146,7 @@
 Chris Szurgot <szurgotc@amazon.com>
 Christophe Dumez <ch.dumez@samsung.com>
 Christopher Dale <chrelad@gmail.com>
+Claudio DeSouza <claudiomdsjr@gmail.com>
 Clemens Fruhwirth <clemens@endorphin.org>
 Clement Scheelfeldt Skau <clementskau@gmail.com>
 Clinton Staley <clintstaley@chromium.org>
diff --git a/DEPS b/DEPS
index 2ca4243..f4abdc0 100644
--- a/DEPS
+++ b/DEPS
@@ -45,7 +45,7 @@
   # 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': '3024b9faa8799f1e46ebe4beb23e124ab892d269',
+  'v8_revision': '7010e26fb854aa21c569768174f12963aad24056',
   # 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.
@@ -57,7 +57,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling build tools
   # and whatever else without interference from each other.
-  'buildtools_revision': '26b7e66950e910d7cdd4c3faf780cca25a5ce39a',
+  'buildtools_revision': 'f6d165d9d842ddd29056c127a5f3a3c5d8e0d2e3',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling SwiftShader
   # and whatever else without interference from each other.
@@ -97,7 +97,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': '6be590cea27639a6550211f9064d6fb7a1c556be',
+  'catapult_revision': 'e1aa3179fac3ded8df9856820f270694572a10d3',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libFuzzer
   # and whatever else without interference from each other.
@@ -240,7 +240,7 @@
     Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067',
 
   'src/third_party/webrtc':
-    Var('webrtc_git') + '/src.git' + '@' + 'a730c1c5ae96c6534f96096d69da9e2ebe10f251', # commit position 19887
+    Var('webrtc_git') + '/src.git' + '@' + '99a81b613d754baad33f68a0c3f8fdd60ee8f186', # commit position 19911
 
   'src/third_party/openmax_dl':
     Var('webrtc_git') + '/deps/third_party/openmax.git' + '@' +  Var('openmax_dl_revision'),
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn
index b7cd868..096dc491 100644
--- a/android_webview/BUILD.gn
+++ b/android_webview/BUILD.gn
@@ -878,7 +878,7 @@
     ":android_webview_java_enums_srcjar",
     ":aw_error_ui",
     ":aw_safe_browsing_action",
-    "//components/safe_browsing_db:sb_threat_values",
+    "//components/safe_browsing/db:sb_threat_values",
   ]
 
   # Manifest used for linting (determining unused resources).
diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS
index a32c46a6..96eaa9b5 100644
--- a/android_webview/browser/DEPS
+++ b/android_webview/browser/DEPS
@@ -22,7 +22,6 @@
   "+components/printing/browser",
   "+components/printing/common",
   "+components/safe_browsing",
-  "+components/safe_browsing_db",
   "+components/security_interstitials",
   "+components/spellcheck/browser",
   "+components/spellcheck/common",
diff --git a/android_webview/browser/aw_safe_browsing_resource_throttle.cc b/android_webview/browser/aw_safe_browsing_resource_throttle.cc
index 93d733e..0e88b9d 100644
--- a/android_webview/browser/aw_safe_browsing_resource_throttle.cc
+++ b/android_webview/browser/aw_safe_browsing_resource_throttle.cc
@@ -8,8 +8,8 @@
 
 #include "android_webview/browser/aw_contents_client_bridge.h"
 #include "android_webview/browser/aw_safe_browsing_whitelist_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/features.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "net/url_request/url_request.h"
 
 namespace android_webview {
diff --git a/android_webview/browser/aw_safe_browsing_resource_throttle.h b/android_webview/browser/aw_safe_browsing_resource_throttle.h
index fb4405f0d..1316072 100644
--- a/android_webview/browser/aw_safe_browsing_resource_throttle.h
+++ b/android_webview/browser/aw_safe_browsing_resource_throttle.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "components/safe_browsing/base_resource_throttle.h"
 #include "components/safe_browsing/browser/base_parallel_resource_throttle.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/security_interstitials/content/unsafe_resource.h"
 #include "content/public/common/resource_type.h"
 
diff --git a/android_webview/browser/aw_url_checker_delegate_impl.cc b/android_webview/browser/aw_url_checker_delegate_impl.cc
index a425a6e..3bf5b1f6 100644
--- a/android_webview/browser/aw_url_checker_delegate_impl.cc
+++ b/android_webview/browser/aw_url_checker_delegate_impl.cc
@@ -9,8 +9,8 @@
 #include "android_webview/browser/aw_safe_browsing_whitelist_manager.h"
 #include "android_webview/browser/net/aw_web_resource_request.h"
 #include "base/bind.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/security_interstitials/content/unsafe_resource.h"
 #include "components/security_interstitials/core/urls.h"
 #include "content/public/browser/browser_thread.h"
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc
index 86874a5..6d4925b9 100644
--- a/base/trace_event/memory_dump_manager_unittest.cc
+++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -63,6 +63,7 @@
     kWhitelistedMDPName, kBackgroundButNotSummaryWhitelistedMDPName, nullptr};
 const char* const kTestMDPWhitelistForSummary[] = {kWhitelistedMDPName,
                                                    nullptr};
+
 void RegisterDumpProvider(
     MemoryDumpProvider* mdp,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner,
diff --git a/base/trace_event/memory_infra_background_whitelist.cc b/base/trace_event/memory_infra_background_whitelist.cc
index 38101c3..9bc4447 100644
--- a/base/trace_event/memory_infra_background_whitelist.cc
+++ b/base/trace_event/memory_infra_background_whitelist.cc
@@ -9,6 +9,8 @@
 
 #include <string>
 
+#include "base/strings/string_util.h"
+
 namespace base {
 namespace trace_event {
 namespace {
@@ -258,6 +260,14 @@
 }
 
 bool IsMemoryAllocatorDumpNameWhitelisted(const std::string& name) {
+  // Global dumps are explicitly whitelisted for background use.
+  if (base::StartsWith(name, "global/", CompareCase::SENSITIVE)) {
+    for (size_t i = sizeof("global/"); i < name.size(); i++)
+      if (!base::IsHexDigit(name[i]))
+        return false;
+    return true;
+  }
+
   // Remove special characters, numbers (including hexadecimal which are marked
   // by '0x') from the given string.
   const size_t length = name.size();
diff --git a/base/trace_event/process_memory_dump.cc b/base/trace_event/process_memory_dump.cc
index 82e55ac..17b7656f 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -244,14 +244,10 @@
 
 MemoryAllocatorDump* ProcessMemoryDump::CreateSharedGlobalAllocatorDump(
     const MemoryAllocatorDumpGuid& guid) {
-  // Global dumps are disabled in background mode.
-  if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND)
-    return GetBlackHoleMad();
-
   // A shared allocator dump can be shared within a process and the guid could
   // have been created already.
   MemoryAllocatorDump* mad = GetSharedGlobalAllocatorDump(guid);
-  if (mad) {
+  if (mad && mad != black_hole_mad_.get()) {
     // The weak flag is cleared because this method should create a non-weak
     // dump.
     mad->clear_flags(MemoryAllocatorDump::Flags::WEAK);
@@ -262,12 +258,8 @@
 
 MemoryAllocatorDump* ProcessMemoryDump::CreateWeakSharedGlobalAllocatorDump(
     const MemoryAllocatorDumpGuid& guid) {
-  // Global dumps are disabled in background mode.
-  if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND)
-    return GetBlackHoleMad();
-
   MemoryAllocatorDump* mad = GetSharedGlobalAllocatorDump(guid);
-  if (mad)
+  if (mad && mad != black_hole_mad_.get())
     return mad;
   mad = CreateAllocatorDump(GetSharedGlobalAllocatorDumpName(guid), guid);
   mad->set_flags(MemoryAllocatorDump::Flags::WEAK);
diff --git a/base/trace_event/process_memory_dump_unittest.cc b/base/trace_event/process_memory_dump_unittest.cc
index 4bc16fb..af73720 100644
--- a/base/trace_event/process_memory_dump_unittest.cc
+++ b/base/trace_event/process_memory_dump_unittest.cc
@@ -35,7 +35,7 @@
 const MemoryDumpArgs kDetailedDumpArgs = {MemoryDumpLevelOfDetail::DETAILED};
 const char* const kTestDumpNameWhitelist[] = {
     "Whitelisted/TestName", "Whitelisted/TestName_0x?",
-    "Whitelisted/0x?/TestName", nullptr};
+    "Whitelisted/0x?/TestName", "Whitelisted/0x?", nullptr};
 
 TracedValue* GetHeapDump(const ProcessMemoryDump& pmd, const char* name) {
   auto it = pmd.heap_dumps().find(name);
@@ -429,17 +429,17 @@
   EXPECT_EQ(black_hole_mad,
             pmd->CreateAllocatorDump("Whitelisted/TestName/__12/Google"));
 
-  // Global dumps.
-  MemoryAllocatorDumpGuid guid(1);
-  EXPECT_EQ(black_hole_mad, pmd->CreateSharedGlobalAllocatorDump(guid));
-  EXPECT_EQ(black_hole_mad, pmd->CreateWeakSharedGlobalAllocatorDump(guid));
-  EXPECT_EQ(black_hole_mad, pmd->GetSharedGlobalAllocatorDump(guid));
-
   // Suballocations.
+  MemoryAllocatorDumpGuid guid(1);
   pmd->AddSuballocation(guid, "malloc/allocated_objects");
   EXPECT_EQ(0u, pmd->allocator_dumps_edges_.size());
   EXPECT_EQ(0u, pmd->allocator_dumps_.size());
 
+  // Global dumps.
+  EXPECT_NE(black_hole_mad, pmd->CreateSharedGlobalAllocatorDump(guid));
+  EXPECT_NE(black_hole_mad, pmd->CreateWeakSharedGlobalAllocatorDump(guid));
+  EXPECT_NE(black_hole_mad, pmd->GetSharedGlobalAllocatorDump(guid));
+
   // Valid dump names.
   EXPECT_NE(black_hole_mad, pmd->CreateAllocatorDump("Whitelisted/TestName"));
   EXPECT_NE(black_hole_mad,
@@ -450,6 +450,21 @@
   // GetAllocatorDump is consistent.
   EXPECT_EQ(black_hole_mad, pmd->GetAllocatorDump("NotWhitelisted/TestName"));
   EXPECT_NE(black_hole_mad, pmd->GetAllocatorDump("Whitelisted/TestName"));
+
+  // Test whitelisted entries.
+  ASSERT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("Whitelisted/TestName"));
+
+  // Global dumps should be whitelisted.
+  ASSERT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("global/13456"));
+
+  // Global dumps with non-guids should not be.
+  ASSERT_FALSE(IsMemoryAllocatorDumpNameWhitelisted("global/random"));
+
+  // Random names should not.
+  ASSERT_FALSE(IsMemoryAllocatorDumpNameWhitelisted("NotWhitelisted/TestName"));
+
+  // Check hex processing.
+  ASSERT_TRUE(IsMemoryAllocatorDumpNameWhitelisted("Whitelisted/0xA1b2"));
 }
 
 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
diff --git a/chrome/android/java/res/layout/suggestions_site_tile_grid_modern.xml b/chrome/android/java/res/layout/suggestions_site_tile_grid_modern.xml
index 0429215..11364d1 100644
--- a/chrome/android/java/res/layout/suggestions_site_tile_grid_modern.xml
+++ b/chrome/android/java/res/layout/suggestions_site_tile_grid_modern.xml
@@ -9,6 +9,4 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_marginBottom="16dp"
-    android:layout_marginStart="@dimen/tile_grid_layout_padding_start"
-    android:layout_marginEnd="@dimen/tile_grid_layout_padding_end"
     android:layout_gravity="center_horizontal" />
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
index 3e3a93cb..54c5bfc2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java
@@ -262,7 +262,7 @@
                 /* observer = */ this, offlinePageBridge);
 
         mSiteSectionViewHolder =
-                SiteSection.createViewHolder(mNewTabPageLayout.getSiteSectionView());
+                SiteSection.createViewHolder(mNewTabPageLayout.getSiteSectionView(), mUiConfig);
         mSiteSectionViewHolder.bindDataSource(mTileGroup, tileRenderer);
 
         mSearchProviderLogoView = mNewTabPageLayout.findViewById(R.id.search_provider_logo);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
index fda23d8b..7a436ae 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapter.java
@@ -151,7 +151,8 @@
                 return new NewTabPageViewHolder(mAboveTheFoldView);
 
             case ItemViewType.SITE_SECTION:
-                return SiteSection.createViewHolder(SiteSection.inflateSiteSection(parent));
+                return SiteSection.createViewHolder(
+                        SiteSection.inflateSiteSection(parent), mUiConfig);
 
             case ItemViewType.HEADER:
                 return new SectionHeaderViewHolder(mRecyclerView, mUiConfig);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java
index 1d10c5d..6dcb3cf 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SiteSection.java
@@ -48,10 +48,10 @@
                 .inflate(getLayout(), parent, false);
     }
 
-    public static SiteSectionViewHolder createViewHolder(ViewGroup view) {
+    public static SiteSectionViewHolder createViewHolder(ViewGroup view, UiConfig uiConfig) {
         return SuggestionsConfig.useSitesExplorationUi()
                 ? new SiteExploreViewHolder(view, MAX_TILE_COLUMNS)
-                : new TileGridViewHolder(view, getMaxTileRows(), MAX_TILE_COLUMNS);
+                : new TileGridViewHolder(view, getMaxTileRows(), MAX_TILE_COLUMNS, uiConfig);
     }
 
     public SiteSection(SuggestionsUiDelegate uiDelegate, ContextMenuManager contextMenuManager,
@@ -62,7 +62,7 @@
                 uiDelegate.getImageFetcher());
         mTileGroup = new TileGroup(mTileRenderer, uiDelegate, contextMenuManager, tileGroupDelegate,
                 /* observer = */ this, offlinePageBridge);
-        mTileGroup.startObserving(getMaxTileRows() * MAX_TILE_COLUMNS);
+        mTileGroup.startObserving(MAX_TILE_COLUMNS * getMaxTileRows());
     }
 
     @Override
@@ -113,12 +113,14 @@
 
     private static int getMaxTileRows() {
         int defaultValue = 2;
+        if (!FeatureUtilities.isChromeHomeEnabled()) return defaultValue;
         return ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                 ChromeFeatureList.CHROME_HOME, PARAM_CHROME_HOME_MAX_TILE_ROWS, defaultValue);
     }
 
     private static int getTileTitleLines() {
         int defaultValue = 1;
+        if (!FeatureUtilities.isChromeHomeEnabled()) return defaultValue;
         return ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                 ChromeFeatureList.CHROME_HOME, PARAM_CHROME_HOME_TILE_TITLE_LINES, defaultValue);
     }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridLayout.java
index 5ffb9e8..0b94257e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridLayout.java
@@ -8,10 +8,12 @@
 import android.content.res.Resources;
 import android.support.annotation.Nullable;
 import android.util.AttributeSet;
+import android.util.Pair;
 import android.view.View;
 import android.widget.FrameLayout;
 
 import org.chromium.base.ApiCompatibilityUtils;
+import org.chromium.base.VisibleForTesting;
 import org.chromium.chrome.R;
 import org.chromium.chrome.browser.util.FeatureUtilities;
 import org.chromium.chrome.browser.util.MathUtils;
@@ -23,9 +25,8 @@
  * A layout that arranges tiles in a grid.
  */
 public class TileGridLayout extends FrameLayout {
-    public static final int PADDING_START_PX = 0;
-    public static final int PADDING_END_PX = 0;
-
+    /** Whether tiles should be spread across all the available width or clustered in its center. */
+    private final boolean mUseFullWidth;
     private final int mVerticalSpacing;
     private final int mMinHorizontalSpacing;
     private final int mMaxHorizontalSpacing;
@@ -44,15 +45,19 @@
     public TileGridLayout(Context context, AttributeSet attrs) {
         super(context, attrs);
 
+        mUseFullWidth = FeatureUtilities.isChromeHomeModernEnabled();
+
         Resources res = getResources();
         mVerticalSpacing = FeatureUtilities.isChromeHomeModernEnabled()
                 ? res.getDimensionPixelOffset(R.dimen.tile_grid_layout_vertical_spacing_modern)
                 : res.getDimensionPixelOffset(R.dimen.tile_grid_layout_vertical_spacing);
         mMinHorizontalSpacing =
                 res.getDimensionPixelOffset(R.dimen.tile_grid_layout_min_horizontal_spacing);
-        mMaxHorizontalSpacing =
-                res.getDimensionPixelOffset(R.dimen.tile_grid_layout_max_horizontal_spacing);
-        mMaxWidth = res.getDimensionPixelOffset(R.dimen.tile_grid_layout_max_width);
+        mMaxHorizontalSpacing = mUseFullWidth
+                ? Integer.MAX_VALUE
+                : res.getDimensionPixelOffset(R.dimen.tile_grid_layout_max_horizontal_spacing);
+        mMaxWidth = mUseFullWidth ? Integer.MAX_VALUE
+                                  : res.getDimensionPixelOffset(R.dimen.tile_grid_layout_max_width);
     }
 
     /**
@@ -85,7 +90,7 @@
 
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        int totalWidth = resolveSize(mMaxWidth, widthMeasureSpec);
+        int totalWidth = Math.min(MeasureSpec.getSize(widthMeasureSpec), mMaxWidth);
         int childCount = getChildCount();
         if (childCount == 0) {
             setMeasuredDimension(totalWidth, resolveSize(0, heightMeasureSpec));
@@ -101,25 +106,18 @@
         }
 
         // Determine the number of columns that will fit.
-        int gridWidth = totalWidth - PADDING_START_PX - PADDING_END_PX;
         int childHeight = getChildAt(0).getMeasuredHeight();
         int childWidth = getChildAt(0).getMeasuredWidth();
         int numColumns = MathUtils.clamp(
-                (gridWidth + mMinHorizontalSpacing) / (childWidth + mMinHorizontalSpacing), 1,
+                (totalWidth + mMinHorizontalSpacing) / (childWidth + mMinHorizontalSpacing), 1,
                 mMaxColumns);
 
-        // Ensure column spacing isn't greater than mMaxHorizontalSpacing.
-        int gridWidthMinusColumns = Math.max(0, gridWidth - numColumns * childWidth);
-        int gridSidePadding = gridWidthMinusColumns - mMaxHorizontalSpacing * (numColumns - 1);
-
-        int gridStart = 0;
-        float horizontalSpacing;
-        if (gridSidePadding > 0) {
-            horizontalSpacing = mMaxHorizontalSpacing;
-            gridStart = gridSidePadding / 2;
-        } else {
-            horizontalSpacing = (float) gridWidthMinusColumns / Math.max(1, numColumns - 1);
-        }
+        // Determine how much padding to use between and around the tiles.
+        int gridWidthMinusColumns = Math.max(0, totalWidth - numColumns * childWidth);
+        Pair<Integer, Integer> gridProperties =
+                computeHorizontalDimensions(mUseFullWidth, gridWidthMinusColumns, numColumns);
+        int gridStart = gridProperties.first;
+        int horizontalSpacing = gridProperties.second;
 
         // Limit the number of rows to mMaxRows.
         int visibleChildCount = Math.min(childCount, mMaxRows * numColumns);
@@ -138,7 +136,7 @@
             int column = i % numColumns;
             int verticalOffset = Math.round(mExtraVerticalSpacing * ((float) (row + 1) / numRows));
             int childTop = row * (childHeight + mVerticalSpacing) + verticalOffset;
-            int childStart = gridStart + Math.round(column * (childWidth + horizontalSpacing));
+            int childStart = gridStart + (column * (childWidth + horizontalSpacing));
             MarginLayoutParams layoutParams = (MarginLayoutParams) child.getLayoutParams();
             layoutParams.setMargins(isRtl ? 0 : childStart, childTop, isRtl ? childStart : 0, 0);
             child.setLayoutParams(layoutParams);
@@ -183,6 +181,43 @@
         return orderedChildren;
     }
 
+    /**
+     * @param spreadTiles Whether to spread the tiles with the same space between and around them.
+     * @param availableWidth The space available to spread between and around the tiles.
+     * @param numColumns The number of columns to be organised.
+     * @return The [gridStart, horizontalSpacing] pair of dimensions.
+     */
+    @VisibleForTesting
+    Pair<Integer, Integer> computeHorizontalDimensions(
+            boolean spreadTiles, int availableWidth, int numColumns) {
+        int gridStart;
+        float horizontalSpacing;
+        if (spreadTiles) {
+            // Identically sized spacers are added both between and around the tiles.
+            int spacerCount = numColumns + 1;
+            horizontalSpacing = (float) availableWidth / spacerCount;
+            gridStart = Math.round(horizontalSpacing);
+            if (horizontalSpacing < mMinHorizontalSpacing) {
+                return computeHorizontalDimensions(false, availableWidth, numColumns);
+            }
+        } else {
+            // Ensure column spacing isn't greater than mMaxHorizontalSpacing.
+            int gridSidePadding = availableWidth - mMaxHorizontalSpacing * (numColumns - 1);
+            if (gridSidePadding > 0) {
+                horizontalSpacing = mMaxHorizontalSpacing;
+                gridStart = gridSidePadding / 2;
+            } else {
+                horizontalSpacing = (float) availableWidth / Math.max(1, numColumns - 1);
+                gridStart = 0;
+            }
+        }
+
+        assert horizontalSpacing >= mMinHorizontalSpacing;
+        assert horizontalSpacing <= mMaxHorizontalSpacing;
+
+        return Pair.create(gridStart, Math.round(horizontalSpacing));
+    }
+
     @Nullable
     public TileView getTileView(SiteSuggestion suggestion) {
         int childCount = getChildCount();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridViewHolder.java
index 7293464..ccb544e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridViewHolder.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/TileGridViewHolder.java
@@ -4,10 +4,15 @@
 
 package org.chromium.chrome.browser.suggestions;
 
+import android.content.res.Resources;
 import android.view.ViewGroup;
 
-import java.util.List;
+import org.chromium.chrome.R;
+import org.chromium.chrome.browser.util.FeatureUtilities;
+import org.chromium.chrome.browser.widget.displaystyle.MarginResizer;
+import org.chromium.chrome.browser.widget.displaystyle.UiConfig;
 
+import java.util.List;
 /**
  * A {@link SiteSectionViewHolder} specialised in displaying sites as a simple grid of tiles,
  * through
@@ -15,13 +20,26 @@
  */
 public class TileGridViewHolder extends SiteSectionViewHolder {
     private final TileGridLayout mSectionView;
+    private final MarginResizer mMarginResizer;
 
-    public TileGridViewHolder(ViewGroup view, int maxRows, int maxColumns) {
+    public TileGridViewHolder(ViewGroup view, int maxRows, int maxColumns, UiConfig uiConfig) {
         super(view);
 
         mSectionView = (TileGridLayout) itemView;
         mSectionView.setMaxRows(maxRows);
         mSectionView.setMaxColumns(maxColumns);
+
+        if (FeatureUtilities.isChromeHomeModernEnabled()) {
+            Resources res = itemView.getResources();
+            int defaultLateralMargin =
+                    res.getDimensionPixelSize(R.dimen.tile_grid_layout_padding_start);
+            int wideLateralMargin =
+                    res.getDimensionPixelSize(R.dimen.ntp_wide_card_lateral_margins);
+            mMarginResizer =
+                    new MarginResizer(itemView, uiConfig, defaultLateralMargin, wideLateralMargin);
+        } else {
+            mMarginResizer = null;
+        }
     }
 
     @Override
@@ -39,4 +57,15 @@
         return mSectionView.getTileView(data);
     }
 
+    @Override
+    public void bindDataSource(TileGroup tileGroup, TileRenderer tileRenderer) {
+        super.bindDataSource(tileGroup, tileRenderer);
+        if (mMarginResizer != null) mMarginResizer.attach();
+    }
+
+    @Override
+    public void recycle() {
+        super.recycle();
+        if (mMarginResizer != null) mMarginResizer.detach();
+    }
 }
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
index 966b3b5..bf1ab1c 100644
--- a/chrome/android/java/strings/android_chrome_strings.grd
+++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -952,7 +952,7 @@
       </message>
 
       <!-- Location preferences -->
-      <message name="IDS_WEBSITE_SETTINGS_DEVICE_LOCATION" desc="Title for Location settings, which control which websites can access your location.">
+      <message name="IDS_WEBSITE_SETTINGS_DEVICE_LOCATION" desc="Title for Location settings, which control which websites can access your location." meaning="Geolocation">
         Location
       </message>
       <message name="IDS_GEOLOCATION_PERMISSION_TITLE" desc="Title for the permission of accessing the current location of a device [CHAR-LIMIT=32]">
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NtpUiCaptureTestData.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NtpUiCaptureTestData.java
index ba6bce3..db95a9d3 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NtpUiCaptureTestData.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NtpUiCaptureTestData.java
@@ -44,13 +44,16 @@
             createSiteSuggestion("Shop.rr", "shop"),
             createSiteSuggestion("Now Entertainment", "movies")};
 
+    /** Grey, the default fallback color as defined in fallback_icon_style.cc. */
+    private static final int DEFAULT_ICON_COLOR = 0xff787878;
+
     private static final int[] FALLBACK_COLORS = {
             0xff306090, // Muted blue.
             0xff903060, // Muted purplish red.
             0xff309060, // Muted green.
             0xff603090, // Muted purple.
             0xff906030, // Muted brown.
-            0xff787878, // Grey, the default fallback color as defined in fallback_icon_style.cc.
+            DEFAULT_ICON_COLOR,
             0xff609060, // Muted brownish green.
             0xff903030 // Muted red.
     };
@@ -159,7 +162,9 @@
             public boolean getLargeIconForUrl(
                     String url, int desiredSizePx, LargeIconCallback callback) {
                 ThreadUtils.postOnUiThread(() -> {
-                    callback.onLargeIconAvailable(iconMap.get(url), colorMap.get(url), true);
+                    int fallbackColor =
+                            colorMap.containsKey(url) ? colorMap.get(url) : DEFAULT_ICON_COLOR;
+                    callback.onLargeIconAvailable(iconMap.get(url), fallbackColor, true);
                 });
                 return true;
             }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java
index 837ef207..7dbc314 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java
@@ -59,17 +59,17 @@
                                    .getFragmentForTest();
         mPasswordsPref = (ChromeBasePreference) mMainPreferences.findPreference(
                 MainPreferences.PREF_SAVED_PASSWORDS);
-        setupTestAccount(mContext);
+        setupTestAccount();
         AndroidSyncSettings.overrideForTests(mContext, mSyncContentResolverDelegate);
         mAuthority = AndroidSyncSettings.getContractAuthority(mContext);
         AndroidSyncSettings.updateAccount(mContext, mAccount);
         mActivityTestRule.loadNativeLibraryAndInitBrowserProcess();
     }
 
-    private void setupTestAccount(Context context) {
+    private void setupTestAccount() {
         mAccountManager = new FakeAccountManagerDelegate(
                 FakeAccountManagerDelegate.DISABLE_PROFILE_DATA_SOURCE);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(context, mAccountManager);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mAccountManager);
         mAccount = AccountManagerFacade.createAccountFromName("account@example.com");
         AccountHolder.Builder accountHolder =
                 AccountHolder.builder(mAccount).password("password").alwaysAccept(true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceIntegrationTest.java
index d7fc305..394b099 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceIntegrationTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceIntegrationTest.java
@@ -72,7 +72,7 @@
                 InstrumentationRegistry.getInstrumentation().getTargetContext());
         mAccountManager = new FakeAccountManagerDelegate(
                 FakeAccountManagerDelegate.DISABLE_PROFILE_DATA_SOURCE);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(mContext, mAccountManager);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mAccountManager);
 
         mActivityTestRule.loadNativeLibraryAndInitBrowserProcess();
 
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java
index e9e0cfa..8b3065c7 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/OAuth2TokenServiceTest.java
@@ -37,7 +37,7 @@
                 InstrumentationRegistry.getInstrumentation().getTargetContext());
         mAccountManager = new FakeAccountManagerDelegate(
                 FakeAccountManagerDelegate.DISABLE_PROFILE_DATA_SOURCE);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(mContext, mAccountManager);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mAccountManager);
     }
 
     @After
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninHelperTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninHelperTest.java
index 8ae036b..57cf553 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninHelperTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninHelperTest.java
@@ -41,7 +41,7 @@
 
         mAccountManager = new FakeAccountManagerDelegate(
                 FakeAccountManagerDelegate.DISABLE_PROFILE_DATA_SOURCE);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(mContext, mAccountManager);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mAccountManager);
     }
 
     @After
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetTilesUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetTilesUiCaptureTest.java
index e9b9d19..e705d08 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetTilesUiCaptureTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetTilesUiCaptureTest.java
@@ -8,7 +8,6 @@
 import static android.support.test.espresso.action.ViewActions.longClick;
 import static android.support.test.espresso.matcher.ViewMatchers.withText;
 
-import static org.chromium.chrome.test.BottomSheetTestRule.ENABLE_CHROME_HOME;
 import static org.chromium.chrome.test.BottomSheetTestRule.waitForWindowUpdates;
 
 import android.support.test.filters.MediumTest;
@@ -18,11 +17,9 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import org.chromium.base.test.util.CommandLineFlags;
 import org.chromium.base.test.util.Feature;
 import org.chromium.base.test.util.Restriction;
 import org.chromium.base.test.util.ScreenShooter;
-import org.chromium.base.test.util.parameter.CommandLineParameter;
 import org.chromium.chrome.browser.ntp.NtpUiCaptureTestData;
 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
 import org.chromium.chrome.test.BottomSheetTestRule;
@@ -36,9 +33,6 @@
  */
 @RunWith(ChromeJUnit4ClassRunner.class)
 @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones
-// TODO(https://crbug.com/754778) improve annotation processor. We need to remove the currently
-// registered Feature flags to be able to change them later.
-@CommandLineFlags.Remove(ENABLE_CHROME_HOME)
 public class HomeSheetTilesUiCaptureTest {
     @Rule
     public BottomSheetTestRule mActivityRule = new BottomSheetTestRule();
@@ -63,7 +57,6 @@
     @Test
     @MediumTest
     @Feature({"UiCatalogue"})
-    @CommandLineParameter(ENABLE_CHROME_HOME)
     @ScreenShooter.Directory("HomeSheetTiles")
     public void testAppearance() {
         mActivityRule.setSheetState(BottomSheet.SHEET_STATE_FULL, false);
@@ -74,7 +67,6 @@
     @Test
     @MediumTest
     @Feature({"UiCatalogue"})
-    @CommandLineParameter(ENABLE_CHROME_HOME)
     @ScreenShooter.Directory("HomeSheetTiles")
     public void testContextMenu() {
         mActivityRule.setSheetState(BottomSheet.SHEET_STATE_FULL, false);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetUiCaptureTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetUiCaptureTest.java
index 5c57c79b..232ccfb 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetUiCaptureTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetUiCaptureTest.java
@@ -6,7 +6,6 @@
 
 import static org.junit.Assert.assertNotEquals;
 
-import static org.chromium.chrome.test.BottomSheetTestRule.ENABLE_CHROME_HOME;
 import static org.chromium.chrome.test.BottomSheetTestRule.waitForWindowUpdates;
 
 import android.support.test.filters.MediumTest;
@@ -29,6 +28,7 @@
 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter;
 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
 import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
+import org.chromium.chrome.test.util.browser.ChromeHome;
 import org.chromium.chrome.test.util.browser.suggestions.FakeSuggestionsSource;
 import org.chromium.chrome.test.util.browser.suggestions.SuggestionsDependenciesRule;
 import org.chromium.ui.test.util.UiRestriction;
@@ -40,7 +40,7 @@
 @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones
 // TODO(https://crbug.com/754778) improve annotation processor. We need to remove the currently
 // registered Feature flags to be able to change them later.
-@CommandLineFlags.Remove(ENABLE_CHROME_HOME)
+@CommandLineFlags.Remove(ChromeHome.ENABLE_FLAGS)
 @ScreenShooter.Directory("HomeSheetStates")
 public class HomeSheetUiCaptureTest {
     @Rule
@@ -66,9 +66,10 @@
     @Test
     @MediumTest
     @Feature({"UiCatalogue"})
-    @CommandLineParameter({ENABLE_CHROME_HOME,
-            "enable-features=" + ChromeFeatureList.CHROME_HOME + ","
-                    + ChromeFeatureList.ANDROID_SIGNIN_PROMOS})
+    @CommandLineParameter({
+            ChromeHome.ENABLE_FLAGS,
+            "enable-features=" + ChromeHome.FEATURES + "," + ChromeFeatureList.ANDROID_SIGNIN_PROMOS
+    })
     @ScreenShooter.Directory("SignInPromo")
     public void testSignInPromo() {
         // Needs to be "Full" to for this to work on small screens in landscape.
@@ -85,7 +86,7 @@
     @Test
     @MediumTest
     @Feature({"UiCatalogue"})
-    @CommandLineFlags.Add(ENABLE_CHROME_HOME)
+    @CommandLineFlags.Add(ChromeHome.ENABLE_FLAGS)
     @ScreenShooter.Directory("AllDismissed")
     public void testAllDismissed() {
         NewTabPageAdapter adapter = mActivityRule.getAdapter();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/TileGridLayoutTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/TileGridLayoutTest.java
index 6ece789a9..4e617af6 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/TileGridLayoutTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/TileGridLayoutTest.java
@@ -4,36 +4,62 @@
 
 package org.chromium.chrome.browser.suggestions;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.lessThanOrEqualTo;
+
+import android.app.Activity;
+import android.content.pm.ActivityInfo;
+import android.support.annotation.Nullable;
+import android.support.test.InstrumentationRegistry;
 import android.support.test.filters.MediumTest;
 import android.support.test.filters.SmallTest;
+import android.util.DisplayMetrics;
+import android.view.View;
 import android.view.ViewGroup;
+import android.widget.FrameLayout;
 
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.annotations.SuppressFBWarnings;
 import org.chromium.base.test.util.CommandLineFlags;
 import org.chromium.base.test.util.Feature;
-import org.chromium.base.test.util.RetryOnFailure;
+import org.chromium.base.test.util.Restriction;
 import org.chromium.chrome.R;
+import org.chromium.chrome.browser.ChromeActivity;
 import org.chromium.chrome.browser.ChromeSwitches;
 import org.chromium.chrome.browser.UrlConstants;
 import org.chromium.chrome.browser.ntp.NewTabPage;
-import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView;
+import org.chromium.chrome.browser.ntp.cards.NewTabPageViewHolder;
+import org.chromium.chrome.browser.ntp.cards.NodeParent;
+import org.chromium.chrome.browser.ntp.cards.TreeNode;
+import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
+import org.chromium.chrome.browser.profiles.Profile;
 import org.chromium.chrome.browser.tab.Tab;
+import org.chromium.chrome.browser.widget.displaystyle.UiConfig;
 import org.chromium.chrome.test.ChromeActivityTestRule;
 import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
 import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
 import org.chromium.chrome.test.util.NewTabPageTestUtils;
 import org.chromium.chrome.test.util.RenderTestRule;
+import org.chromium.chrome.test.util.browser.ChromeHome;
 import org.chromium.chrome.test.util.browser.RecyclerViewTestUtils;
 import org.chromium.chrome.test.util.browser.suggestions.FakeMostVisitedSites;
 import org.chromium.chrome.test.util.browser.suggestions.FakeSuggestionsSource;
 import org.chromium.chrome.test.util.browser.suggestions.SuggestionsDependenciesRule;
+import org.chromium.content.browser.test.util.Criteria;
+import org.chromium.content.browser.test.util.CriteriaHelper;
 import org.chromium.net.test.EmbeddedTestServerRule;
+import org.chromium.ui.test.util.UiRestriction;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -45,11 +71,14 @@
         ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
         ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG,
 })
-@RetryOnFailure
 public class TileGridLayoutTest {
     @Rule
     public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule();
 
+    @SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
+    @Rule
+    public ChromeHome.Processor mChromeHomeStateRule = new ChromeHome.Processor();
+
     @Rule
     public SuggestionsDependenciesRule mSuggestionsDeps = new SuggestionsDependenciesRule();
 
@@ -57,8 +86,7 @@
     public EmbeddedTestServerRule mTestServerRule = new EmbeddedTestServerRule();
 
     @Rule
-    public RenderTestRule mRenderTestRule =
-            new RenderTestRule("chrome/test/data/android/render_tests");
+    public RenderTestRule mRenderTestRule = new RenderTestRule();
 
     private static final String HOME_PAGE_URL = "http://ho.me/";
 
@@ -77,23 +105,16 @@
     private static final String[] FAKE_MOST_VISITED_TITLES =
             new String[] {"ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE"};
 
-    private NewTabPage mNtp;
-
-    @Before
-    public void setUp() throws Exception {
-        mActivityTestRule.startMainActivityOnBlankPage();
-    }
-
     @Test
     @SmallTest
     @Feature({"NewTabPage"})
     public void testHomePageIsMovedToFirstRowWhenNotThereInitially() throws Exception {
-        setUpFakeDataToShow(7);
+        NewTabPage ntp = setUpFakeDataToShowOnNtp(7);
 
-        TileView homePageTileView = (TileView) getTileGridLayout().getChildAt(7);
+        TileView homePageTileView = (TileView) getTileGridLayout(ntp).getChildAt(7);
 
         // This is assuming that the rows on the first row are less than 6.
-        TileView tileOnSecondRow = (TileView) getTileGridLayout().getChildAt(6);
+        TileView tileOnSecondRow = (TileView) getTileGridLayout(ntp).getChildAt(6);
 
         Assert.assertNotNull(homePageTileView);
         Assert.assertNotNull(tileOnSecondRow);
@@ -105,9 +126,9 @@
     @SmallTest
     @Feature({"NewTabPage"})
     public void testHomePageStaysAtFirstRowWhenThereInitially() throws Exception {
-        setUpFakeDataToShow(2);
+        NewTabPage ntp = setUpFakeDataToShowOnNtp(2);
 
-        TileView homePageTileView = (TileView) getTileGridLayout().getChildAt(2);
+        TileView homePageTileView = (TileView) getTileGridLayout(ntp).getChildAt(2);
 
         Assert.assertNotNull(homePageTileView);
         Assert.assertTrue(isTileViewOnFirstRow(homePageTileView));
@@ -116,23 +137,101 @@
     @Test
     @MediumTest
     @Feature({"NewTabPage", "RenderTest"})
-    @RetryOnFailure
     public void testTileGridAppearance() throws Exception {
-        setUpFakeDataToShow(2);
-        mRenderTestRule.render(getTileGridLayout(), "ntp_tile_grid_layout");
+        NewTabPage ntp = setUpFakeDataToShowOnNtp(2);
+        mRenderTestRule.render(getTileGridLayout(ntp), "ntp_tile_grid_layout");
     }
-    private void setUpFakeDataToShow(int homePagePosition) throws InterruptedException {
-        List<SiteSuggestion> siteSuggestions = new ArrayList<>();
 
-        assert FAKE_MOST_VISITED_URLS.length == FAKE_MOST_VISITED_TITLES.length;
+    @Test
+    @MediumTest
+    @Feature({"NewTabPage", "RenderTest"})
+    @ChromeHome
+    @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE)
+    public void testModernTileGridAppearance_Full() throws IOException, InterruptedException {
+        View tileGridLayout = renderTiles(makeSuggestions(FAKE_MOST_VISITED_URLS.length));
 
-        for (int i = 0; i < FAKE_MOST_VISITED_URLS.length; i++) {
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "modern_full_grid_portrait");
+
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "modern_full_grid_landscape");
+
+        // In landscape, modern tiles should use all available space.
+        int tileGridMaxWidthPx = tileGridLayout.getResources().getDimensionPixelSize(
+                R.dimen.tile_grid_layout_max_width);
+        if (((FrameLayout) tileGridLayout.getParent()).getMeasuredWidth() > tileGridMaxWidthPx) {
+            assertThat(tileGridLayout.getMeasuredWidth(), greaterThan(tileGridMaxWidthPx));
+        }
+    }
+
+    @Test
+    @MediumTest
+    @Feature({"NewTabPage", "RenderTest"})
+    @ChromeHome(false)
+    public void testTileGridAppearance_Full() throws IOException, InterruptedException {
+        View tileGridLayout = renderTiles(makeSuggestions(FAKE_MOST_VISITED_URLS.length));
+
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "full_grid_portrait");
+
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "full_grid_landscape");
+
+        // In landscape, classic tiles should use at most tile_grid_layout_max_width px.
+        int tileGridMaxWidthPx = tileGridLayout.getResources().getDimensionPixelSize(
+                R.dimen.tile_grid_layout_max_width);
+        if (((FrameLayout) tileGridLayout.getParent()).getMeasuredWidth() > tileGridMaxWidthPx) {
+            assertThat(tileGridLayout.getMeasuredWidth(), lessThanOrEqualTo(tileGridMaxWidthPx));
+        }
+    }
+
+    @Test
+    @MediumTest
+    @Feature({"NewTabPage", "RenderTest"})
+    @ChromeHome
+    @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE)
+    public void testModernTileGridAppearance_Two() throws IOException, InterruptedException {
+        View tileGridLayout = renderTiles(makeSuggestions(2));
+
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "modern_two_tiles_grid_portrait");
+
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "modern_two_tiles_grid_landscape");
+    }
+
+    @Test
+    @MediumTest
+    @Feature({"NewTabPage", "RenderTest"})
+    @ChromeHome(false)
+    public void testTileGridAppearance_Two() throws IOException, InterruptedException {
+        View tileGridLayout = renderTiles(makeSuggestions(2));
+
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "two_tiles_grid_portrait");
+
+        setOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, mActivityTestRule.getActivity());
+        mRenderTestRule.render(tileGridLayout, "two_tiles_grid_landscape");
+    }
+
+    private List<SiteSuggestion> makeSuggestions(int count) {
+        List<SiteSuggestion> siteSuggestions = new ArrayList<>(count);
+
+        assertEquals(FAKE_MOST_VISITED_URLS.length, FAKE_MOST_VISITED_TITLES.length);
+        assertTrue(count <= FAKE_MOST_VISITED_URLS.length);
+
+        for (int i = 0; i < count; i++) {
             String url = FAKE_MOST_VISITED_URLS[i];
             String title = FAKE_MOST_VISITED_TITLES[i];
             siteSuggestions.add(FakeMostVisitedSites.createSiteSuggestion(
                     title, mTestServerRule.getServer().getURL(url)));
         }
 
+        return siteSuggestions;
+    }
+
+    private NewTabPage setUpFakeDataToShowOnNtp(int homePagePosition) throws InterruptedException {
+        List<SiteSuggestion> siteSuggestions = makeSuggestions(FAKE_MOST_VISITED_URLS.length);
         siteSuggestions.add(homePagePosition,
                 new SiteSuggestion("HOMEPAGE", HOME_PAGE_URL, "", TileSource.HOMEPAGE,
                         TileSectionType.PERSONALIZED));
@@ -143,32 +242,123 @@
 
         mSuggestionsDeps.getFactory().suggestionsSource = new FakeSuggestionsSource();
 
-        mActivityTestRule.loadUrl(UrlConstants.NTP_URL);
+        mActivityTestRule.startMainActivityWithURL(UrlConstants.NTP_URL);
 
         Tab mTab = mActivityTestRule.getActivity().getActivityTab();
         NewTabPageTestUtils.waitForNtpLoaded(mTab);
 
         Assert.assertTrue(mTab.getNativePage() instanceof NewTabPage);
-        mNtp = (NewTabPage) mTab.getNativePage();
+        NewTabPage ntp = (NewTabPage) mTab.getNativePage();
 
-        RecyclerViewTestUtils.waitForStableRecyclerView(getRecyclerView());
+        RecyclerViewTestUtils.waitForStableRecyclerView(ntp.getNewTabPageView().getRecyclerView());
+        return ntp;
     }
 
-    private NewTabPageRecyclerView getRecyclerView() {
-        return mNtp.getNewTabPageView().getRecyclerView();
+    private boolean isLandscape(Activity activity) {
+        // Using Configuration#orientation does not yield reliable results (often returning
+        // ActivityInfo#SCREEN_ORIENTATION_USER for example) so we use the screen dimensions
+        // to find the orientation.
+        DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
+        return metrics.widthPixels > metrics.heightPixels;
     }
 
-    private TileGridLayout getTileGridLayout() {
-        TileGridLayout tileGridLayout =
-                mNtp.getNewTabPageView().findViewById(R.id.tile_grid_layout);
+    private void setOrientation(int orientation, Activity activity) {
+        boolean requestedLandscape = orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
+        if (isLandscape(activity) == requestedLandscape) return;
+
+        ThreadUtils.runOnUiThreadBlocking(() -> activity.setRequestedOrientation(orientation));
+
+        CriteriaHelper.pollUiThread(new Criteria() {
+            @Override
+            public boolean isSatisfied() {
+                return isLandscape(activity) == requestedLandscape;
+            }
+        });
+    }
+
+    private TileGridLayout getTileGridLayout(NewTabPage ntp) {
+        TileGridLayout tileGridLayout = ntp.getNewTabPageView().findViewById(R.id.tile_grid_layout);
         Assert.assertNotNull("Unable to retrieve the TileGridLayout.", tileGridLayout);
         return tileGridLayout;
     }
 
     /** {@link TileView}s on the first row have a top margin equal to 0. */
-    public boolean isTileViewOnFirstRow(TileView tileView) {
+    private boolean isTileViewOnFirstRow(TileView tileView) {
         ViewGroup.MarginLayoutParams marginLayoutParams =
                 (ViewGroup.MarginLayoutParams) tileView.getLayoutParams();
         return marginLayoutParams.topMargin == 0;
     }
+
+    /**
+     * Starts and sets up an activity to render the provided site suggestions in the activity.
+     * @return the layout in which the suggestions are rendered.
+     */
+    private TileGridLayout renderTiles(List<SiteSuggestion> siteSuggestions)
+            throws IOException, InterruptedException {
+        // Launching the activity, that should now use the right UI.
+        mActivityTestRule.startMainActivityOnBlankPage();
+        ChromeActivity activity = mActivityTestRule.getActivity();
+
+        // Setting up the dummy data.
+        FakeMostVisitedSites mostVisitedSites = new FakeMostVisitedSites();
+        mostVisitedSites.setTileSuggestions(siteSuggestions);
+        mSuggestionsDeps.getFactory().mostVisitedSites = mostVisitedSites;
+        mSuggestionsDeps.getFactory().suggestionsSource = new FakeSuggestionsSource();
+
+        FrameLayout contentView = new FrameLayout(activity);
+        UiConfig uiConfig = new UiConfig(contentView);
+
+        ThreadUtils.runOnUiThreadBlocking(() -> {
+            activity.setContentView(contentView);
+
+            SiteSectionViewHolder viewHolder = SiteSection.createViewHolder(
+                    SiteSection.inflateSiteSection(contentView), uiConfig);
+
+            uiConfig.updateDisplayStyle();
+
+            SiteSection siteSection = createSiteSection(viewHolder, uiConfig);
+            siteSection.getTileGroup().onSwitchToForeground(false);
+            assertTrue("Tile Data should be visible.", siteSection.isVisible());
+
+            siteSection.onBindViewHolder(viewHolder, 0);
+            contentView.addView(viewHolder.itemView);
+        });
+
+        InstrumentationRegistry.getInstrumentation().waitForIdleSync();
+
+        assertEquals(1, contentView.getChildCount());
+        return (TileGridLayout) contentView.getChildAt(0);
+    }
+
+    private SiteSection createSiteSection(SiteSectionViewHolder viewHolder, UiConfig uiConfig) {
+        ThreadUtils.assertOnUiThread();
+
+        ChromeActivity activity = mActivityTestRule.getActivity();
+
+        Profile profile = Profile.getLastUsedProfile();
+        SuggestionsUiDelegate uiDelegate = new SuggestionsUiDelegateImpl(
+                mSuggestionsDeps.getFactory().createSuggestionSource(null),
+                mSuggestionsDeps.getFactory().createEventReporter(), null, profile, null,
+                activity.getChromeApplication().getReferencePool());
+
+        OfflinePageBridge opb = OfflinePageBridge.getForProfile(profile);
+        TileGroup.Delegate delegate = new TileGroupDelegateImpl(activity, profile, null, null);
+        SiteSection siteSection = new SiteSection(uiDelegate, null, delegate, opb, uiConfig);
+
+        siteSection.setParent(new NodeParent() {
+            @Override
+            public void onItemRangeChanged(TreeNode child, int index, int count,
+                    @Nullable NewTabPageViewHolder.PartialBindCallback callback) {
+                if (callback != null) callback.onResult(viewHolder);
+            }
+
+            @Override
+            public void onItemRangeInserted(TreeNode child, int index, int count) {}
+
+            @Override
+            public void onItemRangeRemoved(TreeNode child, int index, int count) {}
+        });
+
+        return siteSection;
+    }
 }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/util/FeatureUtilitiesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/util/FeatureUtilitiesTest.java
index a2a5036..70cc1c6 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/util/FeatureUtilitiesTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/util/FeatureUtilitiesTest.java
@@ -138,8 +138,7 @@
 
     private void setUpAccountManager(String accountType) {
         mAccountManager = new FakeAuthenticationAccountManager(accountType);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(
-                mAccountTestingContext, mAccountManager);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mAccountManager);
     }
 
     private void addTestAccount() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetBackBehaviorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetBackBehaviorTest.java
index 1d009766..d8f91c9 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetBackBehaviorTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetBackBehaviorTest.java
@@ -43,8 +43,7 @@
  * Tests the behavior of the bottom sheet when used with the back button.
  */
 @RunWith(ChromeJUnit4ClassRunner.class)
-@CommandLineFlags.Add({BottomSheetTestRule.ENABLE_CHROME_HOME,
-        ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
+@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
         BottomSheetTestRule.DISABLE_NETWORK_PREDICTION_FLAG})
 @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones
 public class BottomSheetBackBehaviorTest {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabControllerTest.java
index 07d4468b..5d86174c 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabControllerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetNewTabControllerTest.java
@@ -45,8 +45,7 @@
  * Tests for the NTP UI displayed when Chrome Home is enabled.
  */
 @RunWith(ChromeJUnit4ClassRunner.class)
-@CommandLineFlags.Add({BottomSheetTestRule.ENABLE_CHROME_HOME,
-        ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
+@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
         BottomSheetTestRule.DISABLE_NETWORK_PREDICTION_FLAG})
 @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones
 public class BottomSheetNewTabControllerTest {
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/ToSAckedReceiverTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/ToSAckedReceiverTest.java
index 2f5504e..c4b9caf2 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/ToSAckedReceiverTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/ToSAckedReceiverTest.java
@@ -62,8 +62,7 @@
         Account[] accounts = new Account[1];
         accounts[0] = new Account(GOOGLE_ACCOUNT, "LegitAccount");
         Mockito.doReturn(accounts).when(accountManagerDelegate).getAccountsSync();
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(
-                RuntimeEnvironment.application, accountManagerDelegate);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(accountManagerDelegate);
         Assert.assertTrue(ToSAckedReceiver.checkAnyUserHasSeenToS());
     }
 }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
index f8afa9f96..20ac263e 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/invalidation/InvalidationControllerTest.java
@@ -115,7 +115,7 @@
         ContextUtils.initApplicationContextForTests(mContext.getApplicationContext());
 
         AccountManagerFacade.overrideAccountManagerFacadeForTests(
-                mContext, new SystemAccountManagerDelegate());
+                new SystemAccountManagerDelegate());
 
         ModelTypeHelper.setTestDelegate(new ModelTypeHelper.TestDelegate() {
             @Override
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupUnitTest.java
index 732f4f6..439b55b 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupUnitTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupUnitTest.java
@@ -46,6 +46,7 @@
 import org.chromium.chrome.browser.ntp.cards.CardsVariationParameters;
 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
 import org.chromium.chrome.browser.suggestions.TileView.Style;
+import org.chromium.chrome.browser.widget.displaystyle.UiConfig;
 import org.chromium.chrome.test.util.browser.Features;
 import org.chromium.chrome.test.util.browser.suggestions.FakeMostVisitedSites;
 import org.chromium.testing.local.LocalRobolectricTestRunner;
@@ -392,7 +393,7 @@
 
     private TileGridViewHolder setupView(TileGroup tileGroup) {
         TileGridLayout layout = new TileGridLayout(RuntimeEnvironment.application, null);
-        TileGridViewHolder tileGrid = new TileGridViewHolder(layout, 4, 2);
+        TileGridViewHolder tileGrid = new TileGridViewHolder(layout, 4, 2, mock(UiConfig.class));
         tileGrid.bindDataSource(tileGroup, mTileRenderer);
         return tileGrid;
     }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java
index 6e4c28ec..271ddb9 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/superviseduser/SupervisedUserContentProviderUnitTest.java
@@ -221,8 +221,7 @@
         ChromeBrowserInitializer mockBrowserInitializer = mock(ChromeBrowserInitializer.class);
         ChromeBrowserInitializer.setForTesting(mockBrowserInitializer);
         AccountManagerDelegate mockDelegate = mock(AccountManagerDelegate.class);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(
-                RuntimeEnvironment.application, mockDelegate);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mockDelegate);
         Account account = new Account("Google", "Dummy");
         when(mockDelegate.getAccountsSync()).thenReturn(new Account[] {account});
 
@@ -249,8 +248,7 @@
         ChromeBrowserInitializer mockBrowserInitializer = mock(ChromeBrowserInitializer.class);
         ChromeBrowserInitializer.setForTesting(mockBrowserInitializer);
         AccountManagerDelegate mockDelegate = mock(AccountManagerDelegate.class);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(
-                RuntimeEnvironment.application, mockDelegate);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mockDelegate);
         Account account = new Account("Google", "Dummy");
         when(mockDelegate.getAccountsSync()).thenReturn(new Account[] {account});
 
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index a3f33ac..6aa08d8f 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5009,7 +5009,7 @@
         <message name="IDS_CONFLICTS_HEADER_SIGNED_BY" desc="The 'Signed by' header for each module item in the list">
           Signed by
         </message>
-        <message name="IDS_CONFLICTS_HEADER_LOCATION" desc="The 'Location' header for each module item in the list">
+        <message name="IDS_CONFLICTS_HEADER_LOCATION" desc="The 'Location' header for each module item in the list" meaning="File location">
           Location
         </message>
         <message name="IDS_CONFLICTS_HEADER_VERSION" desc="The 'Version' header for each module item in the list">
@@ -6130,7 +6130,7 @@
     <message name="IDS_HANDLER_OPTIONS_WINDOW_TITLE" desc="The title of the window that lets a user change what handlers they have registered for various protocols / mimetypes.">
       Protocol handlers
     </message>
-      <message name="IDS_GEOLOCATION_TAB_LABEL" desc="Label for Geolocation tab on Content Settings dialog">
+      <message name="IDS_GEOLOCATION_TAB_LABEL" desc="Label for Geolocation tab on Content Settings dialog" meaning="Geolocation">
         Location
       </message>
       <message name="IDS_GEOLOCATION_HEADER" desc="Label for Geolocation exception management page on Content Settings dialog">
@@ -7587,6 +7587,12 @@
       <message name="IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_TAB_LABEL" desc="The label in a tabbed pane that holds the UI controls for the cookies blocked while loading the page.">
         Blocked
       </message>
+      <message name="IDS_COLLECTED_COOKIES_ALLOWED_AUX_TEXT" desc="The text used to label a cookie which has been marked as allowed.">
+        Allowed
+      </message>
+      <message name="IDS_COLLECTED_COOKIES_BLOCKED_AUX_TEXT" desc="The text used to label a cookie which has been marked as blocked.">
+        Blocked
+      </message>
       <message name="IDS_COLLECTED_COOKIES_INFOBAR_MESSAGE" desc="The string shown in the infobar after the user has changed the allowed/blocked state of a cookie, reminding them to reload the page in order for the new cookies to take effect.">
         New cookie settings will take effect after reloading the page.
       </message>
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
index 1dfa3073..5ab4b0f 100644
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -1163,7 +1163,7 @@
   <message name="IDS_SETTINGS_DOWNLOADS" desc="Name of the settings page which displays download preferences.">
     Downloads
   </message>
-  <message name="IDS_SETTINGS_DOWNLOAD_LOCATION" desc="Label for the input which allows the user to specify the default download directory.">
+  <message name="IDS_SETTINGS_DOWNLOAD_LOCATION" desc="Label for the input which allows the user to specify the default download directory." meaning="File location">
     Location
   </message>
   <message name="IDS_SETTINGS_CHANGE_DOWNLOAD_LOCATION" desc="Text for the button which allows the user to change the default download directory.">
@@ -2205,7 +2205,7 @@
   <message name="IDS_SETTINGS_SITE_SETTINGS_HANDLERS" desc="Label for the protocol handlers (e.g. mailto) in site settings.">
     Handlers
   </message>
-  <message name="IDS_SETTINGS_SITE_SETTINGS_LOCATION" desc="Label for the location site settings.">
+  <message name="IDS_SETTINGS_SITE_SETTINGS_LOCATION" desc="Label for the geolocation site settings." meaning="Geolocation">
     Location
   </message>
   <message name="IDS_SETTINGS_SITE_SETTINGS_MIC" desc="Label for the microphone site settings.">
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 31713a0..78103a5 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1990,13 +1990,6 @@
      flag_descriptions::kDropSyncCredentialDescription, kOsAll,
      FEATURE_VALUE_TYPE(password_manager::features::kDropSyncCredential)},
 #if !defined(OS_ANDROID)
-    {"enable-message-center-always-scroll-up-upon-notification-removal",
-     flag_descriptions::kMessageCenterAlwaysScrollUpUponRemovalName,
-     flag_descriptions::kMessageCenterAlwaysScrollUpUponRemovalDescription,
-     kOsDesktop,
-     SINGLE_VALUE_TYPE(
-         message_center::switches::
-             kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval)},
     {"enable-message-center-new-style-notification",
      flag_descriptions::kMessageCenterNewStyleNotificationName,
      flag_descriptions::kMessageCenterNewStyleNotificationDescription,
diff --git a/chrome/browser/android/password_ui_view_android.cc b/chrome/browser/android/password_ui_view_android.cc
index d78cc887..7dfda17 100644
--- a/chrome/browser/android/password_ui_view_android.cc
+++ b/chrome/browser/android/password_ui_view_android.cc
@@ -36,11 +36,8 @@
   return ProfileManager::GetLastUsedProfile();
 }
 
-void PasswordUIViewAndroid::ShowPassword(
-    size_t index,
-    const std::string& origin_url,
-    const std::string& username,
-    const base::string16& password_value) {
+void PasswordUIViewAndroid::ShowPassword(size_t index,
+                                         const base::string16& password_value) {
   NOTIMPLEMENTED();
 }
 
diff --git a/chrome/browser/android/password_ui_view_android.h b/chrome/browser/android/password_ui_view_android.h
index dd6df57..caa4a5f 100644
--- a/chrome/browser/android/password_ui_view_android.h
+++ b/chrome/browser/android/password_ui_view_android.h
@@ -30,11 +30,8 @@
 
   // PasswordUIView implementation.
   Profile* GetProfile() override;
-  void ShowPassword(
-      size_t index,
-      const std::string& origin_url,
-      const std::string& username,
-      const base::string16& password_value) override;
+  void ShowPassword(size_t index,
+                    const base::string16& password_value) override;
   void SetPasswordList(
       const std::vector<std::unique_ptr<autofill::PasswordForm>>& password_list)
       override;
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
index 5700047..2e55e786 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -284,11 +284,11 @@
                        ExternalProtocolHandlerPrefs) {
   Profile* profile = browser()->profile();
   base::DictionaryValue prefs;
-  prefs.SetBoolean("tel", true);
+  prefs.SetBoolean("tel", false);
   profile->GetPrefs()->Set(prefs::kExcludedSchemes, prefs);
   ExternalProtocolHandler::BlockState block_state =
       ExternalProtocolHandler::GetBlockState("tel", profile);
-  ASSERT_EQ(ExternalProtocolHandler::BLOCK, block_state);
+  ASSERT_EQ(ExternalProtocolHandler::DONT_BLOCK, block_state);
   RemoveAndWait(ChromeBrowsingDataRemoverDelegate::DATA_TYPE_SITE_DATA);
   block_state = ExternalProtocolHandler::GetBlockState("tel", profile);
   ASSERT_EQ(ExternalProtocolHandler::UNKNOWN, block_state);
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index c701a43..6695852 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -163,7 +163,7 @@
 #include "components/safe_browsing/browser/mojo_safe_browsing_impl.h"
 #include "components/safe_browsing/browser/url_checker_delegate.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/security_interstitials/core/ssl_error_ui.h"
 #include "components/signin/core/common/profile_management_switches.h"
 #include "components/spellcheck/spellcheck_build_features.h"
@@ -3427,6 +3427,24 @@
   return result;
 }
 
+bool ChromeContentBrowserClient::OverrideLegacySymantecCertConsoleMessage(
+    const GURL& url,
+    const scoped_refptr<net::X509Certificate>& cert,
+    std::string* console_message) {
+  // Certificates issued before June 1, 2016 will be distrusted in Chrome 66.
+  base::Time chrome_66_not_before = base::Time::FromDoubleT(1464739200);
+  std::string in_future_string = cert->valid_start() <= chrome_66_not_before
+                                     ? "in Chrome 66"
+                                     : "in an upcoming release of Chrome";
+  *console_message =
+      "The certificate used to load " + url.spec() +
+      " uses an SSL certificate that will be distrusted " + in_future_string +
+      ". Once distrusted, users will be prevented from "
+      "loading this resource. See https://g.co/chrome/symantecpkicerts for "
+      "more information.";
+  return true;
+}
+
 // Static; handles rewriting Web UI URLs.
 bool ChromeContentBrowserClient::HandleWebUI(
     GURL* url,
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 450623b..f766e0e 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -339,6 +339,10 @@
   std::vector<std::unique_ptr<content::URLLoaderThrottle>>
   CreateURLLoaderThrottles(
       const base::Callback<content::WebContents*()>& wc_getter) override;
+  bool OverrideLegacySymantecCertConsoleMessage(
+      const GURL& url,
+      const scoped_refptr<net::X509Certificate>& cert,
+      std::string* console_messsage) override;
 
  protected:
   static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context);
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
index 63a805e..72987b03 100644
--- a/chrome/browser/chromeos/BUILD.gn
+++ b/chrome/browser/chromeos/BUILD.gn
@@ -108,7 +108,7 @@
     "//components/rappor",
     "//components/renderer_context_menu",
     "//components/safe_browsing:csd_proto",
-    "//components/safe_browsing_db:metadata_proto",
+    "//components/safe_browsing/db:metadata_proto",
     "//components/safe_json",
     "//components/session_manager/core",
     "//components/signin/core/browser",
diff --git a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
index 191e2a1..f6752f4 100644
--- a/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
+++ b/chrome/browser/chromeos/fileapi/recent_arc_media_source.cc
@@ -37,7 +37,7 @@
 const char kMediaDocumentsProviderAuthority[] =
     "com.android.providers.media.documents";
 const char* kMediaDocumentsProviderRootIds[] = {
-    "images_root", "videos_root", "audio_root",
+    "images_root", "videos_root",
 };
 
 base::FilePath GetRelativeMountPath(const std::string& root_id) {
diff --git a/chrome/browser/download/download_danger_prompt_browsertest.cc b/chrome/browser/download/download_danger_prompt_browsertest.cc
index 3d35c8d..04907ec 100644
--- a/chrome/browser/download/download_danger_prompt_browsertest.cc
+++ b/chrome/browser/download/download_danger_prompt_browsertest.cc
@@ -18,8 +18,8 @@
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "chrome/test/base/ui_test_utils.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
 #include "content/public/test/mock_download_item.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn
index 8f3526af..3db2fd35 100644
--- a/chrome/browser/extensions/BUILD.gn
+++ b/chrome/browser/extensions/BUILD.gn
@@ -783,7 +783,7 @@
   # browser, then we can clean up these dependencies.
   public_deps = [
     "//chrome/common/extensions/api",
-    "//components/safe_browsing_db:util",
+    "//components/safe_browsing/db:util",
     "//content/public/browser",
   ]
   deps = [
@@ -842,7 +842,7 @@
     "//components/rappor",
     "//components/resources",
     "//components/safe_browsing/common:safe_browsing_prefs",
-    "//components/safe_browsing_db:database_manager",
+    "//components/safe_browsing/db:database_manager",
     "//components/safe_json",
     "//components/search_engines",
     "//components/sessions",
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
index 22d1c697..d0df64f3 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/extensions/api/passwords_private/passwords_private_api.h"
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/location.h"
@@ -33,8 +35,8 @@
   PasswordsPrivateDelegate* delegate =
       PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(),
                                                             true /* create */);
-  delegate->RemoveSavedPassword(parameters->login_pair.urls.origin,
-                                parameters->login_pair.username);
+
+  delegate->RemoveSavedPassword(parameters->index);
 
   return RespondNow(NoArguments());
 }
@@ -56,7 +58,7 @@
   PasswordsPrivateDelegate* delegate =
       PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(),
                                                             true /* create */);
-  delegate->RemovePasswordException(parameters->exception_url);
+  delegate->RemovePasswordException(parameters->index);
 
   return RespondNow(NoArguments());
 }
@@ -78,10 +80,7 @@
   PasswordsPrivateDelegate* delegate =
       PasswordsPrivateDelegateFactory::GetForBrowserContext(browser_context(),
                                                             true /* create */);
-
-  delegate->RequestShowPassword(parameters->login_pair.urls.origin,
-                                parameters->login_pair.username,
-                                GetSenderWebContents());
+  delegate->RequestShowPassword(parameters->index, GetSenderWebContents());
 
   // No response given from this API function; instead, listeners wait for the
   // chrome.passwordsPrivate.onPlaintextPasswordRetrieved event to fire.
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
index b00abdba..d561c97 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
@@ -9,6 +9,7 @@
 #include "base/command_line.h"
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
+#include "base/numerics/safe_conversions.h"
 #include "base/observer_list.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/values.h"
@@ -39,6 +40,7 @@
   entry.login_pair.urls.link = entry.login_pair.urls.origin;
   entry.login_pair.username = "testName" + std::to_string(num);
   entry.num_characters_in_password = kNumCharactersInPassword;
+  entry.index = num;
   return entry;
 }
 
@@ -47,6 +49,7 @@
   exception.urls.shown = "exception" + std::to_string(num) + ".com";
   exception.urls.origin = "http://" + exception.urls.shown + "/login";
   exception.urls.link = exception.urls.origin;
+  exception.index = num;
   return exception;
 }
 
@@ -88,8 +91,7 @@
     callback.Run(current_exceptions_);
   }
 
-  void RemoveSavedPassword(const std::string& origin,
-                           const std::string& username) override {
+  void RemoveSavedPassword(size_t index) override {
     if (current_entries_.empty())
       return;
 
@@ -99,8 +101,8 @@
     SendSavedPasswordsList();
   }
 
-  void RemovePasswordException(const std::string& exception_url) override {
-    if (current_exceptions_.empty())
+  void RemovePasswordException(size_t index) override {
+    if (index >= current_exceptions_.size())
       return;
 
     // Since this is just mock data, remove the first entry regardless of
@@ -109,15 +111,16 @@
     SendPasswordExceptionsList();
   }
 
-  void RequestShowPassword(const std::string& origin,
-                           const std::string& username,
+  void RequestShowPassword(size_t index,
                            content::WebContents* web_contents) override {
     // Return a mocked password value.
     std::string plaintext_password(kPlaintextPassword);
     PasswordsPrivateEventRouter* router =
         PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
     if (router) {
-      router->OnPlaintextPasswordFetched(origin, username, plaintext_password);
+      if (index >= current_entries_.size())
+        return;
+      router->OnPlaintextPasswordFetched(index, plaintext_password);
     }
   }
 
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
index 4371b3a..403d2db 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
@@ -50,29 +50,22 @@
   virtual void GetPasswordExceptionsList(
       const ExceptionEntriesCallback& callback) = 0;
 
-  // Removes the saved password entry corresponding to |origin_url| and
-  // |username|.
-  // |origin_url| The origin for the URL where the password is used; should be
-  //     obtained using CreateUrlCollectionFromForm().origin.
-  // |username| The username used in conjunction with the saved password.
-  virtual void RemoveSavedPassword(
-      const std::string& origin_url, const std::string& username) = 0;
+  // Removes the saved password entry corresponding to the |index| generated for
+  // each entry of the password list.
+  // |index| the index created when going over the list of saved passwords.
+  virtual void RemoveSavedPassword(size_t index) = 0;
 
-  // Removes the saved password exception entry corresponding to
-  // |exception_url|.
-  // |exception_url| The URL corresponding to the exception to remove; should
-  //     be obtained using CreateUrlCollectionFromForm().origin.
-  virtual void RemovePasswordException(const std::string& exception_url) = 0;
+  // Removes the saved password exception entry corresponding set in the
+  // given |index|
+  // |index| The index for the exception url entry being removed.
+  virtual void RemovePasswordException(size_t index) = 0;
 
-  // Requests the plain text password for entry corresponding to |origin_url|
-  // and |username|.
-  // |origin_url| The origin for the URL where the password is used; should be
-  //     obtained using CreateUrlCollectionFromForm().origin.
-  // |username| The username used in conjunction with the saved password.
-  // |native_window| The Chrome host window; will be used to show an OS-level
-  //     authentication dialog if necessary.
-  virtual void RequestShowPassword(const std::string& origin_url,
-                                   const std::string& username,
+  // Requests the plain text password for entry corresponding to the |index|
+  // generated for each entry of the password list.
+  // |index| the index created when going over the list of saved passwords.
+  // |web_contents| The web content object used as the UI; will be used to show
+  //     an OS-level authentication dialog if necessary.
+  virtual void RequestShowPassword(size_t index,
                                    content::WebContents* web_contents) = 0;
 };
 
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
index 13864f7f..648a51dc 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -4,6 +4,9 @@
 
 #include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h"
 
+#include <utility>
+
+#include "base/numerics/safe_conversions.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "build/build_config.h"
@@ -21,16 +24,6 @@
 #include "content/public/browser/web_contents.h"
 #include "ui/base/l10n/l10n_util.h"
 
-namespace {
-
-std::string LoginPairToMapKey(const std::string& origin_url,
-                              const std::string& username) {
-  // Concatenate origin URL and username to form a unique key.
-  return origin_url + ',' + username;
-}
-
-}  // namespace
-
 namespace extensions {
 
 PasswordsPrivateDelegateImpl::PasswordsPrivateDelegateImpl(Profile* profile)
@@ -76,66 +69,38 @@
     get_password_exception_list_callbacks_.push_back(callback);
 }
 
-void PasswordsPrivateDelegateImpl::RemoveSavedPassword(
-    const std::string& origin_url, const std::string& username) {
-  ExecuteFunction(base::Bind(
-      &PasswordsPrivateDelegateImpl::RemoveSavedPasswordInternal,
-      base::Unretained(this),
-      origin_url,
-      username));
+void PasswordsPrivateDelegateImpl::RemoveSavedPassword(size_t index) {
+  ExecuteFunction(
+      base::Bind(&PasswordsPrivateDelegateImpl::RemoveSavedPasswordInternal,
+                 base::Unretained(this), index));
 }
 
-void PasswordsPrivateDelegateImpl::RemoveSavedPasswordInternal(
-    const std::string& origin_url, const std::string& username) {
-  std::string key = LoginPairToMapKey(origin_url, username);
-  if (login_pair_to_index_map_.find(key) == login_pair_to_index_map_.end()) {
-    // If the URL/username pair does not exist in the map, do nothing.
-    return;
-  }
-
-  password_manager_presenter_->RemoveSavedPassword(
-      login_pair_to_index_map_[key]);
+void PasswordsPrivateDelegateImpl::RemoveSavedPasswordInternal(size_t index) {
+  password_manager_presenter_->RemoveSavedPassword(index);
 }
 
-void PasswordsPrivateDelegateImpl::RemovePasswordException(
-    const std::string& exception_url) {
-  ExecuteFunction(base::Bind(
-      &PasswordsPrivateDelegateImpl::RemovePasswordExceptionInternal,
-      base::Unretained(this),
-      exception_url));
+void PasswordsPrivateDelegateImpl::RemovePasswordException(size_t index) {
+  ExecuteFunction(
+      base::Bind(&PasswordsPrivateDelegateImpl::RemovePasswordExceptionInternal,
+                 base::Unretained(this), index));
 }
 
 void PasswordsPrivateDelegateImpl::RemovePasswordExceptionInternal(
-    const std::string& exception_url) {
-  if (exception_url_to_index_map_.find(exception_url) ==
-      exception_url_to_index_map_.end()) {
-    // If the exception URL does not exist in the map, do nothing.
-    return;
-  }
-
-  password_manager_presenter_->RemovePasswordException(
-      exception_url_to_index_map_[exception_url]);
+    size_t index) {
+  password_manager_presenter_->RemovePasswordException(index);
 }
 
 void PasswordsPrivateDelegateImpl::RequestShowPassword(
-    const std::string& origin_url,
-    const std::string& username,
+    size_t index,
     content::WebContents* web_contents) {
   ExecuteFunction(
       base::Bind(&PasswordsPrivateDelegateImpl::RequestShowPasswordInternal,
-                 base::Unretained(this), origin_url, username, web_contents));
+                 base::Unretained(this), index, web_contents));
 }
 
 void PasswordsPrivateDelegateImpl::RequestShowPasswordInternal(
-    const std::string& origin_url,
-    const std::string& username,
+    size_t index,
     content::WebContents* web_contents) {
-  std::string key = LoginPairToMapKey(origin_url, username);
-  if (login_pair_to_index_map_.find(key) == login_pair_to_index_map_.end()) {
-    // If the URL/username pair does not exist in the map, do nothing.
-    return;
-  }
-
   // Save |web_contents| so that the call to RequestShowPassword() below
   // can use this value by calling GetNativeWindow(). Note: This is safe because
   // GetNativeWindow() will only be called immediately from
@@ -145,8 +110,7 @@
   web_contents_ = web_contents;
 
   // Request the password. When it is retrieved, ShowPassword() will be called.
-  password_manager_presenter_->RequestShowPassword(
-      login_pair_to_index_map_[key]);
+  password_manager_presenter_->RequestShowPassword(index);
 }
 
 Profile* PasswordsPrivateDelegateImpl::GetProfile() {
@@ -155,36 +119,29 @@
 
 void PasswordsPrivateDelegateImpl::ShowPassword(
     size_t index,
-    const std::string& origin_url,
-    const std::string& username,
     const base::string16& password_value) {
   PasswordsPrivateEventRouter* router =
       PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
   if (router) {
-    router->OnPlaintextPasswordFetched(origin_url, username,
+    router->OnPlaintextPasswordFetched(index,
                                        base::UTF16ToUTF8(password_value));
   }
 }
 
 void PasswordsPrivateDelegateImpl::SetPasswordList(
     const std::vector<std::unique_ptr<autofill::PasswordForm>>& password_list) {
-  // Rebuild |login_pair_to_index_map_| so that it reflects the contents of the
-  // new list.
-  // Also, create a list of PasswordUiEntry objects to send to observers.
-  login_pair_to_index_map_.clear();
+  // Create a list of PasswordUiEntry objects to send to observers.
   current_entries_.clear();
 
   for (size_t i = 0; i < password_list.size(); i++) {
     const auto& form = password_list[i];
     api::passwords_private::UrlCollection urls =
         CreateUrlCollectionFromForm(*form);
-    std::string key =
-        LoginPairToMapKey(urls.origin, base::UTF16ToUTF8(form->username_value));
-    login_pair_to_index_map_[key] = i;
 
     api::passwords_private::PasswordUiEntry entry;
     entry.login_pair.urls = std::move(urls);
     entry.login_pair.username = base::UTF16ToUTF8(form->username_value);
+    entry.index = base::checked_cast<int>(i);
     entry.num_characters_in_password = form->password_value.length();
 
     if (!form->federation_origin.unique()) {
@@ -212,20 +169,17 @@
 void PasswordsPrivateDelegateImpl::SetPasswordExceptionList(
     const std::vector<std::unique_ptr<autofill::PasswordForm>>&
         password_exception_list) {
-  // Rebuild |exception_url_to_index_map_| so that it reflects the contents of
-  // the new list.
-  // Also, create a list of exceptions to send to observers.
-  exception_url_to_index_map_.clear();
+  // Creates a list of exceptions to send to observers.
   current_exceptions_.clear();
 
   for (size_t i = 0; i < password_exception_list.size(); i++) {
     const auto& form = password_exception_list[i];
     api::passwords_private::UrlCollection urls =
         CreateUrlCollectionFromForm(*form);
-    exception_url_to_index_map_[urls.origin] = i;
 
     api::passwords_private::ExceptionEntry current_exception_entry;
     current_exception_entry.urls = std::move(urls);
+    current_exception_entry.index = base::checked_cast<int>(i);
     current_exceptions_.push_back(std::move(current_exception_entry));
   }
 
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
index 842eb52..2d71178 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
@@ -7,7 +7,6 @@
 
 #include <stddef.h>
 
-#include <map>
 #include <memory>
 #include <string>
 #include <vector>
@@ -44,19 +43,15 @@
   void SendPasswordExceptionsList() override;
   void GetPasswordExceptionsList(
       const ExceptionEntriesCallback& callback) override;
-  void RemoveSavedPassword(
-      const std::string& origin_url, const std::string& username) override;
-  void RemovePasswordException(const std::string& exception_url) override;
-  void RequestShowPassword(const std::string& origin_url,
-                           const std::string& username,
+  void RemoveSavedPassword(size_t index) override;
+  void RemovePasswordException(size_t index) override;
+  void RequestShowPassword(size_t index,
                            content::WebContents* web_contents) override;
 
   // PasswordUIView implementation.
   Profile* GetProfile() override;
   void ShowPassword(
       size_t index,
-      const std::string& origin_url,
-      const std::string& username,
       const base::string16& plaintext_password) override;
   void SetPasswordList(
       const std::vector<std::unique_ptr<autofill::PasswordForm>>& password_list)
@@ -81,11 +76,9 @@
   // has been initialized or by deferring it until initialization has completed.
   void ExecuteFunction(const base::Closure& callback);
 
-  void RemoveSavedPasswordInternal(
-      const std::string& origin_url, const std::string& username);
-  void RemovePasswordExceptionInternal(const std::string& exception_url);
-  void RequestShowPasswordInternal(const std::string& origin_url,
-                                   const std::string& username,
+  void RemoveSavedPasswordInternal(size_t index);
+  void RemovePasswordExceptionInternal(size_t index);
+  void RequestShowPasswordInternal(size_t index,
                                    content::WebContents* web_contents);
 
   // Not owned by this class.
@@ -118,14 +111,6 @@
   // NativeWindow for the window where the API was called.
   content::WebContents* web_contents_;
 
-  // Map from origin URL and username to the index of |password_list_| at which
-  // the corresponding entry resides.
-  std::map<std::string, size_t> login_pair_to_index_map_;
-
-  // Map from password exception URL to the index of |password_exception_list_|
-  // at which the correponding entry resides.
-  std::map<std::string, size_t> exception_url_to_index_map_;
-
   DISALLOW_COPY_AND_ASSIGN(PasswordsPrivateDelegateImpl);
 };
 
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
index b5a22d86..ca05c357 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.cc
@@ -70,12 +70,10 @@
 }
 
 void PasswordsPrivateEventRouter::OnPlaintextPasswordFetched(
-        const std::string& origin_url,
-        const std::string& username,
-        const std::string& plaintext_password) {
+    size_t index,
+    const std::string& plaintext_password) {
   api::passwords_private::PlaintextPasswordEventParameters params;
-  params.login_pair.urls.origin = origin_url;
-  params.login_pair.username = username;
+  params.index = index;
   params.plaintext_password = plaintext_password;
 
   std::unique_ptr<base::ListValue> event_value(new base::ListValue);
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h
index 5ea04d7..b1d5293 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h
@@ -36,13 +36,10 @@
       const std::vector<api::passwords_private::ExceptionEntry>& exceptions);
 
   // Notifies listeners after fetching a plain-text password.
-  // |origin_url| The origin which the password is saved for.
-  // |username| The username that this password belongs to.
+  // |index| the index for the password entry being shown.
   // |plaintext_password| The human-readable password.
-  void OnPlaintextPasswordFetched(
-      const std::string& origin_url,
-      const std::string& username,
-      const std::string& plaintext_password);
+  void OnPlaintextPasswordFetched(size_t index,
+                                  const std::string& plaintext_password);
 
  protected:
   explicit PasswordsPrivateEventRouter(content::BrowserContext* context);
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h b/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h
index 85e2936..2f3a7878 100644
--- a/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h
+++ b/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h
@@ -18,6 +18,7 @@
 // well as a URL that is linked to.
 api::passwords_private::UrlCollection CreateUrlCollectionFromForm(
     const autofill::PasswordForm& form);
-}
+
+}  // namespace extensions
 
 #endif  // CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_UTILS_H_
diff --git a/chrome/browser/extensions/blacklist.cc b/chrome/browser/extensions/blacklist.cc
index 3270170..ce91e7a 100644
--- a/chrome/browser/extensions/blacklist.cc
+++ b/chrome/browser/extensions/blacklist.cc
@@ -20,7 +20,7 @@
 #include "chrome/browser/extensions/blacklist_state_fetcher.h"
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
 #include "components/prefs/pref_service.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "content/public/browser/notification_details.h"
 #include "content/public/browser/notification_source.h"
 #include "extensions/browser/extension_prefs.h"
diff --git a/chrome/browser/extensions/blacklist.h b/chrome/browser/extensions/blacklist.h
index efce4be6..2b623e62 100644
--- a/chrome/browser/extensions/blacklist.h
+++ b/chrome/browser/extensions/blacklist.h
@@ -17,7 +17,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
 #include "components/keyed_service/core/keyed_service.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 #include "extensions/browser/blacklist_state.h"
diff --git a/chrome/browser/extensions/blacklist_state_fetcher.h b/chrome/browser/extensions/blacklist_state_fetcher.h
index d8d1aaa..183480e 100644
--- a/chrome/browser/extensions/blacklist_state_fetcher.h
+++ b/chrome/browser/extensions/blacklist_state_fetcher.h
@@ -13,7 +13,7 @@
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "extensions/browser/blacklist_state.h"
 #include "net/url_request/url_fetcher.h"
 #include "net/url_request/url_fetcher_delegate.h"
diff --git a/chrome/browser/extensions/fake_safe_browsing_database_manager.cc b/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
index 01c64f77..339a0f9 100644
--- a/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
+++ b/chrome/browser/extensions/fake_safe_browsing_database_manager.cc
@@ -15,8 +15,8 @@
 #include "base/run_loop.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 
 namespace extensions {
 
diff --git a/chrome/browser/external_protocol/external_protocol_handler.cc b/chrome/browser/external_protocol/external_protocol_handler.cc
index 96fd356e..505b9c6c 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.cc
+++ b/chrome/browser/external_protocol/external_protocol_handler.cc
@@ -31,12 +31,29 @@
 
 using content::BrowserThread;
 
+namespace {
+
 // Whether we accept requests for launching external protocols. This is set to
 // false every time an external protocol is requested, and set back to true on
 // each user gesture. This variable should only be accessed from the UI thread.
 static bool g_accept_requests = true;
 
-namespace {
+static const char* const kDeniedSchemes[] = {
+    "afp", "data", "disk", "disks",
+    // ShellExecuting file:///C:/WINDOWS/system32/notepad.exe will simply
+    // execute the file specified!  Hopefully we won't see any "file" schemes
+    // because we think of file:// URLs as handled URLs, but better to be safe
+    // than to let an attacker format the user's hard drive.
+    "file", "hcp", "javascript", "ms-help", "nntp", "shell", "vbscript",
+    // view-source is a special case in chrome. When it comes through an
+    // iframe or a redirect, it looks like an external protocol, but we don't
+    // want to shellexecute it.
+    "view-source", "vnd.ms.radio",
+};
+
+static const char* const kAllowedSchemes[] = {
+    "mailto", "news", "snews",
+};
 
 // Functions enabling unit testing. Using a NULL delegate will use the default
 // behavior; if a delegate is provided it will be used instead.
@@ -152,37 +169,30 @@
     return BLOCK;
   }
 
-  // Check if there are any prefs in the local state. If there are, wipe them,
-  // and migrate the prefs to the profile.
-  // TODO(ramyasharma) remove the migration in M61.
-  PrefService* local_prefs = g_browser_process->local_state();
+  // Always block the hard-coded denied schemes.
+  for (size_t i = 0; i < arraysize(kDeniedSchemes); ++i) {
+    if (kDeniedSchemes[i] == scheme)
+      return BLOCK;
+  }
+
+  // Always allow the hard-coded allowed schemes.
+  for (size_t i = 0; i < arraysize(kAllowedSchemes); ++i) {
+    if (kAllowedSchemes[i] == scheme)
+      return DONT_BLOCK;
+  }
+
   PrefService* profile_prefs = profile->GetPrefs();
-  if (local_prefs && profile_prefs) {  // May be NULL during testing.
-    DictionaryPrefUpdate local_state_schemas(local_prefs,
-                                             prefs::kExcludedSchemes);
+  if (profile_prefs) {  // May be NULL during testing.
     DictionaryPrefUpdate update_excluded_schemas_profile(
         profile_prefs, prefs::kExcludedSchemes);
-    if (update_excluded_schemas_profile->empty()) {
-      // Copy local state to profile state.
-      for (base::DictionaryValue::Iterator it(*local_state_schemas);
-           !it.IsAtEnd(); it.Advance()) {
-        bool is_blocked;
-        // Discard local state if set to blocked, to reset all users
-        // stuck in 'Do Nothing' + 'Do Not Open' state back to the default
-        // prompt state.
-        if (it.value().GetAsBoolean(&is_blocked) && !is_blocked)
-          update_excluded_schemas_profile->SetBoolean(it.key(), is_blocked);
-      }
-      // TODO(ramyasharma): Clear only if required.
-      local_prefs->ClearPref(prefs::kExcludedSchemes);
-    }
-
-    // Prepopulate the default states each time.
-    PrepopulateDictionary(update_excluded_schemas_profile.Get());
-
     bool should_block;
-    if (update_excluded_schemas_profile->GetBoolean(scheme, &should_block))
-      return should_block ? BLOCK : DONT_BLOCK;
+    // Ignore stored block decisions. These are now not possible through the UI,
+    // and previous block decisions should be ignored to allow users to recover
+    // from accidental blocks.
+    if (update_excluded_schemas_profile->GetBoolean(scheme, &should_block) &&
+        !should_block) {
+      return DONT_BLOCK;
+    }
   }
 
   return UNKNOWN;
@@ -192,16 +202,19 @@
 void ExternalProtocolHandler::SetBlockState(const std::string& scheme,
                                             BlockState state,
                                             Profile* profile) {
+  // Setting the state to BLOCK is no longer supported through the UI.
+  DCHECK_NE(state, BLOCK);
+
   // Set in the stored prefs.
   PrefService* profile_prefs = profile->GetPrefs();
   if (profile_prefs) {  // May be NULL during testing.
     DictionaryPrefUpdate update_excluded_schemas_profile(
         profile_prefs, prefs::kExcludedSchemes);
     if (!update_excluded_schemas_profile->empty()) {
-      if (state == UNKNOWN)
-        update_excluded_schemas_profile->Remove(scheme, nullptr);
+      if (state == DONT_BLOCK)
+        update_excluded_schemas_profile->SetBoolean(scheme, false);
       else
-        update_excluded_schemas_profile->SetBoolean(scheme, (state == BLOCK));
+        update_excluded_schemas_profile->Remove(scheme, nullptr);
     }
   }
 }
@@ -270,52 +283,6 @@
 }
 
 // static
-void ExternalProtocolHandler::PrepopulateDictionary(
-    base::DictionaryValue* win_pref) {
-  static const char* const denied_schemes[] = {
-    "afp",
-    "data",
-    "disk",
-    "disks",
-    // ShellExecuting file:///C:/WINDOWS/system32/notepad.exe will simply
-    // execute the file specified!  Hopefully we won't see any "file" schemes
-    // because we think of file:// URLs as handled URLs, but better to be safe
-    // than to let an attacker format the user's hard drive.
-    "file",
-    "hcp",
-    "javascript",
-    "ms-help",
-    "nntp",
-    "shell",
-    "vbscript",
-    // view-source is a special case in chrome. When it comes through an
-    // iframe or a redirect, it looks like an external protocol, but we don't
-    // want to shellexecute it.
-    "view-source",
-    "vnd.ms.radio",
-  };
-
-  static const char* const allowed_schemes[] = {
-    "mailto",
-    "news",
-    "snews",
-  };
-
-  bool should_block;
-  for (size_t i = 0; i < arraysize(denied_schemes); ++i) {
-    if (!win_pref->GetBoolean(denied_schemes[i], &should_block)) {
-      win_pref->SetBoolean(denied_schemes[i], true);
-    }
-  }
-
-  for (size_t i = 0; i < arraysize(allowed_schemes); ++i) {
-    if (!win_pref->GetBoolean(allowed_schemes[i], &should_block)) {
-      win_pref->SetBoolean(allowed_schemes[i], false);
-    }
-  }
-}
-
-// static
 void ExternalProtocolHandler::RecordHandleStateMetrics(bool checkbox_selected,
                                                        BlockState block_state) {
   HandleState handle_state = DONT_LAUNCH;
diff --git a/chrome/browser/external_protocol/external_protocol_handler.h b/chrome/browser/external_protocol/external_protocol_handler.h
index fca8176..f4628c3 100644
--- a/chrome/browser/external_protocol/external_protocol_handler.h
+++ b/chrome/browser/external_protocol/external_protocol_handler.h
@@ -16,10 +16,6 @@
 class PrefRegistrySimple;
 class Profile;
 
-namespace base {
-class DictionaryValue;
-}
-
 class ExternalProtocolHandler {
  public:
   enum BlockState {
@@ -105,10 +101,6 @@
   // the state to false (not allowed).
   static void PermitLaunchUrl();
 
-  // Prepopulates the dictionary with known protocols to deny or allow, if
-  // preferences for them do not already exist.
-  static void PrepopulateDictionary(base::DictionaryValue* win_pref);
-
   // Records an UMA metric for the external protocol HandleState selected, based
   // on if the check box is selected / not and block / Dont block is picked.
   static void RecordHandleStateMetrics(bool checkbox_selected,
diff --git a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
index 1746217..aa30bb0b 100644
--- a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
+++ b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc
@@ -140,8 +140,7 @@
     delegate_.set_os_state(os_state);
     ExternalProtocolHandler::LaunchUrlWithDelegate(
         url, 0, 0, ui::PAGE_TRANSITION_LINK, true, &delegate_);
-    if (block_state != ExternalProtocolHandler::BLOCK)
-      content::RunAllBlockingPoolTasksUntilIdle();
+    content::RunAllBlockingPoolTasksUntilIdle();
 
     EXPECT_EQ(expected_action == Action::PROMPT, delegate_.has_prompted());
     EXPECT_EQ(expected_action == Action::LAUNCH, delegate_.has_launched());
@@ -231,7 +230,7 @@
       ExternalProtocolHandler::GetBlockState("tel", profile_.get());
   EXPECT_EQ(ExternalProtocolHandler::UNKNOWN, block_state);
   EXPECT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
-  EXPECT_FALSE(
+  EXPECT_TRUE(
       profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
 }
 
@@ -240,7 +239,7 @@
       ExternalProtocolHandler::GetBlockState("afp", profile_.get());
   EXPECT_EQ(ExternalProtocolHandler::BLOCK, block_state);
   EXPECT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
-  EXPECT_FALSE(
+  EXPECT_TRUE(
       profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
 }
 
@@ -249,43 +248,6 @@
       ExternalProtocolHandler::GetBlockState("mailto", profile_.get());
   EXPECT_EQ(ExternalProtocolHandler::DONT_BLOCK, block_state);
   EXPECT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
-  EXPECT_FALSE(
-      profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
-}
-
-TEST_F(ExternalProtocolHandlerTest,
-       TestGetBlockStateLocalBlockStateCopiedAndResetOnProfilePref) {
-  base::DictionaryValue prefs_local;
-  prefs_local.SetBoolean("tel", true);
-  local_state_->Set(prefs::kExcludedSchemes, prefs_local);
-  ExternalProtocolHandler::BlockState block_state =
-      ExternalProtocolHandler::GetBlockState("tel", profile_.get());
-  EXPECT_EQ(ExternalProtocolHandler::UNKNOWN, block_state);
-  EXPECT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
-  EXPECT_FALSE(
-      profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
-}
-
-TEST_F(ExternalProtocolHandlerTest,
-       TestGetBlockStateLocalDontBlockCopiedAsIsToProfilePref) {
-  base::DictionaryValue prefs_local;
-  prefs_local.SetBoolean("tel", false);
-  local_state_->Set(prefs::kExcludedSchemes, prefs_local);
-  ExternalProtocolHandler::BlockState block_state =
-      ExternalProtocolHandler::GetBlockState("tel", profile_.get());
-  EXPECT_EQ(ExternalProtocolHandler::DONT_BLOCK, block_state);
-  EXPECT_TRUE(local_state_->GetDictionary(prefs::kExcludedSchemes)->empty());
-  EXPECT_FALSE(
-      profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
-}
-
-TEST_F(ExternalProtocolHandlerTest, TestClearProfileState) {
-  base::DictionaryValue prefs;
-  prefs.SetBoolean("tel", true);
-  profile_->GetPrefs()->Set(prefs::kExcludedSchemes, prefs);
-  EXPECT_FALSE(
-      profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
-  ExternalProtocolHandler::ClearData(profile_.get());
   EXPECT_TRUE(
       profile_->GetPrefs()->GetDictionary(prefs::kExcludedSchemes)->empty());
 }
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index c2921c38..1dcc1826 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -790,13 +790,6 @@
 const char kMessageCenterNewStyleNotificationDescription[] =
     "Enables the experiment style of material-design notification";
 
-const char kMessageCenterAlwaysScrollUpUponRemovalName[] =
-    "Experiments that message center always scroll up upon notification "
-    "removal";
-const char kMessageCenterAlwaysScrollUpUponRemovalDescription[] =
-    "Enables experiment that message center always scroll up when a "
-    "notification is removed.";
-
 const char kMhtmlGeneratorOptionName[] = "MHTML Generation Option";
 const char kMhtmlGeneratorOptionDescription[] =
     "Provides experimental options for MHTML file generator.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 448076c..6f0c102 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -499,9 +499,6 @@
 extern const char kMessageCenterNewStyleNotificationName[];
 extern const char kMessageCenterNewStyleNotificationDescription[];
 
-extern const char kMessageCenterAlwaysScrollUpUponRemovalName[];
-extern const char kMessageCenterAlwaysScrollUpUponRemovalDescription[];
-
 extern const char kMhtmlGeneratorOptionName[];
 extern const char kMhtmlGeneratorOptionDescription[];
 extern const char kMhtmlSkipNostoreMain[];
diff --git a/chrome/browser/loader/safe_browsing_resource_throttle.cc b/chrome/browser/loader/safe_browsing_resource_throttle.cc
index 06978fb4..0a37234 100644
--- a/chrome/browser/loader/safe_browsing_resource_throttle.cc
+++ b/chrome/browser/loader/safe_browsing_resource_throttle.cc
@@ -7,8 +7,8 @@
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
 #include "chrome/browser/safe_browsing/ui_manager.h"
 #include "components/safe_browsing/base_ui_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/features.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "content/public/browser/resource_request_info.h"
 #include "net/http/http_request_headers.h"
 
diff --git a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
index 971a7046..5d24599 100644
--- a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
+++ b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
@@ -536,7 +536,8 @@
       LargeIconServiceFactory::GetForBrowserContext(profile);
   std::unique_ptr<CategoryRanker> category_ranker =
       ntp_snippets::BuildSelectedCategoryRanker(
-          pref_service, base::MakeUnique<base::DefaultClock>());
+          pref_service, base::MakeUnique<base::DefaultClock>(),
+          GetIsChromeHomeEnabled());
 
   auto* service = new ContentSuggestionsService(
       State::ENABLED, signin_manager, history_service, large_icon_service,
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 dd42e8cb..f852dcd 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -53,8 +53,8 @@
 #endif
 
 #if defined(SAFE_BROWSING_DB_LOCAL)
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/safe_browsing/password_protection/password_protection_service.h"
-#include "components/safe_browsing_db/database_manager.h"
 #endif
 
 using browser_sync::ProfileSyncServiceMock;
diff --git a/chrome/browser/permissions/permission_blacklist_client.h b/chrome/browser/permissions/permission_blacklist_client.h
index f0e253854..a7c6458 100644
--- a/chrome/browser/permissions/permission_blacklist_client.h
+++ b/chrome/browser/permissions/permission_blacklist_client.h
@@ -10,7 +10,7 @@
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
 #include "components/content_settings/core/common/content_settings_types.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "content/public/browser/web_contents_observer.h"
 
 class GURL;
diff --git a/chrome/browser/permissions/permission_context_base.cc b/chrome/browser/permissions/permission_context_base.cc
index 8302c223..931aa37 100644
--- a/chrome/browser/permissions/permission_context_base.cc
+++ b/chrome/browser/permissions/permission_context_base.cc
@@ -30,7 +30,7 @@
 #include "chrome/common/pref_names.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/prefs/pref_service.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/render_frame_host.h"
diff --git a/chrome/browser/permissions/permission_context_base_unittest.cc b/chrome/browser/permissions/permission_context_base_unittest.cc
index 382ff687..d68422eb 100644
--- a/chrome/browser/permissions/permission_context_base_unittest.cc
+++ b/chrome/browser/permissions/permission_context_base_unittest.cc
@@ -35,8 +35,8 @@
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/content_settings/core/common/content_settings.h"
 #include "components/content_settings/core/common/content_settings_types.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/render_frame_host.h"
diff --git a/chrome/browser/permissions/permission_decision_auto_blocker.cc b/chrome/browser/permissions/permission_decision_auto_blocker.cc
index 71ef6f8..7830084 100644
--- a/chrome/browser/permissions/permission_decision_auto_blocker.cc
+++ b/chrome/browser/permissions/permission_decision_auto_blocker.cc
@@ -19,7 +19,7 @@
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
 #include "chrome/common/chrome_features.h"
 #include "components/keyed_service/content/browser_context_dependency_manager.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/web_contents.h"
 #include "url/gurl.h"
diff --git a/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc b/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc
index 5612656..2d0d21ee 100644
--- a/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc
+++ b/chrome/browser/permissions/permission_decision_auto_blocker_unittest.cc
@@ -18,7 +18,7 @@
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
-#include "components/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 
 namespace {
 
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index f96c596..51cb5646 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -80,8 +80,8 @@
 #include "components/password_manager/core/browser/password_bubble_experiment.h"
 #include "components/password_manager/core/browser/password_manager_test_utils.h"
 #include "components/password_manager/core/browser/test_password_store.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/util.h"
 #include "components/variations/entropy_provider.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_message_filter.h"
diff --git a/chrome/browser/prerender/prerender_test_utils.cc b/chrome/browser/prerender/prerender_test_utils.cc
index 1f6f5fdf..f1faa8b1 100644
--- a/chrome/browser/prerender/prerender_test_utils.cc
+++ b/chrome/browser/prerender/prerender_test_utils.cc
@@ -26,7 +26,7 @@
 #include "chrome/grit/generated_resources.h"
 #include "chrome/test/base/ui_test_utils.h"
 #include "components/prefs/pref_service.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/browser/notification_details.h"
 #include "content/public/browser/notification_source.h"
 #include "content/public/browser/notification_types.h"
diff --git a/chrome/browser/prerender/prerender_test_utils.h b/chrome/browser/prerender/prerender_test_utils.h
index 5e5db55..3a4ca02 100644
--- a/chrome/browser/prerender/prerender_test_utils.h
+++ b/chrome/browser/prerender/prerender_test_utils.h
@@ -21,7 +21,7 @@
 #include "chrome/browser/prerender/prerender_manager.h"
 #include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
 #include "chrome/test/base/in_process_browser_test.h"
-#include "components/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "net/test/url_request/url_request_mock_http_job.h"
 #include "net/url_request/url_request_interceptor.h"
diff --git a/chrome/browser/resources/local_ntp/local_ntp.css b/chrome/browser/resources/local_ntp/local_ntp.css
index 6d495254..1c11877 100644
--- a/chrome/browser/resources/local_ntp/local_ntp.css
+++ b/chrome/browser/resources/local_ntp/local_ntp.css
@@ -72,7 +72,6 @@
 
 #logo-default,
 #logo-doodle {
-  bottom: 0;
   position: absolute;
   transition: opacity 130ms;
 }
@@ -82,6 +81,7 @@
   background-repeat: no-repeat;
   height: 92px;
   left: calc(50% - 272px/2);
+  top: 157px;
   width: 272px;
 }
 
@@ -94,9 +94,11 @@
   left: -100px;
   opacity: 0;
   right: -100px;
+  top: 44px;
 }
 
 #logo-doodle-link {
+  cursor: pointer;
   margin: 0 auto;
 }
 
diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js
index ca806688..ee7f0fd2 100644
--- a/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -708,16 +708,24 @@
 };
 
 
-/** Returns the currently visible doodle image. The doodle may be fully-visible
- * or fading in. If the default logo is visible or the doodle is fading out,
- * returns null.
- * @returns {?string}
+/** Returns true if |doodle| is currently visible. If doodle.image is null,
+ * returns true when the default logo is visible; if non-null, checks that it
+ * matches the doodle that is currently visible. Here, "visible" means
+ * fully-visible or fading in.
+ *
+ * @param {{image, metadata}} doodle
+ * @returns {boolean}
  */
-var getCurrentDoodleImageUrl = function() {
-  if ($(IDS.LOGO_DOODLE).style.opacity != 0) {
-    return $(IDS.LOGO_DOODLE_IMAGE).src;
-  }
-  return null;
+var isDoodleCurrentlyVisible = function(doodle) {
+  var haveDoodle = ($(IDS.LOGO_DOODLE).style.opacity != 0);
+  var wantDoodle = (doodle.image !== null);
+  if (!haveDoodle || !wantDoodle)
+    return haveDoodle === wantDoodle;
+
+  // Have a visible doodle and a query doodle. Test that they match.
+  var logoDoodleImage = $(IDS.LOGO_DOODLE_IMAGE);
+  return (logoDoodleImage.src === doodle.image) ||
+      (logoDoodleImage.src === doodle.metadata.animatedUrl);
 };
 
 
@@ -746,8 +754,7 @@
   // update the doodle's alt text and href, if applicable.
   if (image === targetDoodle.image) {
     if (metadata !== null) {
-      logoDoodleLink.title = targetDoodle.metadata.altText;
-      logoDoodleLink.href = targetDoodle.metadata.onClickUrl;
+      applyDoodleMetadata(metadata);
       targetDoodle.metadata = metadata;
     }
     return;
@@ -774,8 +781,7 @@
     if (targetDoodle.image === null) {
       logoDefault.style.opacity = 1;
     } else {
-      logoDoodleLink.title = targetDoodle.metadata.altText;
-      logoDoodleLink.href = targetDoodle.metadata.onClickUrl;
+      applyDoodleMetadata(targetDoodle.metadata);
       logoDoodleImage.src = targetDoodle.image;
       logoDoodle.style.opacity = 1;
     }
@@ -784,13 +790,34 @@
 
   // Fade-in finished. It's possible that the wrong image is now faded in, if
   // the logo updated during a fade-in. In this case, restart the fade-out.
-  if (targetDoodle.image !== getCurrentDoodleImageUrl()) {
+  if (!isDoodleCurrentlyVisible(targetDoodle)) {
     logoDoodle.style.opacity = 0;
     logoDefault.style.opacity = 0;
   }
 };
 
 
+var applyDoodleMetadata = function(metadata) {
+  var logoDoodleLink = $(IDS.LOGO_DOODLE_LINK);
+  var logoDoodleImage = $(IDS.LOGO_DOODLE_IMAGE);
+
+  logoDoodleImage.title = metadata.altText;
+
+  if (metadata.animatedUrl) {
+    logoDoodleLink.removeAttribute('href');
+    logoDoodleLink.onclick = function(e) {
+      e.preventDefault();
+      logoDoodleImage.src = metadata.animatedUrl;
+      logoDoodleLink.href = metadata.onClickUrl;
+      logoDoodleLink.onclick = null;
+    };
+  } else {
+    logoDoodleLink.href = metadata.onClickUrl;
+    logoDoodleLink.onclick = null;
+  }
+};
+
+
 return {
   init: init,  // Exposed for testing.
   listen: listen
diff --git a/chrome/browser/resources/md_history/shared_style.html b/chrome/browser/resources/md_history/shared_style.html
index d428ea27..32534a4 100644
--- a/chrome/browser/resources/md_history/shared_style.html
+++ b/chrome/browser/resources/md_history/shared_style.html
@@ -35,7 +35,6 @@
       }
 
       .website-icon {
-        -webkit-margin-end: 16px;
         background-repeat: no-repeat;
         background-size: 16px;
         height: 16px;
@@ -43,6 +42,7 @@
       }
 
       .website-title {
+        -webkit-margin-start: 16px;
         color: var(--primary-text-color);
         overflow: hidden;
         text-decoration: none;
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js
index b426a01..063cd71 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_section.js
@@ -33,10 +33,10 @@
 
   /**
    * Should remove the saved password and notify that the list has changed.
-   * @param {!PasswordManager.LoginPair} loginPair The saved password that
-   *     should be removed from the list. No-op if |loginPair| is not found.
+   * @param {number} index The index for the password entry being removed.
+   *     No-op if |index| is not in the list.
    */
-  removeSavedPassword(loginPair) {}
+  removeSavedPassword(index) {}
 
   /**
    * Add an observer to the list of password exceptions.
@@ -58,18 +58,18 @@
 
   /**
    * Should remove the password exception and notify that the list has changed.
-   * @param {string} exception The exception that should be removed from the
-   *     list. No-op if |exception| is not in the list.
+   * @param {number} index The index for the exception url entry being removed.
+   *     No-op if |index| is not in the list.
    */
-  removeException(exception) {}
+  removeException(index) {}
 
   /**
    * Gets the saved password for a given login pair.
-   * @param {!PasswordManager.LoginPair} loginPair The saved password that
-   *     should be retrieved.
+   * @param {number} index The index for password entry that should be
+   *     retrieved. No-op if |index| is not in the list.
    * @param {function(!PasswordManager.PlaintextPasswordEvent):void} callback
    */
-  getPlaintextPassword(loginPair, callback) {}
+  getPlaintextPassword(index, callback) {}
 }
 
 /** @typedef {chrome.passwordsPrivate.PasswordUiEntry} */
@@ -106,8 +106,8 @@
   }
 
   /** @override */
-  removeSavedPassword(loginPair) {
-    chrome.passwordsPrivate.removeSavedPassword(loginPair);
+  removeSavedPassword(index) {
+    chrome.passwordsPrivate.removeSavedPassword(index);
   }
 
   /** @override */
@@ -128,23 +128,22 @@
   }
 
   /** @override */
-  removeException(exception) {
-    chrome.passwordsPrivate.removePasswordException(exception);
+  removeException(index) {
+    chrome.passwordsPrivate.removePasswordException(index);
   }
 
   /** @override */
-  getPlaintextPassword(loginPair, callback) {
+  getPlaintextPassword(index, callback) {
     var listener = function(reply) {
       // Only handle the reply for our loginPair request.
-      if (reply.loginPair.urls.origin == loginPair.urls.origin &&
-          reply.loginPair.username == loginPair.username) {
+      if (reply.index == index) {
         chrome.passwordsPrivate.onPlaintextPasswordRetrieved.removeListener(
             listener);
         callback(reply);
       }
     };
     chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(listener);
-    chrome.passwordsPrivate.requestPlaintextPassword(loginPair);
+    chrome.passwordsPrivate.requestPlaintextPassword(index);
   }
 }
 
@@ -326,7 +325,7 @@
    * @private
    */
   onMenuRemovePasswordTap_: function() {
-    this.passwordManager_.removeSavedPassword(this.activePassword.loginPair);
+    this.passwordManager_.removeSavedPassword(this.activePassword.index);
     /** @type {CrActionMenuElement} */ (this.$.menu).close();
   },
 
@@ -336,7 +335,7 @@
    * @private
    */
   onRemoveExceptionButtonTap_: function(e) {
-    this.passwordManager_.removeException(e.model.item.urls.origin);
+    this.passwordManager_.removeException(e.model.item.index);
   },
 
   /**
@@ -372,8 +371,7 @@
    */
   showPassword_: function(event) {
     this.passwordManager_.getPlaintextPassword(
-        /** @type {!PasswordManager.LoginPair} */ (event.detail.item.loginPair),
-        item => {
+        /** @type {!number} */ (event.detail.item.index), item => {
           event.detail.password = item.plaintextPassword;
         });
   },
diff --git a/chrome/browser/safe_browsing/BUILD.gn b/chrome/browser/safe_browsing/BUILD.gn
index 7bf6cda9..1a926d64 100644
--- a/chrome/browser/safe_browsing/BUILD.gn
+++ b/chrome/browser/safe_browsing/BUILD.gn
@@ -112,10 +112,10 @@
       "//components/safe_browsing:safe_browsing",
       "//components/safe_browsing/browser:browser",
       "//components/safe_browsing/common:common",
+      "//components/safe_browsing/db:metadata_proto",
+      "//components/safe_browsing/db:whitelist_checker_client",
       "//components/safe_browsing/password_protection",
       "//components/safe_browsing/triggers:triggers",
-      "//components/safe_browsing_db:metadata_proto",
-      "//components/safe_browsing_db:whitelist_checker_client",
     ]
     if (safe_browsing_mode == 1) {
       # "Safe Browsing Full" files in addition to the "basic" ones to use for
@@ -246,10 +246,10 @@
         "//components/content_settings/core/browser:browser",
         "//components/prefs:prefs",
         "//components/safe_browsing/common:safe_browsing_prefs",
+        "//components/safe_browsing/db:db",
         "//components/safe_browsing/triggers:ad_sampler_trigger",
         "//components/safe_browsing/triggers:trigger_throttler",
         "//components/safe_browsing/triggers:triggers",
-        "//components/safe_browsing_db:safe_browsing_db",
         "//components/security_interstitials/content:security_interstitial_page",
         "//content/public/browser:browser",
         "//net:net",
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc
index d627b039..6fde045f 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc
@@ -24,8 +24,8 @@
 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
 #include "components/history/core/browser/history_service.h"
 #include "components/history/core/browser/history_types.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
index b8b676c..aff2da21 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
@@ -24,9 +24,9 @@
 #include "chrome/test/base/testing_profile.h"
 #include "components/history/core/browser/history_backend.h"
 #include "components/history/core/browser/history_service.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/test_database_manager.h"
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service.cc b/chrome/browser/safe_browsing/chrome_password_protection_service.cc
index d0569529..792fabe 100644
--- a/chrome/browser/safe_browsing/chrome_password_protection_service.cc
+++ b/chrome/browser/safe_browsing/chrome_password_protection_service.cc
@@ -25,9 +25,9 @@
 #include "components/prefs/pref_change_registrar.h"
 #include "components/prefs/pref_service.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/safe_browsing/features.h"
 #include "components/safe_browsing/password_protection/password_protection_request.h"
-#include "components/safe_browsing_db/database_manager.h"
 #include "components/signin/core/browser/account_info.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/signin_manager.h"
diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc b/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc
index 78470be..0ee83a9 100644
--- a/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc
@@ -23,9 +23,9 @@
 #include "chrome/test/base/testing_profile.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/prefs/pref_service.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/features.h"
 #include "components/safe_browsing/password_protection/password_protection_request.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/fake_account_fetcher_service.h"
 #include "components/signin/core/browser/signin_manager.h"
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc
index cd08233..7f0903f6 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host.cc
@@ -23,9 +23,9 @@
 #include "components/prefs/pref_service.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
 #include "components/safe_browsing/common/safebrowsing_messages.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/whitelist_checker_client.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/whitelist_checker_client.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.h b/chrome/browser/safe_browsing/client_side_detection_host.h
index 1b82f1b..f1603081 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.h
+++ b/chrome/browser/safe_browsing/client_side_detection_host.h
@@ -15,7 +15,7 @@
 #include "base/memory/ref_counted.h"
 #include "chrome/browser/safe_browsing/browser_feature_extractor.h"
 #include "chrome/browser/safe_browsing/ui_manager.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "content/public/browser/resource_request_details.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "url/gurl.h"
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index aec113e..ece2d9f3 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -23,9 +23,9 @@
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
 #include "components/safe_browsing/common/safebrowsing_messages.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/test_database_manager.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/browser_side_navigation_policy.h"
diff --git a/chrome/browser/safe_browsing/download_protection/check_client_download_request.h b/chrome/browser/safe_browsing/download_protection/check_client_download_request.h
index f7d28f1..3119bbb 100644
--- a/chrome/browser/safe_browsing/download_protection/check_client_download_request.h
+++ b/chrome/browser/safe_browsing/download_protection/check_client_download_request.h
@@ -23,7 +23,7 @@
 #include "chrome/browser/safe_browsing/ui_manager.h"
 #include "chrome/common/safe_browsing/binary_feature_extractor.h"
 #include "components/history/core/browser/history_service.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "content/public/browser/download_item.h"
 #include "net/url_request/url_fetcher.h"
 #include "net/url_request/url_fetcher_delegate.h"
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service.h b/chrome/browser/safe_browsing/download_protection/download_protection_service.h
index 49ceaec..f44babc6 100644
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service.h
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service.h
@@ -26,7 +26,7 @@
 #include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h"
 #include "chrome/browser/safe_browsing/ui_manager.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "url/gurl.h"
 
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
index dc0edd0..dca901b9 100644
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
@@ -44,10 +44,10 @@
 #include "components/prefs/pref_service.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
 #include "components/safe_browsing/common/safebrowsing_switches.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/test_database_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "content/public/browser/download_danger_type.h"
 #include "content/public/browser/page_navigator.h"
 #include "content/public/test/mock_download_item.h"
diff --git a/chrome/browser/safe_browsing/download_protection/download_url_sb_client.h b/chrome/browser/safe_browsing/download_protection/download_url_sb_client.h
index 851723f3..2be9564 100644
--- a/chrome/browser/safe_browsing/download_protection/download_url_sb_client.h
+++ b/chrome/browser/safe_browsing/download_protection/download_url_sb_client.h
@@ -10,7 +10,7 @@
 
 #include "base/scoped_observer.h"
 #include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/download_item.h"
 
diff --git a/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc b/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc
index 5ab3e52..511e35e2 100644
--- a/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc
+++ b/chrome/browser/safe_browsing/download_protection/ppapi_download_request.cc
@@ -11,7 +11,7 @@
 #include "chrome/browser/sessions/session_tab_helper.h"
 #include "chrome/common/safe_browsing/file_type_policies.h"
 #include "components/data_use_measurement/core/data_use_user_data.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/web_contents.h"
 #include "google_apis/google_api_keys.h"
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
index f131a01..408f60a 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
@@ -37,8 +37,8 @@
 #include "chrome/common/pref_names.h"
 #include "components/prefs/pref_service.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "net/url_request/url_request_context_getter.h"
diff --git a/chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h b/chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h
index b2372f51..219054c0 100644
--- a/chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h
+++ b/chrome/browser/safe_browsing/incident_reporting/resource_request_detector.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 
 namespace net {
 class URLRequest;
diff --git a/chrome/browser/safe_browsing/incident_reporting/resource_request_detector_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/resource_request_detector_unittest.cc
index 83431bf..42c2d9a 100644
--- a/chrome/browser/safe_browsing/incident_reporting/resource_request_detector_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/resource_request_detector_unittest.cc
@@ -12,8 +12,8 @@
 #include "chrome/browser/safe_browsing/incident_reporting/incident.h"
 #include "chrome/browser/safe_browsing/incident_reporting/incident_receiver.h"
 #include "chrome/browser/safe_browsing/incident_reporting/mock_incident_receiver.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/test_database_manager.h"
 #include "content/public/browser/resource_request_info.h"
 #include "content/public/common/previews_state.h"
 #include "content/public/common/resource_type.h"
diff --git a/chrome/browser/safe_browsing/local_database_manager.cc b/chrome/browser/safe_browsing/local_database_manager.cc
index 52bdc20..0fb77c7 100644
--- a/chrome/browser/safe_browsing/local_database_manager.cc
+++ b/chrome/browser/safe_browsing/local_database_manager.cc
@@ -36,7 +36,7 @@
 #include "components/prefs/pref_service.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
 #include "components/safe_browsing/common/safebrowsing_switches.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "net/url_request/url_request_context_getter.h"
diff --git a/chrome/browser/safe_browsing/local_database_manager.h b/chrome/browser/safe_browsing/local_database_manager.h
index 327ea7e1..58c79ed5 100644
--- a/chrome/browser/safe_browsing/local_database_manager.h
+++ b/chrome/browser/safe_browsing/local_database_manager.h
@@ -27,10 +27,10 @@
 #include "chrome/browser/safe_browsing/protocol_manager.h"
 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/chrome/browser/safe_browsing/local_database_manager_unittest.cc b/chrome/browser/safe_browsing/local_database_manager_unittest.cc
index 888ac2a..a5c24871 100644
--- a/chrome/browser/safe_browsing/local_database_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/local_database_manager_unittest.cc
@@ -14,9 +14,9 @@
 #include "base/memory/ref_counted.h"
 #include "base/run_loop.h"
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
-#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_utils.h"
 #include "net/url_request/url_request_context_getter.h"
diff --git a/chrome/browser/safe_browsing/notification_image_reporter.cc b/chrome/browser/safe_browsing/notification_image_reporter.cc
index 6eb80b2..d285f10b 100644
--- a/chrome/browser/safe_browsing/notification_image_reporter.cc
+++ b/chrome/browser/safe_browsing/notification_image_reporter.cc
@@ -19,9 +19,9 @@
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/whitelist_checker_client.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/whitelist_checker_client.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_thread.h"
 #include "net/base/net_errors.h"
diff --git a/chrome/browser/safe_browsing/notification_image_reporter_unittest.cc b/chrome/browser/safe_browsing/notification_image_reporter_unittest.cc
index 8002234..6dd740c 100644
--- a/chrome/browser/safe_browsing/notification_image_reporter_unittest.cc
+++ b/chrome/browser/safe_browsing/notification_image_reporter_unittest.cc
@@ -14,8 +14,8 @@
 #include "chrome/test/base/testing_browser_process.h"
 #include "chrome/test/base/testing_profile.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/test_database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index ae8a0589..d4d0560 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -19,7 +19,7 @@
 #include "chrome/browser/safe_browsing/protocol_parser.h"
 #include "chrome/common/env_vars.h"
 #include "components/data_use_measurement/core/data_use_user_data.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_thread.h"
 #include "google_apis/google_api_keys.h"
diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h
index 66fa557..7e145b44 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -31,8 +31,8 @@
 #include "chrome/browser/safe_browsing/protocol_parser.h"
 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/util.h"
 #include "net/url_request/url_fetcher_delegate.h"
 #include "net/url_request/url_request_status.h"
 #include "url/gurl.h"
diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
index e85668b3..fca5a49 100644
--- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
@@ -15,8 +15,8 @@
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/chunk.pb.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/util.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "google_apis/google_api_keys.h"
 #include "net/base/escape.h"
diff --git a/chrome/browser/safe_browsing/protocol_parser.cc b/chrome/browser/safe_browsing/protocol_parser.cc
index 3fca387..fb5bf7d8 100644
--- a/chrome/browser/safe_browsing/protocol_parser.cc
+++ b/chrome/browser/safe_browsing/protocol_parser.cc
@@ -20,7 +20,7 @@
 #include "base/sys_byteorder.h"
 #include "base/time/time.h"
 #include "build/build_config.h"
-#include "components/safe_browsing_db/metadata.pb.h"
+#include "components/safe_browsing/db/metadata.pb.h"
 
 namespace safe_browsing {
 
diff --git a/chrome/browser/safe_browsing/protocol_parser.h b/chrome/browser/safe_browsing/protocol_parser.h
index ae356a2..4a245a1 100644
--- a/chrome/browser/safe_browsing/protocol_parser.h
+++ b/chrome/browser/safe_browsing/protocol_parser.h
@@ -16,7 +16,7 @@
 #include <vector>
 
 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace base {
 class TimeDelta;
diff --git a/chrome/browser/safe_browsing/protocol_parser_unittest.cc b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
index 9a1f220..51627326 100644
--- a/chrome/browser/safe_browsing/protocol_parser_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
@@ -10,8 +10,8 @@
 #include "base/strings/stringprintf.h"
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/protocol_parser.h"
-#include "components/safe_browsing_db/metadata.pb.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/metadata.pb.h"
+#include "components/safe_browsing/db/util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace safe_browsing {
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index c52bd8c..7faeb7c 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -41,11 +41,11 @@
 #include "components/prefs/pref_service.h"
 #include "components/safe_browsing/browser/threat_details.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/web_ui/constants.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/test_database_manager.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "components/security_interstitials/content/security_interstitial_controller_client.h"
 #include "components/security_interstitials/core/controller_client.h"
 #include "components/security_interstitials/core/metrics_helper.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index ca6e852..c47e41e 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -25,8 +25,8 @@
 #include "base/time/time.h"
 #include "build/build_config.h"
 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
-#include "components/safe_browsing_db/prefix_set.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/prefix_set.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/browser/browser_thread.h"
 #include "crypto/sha2.h"
 #include "net/base/ip_address.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h
index 14308e1..e9d4345 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.h
+++ b/chrome/browser/safe_browsing/safe_browsing_database.h
@@ -21,7 +21,7 @@
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/safe_browsing_store.h"
 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 class GURL;
 
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index 2501e465..244e1d8 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -38,11 +38,11 @@
 #include "components/safe_browsing/browser/safe_browsing_url_request_context_getter.h"
 #include "components/safe_browsing/common/safebrowsing_constants.h"
 #include "components/safe_browsing/common/safebrowsing_switches.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/v4_feature_list.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_local_database_manager.h"
 #include "components/safe_browsing/triggers/trigger_manager.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/v4_feature_list.h"
-#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
-#include "components/safe_browsing_db/v4_local_database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/resource_request_info.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h
index 5183f6d..834659f 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -21,8 +21,8 @@
 #include "base/sequenced_task_runner_helpers.h"
 #include "chrome/browser/safe_browsing/services_delegate.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_feature_list.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_feature_list.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index 7b3041525..d0369d4d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -61,14 +61,14 @@
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/prefs/pref_service.h"
 #include "components/safe_browsing/common/safebrowsing_switches.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/metadata.pb.h"
-#include "components/safe_browsing_db/test_database_manager.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_database.h"
-#include "components/safe_browsing_db/v4_feature_list.h"
-#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/metadata.pb.h"
+#include "components/safe_browsing/db/test_database_manager.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_database.h"
+#include "components/safe_browsing/db/v4_feature_list.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/browser/interstitial_page.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/render_frame_host.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_store.h b/chrome/browser/safe_browsing/safe_browsing_store.h
index 76b241e3..a31d694 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store.h
+++ b/chrome/browser/safe_browsing/safe_browsing_store.h
@@ -15,7 +15,7 @@
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "base/time/time.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace base {
 class FilePath;
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc
index 6010530..f9a71406 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc
@@ -11,7 +11,7 @@
 #include "base/md5.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/metrics/sparse_histogram.h"
-#include "components/safe_browsing_db/prefix_set.h"
+#include "components/safe_browsing/db/prefix_set.h"
 
 namespace safe_browsing {
 
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
index e073dfb..b75e7c6 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc
@@ -16,8 +16,8 @@
 #include "base/test/test_simple_task_runner.h"
 #include "build/build_config.h"
 #include "chrome/common/chrome_paths.h"
-#include "components/safe_browsing_db/prefix_set.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/prefix_set.h"
+#include "components/safe_browsing/db/util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc
index 2814cb8..293305d4 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_unittest.cc
@@ -6,7 +6,7 @@
 #include <string.h>
 
 #include "chrome/browser/safe_browsing/safe_browsing_store.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.h b/chrome/browser/safe_browsing/safe_browsing_util.h
index 03a79af8..06ab4dc 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.h
+++ b/chrome/browser/safe_browsing/safe_browsing_util.h
@@ -18,7 +18,7 @@
 #include "base/strings/string_piece.h"
 #include "base/time/time.h"
 #include "chrome/browser/safe_browsing/chunk_range.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace safe_browsing {
 
diff --git a/chrome/browser/safe_browsing/services_delegate_impl.cc b/chrome/browser/safe_browsing/services_delegate_impl.cc
index e50cb929..a136ce4 100644
--- a/chrome/browser/safe_browsing/services_delegate_impl.cc
+++ b/chrome/browser/safe_browsing/services_delegate_impl.cc
@@ -11,7 +11,7 @@
 #include "base/strings/string_util.h"
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
 #include "chrome/common/chrome_switches.h"
-#include "components/safe_browsing_db/v4_local_database_manager.h"
+#include "components/safe_browsing/db/v4_local_database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "services/preferences/public/interfaces/tracked_preference_validation_delegate.mojom.h"
 
diff --git a/chrome/browser/safe_browsing/services_delegate_stub.cc b/chrome/browser/safe_browsing/services_delegate_stub.cc
index 9288ceb..f2d10333 100644
--- a/chrome/browser/safe_browsing/services_delegate_stub.cc
+++ b/chrome/browser/safe_browsing/services_delegate_stub.cc
@@ -6,7 +6,7 @@
 
 #include "base/logging.h"
 #include "base/memory/ptr_util.h"
-#include "components/safe_browsing_db/v4_local_database_manager.h"
+#include "components/safe_browsing/db/v4_local_database_manager.h"
 #include "services/preferences/public/interfaces/tracked_preference_validation_delegate.mojom.h"
 
 namespace safe_browsing {
diff --git a/chrome/browser/safe_browsing/test_safe_browsing_database_helper.cc b/chrome/browser/safe_browsing/test_safe_browsing_database_helper.cc
index a7e603ca..2754c8e 100644
--- a/chrome/browser/safe_browsing/test_safe_browsing_database_helper.cc
+++ b/chrome/browser/safe_browsing/test_safe_browsing_database_helper.cc
@@ -16,8 +16,8 @@
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
 #include "chrome/browser/safe_browsing/test_safe_browsing_service.h"
 #include "chrome/browser/safe_browsing/v4_test_utils.h"
-#include "components/safe_browsing_db/v4_database.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_database.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/security_interstitials/content/unsafe_resource.h"
 
 namespace {
diff --git a/chrome/browser/safe_browsing/test_safe_browsing_database_helper.h b/chrome/browser/safe_browsing/test_safe_browsing_database_helper.h
index 9d02f64..9985497c 100644
--- a/chrome/browser/safe_browsing/test_safe_browsing_database_helper.h
+++ b/chrome/browser/safe_browsing/test_safe_browsing_database_helper.h
@@ -9,7 +9,7 @@
 #include <vector>
 
 #include "base/macros.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace safe_browsing {
 class ListIdentifier;
diff --git a/chrome/browser/safe_browsing/test_safe_browsing_service.cc b/chrome/browser/safe_browsing/test_safe_browsing_service.cc
index af9c88e..609e7c66 100644
--- a/chrome/browser/safe_browsing/test_safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/test_safe_browsing_service.cc
@@ -8,9 +8,9 @@
 #include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
 #include "chrome/browser/safe_browsing/ping_manager.h"
 #include "chrome/browser/safe_browsing/ui_manager.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/test_database_manager.h"
-#include "components/safe_browsing_db/v4_feature_list.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
+#include "components/safe_browsing/db/v4_feature_list.h"
 
 namespace safe_browsing {
 
diff --git a/chrome/browser/safe_browsing/test_safe_browsing_service.h b/chrome/browser/safe_browsing/test_safe_browsing_service.h
index 1d8fecef..3032cb4 100644
--- a/chrome/browser/safe_browsing/test_safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/test_safe_browsing_service.h
@@ -9,7 +9,7 @@
 
 #include "chrome/browser/safe_browsing/protocol_manager.h"
 #include "chrome/browser/safe_browsing/ui_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 
 namespace safe_browsing {
 struct SafeBrowsingProtocolConfig;
diff --git a/chrome/browser/safe_browsing/ui_manager_unittest.cc b/chrome/browser/safe_browsing/ui_manager_unittest.cc
index 83e6c2c3..fa3b0b8 100644
--- a/chrome/browser/safe_browsing/ui_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/ui_manager_unittest.cc
@@ -12,7 +12,7 @@
 #include "chrome/test/base/testing_browser_process.h"
 #include "chrome/test/base/testing_profile.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "components/security_interstitials/core/base_safe_browsing_error_ui.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/render_process_host.h"
diff --git a/chrome/browser/safe_browsing/url_checker_delegate_impl.cc b/chrome/browser/safe_browsing/url_checker_delegate_impl.cc
index 68cfcc1..db9eda2 100644
--- a/chrome/browser/safe_browsing/url_checker_delegate_impl.cc
+++ b/chrome/browser/safe_browsing/url_checker_delegate_impl.cc
@@ -8,8 +8,8 @@
 #include "chrome/browser/prerender/prerender_contents.h"
 #include "chrome/browser/prerender/prerender_final_status.h"
 #include "chrome/browser/safe_browsing/ui_manager.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/web_contents.h"
 
diff --git a/chrome/browser/safe_browsing/v4_test_utils.h b/chrome/browser/safe_browsing/v4_test_utils.h
index fedc05ee..cb82bf7 100644
--- a/chrome/browser/safe_browsing/v4_test_utils.h
+++ b/chrome/browser/safe_browsing/v4_test_utils.h
@@ -7,8 +7,8 @@
 
 #include <memory>
 
-#include "components/safe_browsing_db/v4_database.h"
-#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_database.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
 
 namespace safe_browsing {
 
diff --git a/chrome/browser/signin/account_reconcilor_unittest.cc b/chrome/browser/signin/account_reconcilor_unittest.cc
index afafa710..7d986a9d9 100644
--- a/chrome/browser/signin/account_reconcilor_unittest.cc
+++ b/chrome/browser/signin/account_reconcilor_unittest.cc
@@ -319,6 +319,7 @@
 }
 
 #if BUILDFLAG(ENABLE_DICE_SUPPORT)
+
 // Tests that the AccountReconcilor is enabled when Dice is enabled.
 TEST_F(AccountReconcilorTest, EnabledWithDice) {
   signin::ScopedAccountConsistencyDice scoped_dice;
@@ -478,6 +479,34 @@
 
 #endif  // BUILDFLAG(ENABLE_DICE_SUPPORT)
 
+// Tests that reconcile cannot start before the tokens are loaded, and is
+// automatically started when tokens are loaded.
+TEST_F(AccountReconcilorTest, TokensNotLoaded) {
+  const std::string account_id =
+      ConnectProfileToAccount("12345", "user@gmail.com");
+  cookie_manager_service()->SetListAccountsResponseNoAccounts();
+  token_service()->set_all_credentials_loaded_for_testing(false);
+
+  AccountReconcilor* reconcilor = GetMockReconcilor();
+  reconcilor->StartReconcile();
+
+#if !defined(OS_CHROMEOS)
+  // No reconcile when tokens are not loaded, except on ChromeOS where reconcile
+  // can start as long as the token service is not empty.
+  ASSERT_FALSE(reconcilor->is_reconcile_started_);
+  // When tokens are loaded, reconcile starts automatically.
+  token_service()->LoadCredentials(account_id);
+#endif
+
+  EXPECT_CALL(*GetMockReconcilor(), PerformMergeAction(account_id));
+  ASSERT_TRUE(reconcilor->is_reconcile_started_);
+  base::RunLoop().RunUntilIdle();
+  SimulateAddAccountToCookieCompleted(reconcilor, account_id,
+                                      GoogleServiceAuthError::AuthErrorNone());
+  ASSERT_FALSE(reconcilor->is_reconcile_started_);
+  ASSERT_EQ(signin_metrics::ACCOUNT_RECONCILOR_OK, reconcilor->GetState());
+}
+
 TEST_F(AccountReconcilorTest, GetAccountsFromCookieSuccess) {
   const std::string account_id =
       ConnectProfileToAccount("12345", "user@gmail.com");
diff --git a/chrome/browser/signin/dice_browsertest.cc b/chrome/browser/signin/dice_browsertest.cc
index 0876f8e..15b5dc3 100644
--- a/chrome/browser/signin/dice_browsertest.cc
+++ b/chrome/browser/signin/dice_browsertest.cc
@@ -505,7 +505,7 @@
 
   // Start from a signed-in state.
   SetupSignedInAccounts();
-  EXPECT_EQ(2, reconcilor_started_count_);
+  EXPECT_EQ(1, reconcilor_started_count_);
 
   // Navigate to Gaia and sign in again with the main account.
   NavigateToURL(kSigninURL);
@@ -526,7 +526,7 @@
 
   EXPECT_EQ(1, reconcilor_blocked_count_);
   WaitForReconcilorUnblockedCount(1);
-  EXPECT_EQ(3, reconcilor_started_count_);
+  EXPECT_EQ(2, reconcilor_started_count_);
 }
 
 // Checks that the Dice signout flow works and deletes all tokens.
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 3e4979a1..bd3b981 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -16,6 +16,7 @@
 #include "base/metrics/field_trial.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
+#include "base/strings/pattern.h"
 #include "base/strings/string_split.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
@@ -6047,6 +6048,122 @@
       interstitial_page, expected_title));
 }
 
+// Allows tests to effectively turn off CT requirements. Used by
+// SymantecMessageSSLUITest below to test Symantec certificates issued after the
+// CT requirement date.
+class NoRequireCTDelegate
+    : public net::TransportSecurityState::RequireCTDelegate {
+ public:
+  NoRequireCTDelegate() {}
+  ~NoRequireCTDelegate() override = default;
+
+  CTRequirementLevel IsCTRequiredForHost(const std::string& hostname) override {
+    return CTRequirementLevel::NOT_REQUIRED;
+  }
+};
+
+void SetRequireCTDelegateOnIOThread(
+    scoped_refptr<net::URLRequestContextGetter> context_getter,
+    net::TransportSecurityState::RequireCTDelegate* delegate) {
+  net::TransportSecurityState* state =
+      context_getter->GetURLRequestContext()->transport_security_state();
+  state->SetRequireCTDelegate(delegate);
+}
+
+// A test fixture that mocks certificate verifications for legacy Symantec
+// certificates that are slated to be distrusted in future Chrome releases.
+class SymantecMessageSSLUITest : public CertVerifierBrowserTest {
+ public:
+  SymantecMessageSSLUITest()
+      : CertVerifierBrowserTest(),
+        https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {}
+  ~SymantecMessageSSLUITest() override {}
+
+  void SetUpOnMainThread() override {
+    CertVerifierBrowserTest::SetUpOnMainThread();
+
+    require_ct_delegate_ = base::MakeUnique<NoRequireCTDelegate>();
+    content::BrowserThread::PostTask(
+        content::BrowserThread::IO, FROM_HERE,
+        base::BindOnce(
+            &SetRequireCTDelegateOnIOThread,
+            base::RetainedRef(browser()->profile()->GetRequestContext()),
+            require_ct_delegate_.get()));
+  }
+
+ protected:
+  void SetUpCertVerifier(bool use_chrome_66_date) {
+    net::CertVerifyResult verify_result;
+    {
+      base::ThreadRestrictions::ScopedAllowIO allow_io;
+      verify_result.verified_cert = net::CreateCertificateChainFromFile(
+          net::GetTestCertsDirectory(),
+          use_chrome_66_date ? "pre_june_2016.pem" : "post_june_2016.pem",
+          net::X509Certificate::FORMAT_AUTO);
+    }
+    ASSERT_TRUE(verify_result.verified_cert);
+    verify_result.cert_status = 0;
+
+    // Collect the hashes of the leaf and intermediates.
+    verify_result.public_key_hashes.push_back(
+        GetSPKIHash(verify_result.verified_cert.get()));
+    for (const net::X509Certificate::OSCertHandle& intermediate :
+         verify_result.verified_cert->GetIntermediateCertificates()) {
+      scoped_refptr<net::X509Certificate> intermediate_x509 =
+          net::X509Certificate::CreateFromHandle(
+              intermediate, net::X509Certificate::OSCertHandles());
+      ASSERT_TRUE(intermediate_x509);
+      verify_result.public_key_hashes.push_back(
+          GetSPKIHash(intermediate_x509.get()));
+    }
+
+    mock_cert_verifier()->AddResultForCert(https_server_.GetCertificate().get(),
+                                           verify_result, net::OK);
+  }
+
+  net::EmbeddedTestServer* https_server() { return &https_server_; }
+
+ private:
+  net::EmbeddedTestServer https_server_;
+  std::unique_ptr<NoRequireCTDelegate> require_ct_delegate_;
+
+  DISALLOW_COPY_AND_ASSIGN(SymantecMessageSSLUITest);
+};
+
+// Tests that the Symantec console message is properly overridden for pre-June
+// 2016 certificates.
+IN_PROC_BROWSER_TEST_F(SymantecMessageSSLUITest, PreJune2016) {
+  ASSERT_NO_FATAL_FAILURE(
+      SetUpCertVerifier(true /* use Chrome 66 distrust date */));
+  ASSERT_TRUE(https_server()->Start());
+  GURL url(https_server()->GetURL("/ssl/google.html"));
+  WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
+  content::ConsoleObserverDelegate console_observer(
+      tab, "*distrusted in Chrome 66*");
+  tab->SetDelegate(&console_observer);
+  ui_test_utils::NavigateToURL(browser(), url);
+  console_observer.Wait();
+  EXPECT_TRUE(base::MatchPattern(console_observer.message(),
+                                 "*The certificate used to load*"));
+}
+
+// Tests that the Symantec console message is properly overridden for post-June
+// 2016 certificates.
+IN_PROC_BROWSER_TEST_F(SymantecMessageSSLUITest, PostJune2016) {
+  ASSERT_NO_FATAL_FAILURE(
+      SetUpCertVerifier(false /* use Chrome 66 distrust date */));
+  ASSERT_TRUE(https_server()->Start());
+  GURL url(https_server()->GetURL("/ssl/google.html"));
+  WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
+  content::ConsoleObserverDelegate console_observer(
+      tab, "*distrusted in Chrome 66*");
+  tab->SetDelegate(&console_observer);
+  ui_test_utils::NavigateToURL(browser(), url);
+  console_observer.Wait();
+  EXPECT_TRUE(base::MatchPattern(console_observer.message(),
+                                 "*The certificate used to load*"));
+}
+
 // TODO(jcampan): more tests to do below.
 
 // Visit a page over https that contains a frame with a redirect.
diff --git a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
index 3c18286f..bc9d041 100644
--- a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
+++ b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc
@@ -24,7 +24,7 @@
 #include "components/rappor/public/rappor_parameters.h"
 #include "components/rappor/public/rappor_utils.h"
 #include "components/rappor/rappor_service_impl.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/subresource_filter/content/browser/content_ruleset_service.h"
 #include "components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h"
 #include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h"
diff --git a/chrome/browser/subresource_filter/subresource_filter_browser_test_harness.cc b/chrome/browser/subresource_filter/subresource_filter_browser_test_harness.cc
index 9e644db..5c149a0 100644
--- a/chrome/browser/subresource_filter/subresource_filter_browser_test_harness.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_browser_test_harness.cc
@@ -23,8 +23,8 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/common/chrome_paths.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/subresource_filter/core/browser/subresource_filter_features.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/content_switches.h"
diff --git a/chrome/browser/subresource_filter/subresource_filter_test_harness.cc b/chrome/browser/subresource_filter/subresource_filter_test_harness.cc
index 9195e5b..088e9af 100644
--- a/chrome/browser/subresource_filter/subresource_filter_test_harness.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_test_harness.cc
@@ -22,7 +22,7 @@
 #include "chrome/browser/subresource_filter/test_ruleset_publisher.h"
 #include "chrome/test/base/testing_browser_process.h"
 #include "chrome/test/base/testing_profile.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/subresource_filter/content/browser/content_ruleset_service.h"
 #include "components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h"
 #include "components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h"
diff --git a/chrome/browser/subresource_filter/subresource_filter_unittest.cc b/chrome/browser/subresource_filter/subresource_filter_unittest.cc
index 69f47d4..083054a 100644
--- a/chrome/browser/subresource_filter/subresource_filter_unittest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_unittest.cc
@@ -11,8 +11,8 @@
 #include "chrome/test/base/testing_browser_process.h"
 #include "components/rappor/public/rappor_parameters.h"
 #include "components/rappor/test_rappor_service.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h"
 #include "components/subresource_filter/content/browser/fake_safe_browsing_database_manager.h"
 #include "components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h"
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 10d997c..fd25904 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -555,9 +555,9 @@
     "//components/renderer_context_menu",
     "//components/resources",
     "//components/safe_browsing/common:safe_browsing_prefs",
+    "//components/safe_browsing/db:database_manager",
     "//components/safe_browsing/password_protection",
     "//components/safe_browsing/web_ui",
-    "//components/safe_browsing_db:database_manager",
     "//components/safe_json",
     "//components/search",
     "//components/search_engines",
diff --git a/chrome/browser/ui/cocoa/accessibility_browsertest.mm b/chrome/browser/ui/cocoa/accessibility_browsertest.mm
deleted file mode 100644
index c21ad4d3..0000000
--- a/chrome/browser/ui/cocoa/accessibility_browsertest.mm
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2017 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 <Cocoa/Cocoa.h>
-
-#include "base/mac/foundation_util.h"
-#include "base/mac/mac_util.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/cocoa/view_id_util.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "testing/gtest_mac.h"
-
-class AccessibilityTest : public InProcessBrowserTest {
- public:
-  AccessibilityTest() {}
-
- protected:
-  NSView* ContentView() {
-    return [browser()->window()->GetNativeWindow() contentView];
-  }
-
-  NSView* ViewWithID(ViewID id) {
-    return view_id_util::GetView(browser()->window()->GetNativeWindow(), id);
-  }
-
-  bool AXHasAttribute(id obj, NSString* attribute) {
-    return [[obj accessibilityAttributeNames] containsObject:attribute];
-  }
-
-  // For NSView subclasses with cells, the cell contains some of the
-  // accessibility properties, not the view. NSButton is one such subclass;
-  // there are probably also others. This function returns the correct object to
-  // ask for |attribute| on |object|, or |object| if there is no such correct
-  // object.
-  id RealAXObjectFor(id object, NSString* attribute) {
-    if ([object isKindOfClass:[NSButton class]]) {
-      NSButtonCell* cell = [static_cast<NSButton*>(object) cell];
-      if (AXHasAttribute(cell, attribute))
-        return cell;
-    }
-    return object;
-  }
-
-  id AXAttribute(id obj, NSString* attribute) {
-    return
-        [RealAXObjectFor(obj, attribute) accessibilityAttributeValue:attribute];
-  }
-
-  bool AXIsIgnored(id obj) { return [obj accessibilityIsIgnored]; }
-
-  NSString* AXRole(id obj) {
-    return base::mac::ObjCCast<NSString>(
-        AXAttribute(obj, NSAccessibilityRoleAttribute));
-  }
-
-  NSArray* AXChildren(id obj) {
-    return base::mac::ObjCCast<NSArray>(
-        AXAttribute(obj, NSAccessibilityChildrenAttribute));
-  }
-
-  NSString* AXTitle(id obj) {
-    return base::mac::ObjCCast<NSString>(
-        AXAttribute(obj, NSAccessibilityTitleAttribute));
-  }
-
-  NSString* AXDescription(id obj) {
-    return base::mac::ObjCCast<NSString>(
-        AXAttribute(obj, NSAccessibilityDescriptionAttribute));
-  }
-
-  // Returns an array containing every non-ignored accessibility node that is a
-  // descendant of |root|.
-  NSArray* CollectAXTree(id root) {
-    NSMutableArray* result = [[[NSMutableArray alloc] init] autorelease];
-    CollectAXTreeHelper(root, result);
-    return result;
-  }
-
- private:
-  void CollectAXTreeHelper(id root, NSMutableArray* result) {
-    if (!AXIsIgnored(root))
-      [result addObject:root];
-    for (id child : AXChildren(root))
-      CollectAXTreeHelper(child, result);
-  }
-};
-
-IN_PROC_BROWSER_TEST_F(AccessibilityTest, EveryElementHasRole) {
-  // These a11y APIs are not present in 10.9, so these tests don't run there.
-  if (!base::mac::IsAtLeastOS10_10())
-    return;
-  NSArray* elements = CollectAXTree(ContentView());
-  EXPECT_GT([elements count], 0U);
-  for (id elem : elements) {
-    EXPECT_NSNE(AXRole(elem), NSAccessibilityUnknownRole);
-  }
-}
-
-// Every element must have at least one of a title or a description.
-IN_PROC_BROWSER_TEST_F(AccessibilityTest, EveryElementHasText) {
-  if (!base::mac::IsAtLeastOS10_10())
-    return;
-  NSArray* elements = CollectAXTree(ContentView());
-  EXPECT_GT([elements count], 0U);
-  for (id elem : elements) {
-    NSString* text =
-        [AXTitle(elem) length] > 0 ? AXTitle(elem) : AXDescription(elem);
-    EXPECT_NSNE(text, @"");
-  }
-}
-
-IN_PROC_BROWSER_TEST_F(AccessibilityTest, ControlRoles) {
-  if (!base::mac::IsAtLeastOS10_10())
-    return;
-  // TODO(ellyjones): figure out a more principled way to ensure each control
-  // has the expected role. For now, this is just a regression test for
-  // https://crbug.com/754223
-  EXPECT_NSEQ(AXRole(ViewWithID(VIEW_ID_APP_MENU)),
-              NSAccessibilityPopUpButtonRole);
-}
diff --git a/chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller.mm b/chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller.mm
index 83fcd54..9416542 100644
--- a/chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller.mm
+++ b/chrome/browser/ui/cocoa/passwords/save_pending_password_view_controller.mm
@@ -53,8 +53,9 @@
   if (editMode_) {
     PendingPasswordItemView* row =
         [[passwordItemContainer_ subviews] objectAtIndex:0];
-    self.model->OnUsernameEdited(
-        base::SysNSStringToUTF16([[row usernameField] stringValue]));
+    self.model->OnCredentialEdited(
+        base::SysNSStringToUTF16([[row usernameField] stringValue]),
+        self.model->pending_password().password_value);
     [self disableEditMode];
   }
   ManagePasswordsBubbleModel* model = self.model;
@@ -96,8 +97,9 @@
   if (editMode_) {
     PendingPasswordItemView* row =
         [[passwordItemContainer_ subviews] objectAtIndex:0];
-    self.model->OnUsernameEdited(
-        base::SysNSStringToUTF16([[row usernameField] stringValue]));
+    self.model->OnCredentialEdited(
+        base::SysNSStringToUTF16([[row usernameField] stringValue]),
+        self.model->pending_password().password_value);
     [self disableEditMode];
   }
 }
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
index f85b0c4..bfae2fe 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -395,14 +395,11 @@
   delegate_->NeverSavePassword();
 }
 
-void ManagePasswordsBubbleModel::OnUsernameEdited(base::string16 new_username) {
-  DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_);
-  pending_password_.username_value = std::move(new_username);
-}
-
-void ManagePasswordsBubbleModel::OnPasswordSelected(
+void ManagePasswordsBubbleModel::OnCredentialEdited(
+    base::string16 new_username,
     base::string16 new_password) {
   DCHECK_EQ(password_manager::ui::PENDING_PASSWORD_STATE, state_);
+  pending_password_.username_value = std::move(new_username);
   pending_password_.password_value = std::move(new_password);
 }
 
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
index 91bc7ca..c258bbdd2 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
@@ -46,13 +46,10 @@
   // by the user.
   void OnNeverForThisSiteClicked();
 
-  // Called by the view code when username is corrected using the edit button
-  // in PendingView.
-  void OnUsernameEdited(base::string16 new_username);
-
-  // Called by the view code when a password is selected from the dropdown list
-  // of the password selection feature in PendingView.
-  void OnPasswordSelected(base::string16 new_password);
+  // Called by the view code when username or password is corrected using
+  // the username correction or password selection features in PendingView.
+  void OnCredentialEdited(base::string16 new_username,
+                          base::string16 new_password);
 
   // Called by the view code when the save button is clicked by the user.
   void OnSaveClicked();
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
index c7d42655..cd353a6 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -329,6 +329,23 @@
   DestroyModel();
 }
 
+TEST_F(ManagePasswordsBubbleModelTest, EditCredential) {
+  PretendPasswordWaiting();
+  EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin()));
+
+  const base::string16 kExpectedUsername = base::UTF8ToUTF16("new_username");
+  const base::string16 kExpectedPassword = base::UTF8ToUTF16("new_password");
+
+  model()->OnCredentialEdited(kExpectedUsername, kExpectedPassword);
+  EXPECT_EQ(kExpectedUsername, model()->pending_password().username_value);
+  EXPECT_EQ(kExpectedPassword, model()->pending_password().password_value);
+  EXPECT_CALL(*controller(),
+              SavePassword(kExpectedUsername, kExpectedPassword));
+  EXPECT_CALL(*controller(), NeverSavePassword()).Times(0);
+  model()->OnSaveClicked();
+  DestroyModel();
+}
+
 TEST_F(ManagePasswordsBubbleModelTest, OnBrandLinkClicked) {
   PretendPasswordWaiting();
 
diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc
index a68abaa..69c57924 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -251,11 +251,7 @@
   // Call back the front end to reveal the password.
   std::string origin_url =
       extensions::CreateUrlCollectionFromForm(*password_list_[index]).origin;
-  password_view_->ShowPassword(
-      index,
-      origin_url,
-      base::UTF16ToUTF8(password_list_[index]->username_value),
-      password_list_[index]->password_value);
+  password_view_->ShowPassword(index, password_list_[index]->password_value);
   UMA_HISTOGRAM_ENUMERATION(
       "PasswordManager.AccessPasswordInSettings",
       password_manager::metrics_util::ACCESS_PASSWORD_VIEWED,
diff --git a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
index e615819..5d7a781 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter_unittest.cc
@@ -47,8 +47,7 @@
 #if !defined(OS_ANDROID)
   gfx::NativeWindow GetNativeWindow() const override;
 #endif
-  MOCK_METHOD4(ShowPassword, void(
-      size_t, const std::string&, const std::string&, const base::string16&));
+  MOCK_METHOD2(ShowPassword, void(size_t, const base::string16&));
   MOCK_METHOD1(
       SetPasswordList,
       void(const std::vector<std::unique_ptr<autofill::PasswordForm>>&));
diff --git a/chrome/browser/ui/passwords/password_ui_view.h b/chrome/browser/ui/passwords/password_ui_view.h
index 5f4c4fae..7d23436 100644
--- a/chrome/browser/ui/passwords/password_ui_view.h
+++ b/chrome/browser/ui/passwords/password_ui_view.h
@@ -32,13 +32,8 @@
 
   // Reveals the password for the saved password entry.
   // |index| the index of the saved password entry.
-  // |origin_url| the URL of the saved password entry; obtained via
-  //     CreateUrlCollectionFromForm().origin.
-  // |username| the username of the saved password entry.
   // |password_value| the value of saved password entry at |index|.
   virtual void ShowPassword(size_t index,
-                            const std::string& origin_url,
-                            const std::string& username,
                             const base::string16& password_value) = 0;
 
   // Updates the list of passwords in the UI.
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc
index 3e216d8c..4627af7b 100644
--- a/chrome/browser/ui/views/collected_cookies_views.cc
+++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -91,6 +91,50 @@
 
 }  // namespace
 
+// This DrawingProvider keeps track of a set of ui::TreeModelNode*s which are
+// considered "invalidated", and marks them as such by lightening their text
+// color and adding auxiliary text to them.
+class CookiesTreeViewDrawingProvider : public views::TreeViewDrawingProvider {
+ public:
+  explicit CookiesTreeViewDrawingProvider(
+      const base::string16& invalidated_text)
+      : invalidated_text_(invalidated_text) {}
+  ~CookiesTreeViewDrawingProvider() override {}
+
+  void MarkNodeAsInvalidated(ui::TreeModelNode* node);
+
+  SkColor GetTextColorForNode(views::TreeView* tree_view,
+                              ui::TreeModelNode* node) override;
+  base::string16 GetAuxiliaryTextForNode(views::TreeView* tree_view,
+                                         ui::TreeModelNode* node) override;
+
+ private:
+  base::string16 invalidated_text_;
+  std::set<ui::TreeModelNode*> invalidated_nodes_;
+};
+
+void CookiesTreeViewDrawingProvider::MarkNodeAsInvalidated(
+    ui::TreeModelNode* node) {
+  invalidated_nodes_.insert(node);
+}
+
+SkColor CookiesTreeViewDrawingProvider::GetTextColorForNode(
+    views::TreeView* tree_view,
+    ui::TreeModelNode* node) {
+  SkColor color = TreeViewDrawingProvider::GetTextColorForNode(tree_view, node);
+  if (invalidated_nodes_.find(node) != invalidated_nodes_.end())
+    color = SkColorSetA(color, 0x80);
+  return color;
+}
+
+base::string16 CookiesTreeViewDrawingProvider::GetAuxiliaryTextForNode(
+    views::TreeView* tree_view,
+    ui::TreeModelNode* node) {
+  if (invalidated_nodes_.find(node) != invalidated_nodes_.end())
+    return invalidated_text_;
+  return TreeViewDrawingProvider::GetAuxiliaryTextForNode(tree_view, node);
+}
+
 // A custom view that conditionally displays an infobar.
 class InfobarView : public views::View {
  public:
@@ -368,8 +412,14 @@
 
   allowed_cookies_tree_model_ =
       content_settings->allowed_local_shared_objects().CreateCookiesTreeModel();
+  std::unique_ptr<CookiesTreeViewDrawingProvider> allowed_drawing_provider =
+      base::MakeUnique<CookiesTreeViewDrawingProvider>(
+          l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCKED_AUX_TEXT));
+  allowed_cookies_drawing_provider_ = allowed_drawing_provider.get();
   allowed_cookies_tree_ = new views::TreeView();
   allowed_cookies_tree_->SetModel(allowed_cookies_tree_model_.get());
+  allowed_cookies_tree_->SetDrawingProvider(
+      std::move(allowed_drawing_provider));
   allowed_cookies_tree_->SetRootShown(false);
   allowed_cookies_tree_->SetEditable(false);
   allowed_cookies_tree_->set_auto_expand_children(true);
@@ -435,8 +485,14 @@
   blocked_label_->SizeToFit(kTreeViewWidth);
   blocked_cookies_tree_model_ =
       content_settings->blocked_local_shared_objects().CreateCookiesTreeModel();
+  std::unique_ptr<CookiesTreeViewDrawingProvider> blocked_drawing_provider =
+      base::MakeUnique<CookiesTreeViewDrawingProvider>(
+          l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOWED_AUX_TEXT));
+  blocked_cookies_drawing_provider_ = blocked_drawing_provider.get();
   blocked_cookies_tree_ = new views::TreeView();
   blocked_cookies_tree_->SetModel(blocked_cookies_tree_model_.get());
+  blocked_cookies_tree_->SetDrawingProvider(
+      std::move(blocked_drawing_provider));
   blocked_cookies_tree_->SetRootShown(false);
   blocked_cookies_tree_->SetEditable(false);
   blocked_cookies_tree_->set_auto_expand_children(true);
@@ -551,6 +607,12 @@
       CookieSettingsFactory::GetForProfile(profile).get(), setting);
   infobar_->UpdateVisibility(true, setting, host_node->GetTitle());
   status_changed_ = true;
+
+  CookiesTreeViewDrawingProvider* provider =
+      (tree_view == allowed_cookies_tree_) ? allowed_cookies_drawing_provider_
+                                           : blocked_cookies_drawing_provider_;
+  provider->MarkNodeAsInvalidated(tree_view->GetSelectedNode());
+  tree_view->SchedulePaint();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/views/collected_cookies_views.h b/chrome/browser/ui/views/collected_cookies_views.h
index d8798593..e57d090 100644
--- a/chrome/browser/ui/views/collected_cookies_views.h
+++ b/chrome/browser/ui/views/collected_cookies_views.h
@@ -17,6 +17,7 @@
 
 class CookieInfoView;
 class CookiesTreeModel;
+class CookiesTreeViewDrawingProvider;
 class InfobarView;
 
 namespace content {
@@ -110,6 +111,9 @@
   std::unique_ptr<CookiesTreeModel> allowed_cookies_tree_model_;
   std::unique_ptr<CookiesTreeModel> blocked_cookies_tree_model_;
 
+  CookiesTreeViewDrawingProvider* allowed_cookies_drawing_provider_;
+  CookiesTreeViewDrawingProvider* blocked_cookies_drawing_provider_;
+
   CookieInfoView* cookie_info_view_;
 
   InfobarView* infobar_;
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index 9c44097..6580c38 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -259,14 +259,12 @@
 }
 
 // Builds a credential row, adds the given elements to the layout.
-// Releases the unique pointers after adding them to the layout.
 // |password_view_button| is an optional field. If it is a nullptr, a
 // DOUBLE_VIEW_COLUMN_SET will be used instead of TRIPLE_VIEW_COLUMN_SET.
-void BuildCredentialRow(
-    views::GridLayout* layout,
-    std::unique_ptr<views::View> username_field,
-    std::unique_ptr<views::View> password_field,
-    std::unique_ptr<views::ToggleImageButton> password_view_button) {
+void BuildCredentialRow(views::GridLayout* layout,
+                        views::View* username_field,
+                        views::View* password_field,
+                        views::ToggleImageButton* password_view_button) {
   ColumnSetType type =
       password_view_button ? TRIPLE_VIEW_COLUMN_SET : DOUBLE_VIEW_COLUMN_SET;
   BuildColumnSet(layout, type);
@@ -289,31 +287,31 @@
   if (username_width > available_width && password_width < available_width) {
     // If username is long and password is short, we limit the length of the
     // username to the available width and password gets 0.
-    layout->AddView(username_field.release(), 1, 1, views::GridLayout::FILL,
+    layout->AddView(username_field, 1, 1, views::GridLayout::FILL,
                     views::GridLayout::FILL, available_width, 0);
-    layout->AddView(password_field.release(), 1, 1, views::GridLayout::FILL,
+    layout->AddView(password_field, 1, 1, views::GridLayout::FILL,
                     views::GridLayout::FILL, 0, 0);
   } else if (username_width < available_width &&
              password_width > available_width) {
     // If username is short and password is long, username keeps its
     // preferred length, and password gets the remaining available width.
-    layout->AddView(username_field.release(), 1, 1, views::GridLayout::FILL,
+    layout->AddView(username_field, 1, 1, views::GridLayout::FILL,
                     views::GridLayout::FILL, username_width, 0);
-    layout->AddView(password_field.release(), 1, 1, views::GridLayout::FILL,
+    layout->AddView(password_field, 1, 1, views::GridLayout::FILL,
                     views::GridLayout::FILL, available_width - username_width,
                     0);
   } else {
     // If both fields are long or both are short, regular implementation is
     // kept. For long username and password, fields get equal space. For
     // shorter ones, they share the existing space.
-    layout->AddView(username_field.release(), 1, 1, views::GridLayout::FILL,
+    layout->AddView(username_field, 1, 1, views::GridLayout::FILL,
                     views::GridLayout::FILL, 0, 0);
-    layout->AddView(password_field.release(), 1, 1, views::GridLayout::FILL,
+    layout->AddView(password_field, 1, 1, views::GridLayout::FILL,
                     views::GridLayout::FILL, 0, 0);
   }
   // The eye icon is also added to the layout if it was passed.
   if (password_view_button) {
-    layout->AddView(password_view_button.release());
+    layout->AddView(password_view_button);
   }
 }
 
@@ -414,11 +412,9 @@
 
 // A view offering the user the ability to save credentials. Contains a
 // single ManagePasswordItemsView, along with a "Save Passwords" button,
-// a "Never" button and an "Edit" button to edit username field.
-class ManagePasswordsBubbleView::PendingView
-    : public views::View,
-      public views::ButtonListener,
-      public views::FocusChangeListener {
+// a "Never" button.
+class ManagePasswordsBubbleView::PendingView : public views::View,
+                                               public views::ButtonListener {
  public:
   explicit PendingView(ManagePasswordsBubbleView* parent);
   ~PendingView() override;
@@ -427,25 +423,17 @@
   void CreateAndSetLayout();
   // views::ButtonListener:
   void ButtonPressed(views::Button* sender, const ui::Event& event) override;
-  // views::FocusChangeListener:
-  void OnWillChangeFocus(View* focused_before, View* focused_now) override;
-  void OnDidChangeFocus(View* focused_before, View* focused_now) override;
-  // views::View:
-  bool OnKeyPressed(const ui::KeyEvent& event) override;
-  gfx::Size CalculatePreferredSize() const override;
 
-  void ToggleEditingState(bool accept_changes);
+  gfx::Size CalculatePreferredSize() const override;
 
   ManagePasswordsBubbleView* parent_;
 
-  views::Button* edit_button_;
   views::Button* save_button_;
   views::Button* never_button_;
-  views::View* username_field_;
-  views::View* password_field_;
-  views::ToggleImageButton* password_view_button_;
-
-  bool editing_;
+  // Those views can be recreated, thus they are owned by the client.
+  std::unique_ptr<views::View> username_field_;
+  std::unique_ptr<views::View> password_field_;
+  std::unique_ptr<views::ToggleImageButton> password_view_button_;
 
   DISALLOW_COPY_AND_ASSIGN(PendingView);
 };
@@ -453,13 +441,11 @@
 ManagePasswordsBubbleView::PendingView::PendingView(
     ManagePasswordsBubbleView* parent)
     : parent_(parent),
-      edit_button_(nullptr),
       save_button_(nullptr),
       never_button_(nullptr),
       username_field_(nullptr),
       password_field_(nullptr),
-      password_view_button_(nullptr),
-      editing_(false) {
+      password_view_button_(nullptr) {
   CreateAndSetLayout();
   parent_->set_initially_focused_view(save_button_);
 }
@@ -468,13 +454,7 @@
   views::GridLayout* layout = views::GridLayout::CreateAndInstall(this);
   layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0));
 
-  // Create the edit, save and never buttons.
-  if (!edit_button_ &&
-      base::FeatureList::IsEnabled(
-          password_manager::features::kEnableUsernameCorrection)) {
-    edit_button_ = views::MdTextButton::CreateSecondaryUiButton(
-        this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EDIT_BUTTON));
-  }
+  // Create buttons.
   if (!save_button_) {
     save_button_ = views::MdTextButton::CreateSecondaryUiBlueButton(
         this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON));
@@ -486,48 +466,43 @@
   }
 
   // Credentials row.
-  if (!parent_->model()->pending_password().username_value.empty() ||
-      edit_button_) {
-    // Create the eye icon if password selection feature is on.
-    if (base::FeatureList::IsEnabled(
-            password_manager::features::kEnablePasswordSelection) &&
-        !password_view_button_) {
-      password_view_button_ = GeneratePasswordViewButton(this).release();
-    }
-
-    const autofill::PasswordForm* password_form =
-        &parent_->model()->pending_password();
-    DCHECK(!username_field_);
-    if (editing_) {
-      username_field_ = GenerateUsernameEditable(*password_form).release();
-    } else {
-      username_field_ = GenerateUsernameLabel(*password_form).release();
-    }
-
-    DCHECK(!password_field_);
-    if (password_view_button_ && editing_ &&
-        password_form->other_possible_passwords.size() > 1) {
-      password_field_ = GeneratePasswordDropdownView(*password_form).release();
-    } else {
-      password_field_ = GeneratePasswordLabel(*password_form).release();
-    }
-
-    BuildCredentialRow(
-        layout, std::unique_ptr<views::View>(username_field_),
-        std::unique_ptr<views::View>(password_field_),
-        std::unique_ptr<views::ToggleImageButton>(password_view_button_));
-    layout->AddPaddingRow(
-        0, ChromeLayoutProvider::Get()->GetDistanceMetric(
-               views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_CONTROL));
+  const autofill::PasswordForm& password_form =
+      parent_->model()->pending_password();
+  DCHECK(!username_field_);
+  if (base::FeatureList::IsEnabled(
+          password_manager::features::kEnableUsernameCorrection)) {
+    username_field_ = GenerateUsernameEditable(password_form);
+  } else {
+    username_field_ = GenerateUsernameLabel(password_form);
   }
+  username_field_->set_owned_by_client();
+
+  DCHECK(!password_field_);
+  const bool enable_password_selection = base::FeatureList::IsEnabled(
+      password_manager::features::kEnablePasswordSelection);
+  if (enable_password_selection &&
+      password_form.other_possible_passwords.size() > 1) {
+    password_field_ = GeneratePasswordDropdownView(password_form);
+  } else {
+    password_field_ = GeneratePasswordLabel(password_form);
+  }
+  password_field_->set_owned_by_client();
+
+  DCHECK(!password_view_button_);
+  if (enable_password_selection) {
+    password_view_button_ = GeneratePasswordViewButton(this);
+    password_view_button_->set_owned_by_client();
+  }
+
+  BuildCredentialRow(layout, username_field_.get(), password_field_.get(),
+                     password_view_button_.get());
+  layout->AddPaddingRow(
+      0, ChromeLayoutProvider::Get()->GetDistanceMetric(
+             views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_CONTROL));
+
   // Button row.
-  ColumnSetType column_set_type =
-      edit_button_ ? TRIPLE_BUTTON_COLUMN_SET : DOUBLE_BUTTON_COLUMN_SET;
-  BuildColumnSet(layout, column_set_type);
-  layout->StartRow(0, column_set_type);
-  if (column_set_type == TRIPLE_BUTTON_COLUMN_SET) {
-    layout->AddView(edit_button_);
-  }
+  BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET);
+  layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET);
   layout->AddView(save_button_);
   layout->AddView(never_button_);
 }
@@ -538,11 +513,30 @@
 void ManagePasswordsBubbleView::PendingView::ButtonPressed(
     views::Button* sender,
     const ui::Event& event) {
-  if (sender == edit_button_) {
-    ToggleEditingState(false);
-    return;
-  }
   if (sender == save_button_) {
+    const bool username_editable = base::FeatureList::IsEnabled(
+        password_manager::features::kEnableUsernameCorrection);
+    const bool password_editable = base::FeatureList::IsEnabled(
+        password_manager::features::kEnablePasswordSelection);
+    if (username_editable || password_editable) {
+      base::string16 new_username =
+          parent_->model()->pending_password().username_value;
+      base::string16 new_password =
+          parent_->model()->pending_password().password_value;
+      if (username_editable) {
+        new_username =
+            static_cast<views::Textfield*>(username_field_.get())->text();
+      }
+      if (password_editable &&
+          parent_->model()->pending_password().other_possible_passwords.size() >
+              1) {
+        new_password =
+            parent_->model()->pending_password().other_possible_passwords.at(
+                static_cast<views::Combobox*>(password_field_.get())
+                    ->selected_index());
+      }
+      parent_->model()->OnCredentialEdited(new_username, new_password);
+    }
     parent_->model()->OnSaveClicked();
     if (parent_->model()->ReplaceToShowPromotionIfNeeded()) {
       parent_->Refresh();
@@ -550,7 +544,7 @@
     }
   } else if (sender == never_button_) {
     parent_->model()->OnNeverForThisSiteClicked();
-  } else if (sender == password_view_button_) {
+  } else if (sender == password_view_button_.get()) {
     // TODO(https://crbug.com/753806): Implement making passwords visible logic.
     return;
   } else {
@@ -560,31 +554,6 @@
   parent_->CloseBubble();
 }
 
-void ManagePasswordsBubbleView::PendingView::OnWillChangeFocus(
-    View* focused_before,
-    View* focused_now) {
-  // Nothing to do here.
-}
-
-void ManagePasswordsBubbleView::PendingView::OnDidChangeFocus(
-    View* focused_before,
-    View* focused_now) {
-  if (editing_ && focused_now != username_field_ &&
-      focused_now != password_field_) {
-    ToggleEditingState(true);
-  }
-}
-
-bool ManagePasswordsBubbleView::PendingView::OnKeyPressed(
-    const ui::KeyEvent& event) {
-  if (editing_ && (event.key_code() == ui::KeyboardCode::VKEY_RETURN ||
-                   event.key_code() == ui::KeyboardCode::VKEY_ESCAPE)) {
-    ToggleEditingState(event.key_code() == ui::KeyboardCode::VKEY_RETURN);
-    return true;
-  }
-  return false;
-}
-
 gfx::Size ManagePasswordsBubbleView::PendingView::CalculatePreferredSize()
     const {
   return gfx::Size(kDesiredBubbleWidth,
@@ -592,38 +561,6 @@
                        this, kDesiredBubbleWidth));
 }
 
-void ManagePasswordsBubbleView::PendingView::ToggleEditingState(
-    bool accept_changes) {
-  if (editing_ && accept_changes) {
-    parent_->model()->OnUsernameEdited(
-        static_cast<views::Textfield*>(username_field_)->text());
-    if (password_view_button_ &&
-        parent_->model()->pending_password().other_possible_passwords.size() >
-            1) {
-      parent_->model()->OnPasswordSelected(
-          parent_->model()->pending_password().other_possible_passwords.at(
-              static_cast<views::Combobox*>(password_field_)
-                  ->selected_index()));
-    }
-  }
-  editing_ = !editing_;
-  edit_button_->SetEnabled(!editing_);
-  RemoveChildView(username_field_);
-  username_field_ = nullptr;
-  RemoveChildView(password_field_);
-  password_field_ = nullptr;
-  CreateAndSetLayout();
-  Layout();
-  if (editing_) {
-    GetFocusManager()->SetFocusedView(username_field_);
-    GetFocusManager()->AddFocusChangeListener(this);
-  } else {
-    GetFocusManager()->RemoveFocusChangeListener(this);
-    GetFocusManager()->SetFocusedView(save_button_);
-  }
-  parent_->SizeToContents();
-}
-
 // ManagePasswordsBubbleView::ManageView --------------------------------------
 
 // A view offering the user a list of their currently saved credentials
@@ -892,10 +829,10 @@
     layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
     layout->AddView(new CredentialsSelectionView(parent->model()));
   } else {
-    const autofill::PasswordForm* password_form =
-        &parent_->model()->pending_password();
-    BuildCredentialRow(layout, GenerateUsernameLabel(*password_form),
-                       GeneratePasswordLabel(*password_form), nullptr);
+    const autofill::PasswordForm& password_form =
+        parent_->model()->pending_password();
+    BuildCredentialRow(layout, GenerateUsernameLabel(password_form).release(),
+                       GeneratePasswordLabel(password_form).release(), nullptr);
   }
   layout->AddPaddingRow(
       0, layout_provider->GetDistanceMetric(
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
index c8361ac..9567b08b 100644
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -21,7 +21,7 @@
 #include "chrome/common/features.h"
 #include "chrome/common/url_constants.h"
 #include "components/grit/components_resources.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/security_interstitials/core/ssl_error_ui.h"
 #include "components/supervised_user_error_page/supervised_user_error_page.h"
 #include "content/public/browser/interstitial_page_delegate.h"
diff --git a/chrome/common/extensions/api/passwords_private.idl b/chrome/common/extensions/api/passwords_private.idl
index 4784122..06c12ae4 100644
--- a/chrome/common/extensions/api/passwords_private.idl
+++ b/chrome/common/extensions/api/passwords_private.idl
@@ -35,12 +35,15 @@
 
     // Text shown if the password was obtained via a federated identity.
     DOMString? federationText;
+
+    // An index to refer back to a unique password entry record.
+    long index;
   };
 
   // Dictionary passed to listeners for the onPlaintextPasswordRetrieved event.
   dictionary PlaintextPasswordEventParameters {
-    // The LoginPair associated with the retrieved password.
-    LoginPair loginPair;
+    // An index to refer back to a unique password entry record.
+    long index;
 
     // The password in plaintext.
     DOMString plaintextPassword;
@@ -48,6 +51,9 @@
 
   dictionary ExceptionEntry {
     UrlCollection urls;
+
+    // An index to refer back to a unique exception entry record.
+    long index;
   };
 
   callback PasswordListCallback = void(PasswordUiEntry[] entries);
@@ -57,24 +63,23 @@
     // Removes the saved password corresponding to |loginPair|. If no saved
     // password for this pair exists, this function is a no-op.
     //
-    // |loginPair|: The LoginPair corresponding to the entry to remove.
-    static void removeSavedPassword(LoginPair loginPair);
+    // |index|: The index for the password entry being removed.
+    static void removeSavedPassword(long index);
 
     // Removes the saved password exception corresponding to |exceptionUrl|. If
     // no exception with this URL exists, this function is a no-op.
     //
-    // |exceptionUrl|: The URL corresponding to the exception to remove.
-    static void removePasswordException(DOMString exceptionUrl);
+    // |index|: The index for the exception url entry being removed.
+    static void removePasswordException(long index);
 
-    // Returns the plaintext password corresponding to |loginPair|. Note that on
+    // Returns the plaintext password corresponding to |index|. Note that on
     // some operating systems, this call may result in an OS-level
     // reauthentication. Once the password has been fetched, it will be returned
     // via the onPlaintextPasswordRetrieved event.
     // TODO(hcarmona): Investigate using a callback for consistency.
     //
-    // |loginPair|: The LoginPair corresponding to the entry whose password
-    //     is to be returned.
-    static void requestPlaintextPassword(LoginPair loginPair);
+    // |index|: The index for the password entry being being retrieved.
+    static void requestPlaintextPassword(long index);
 
     // Returns the list of saved passwords.
     // |callback|: Called with the list of saved passwords.
@@ -101,7 +106,7 @@
     // Fired when a plaintext password has been fetched in response to a call to
     // chrome.passwordsPrivate.requestPlaintextPassword().
     //
-    // |loginPair|: The LoginPair whose password was found.
+    // |index|: The index for the password entry being being retrieved.
     // |plaintextPassword|: The plaintext password which was retrieved.
     static void onPlaintextPasswordRetrieved(
         PlaintextPasswordEventParameters dict);
diff --git a/chrome/gpu/OWNERS b/chrome/gpu/OWNERS
index 7453997e..4e730ff 100644
--- a/chrome/gpu/OWNERS
+++ b/chrome/gpu/OWNERS
@@ -1,3 +1,4 @@
+kcwu@chromium.org
 piman@chromium.org
 posciak@chromium.org
 wuchengli@chromium.org
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 65c6bf28..1f64f38 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -1636,7 +1636,7 @@
       "//components/feature_engagement/test:test_support",
       "//components/policy:chrome_settings_proto_generated_compile",
       "//components/resources",
-      "//components/safe_browsing_db:test_database_manager",
+      "//components/safe_browsing/db:test_database_manager",
       "//components/strings",
       "//components/sync",
       "//components/translate/core/common",
@@ -2494,7 +2494,6 @@
       if (!mac_views_browser) {
         sources += [
           "../browser/ui/cocoa/accelerators_cocoa_browsertest.mm",
-          "../browser/ui/cocoa/accessibility_browsertest.mm",
           "../browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm",
           "../browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm",
           "../browser/ui/cocoa/browser_window_controller_browsertest.mm",
@@ -3520,8 +3519,8 @@
     "//components/os_crypt:test_support",
     "//components/resources",
     "//components/safe_browsing:features",
-    "//components/safe_browsing_db",
-    "//components/safe_browsing_db:test_database_manager",
+    "//components/safe_browsing/db",
+    "//components/safe_browsing/db:test_database_manager",
     "//components/safe_json:test_support",
     "//components/spellcheck:build_features",
     "//components/strings",
@@ -4440,8 +4439,8 @@
     deps += [
       ":test_proto",
       "//components/safe_browsing:base_ping_manager_unittest",
+      "//components/safe_browsing/db:v4_test_util",
       "//components/safe_browsing/renderer:websocket_sb_handshake_throttle_unittest",
-      "//components/safe_browsing_db:v4_test_util",
     ]
 
     if (is_mac) {
diff --git a/chrome/test/android/BUILD.gn b/chrome/test/android/BUILD.gn
index 4a0f359..4c30e79 100644
--- a/chrome/test/android/BUILD.gn
+++ b/chrome/test/android/BUILD.gn
@@ -33,6 +33,7 @@
     "javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java",
     "javatests/src/org/chromium/chrome/test/util/browser/compositor/layouts/DisableChromeAnimations.java",
     "javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java",
+    "javatests/src/org/chromium/chrome/test/util/browser/ChromeHome.java",
     "javatests/src/org/chromium/chrome/test/util/browser/Features.java",
     "javatests/src/org/chromium/chrome/test/util/browser/LocationSettingsTestUtil.java",
     "javatests/src/org/chromium/chrome/test/util/browser/notifications/MockNotificationManagerProxy.java",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestRule.java
index e1b0a2f..b39f497 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestRule.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/BottomSheetTestRule.java
@@ -6,7 +6,6 @@
 
 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
 import static org.chromium.chrome.browser.ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE;
-import static org.chromium.chrome.test.BottomSheetTestRule.ENABLE_CHROME_HOME;
 import static org.chromium.chrome.test.ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG;
 
 import android.support.test.InstrumentationRegistry;
@@ -16,19 +15,18 @@
 import org.chromium.base.test.util.CallbackHelper;
 import org.chromium.base.test.util.CommandLineFlags;
 import org.chromium.chrome.R;
-import org.chromium.chrome.browser.ChromeFeatureList;
-import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent;
 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason;
 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContentController;
 import org.chromium.chrome.browser.widget.bottomsheet.EmptyBottomSheetObserver;
+import org.chromium.chrome.test.util.browser.ChromeHome;
 import org.chromium.chrome.test.util.browser.RecyclerViewTestUtils;
 
 /**
  * Junit4 rule for tests testing the Chrome Home bottom sheet.
  */
-@CommandLineFlags.Add({ENABLE_CHROME_HOME, DISABLE_FIRST_RUN_EXPERIENCE,
+@CommandLineFlags.Add({ChromeHome.ENABLE_FLAGS, DISABLE_FIRST_RUN_EXPERIENCE,
         DISABLE_NETWORK_PREDICTION_FLAG})
 public class BottomSheetTestRule extends ChromeTabbedActivityTestRule {
     /** An observer used to record events that occur with respect to the bottom sheet. */
@@ -92,23 +90,15 @@
         }
     }
 
-    public static final String ENABLE_CHROME_HOME =
-            "enable-features=" + ChromeFeatureList.CHROME_HOME;
-
     /** A handle to the sheet's observer. */
     private Observer mObserver;
 
-    private boolean mOldChromeHomeFlagValue;
+    private ChromeHome.Processor mChromeHomeEnabler = new ChromeHome.Processor();
 
     private @BottomSheet.SheetState int mStartingBottomSheetState = BottomSheet.SHEET_STATE_FULL;
 
     protected void beforeStartingActivity() {
-        // Chrome relies on a shared preference to determine if the ChromeHome feature is enabled
-        // during start up, so we need to manually set the preference to enable ChromeHome before
-        // starting Chrome.
-        ChromePreferenceManager prefManager = ChromePreferenceManager.getInstance();
-        mOldChromeHomeFlagValue = prefManager.isChromeHomeEnabled();
-        prefManager.setChromeHomeEnabled(true);
+        mChromeHomeEnabler.setPrefs(true);
     }
 
     protected void afterStartingActivity() {
@@ -128,7 +118,7 @@
     @Override
     protected void afterActivityFinished() {
         super.afterActivityFinished();
-        ChromePreferenceManager.getInstance().setChromeHomeEnabled(mOldChromeHomeFlagValue);
+        mChromeHomeEnabler.clearTestState();
     }
 
     public void startMainActivityOnBottomSheet(@BottomSheet.SheetState int startingSheetState)
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java
index b656d8a..5cbc567 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/RenderTestRule.java
@@ -105,6 +105,13 @@
         }
     }
 
+    /**
+     * Constructor using {@code "chrome/test/data/android/render_tests"} as default golden folder.
+     */
+    public RenderTestRule() {
+        this("chrome/test/data/android/render_tests");
+    }
+
     public RenderTestRule(String goldenFolder) {
         // |goldenFolder| is relative to the src directory in the repository. |mGoldenFolder| will
         // be the folder on the test device.
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/ChromeHome.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/ChromeHome.java
new file mode 100644
index 0000000..33b98d89
--- /dev/null
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/ChromeHome.java
@@ -0,0 +1,116 @@
+// Copyright 2017 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.test.util.browser;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import android.os.StrictMode;
+import android.text.TextUtils;
+
+import org.chromium.base.CommandLine;
+import org.chromium.base.test.util.AnnotationProcessor;
+import org.chromium.chrome.browser.ChromeFeatureList;
+import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
+import org.chromium.chrome.browser.util.FeatureUtilities;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Utility annotation and rule to enable or disable ChromeHome. Handles setting and resetting the
+ * feature flag and the preference.
+ *
+ * @see ChromeHome.Processor
+ * @see FeatureUtilities#isChromeHomeEnabled()
+ */
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface ChromeHome {
+    boolean value() default true;
+
+    String FEATURES =
+            ChromeFeatureList.CHROME_HOME + "," + ChromeFeatureList.CHROME_HOME_MODERN_LAYOUT;
+    String ENABLE_FLAGS = "enable-features=" + FEATURES;
+
+    /**
+     * Rule to Handle setting and resetting the feature flag and preference for ChromeHome. Can be
+     * used by explicitly calling methods ({@link #setPrefs(boolean)} and {@link #clearTestState()})
+     * or by using the {@link ChromeHome} annotation on tests.
+     */
+    class Processor extends AnnotationProcessor<ChromeHome> {
+        private Boolean mOldState;
+
+        public Processor() {
+            super(ChromeHome.class);
+        }
+
+        @Override
+        protected void before() throws Throwable {
+            boolean enabled = getRequestedState();
+            if (enabled) updateCommandLine();
+            setPrefs(enabled);
+        }
+
+        @Override
+        protected void after() {
+            clearTestState();
+        }
+
+        public void setPrefs(boolean enabled) {
+            // Chrome relies on a shared preference to determine if the ChromeHome feature is
+            // enabled during start up, so we need to manually set the preference to enable
+            // ChromeHome before starting Chrome.
+            ChromePreferenceManager prefsManager = ChromePreferenceManager.getInstance();
+            StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+            try {
+                mOldState = prefsManager.isChromeHomeEnabled();
+            } finally {
+                StrictMode.setThreadPolicy(oldPolicy);
+            }
+
+            FeatureUtilities.resetChromeHomeEnabledForTests();
+
+            // The native library should not be enabled yet, so we set the preference here and
+            // cache it by checking for the feature. Ideally we instead would call
+            // FeatureUtilities.cacheChromeHomeEnabled()
+            prefsManager.setChromeHomeEnabled(enabled);
+            assertEquals(enabled, FeatureUtilities.isChromeHomeEnabled());
+        }
+
+        public void clearTestState() {
+            assertNotNull(mOldState);
+            ChromePreferenceManager.getInstance().setChromeHomeEnabled(mOldState);
+        }
+
+        private void updateCommandLine() {
+            // TODO(dgn): Possible extra work: detect the flag and combine them with existing ones
+            // or support explicitly disabling the feature. Ideally this will be done by refactoring
+            // the entire features setting system for tests instead or string manipulation.
+            CommandLine commandLine = CommandLine.getInstance();
+            String existingFeatures = commandLine.getSwitchValue("enable-features");
+
+            if (TextUtils.equals(existingFeatures, FEATURES)) return;
+
+            if (existingFeatures != null) {
+                throw new IllegalStateException("Unable to enable ChromeHome, the feature flag is"
+                        + " already set to " + existingFeatures);
+            }
+
+            commandLine.appendSwitch(ENABLE_FLAGS);
+        }
+
+        private boolean getRequestedState() {
+            if (getTestAnnotation() != null) return getTestAnnotation().value();
+            if (getClassAnnotation() != null) return getClassAnnotation().value();
+
+            throw new IllegalStateException("Rule called with no annotation");
+        }
+    }
+}
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java
index b5e19f56..2453a9e8 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/SigninTestUtil.java
@@ -55,7 +55,7 @@
         });
         sAccountManager = new FakeAccountManagerDelegate(
                 FakeAccountManagerDelegate.DISABLE_PROFILE_DATA_SOURCE);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(sContext, sAccountManager);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(sAccountManager);
         overrideAccountIdProvider();
         resetSigninState();
     }
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.full_grid_landscape.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.full_grid_landscape.Nexus_5-19.png
new file mode 100644
index 0000000..9c7dc7d
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.full_grid_landscape.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.full_grid_portrait.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.full_grid_portrait.Nexus_5-19.png
new file mode 100644
index 0000000..fddbb9f
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.full_grid_portrait.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_full_grid_landscape.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_full_grid_landscape.Nexus_5-19.png
new file mode 100644
index 0000000..279d5a4
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_full_grid_landscape.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_full_grid_portrait.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_full_grid_portrait.Nexus_5-19.png
new file mode 100644
index 0000000..d662cf40
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_full_grid_portrait.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_two_tiles_grid_landscape.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_two_tiles_grid_landscape.Nexus_5-19.png
new file mode 100644
index 0000000..bdcec03b
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_two_tiles_grid_landscape.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_two_tiles_grid_portrait.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_two_tiles_grid_portrait.Nexus_5-19.png
new file mode 100644
index 0000000..7c12646
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.modern_two_tiles_grid_portrait.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.two_tiles_grid_landscape.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.two_tiles_grid_landscape.Nexus_5-19.png
new file mode 100644
index 0000000..2823752
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.two_tiles_grid_landscape.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/android/render_tests/TileGridLayoutTest.two_tiles_grid_portrait.Nexus_5-19.png b/chrome/test/data/android/render_tests/TileGridLayoutTest.two_tiles_grid_portrait.Nexus_5-19.png
new file mode 100644
index 0000000..24ad2c1
--- /dev/null
+++ b/chrome/test/data/android/render_tests/TileGridLayoutTest.two_tiles_grid_portrait.Nexus_5-19.png
Binary files differ
diff --git a/chrome/test/data/extensions/api_test/passwords_private/test.js b/chrome/test/data/extensions/api_test/passwords_private/test.js
index 6117b91..9dc7bccc 100644
--- a/chrome/test/data/extensions/api_test/passwords_private/test.js
+++ b/chrome/test/data/extensions/api_test/passwords_private/test.js
@@ -15,14 +15,8 @@
 
       if (numCalls == 1) {
         numSavedPasswords = savedPasswordsList.length;
-        chrome.passwordsPrivate.removeSavedPassword({
-          urls: {
-            origin: savedPasswordsList[0].loginPair.urls.origin,
-            shown: savedPasswordsList[0].loginPair.urls.shown,
-            link: savedPasswordsList[0].loginPair.urls.link,
-          },
-          username: savedPasswordsList[0].loginPair.username
-        });
+        chrome.passwordsPrivate.removeSavedPassword(
+            savedPasswordsList[0].index);
       } else if (numCalls == 2) {
         chrome.test.assertEq(
             savedPasswordsList.length, numSavedPasswords - 1);
@@ -45,7 +39,7 @@
       if (numCalls == 1) {
         numPasswordExceptions = passwordExceptionsList.length;
         chrome.passwordsPrivate.removePasswordException(
-            passwordExceptionsList[0].urls.origin);
+            passwordExceptionsList[0].index);
       } else if (numCalls == 2) {
         chrome.test.assertEq(
             passwordExceptionsList.length, numPasswordExceptions - 1);
@@ -67,14 +61,7 @@
     };
 
     chrome.passwordsPrivate.onPlaintextPasswordRetrieved.addListener(callback);
-    chrome.passwordsPrivate.requestPlaintextPassword({
-      urls: {
-        origin: 'http://www.test.com',
-        shown: 'www.test.com',
-        link: 'http://www.test.com',
-      },
-      username: 'test@test.com'
-    });
+    chrome.passwordsPrivate.requestPlaintextPassword(0);
   },
 
   function getSavedPasswordList() {
@@ -88,6 +75,7 @@
         chrome.test.assertTrue(!!entry.loginPair.urls.origin);
         chrome.test.assertTrue(!!entry.loginPair.urls.shown);
         chrome.test.assertTrue(!!entry.loginPair.urls.link);
+        chrome.test.assertEq(entry.index, i);
       }
 
       // Ensure that the callback is invoked.
@@ -107,6 +95,7 @@
         chrome.test.assertTrue(!!exception.urls.origin);
         chrome.test.assertTrue(!!exception.urls.shown);
         chrome.test.assertTrue(!!exception.urls.link);
+        chrome.test.assertEq(exception.index, i);
       }
 
       // Ensure that the callback is invoked.
diff --git a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js
index ccdc8300..1ac94f7 100644
--- a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js
+++ b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.js
@@ -21,6 +21,8 @@
   url = url || FakeDataMaker.patternMaker_('www.xxxxxx.com', 16);
   username = username || FakeDataMaker.patternMaker_('user_xxxxx', 16);
   passwordLength = passwordLength || Math.floor(Math.random() * 15) + 3;
+  entryIndex = -1;
+  exceptionIndex = -1;
 
   return {
     loginPair: {
@@ -32,6 +34,7 @@
       username: username,
     },
     numCharactersInPassword: passwordLength,
+    index: ++entryIndex,
   };
 };
 
@@ -47,7 +50,8 @@
       origin: 'http://' + url + '/login',
       shown: url,
       link: 'http://' + url + '/login',
-    }
+    },
+    index: ++exceptionIndex,
   };
 };
 
@@ -196,11 +200,11 @@
   },
 
   /** @override */
-  removeSavedPassword: function(loginPair) {
+  removeSavedPassword: function(index) {
     this.actual_.removed.passwords++;
 
     if (this.onRemoveSavedPassword)
-      this.onRemoveSavedPassword(loginPair);
+      this.onRemoveSavedPassword(index);
   },
 
   /** @override */
@@ -221,15 +225,15 @@
   },
 
   /** @override */
-  removeException: function(exception) {
+  removeException: function(index) {
     this.actual_.removed.exceptions++;
 
     if (this.onRemoveException)
-      this.onRemoveException(exception);
+      this.onRemoveException(index);
   },
 
   /** @override */
-  getPlaintextPassword: function(loginPair, callback) {
+  getPlaintextPassword: function(index, callback) {
     this.actual_.requested.plaintextPassword++;
     this.lastCallback.getPlaintextPassword = callback;
   },
diff --git a/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js b/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js
index 140b2574..7fa13f9bc 100644
--- a/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js
+++ b/chrome/test/data/webui/settings/settings_passwords_section_browsertest.js
@@ -289,10 +289,9 @@
       assert(firstNode);
       var firstPassword = passwordList[0];
 
-      passwordManager.onRemoveSavedPassword = function(detail) {
+      passwordManager.onRemoveSavedPassword = function(index) {
         // Verify that the event matches the expected value.
-        assertEquals(firstPassword.loginPair.urls.origin, detail.urls.origin);
-        assertEquals(firstPassword.loginPair.username, detail.username);
+        assertEquals(firstPassword.index, index);
 
         // Clean up after self.
         passwordManager.onRemoveSavedPassword = null;
@@ -436,19 +435,19 @@
           getDomRepeatChildren(passwordsSection.$.passwordExceptionsList);
 
       // The index of the button currently being checked.
-      var index = 0;
+      var item = 0;
 
       var clickRemoveButton = function() {
         MockInteractions.tap(
-            exceptions[index].querySelector('#removeExceptionButton'));
+            exceptions[item].querySelector('#removeExceptionButton'));
       };
 
-      passwordManager.onRemoveException = function(detail) {
+      passwordManager.onRemoveException = function(index) {
         // Verify that the event matches the expected value.
-        assertTrue(index < exceptionList.length);
-        assertEquals(exceptionList[index].urls.origin, detail);
+        assertTrue(item < exceptionList.length);
+        assertEquals(index, exceptionList[item].index);
 
-        if (++index < exceptionList.length) {
+        if (++item < exceptionList.length) {
           clickRemoveButton();  // Click 'remove' on all passwords, one by one.
         } else {
           // Clean up after self.
diff --git a/chrome/test/ppapi/ppapi_filechooser_browsertest.cc b/chrome/test/ppapi/ppapi_filechooser_browsertest.cc
index bf60998..e2770ea 100644
--- a/chrome/test/ppapi/ppapi_filechooser_browsertest.cc
+++ b/chrome/test/ppapi/ppapi_filechooser_browsertest.cc
@@ -26,7 +26,7 @@
 #if defined(FULL_SAFE_BROWSING)
 #include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
-#include "components/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "content/public/test/test_download_request_handler.h"
 
 using safe_browsing::DownloadProtectionService;
diff --git a/chromeos/dbus/dbus_method_call_status.h b/chromeos/dbus/dbus_method_call_status.h
index 9a40acf5..aa21426 100644
--- a/chromeos/dbus/dbus_method_call_status.h
+++ b/chromeos/dbus/dbus_method_call_status.h
@@ -46,11 +46,6 @@
     DBusMethodCallStatus call_status,
     bool result)> BooleanDBusMethodCallback;
 
-// A callback to handle responses of methods returning a ObjectPath value.
-typedef base::Callback<void(
-    DBusMethodCallStatus call_status,
-    const dbus::ObjectPath& result)> ObjectPathDBusMethodCallback;
-
 // A callback to handle responses of methods returning a ObjectPath value that
 // doesn't get call status.
 typedef base::Callback<void(const dbus::ObjectPath& result)> ObjectPathCallback;
diff --git a/chromeos/dbus/shill_client_helper.cc b/chromeos/dbus/shill_client_helper.cc
index 0eca2674..86143d8 100644
--- a/chromeos/dbus/shill_client_helper.cc
+++ b/chromeos/dbus/shill_client_helper.cc
@@ -100,24 +100,6 @@
                                    : DBUS_METHOD_CALL_FAILURE);
 }
 
-// Handles responses for methods with ObjectPath results.
-void OnObjectPathMethod(
-    ShillClientHelper::RefHolder* ref_holder,
-    const ObjectPathDBusMethodCallback& callback,
-    dbus::Response* response) {
-  if (!response) {
-    callback.Run(DBUS_METHOD_CALL_FAILURE, dbus::ObjectPath());
-    return;
-  }
-  dbus::MessageReader reader(response);
-  dbus::ObjectPath result;
-  if (!reader.PopObjectPath(&result)) {
-    callback.Run(DBUS_METHOD_CALL_FAILURE, dbus::ObjectPath());
-    return;
-  }
-  callback.Run(DBUS_METHOD_CALL_SUCCESS, result);
-}
-
 // Handles responses for methods with ObjectPath results and no status.
 void OnObjectPathMethodWithoutStatus(
     ShillClientHelper::RefHolder* ref_holder,
@@ -286,17 +268,6 @@
                      std::move(callback)));
 }
 
-void ShillClientHelper::CallObjectPathMethod(
-    dbus::MethodCall* method_call,
-    const ObjectPathDBusMethodCallback& callback) {
-  DCHECK(!callback.is_null());
-  proxy_->CallMethod(
-      method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
-      base::BindOnce(&OnObjectPathMethod,
-                     base::Owned(new RefHolder(weak_ptr_factory_.GetWeakPtr())),
-                     callback));
-}
-
 void ShillClientHelper::CallObjectPathMethodWithErrorCallback(
     dbus::MethodCall* method_call,
     const ObjectPathCallback& callback,
diff --git a/chromeos/dbus/shill_client_helper.h b/chromeos/dbus/shill_client_helper.h
index 3408f00b..e0fe0e5 100644
--- a/chromeos/dbus/shill_client_helper.h
+++ b/chromeos/dbus/shill_client_helper.h
@@ -92,10 +92,6 @@
   void CallVoidMethod(dbus::MethodCall* method_call,
                       VoidDBusMethodCallback callback);
 
-  // Calls a method with an object path result.
-  void CallObjectPathMethod(dbus::MethodCall* method_call,
-                            const ObjectPathDBusMethodCallback& callback);
-
   // Calls a method with an object path result where there is an error callback.
   void CallObjectPathMethodWithErrorCallback(
       dbus::MethodCall* method_call,
diff --git a/components/BUILD.gn b/components/BUILD.gn
index 3545925..fedaff5 100644
--- a/components/BUILD.gn
+++ b/components/BUILD.gn
@@ -320,7 +320,7 @@
   }
 
   if (safe_browsing_mode == 1) {
-    deps += [ "//components/safe_browsing_db:unit_tests_desktop" ]
+    deps += [ "//components/safe_browsing/db:unit_tests_desktop" ]
   } else if (safe_browsing_mode == 2) {
     deps += [ "//components/safe_browsing/db:unit_tests_mobile" ]
   }
diff --git a/components/history/core/browser/expire_history_backend.cc b/components/history/core/browser/expire_history_backend.cc
index 2e69c92..b19fef9 100644
--- a/components/history/core/browser/expire_history_backend.cc
+++ b/components/history/core/browser/expire_history_backend.cc
@@ -135,6 +135,8 @@
 const base::Feature kClearOldOnDemandFavicons{
     "ClearOldOnDemandFavicons", base::FEATURE_DISABLED_BY_DEFAULT};
 
+const int kOnDemandFaviconIsOldAfterDays = 30;
+
 }  // namespace internal
 
 // ExpireHistoryBackend::DeleteEffects ----------------------------------------
@@ -499,7 +501,9 @@
     work_queue_.push(reader);
   } else {
     // Otherwise do a final clean-up - remove old favicons not bound to visits.
-    ClearOldOnDemandFavicons(GetCurrentExpirationTime());
+    ClearOldOnDemandFavicons(
+        base::Time::Now() -
+        base::TimeDelta::FromDays(internal::kOnDemandFaviconIsOldAfterDays));
   }
 
   ScheduleExpire();
diff --git a/components/history/core/browser/expire_history_backend.h b/components/history/core/browser/expire_history_backend.h
index 824e822..d571e8c 100644
--- a/components/history/core/browser/expire_history_backend.h
+++ b/components/history/core/browser/expire_history_backend.h
@@ -46,6 +46,9 @@
 namespace internal {
 // Feature that enables clearing old on-demand favicons.
 extern const base::Feature kClearOldOnDemandFavicons;
+
+// The minimum number of days since last use for an icon to be considered old.
+extern const int kOnDemandFaviconIsOldAfterDays;
 }  // namespace internal
 
 // Helper component to HistoryBackend that manages expiration and deleting of
diff --git a/components/history/core/browser/expire_history_backend_unittest.cc b/components/history/core/browser/expire_history_backend_unittest.cc
index be6bc13..cdc1a82 100644
--- a/components/history/core/browser/expire_history_backend_unittest.cc
+++ b/components/history/core/browser/expire_history_backend_unittest.cc
@@ -49,6 +49,12 @@
 bool MockCanAddURLToHistory(const GURL& url) {
   return url.is_valid();
 }
+
+base::Time GetOldFaviconThreshold() {
+  return base::Time::Now() -
+         base::TimeDelta::FromDays(internal::kOnDemandFaviconIsOldAfterDays);
+}
+
 }  // namespace
 
 // ExpireHistoryTest -----------------------------------------------------------
@@ -908,13 +914,12 @@
   GURL url("http://google.com/favicon.ico");
   favicon_base::FaviconID icon_id = thumb_db_->AddFavicon(
       url, favicon_base::FAVICON, favicon, FaviconBitmapType::ON_DEMAND,
-      base::Time::Now() - base::TimeDelta::FromDays(100), gfx::Size());
+      GetOldFaviconThreshold() - base::TimeDelta::FromSeconds(1), gfx::Size());
   ASSERT_NE(0, icon_id);
   GURL page_url("http://google.com/");
   ASSERT_NE(0, thumb_db_->AddIconMapping(page_url, icon_id));
 
-  expirer_.ClearOldOnDemandFavicons(base::Time::Now() -
-                                    base::TimeDelta::FromDays(90));
+  expirer_.ClearOldOnDemandFavicons(GetOldFaviconThreshold());
 
   // The icon gets deleted.
   EXPECT_FALSE(thumb_db_->GetIconMappingsForPageURL(page_url, nullptr));
@@ -937,7 +942,7 @@
   GURL url("http://google.com/favicon.ico");
   favicon_base::FaviconID icon_id = thumb_db_->AddFavicon(
       url, favicon_base::FAVICON, favicon, FaviconBitmapType::ON_DEMAND,
-      base::Time::Now() - base::TimeDelta::FromDays(100), gfx::Size());
+      GetOldFaviconThreshold() - base::TimeDelta::FromSeconds(1), gfx::Size());
   ASSERT_NE(0, icon_id);
   GURL page_url1("http://google.com/1");
   ASSERT_NE(0, thumb_db_->AddIconMapping(page_url1, icon_id));
@@ -945,8 +950,7 @@
   GURL page_url2("http://google.com/2");
   ASSERT_NE(0, thumb_db_->AddIconMapping(page_url2, icon_id));
 
-  expirer_.ClearOldOnDemandFavicons(base::Time::Now() -
-                                    base::TimeDelta::FromDays(90));
+  expirer_.ClearOldOnDemandFavicons(GetOldFaviconThreshold());
 
   // Nothing gets deleted.
   EXPECT_TRUE(thumb_db_->GetFaviconHeader(icon_id, nullptr, nullptr));
@@ -968,8 +972,8 @@
   feature_list.InitAndEnableFeature(internal::kClearOldOnDemandFavicons);
 
   // Previous clearing (2 days ago).
-  expirer_.ClearOldOnDemandFavicons(base::Time::Now() -
-                                    base::TimeDelta::FromDays(92));
+  expirer_.ClearOldOnDemandFavicons(GetOldFaviconThreshold() -
+                                    base::TimeDelta::FromDays(2));
 
   // The blob does not encode any real bitmap, obviously.
   const unsigned char kBlob[] = "0";
@@ -980,13 +984,12 @@
   GURL url("http://google.com/favicon.ico");
   favicon_base::FaviconID icon_id = thumb_db_->AddFavicon(
       url, favicon_base::FAVICON, favicon, FaviconBitmapType::ON_DEMAND,
-      base::Time::Now() - base::TimeDelta::FromDays(100), gfx::Size());
+      GetOldFaviconThreshold() - base::TimeDelta::FromSeconds(1), gfx::Size());
   ASSERT_NE(0, icon_id);
   GURL page_url("http://google.com/");
   ASSERT_NE(0, thumb_db_->AddIconMapping(page_url, icon_id));
 
-  expirer_.ClearOldOnDemandFavicons(base::Time::Now() -
-                                    base::TimeDelta::FromDays(90));
+  expirer_.ClearOldOnDemandFavicons(GetOldFaviconThreshold());
 
   // The icon gets deleted.
   EXPECT_FALSE(thumb_db_->GetIconMappingsForPageURL(page_url, nullptr));
@@ -1002,8 +1005,7 @@
   feature_list.InitAndEnableFeature(internal::kClearOldOnDemandFavicons);
 
   // Previous clearing (5 minutes ago).
-  expirer_.ClearOldOnDemandFavicons(base::Time::Now() -
-                                    base::TimeDelta::FromDays(90) -
+  expirer_.ClearOldOnDemandFavicons(GetOldFaviconThreshold() -
                                     base::TimeDelta::FromMinutes(5));
 
   // The blob does not encode any real bitmap, obviously.
@@ -1015,15 +1017,14 @@
   GURL url("http://google.com/favicon.ico");
   favicon_base::FaviconID icon_id = thumb_db_->AddFavicon(
       url, favicon_base::FAVICON, favicon, FaviconBitmapType::ON_DEMAND,
-      base::Time::Now() - base::TimeDelta::FromDays(100), gfx::Size());
+      GetOldFaviconThreshold() - base::TimeDelta::FromSeconds(1), gfx::Size());
   ASSERT_NE(0, icon_id);
   GURL page_url1("http://google.com/1");
   ASSERT_NE(0, thumb_db_->AddIconMapping(page_url1, icon_id));
   GURL page_url2("http://google.com/2");
   ASSERT_NE(0, thumb_db_->AddIconMapping(page_url2, icon_id));
 
-  expirer_.ClearOldOnDemandFavicons(base::Time::Now() -
-                                    base::TimeDelta::FromDays(90));
+  expirer_.ClearOldOnDemandFavicons(GetOldFaviconThreshold());
 
   // Nothing gets deleted.
   EXPECT_TRUE(thumb_db_->GetFaviconHeader(icon_id, nullptr, nullptr));
diff --git a/components/history/core/browser/thumbnail_database.h b/components/history/core/browser/thumbnail_database.h
index f9ba1c71..bd29eb49 100644
--- a/components/history/core/browser/thumbnail_database.h
+++ b/components/history/core/browser/thumbnail_database.h
@@ -28,7 +28,7 @@
 
 // The minimum number of days after which last_requested field gets updated.
 // All earlier updates are ignored.
-static const int kFaviconUpdateLastRequestedAfterDays = 14;
+static const int kFaviconUpdateLastRequestedAfterDays = 10;
 
 // This database interface is owned by the history backend and runs on the
 // history thread. It is a totally separate component from history partially
diff --git a/components/ntp_snippets/category.cc b/components/ntp_snippets/category.cc
index 1ef1bed..0ea06474 100644
--- a/components/ntp_snippets/category.cc
+++ b/components/ntp_snippets/category.cc
@@ -38,6 +38,11 @@
 
 Category::Category(int id) : id_(id) {}
 
+int Category::remote_id() const {
+  DCHECK_GT(id_, static_cast<int>(KnownCategories::REMOTE_CATEGORIES_OFFSET));
+  return id_ - static_cast<int>(KnownCategories::REMOTE_CATEGORIES_OFFSET);
+}
+
 bool Category::IsKnownCategory(KnownCategories known_category) const {
   DCHECK_NE(known_category, KnownCategories::LOCAL_CATEGORIES_COUNT);
   DCHECK_NE(known_category, KnownCategories::REMOTE_CATEGORIES_OFFSET);
diff --git a/components/ntp_snippets/category.h b/components/ntp_snippets/category.h
index 59b78b4..c40ed5d 100644
--- a/components/ntp_snippets/category.h
+++ b/components/ntp_snippets/category.h
@@ -95,6 +95,10 @@
   // |CategoryFactory::FromIDValue(id)|.
   int id() const { return id_; }
 
+  // Returns a remote category identifier. Do not call for non-remote
+  // categories.
+  int remote_id() const;
+
   // Returns whether this category matches the given |known_category|.
   bool IsKnownCategory(KnownCategories known_category) const;
 
diff --git a/components/ntp_snippets/features.cc b/components/ntp_snippets/features.cc
index 2895c481..31823bbc 100644
--- a/components/ntp_snippets/features.cc
+++ b/components/ntp_snippets/features.cc
@@ -73,17 +73,17 @@
 const char kCategoryRankerConstantRanker[] = "constant";
 const char kCategoryRankerClickBasedRanker[] = "click_based";
 
-CategoryRankerChoice GetSelectedCategoryRanker() {
+CategoryRankerChoice GetSelectedCategoryRanker(bool is_chrome_home_enabled) {
   std::string category_ranker_value =
       variations::GetVariationParamValueByFeature(kCategoryRanker,
                                                   kCategoryRankerParameter);
 
   if (category_ranker_value.empty()) {
-    // TODO(crbug.com/735066): Remove the experiment configurations from
-    // fieldtrial_testing_config.json when enabling ClickBasedRanker by default.
-
     // Default, Enabled or Disabled.
-    return CategoryRankerChoice::CONSTANT;
+    if (is_chrome_home_enabled) {
+      return CategoryRankerChoice::CONSTANT;
+    }
+    return CategoryRankerChoice::CLICK_BASED;
   }
   if (category_ranker_value == kCategoryRankerConstantRanker) {
     return CategoryRankerChoice::CONSTANT;
@@ -99,8 +99,11 @@
 
 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker(
     PrefService* pref_service,
-    std::unique_ptr<base::Clock> clock) {
-  CategoryRankerChoice choice = ntp_snippets::GetSelectedCategoryRanker();
+    std::unique_ptr<base::Clock> clock,
+    bool is_chrome_home_enabled) {
+  CategoryRankerChoice choice =
+      ntp_snippets::GetSelectedCategoryRanker(is_chrome_home_enabled);
+
   switch (choice) {
     case CategoryRankerChoice::CONSTANT:
       return base::MakeUnique<ConstantCategoryRanker>();
@@ -130,7 +133,7 @@
 
   if (category_order_value.empty()) {
     // Enabled with no parameters.
-    return CategoryOrderChoice::GENERAL;
+    return CategoryOrderChoice::EMERGING_MARKETS_ORIENTED;
   }
   if (category_order_value == kCategoryOrderGeneral) {
     return CategoryOrderChoice::GENERAL;
diff --git a/components/ntp_snippets/features.h b/components/ntp_snippets/features.h
index af47b62..4547a5e 100644
--- a/components/ntp_snippets/features.h
+++ b/components/ntp_snippets/features.h
@@ -62,13 +62,15 @@
   CLICK_BASED,
 };
 
-// Returns which CategoryRanker to use according to kCategoryRanker feature.
-CategoryRankerChoice GetSelectedCategoryRanker();
+// Returns which CategoryRanker to use according to kCategoryRanker feature and
+// Chrome Home.
+CategoryRankerChoice GetSelectedCategoryRanker(bool is_chrome_home_enabled);
 
-// Builds a CategoryRanker according to kCategoryRanker feature.
+// Builds a CategoryRanker according to kCategoryRanker feature and Chrome Home.
 std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker(
     PrefService* pref_service,
-    std::unique_ptr<base::Clock> clock);
+    std::unique_ptr<base::Clock> clock,
+    bool is_chrome_home_enabled);
 
 // Feature to choose a default category order.
 extern const base::Feature kCategoryOrder;
diff --git a/components/ntp_snippets/remote/json_request.cc b/components/ntp_snippets/remote/json_request.cc
index 206c846c..b334545 100644
--- a/components/ntp_snippets/remote/json_request.cc
+++ b/components/ntp_snippets/remote/json_request.cc
@@ -340,7 +340,19 @@
     request->Set("topLanguages", std::move(language_list));
   }
 
-  // TODO(sfiera): Support count_to_fetch.
+  // TODO(vitaliii): Support count_to_fetch without requiring
+  // |exclusive_category|.
+  if (params_.exclusive_category.has_value()) {
+    base::DictionaryValue exclusive_category_parameters;
+    exclusive_category_parameters.SetInteger(
+        "id", params_.exclusive_category->remote_id());
+    exclusive_category_parameters.SetInteger("numSuggestions",
+                                             params_.count_to_fetch);
+    base::ListValue category_parameters;
+    category_parameters.GetList().push_back(
+        std::move(exclusive_category_parameters));
+    request->SetKey("categoryParameters", std::move(category_parameters));
+  }
 
   std::string request_json;
   bool success = base::JSONWriter::WriteWithOptions(
diff --git a/components/ntp_snippets/remote/json_request_unittest.cc b/components/ntp_snippets/remote/json_request_unittest.cc
index 3bbb6a5..a5bb386 100644
--- a/components/ntp_snippets/remote/json_request_unittest.cc
+++ b/components/ntp_snippets/remote/json_request_unittest.cc
@@ -268,6 +268,50 @@
                          "}"));
 }
 
+TEST_F(JsonRequestTest,
+       ShouldPropagateCountToFetchWhenExclusiveCategoryPresent) {
+  JsonRequest::Builder builder;
+  RequestParams params;
+  params.interactive_request = true;
+  params.language_code = "en";
+  params.exclusive_category =
+      Category::FromKnownCategory(KnownCategories::ARTICLES);
+  params.count_to_fetch = 25;
+  builder.SetParams(params);
+
+  EXPECT_THAT(builder.PreviewRequestBodyForTesting(), EqualsJSON(R"(
+                              {
+                                "priority": "USER_ACTION",
+                                "uiLanguage": "en",
+                                "excludedSuggestionIds": [],
+                                "categoryParameters": [{
+                                  "id": 1,
+                                  "numSuggestions": 25
+                                }]
+                              }
+                            )"));
+}
+
+// TODO(vitaliii): Propagate count to fetch in this case as well and delete this
+// test. Currently the server does not support this.
+TEST_F(JsonRequestTest,
+       ShouldNotPropagateCountToFetchWhenExclusiveCategoryNotPresent) {
+  JsonRequest::Builder builder;
+  RequestParams params;
+  params.interactive_request = true;
+  params.language_code = "en";
+  params.count_to_fetch = 10;
+  builder.SetParams(params);
+
+  EXPECT_THAT(builder.PreviewRequestBodyForTesting(), EqualsJSON(R"(
+                              {
+                                "priority": "USER_ACTION",
+                                "uiLanguage": "en",
+                                "excludedSuggestionIds": []
+                              }
+                            )"));
+}
+
 }  // namespace internal
 
 }  // namespace ntp_snippets
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
index 8300002..47198c2c 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.cc
@@ -42,9 +42,13 @@
 
 namespace {
 
-// Number of suggestions requested to the server. Consider replacing sparse UMA
-// histograms with COUNTS() if this number increases beyond 50.
-const int kMaxSuggestionCount = 10;
+// Maximal number of suggestions we expect to receive from the server during a
+// normal (not fetch-more) fetch. Consider replacing sparse UMA histograms with
+// COUNTS() if this number increases beyond 50.
+// TODO(vitaliii): Either support requesting a given number of suggestions on
+// the server or delete this constant (this will require moving the UMA
+// reporting below to content_suggestions_metrics).
+const int kMaxNormalFetchSuggestionCount = 20;
 
 // Number of archived suggestions we keep around in memory.
 const int kMaxArchivedSuggestionCount = 200;
@@ -85,7 +89,7 @@
   // base/metrics/field_trial_params.h. GetVariationParamByFeature(As.*)? are
   // deprecated.
   return variations::GetVariationParamByFeatureAsBool(
-      ntp_snippets::kArticleSuggestionsFeature,
+      kArticleSuggestionsFeature,
       kOrderNewRemoteCategoriesBasedOnArticlesCategory,
       /*default_value=*/false);
 }
@@ -145,8 +149,7 @@
 
 bool IsFetchedSuggestionsNotificationsEnabled() {
   return base::GetFieldTrialParamByFeatureAsBool(
-      ntp_snippets::kNotificationsFeature,
-      kEnableFetchedSuggestionsNotificationsParamName,
+      kNotificationsFeature, kEnableFetchedSuggestionsNotificationsParamName,
       kEnableFetchedSuggestionsNotificationsDefault);
 }
 
@@ -159,8 +162,7 @@
 
 bool IsPushedSuggestionsNotificationsEnabled() {
   return base::GetFieldTrialParamByFeatureAsBool(
-      ntp_snippets::kNotificationsFeature,
-      kEnablePushedSuggestionsNotificationsParamName,
+      kNotificationsFeature, kEnablePushedSuggestionsNotificationsParamName,
       kEnablePushedSuggestionsNotificationsDefault);
 }
 
@@ -171,7 +173,7 @@
 
 bool IsSignedInUsersSubscriptionForPushedSuggestionsEnabled() {
   return base::GetFieldTrialParamByFeatureAsBool(
-      ntp_snippets::kBreakingNewsPushFeature,
+      kBreakingNewsPushFeature,
       kEnableSignedInUsersSubscriptionForPushedSuggestionsParamName,
       kEnableSignedInUsersSubscriptionForPushedSuggestionsDefault);
 }
@@ -183,7 +185,7 @@
 
 bool IsSignedOutUsersSubscriptionForPushedSuggestionsEnabled() {
   return base::GetFieldTrialParamByFeatureAsBool(
-      ntp_snippets::kBreakingNewsPushFeature,
+      kBreakingNewsPushFeature,
       kEnableSignedOutUsersSubscriptionForPushedSuggestionsParamName,
       kEnableSignedOutUsersSubscriptionForPushedSuggestionsDefault);
 }
@@ -197,11 +199,21 @@
 
 bool ShouldForceFetchedSuggestionsNotifications() {
   return base::GetFieldTrialParamByFeatureAsBool(
-      ntp_snippets::kNotificationsFeature,
-      kForceFetchedSuggestionsNotificationsParamName,
+      kNotificationsFeature, kForceFetchedSuggestionsNotificationsParamName,
       kForceFetchedSuggestionsNotificationsDefault);
 }
 
+// Variation parameter for number of suggestions to request when fetching more.
+const char kFetchMoreSuggestionsCountParamName[] =
+    "fetch_more_suggestions_count";
+const int kFetchMoreSuggestionsCountDefault = 25;
+
+int GetFetchMoreSuggestionsCount() {
+  return base::GetFieldTrialParamByFeatureAsInt(
+      kArticleSuggestionsFeature, kFetchMoreSuggestionsCountParamName,
+      kFetchMoreSuggestionsCountDefault);
+}
+
 template <typename SuggestionPtrContainer>
 std::unique_ptr<std::vector<std::string>> GetSuggestionIDVector(
     const SuggestionPtrContainer& suggestions) {
@@ -459,7 +471,10 @@
 
   MarkEmptyCategoriesAsLoading();
 
-  RequestParams params = BuildFetchParams(/*fetched_category=*/base::nullopt);
+  // |count_to_fetch| is actually ignored, because the server does not support
+  // this functionality.
+  RequestParams params = BuildFetchParams(/*fetched_category=*/base::nullopt,
+                                          /*count_to_fetch=*/10);
   params.interactive_request = interactive_request;
   suggestions_fetcher_->FetchSnippets(
       params, base::BindOnce(&RemoteSuggestionsProviderImpl::OnFetchFinished,
@@ -494,7 +509,8 @@
       },
       base::Unretained(remote_suggestions_scheduler_), std::move(callback));
 
-  RequestParams params = BuildFetchParams(category);
+  RequestParams params = BuildFetchParams(
+      category, /*count_to_fetch=*/GetFetchMoreSuggestionsCount());
   params.excluded_ids.insert(known_suggestion_ids.begin(),
                              known_suggestion_ids.end());
   params.interactive_request = true;
@@ -508,10 +524,11 @@
 
 // Builds default fetcher params.
 RequestParams RemoteSuggestionsProviderImpl::BuildFetchParams(
-    base::Optional<Category> fetched_category) const {
+    base::Optional<Category> fetched_category,
+    int count_to_fetch) const {
   RequestParams result;
   result.language_code = application_language_code_;
-  result.count_to_fetch = kMaxSuggestionCount;
+  result.count_to_fetch = count_to_fetch;
   // If this is a fetch for a specific category, its dismissed suggestions are
   // added first to truncate them less.
   if (fetched_category.has_value()) {
@@ -644,8 +661,9 @@
 }
 
 // static
-int RemoteSuggestionsProviderImpl::GetMaxSuggestionCountForTesting() {
-  return kMaxSuggestionCount;
+int RemoteSuggestionsProviderImpl::
+    GetMaxNormalFetchSuggestionCountForTesting() {
+  return kMaxNormalFetchSuggestionCount;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -848,7 +866,7 @@
         UMA_HISTOGRAM_SPARSE_SLOWLY(
             "NewTabPage.Snippets.NumArticlesFetched",
             std::min(fetched_category.suggestions.size(),
-                     static_cast<size_t>(kMaxSuggestionCount + 1)));
+                     static_cast<size_t>(kMaxNormalFetchSuggestionCount)));
         response_includes_article_category = true;
 
         if (Logger::IsLoggingEnabled()) {
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
index 5d75db5d..57f0c8b3 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
+++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl.h
@@ -121,8 +121,9 @@
       DismissedSuggestionsCallback callback) override;
   void ClearDismissedSuggestionsForDebugging(Category category) override;
 
-  // Returns the maximum number of suggestions that will be shown at once.
-  static int GetMaxSuggestionCountForTesting();
+  // Returns the maximum number of suggestions we expect to receive from the
+  // server during a normal (not fetch-more) fetch..
+  static int GetMaxNormalFetchSuggestionCountForTesting();
 
   // Available suggestions, only for unit tests.
   // TODO(treib): Get rid of this. Tests should use a fake observer instead.
@@ -166,6 +167,9 @@
                            CallsSchedulerWhenSignedIn);
   FRIEND_TEST_ALL_PREFIXES(RemoteSuggestionsProviderImplTest,
                            CallsSchedulerWhenSignedOut);
+  FRIEND_TEST_ALL_PREFIXES(
+      RemoteSuggestionsProviderImplTest,
+      ShouldNotSetExclusiveCategoryWhenFetchingSuggestions);
 
   // Possible state transitions:
   //       NOT_INITED --------+
@@ -380,9 +384,12 @@
   void RestoreCategoriesFromPrefs();
   void StoreCategoriesToPrefs();
 
-  // Absence of fetched category corresponds to fetching all categories.
-  RequestParams BuildFetchParams(
-      base::Optional<Category> fetched_category) const;
+  // If |fetched_category| is nullopt, fetches all categories. Otherwise,
+  // fetches at most |count_to_fetch| suggestions only from |fetched_category|.
+  // TODO(vitaliii): Also support |count_to_fetch| when |fetched_category| is
+  // nullopt.
+  RequestParams BuildFetchParams(base::Optional<Category> fetched_category,
+                                 int count_to_fetch) const;
 
   void MarkEmptyCategoriesAsLoading();
 
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
index 1ad9939f..8ef43711 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
@@ -606,6 +606,17 @@
         {kNotificationsFeature.name});
   }
 
+  void SetFetchMoreSuggestionsCount(int count) {
+    // VariationParamsManager supports only one
+    // |SetVariationParamsWithFeatureAssociations| at a time, so we clear
+    // previous settings first to make this explicit.
+    params_manager_.ClearAllVariationParams();
+    params_manager_.SetVariationParamsWithFeatureAssociations(
+        /*trial_name=*/kArticleSuggestionsFeature.name,
+        {{"fetch_more_suggestions_count", base::IntToString(count)}},
+        {kArticleSuggestionsFeature.name});
+  }
+
  private:
   variations::testing::VariationParamsManager params_manager_;
   test::RemoteSuggestionsTestUtils utils_;
@@ -2169,7 +2180,8 @@
   std::vector<FetchedCategory> fetched_categories;
   FetchedCategoryBuilder category_builder;
   category_builder.SetCategory(articles_category());
-  for (int i = 0; i < provider->GetMaxSuggestionCountForTesting() + 1; ++i) {
+  for (int i = 0;
+       i < provider->GetMaxNormalFetchSuggestionCountForTesting() + 1; ++i) {
     category_builder.AddSuggestionViaBuilder(RemoteSuggestionBuilder().AddId(
         base::StringPrintf("http://localhost/suggestion-id-%d", i)));
   }
@@ -2178,8 +2190,9 @@
                         Status::Success(), std::move(fetched_categories));
   // TODO(tschumann): We should probably trim out any additional results and
   // only serve the MaxSuggestionCount items.
-  EXPECT_THAT(provider->GetSuggestionsForTesting(articles_category()),
-              SizeIs(provider->GetMaxSuggestionCountForTesting() + 1));
+  EXPECT_THAT(
+      provider->GetSuggestionsForTesting(articles_category()),
+      SizeIs(provider->GetMaxNormalFetchSuggestionCountForTesting() + 1));
 }
 
 TEST_F(RemoteSuggestionsProviderImplTest,
@@ -4049,4 +4062,48 @@
               GURL("http://articles.com"));
 }
 
+TEST_F(RemoteSuggestionsProviderImplTest,
+       ShouldNotSetExclusiveCategoryWhenFetchingSuggestions) {
+  auto provider = MakeSuggestionsProvider(
+      /*use_mock_prefetched_pages_tracker=*/false,
+      /*use_fake_breaking_news_listener=*/false,
+      /*use_mock_remote_suggestions_status_service=*/false);
+
+  RequestParams params;
+  EXPECT_CALL(*mock_suggestions_fetcher(), FetchSnippets(_, _))
+      .WillOnce(SaveArg<0>(&params));
+  provider->FetchSuggestions(
+      /*interactive_request=*/true,
+      RemoteSuggestionsProvider::FetchStatusCallback());
+
+  EXPECT_FALSE(params.exclusive_category.has_value());
+  EXPECT_EQ(params.count_to_fetch, 10);
+}
+
+TEST_F(RemoteSuggestionsProviderImplTest,
+       ShouldSetExclusiveCategoryAndCountToFetchWhenFetchingMoreSuggestions) {
+  SetFetchMoreSuggestionsCount(35);
+
+  auto provider = MakeSuggestionsProvider(
+      /*use_mock_prefetched_pages_tracker=*/false,
+      /*use_fake_breaking_news_listener=*/false,
+      /*use_mock_remote_suggestions_status_service=*/false);
+
+  RequestParams params;
+  EXPECT_CALL(*mock_suggestions_fetcher(), FetchSnippets(_, _))
+      .WillOnce(SaveArg<0>(&params));
+  EXPECT_CALL(*scheduler(), AcquireQuotaForInteractiveFetch())
+      .WillOnce(Return(true))
+      .RetiresOnSaturation();
+  provider->Fetch(
+      articles_category(), /*known_suggestion_ids=*/std::set<std::string>(),
+      /*fetch_done_callback=*/
+      base::Bind([](Status status_code,
+                    std::vector<ContentSuggestion> suggestions) -> void {}));
+
+  ASSERT_TRUE(params.exclusive_category.has_value());
+  EXPECT_EQ(*params.exclusive_category, articles_category());
+  EXPECT_EQ(params.count_to_fetch, 35);
+}
+
 }  // namespace ntp_snippets
diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp
index a84e8c0..76afb09 100644
--- a/components/page_info_strings.grdp
+++ b/components/page_info_strings.grdp
@@ -197,7 +197,7 @@
     <message name="IDS_PAGE_INFO_TYPE_FLASH" desc="The label used for Flash permissions in the Page Info popup.">
       Flash
     </message>
-    <message name="IDS_PAGE_INFO_TYPE_LOCATION" desc="The label used for location permission controls in the Page Info popup.">
+    <message name="IDS_PAGE_INFO_TYPE_LOCATION" desc="The label used for geolocation permission controls in the Page Info popup." meaning="Geolocation">
       Location
     </message>
     <message name="IDS_PAGE_INFO_TYPE_NOTIFICATIONS" desc="The label used for notifications permission controls in the Page Info popup.">
diff --git a/components/policy/tools/template_writers/writers/adm_writer_unittest.py b/components/policy/tools/template_writers/writers/adm_writer_unittest.py
index d27d588..a6501ec 100755
--- a/components/policy/tools/template_writers/writers/adm_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/adm_writer_unittest.py
@@ -43,7 +43,7 @@
 
   def testEmpty(self):
     # Test PListWriter in case of empty polices.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [],
         'placeholders': [],
@@ -55,8 +55,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium': '1',}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium': '1',}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -78,7 +78,7 @@
 
   def testVersionAnnotation(self):
     # Test PListWriter in case of empty polices.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [],
         'placeholders': [],
@@ -90,9 +90,9 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd, 'fr', {'_chromium': '1', 'version':'39.0.0.0'}, 'adm', 'en')
+        policy_json, {'_chromium': '1', 'version':'39.0.0.0'}, 'adm')
     expected_output = '; chromium version: 39.0.0.0\n' + \
         self.ConstructOutput(['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -114,7 +114,7 @@
 
   def testMainPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -135,8 +135,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_google_chrome' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!Google:Cat_Google
@@ -185,7 +185,7 @@
 
   def testMainPolicyRecommendedOnly(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -209,8 +209,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_google_chrome' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!Google:Cat_Google
@@ -249,7 +249,7 @@
 
   def testStringPolicy(self):
     # Tests a policy group with a single policy of type 'string'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -271,8 +271,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -322,7 +322,7 @@
 
   def testIntPolicy(self):
     # Tests a policy group with a single policy of type 'string'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -343,8 +343,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -394,7 +394,7 @@
 
   def testIntEnumPolicy(self):
     # Tests a policy group with a single policy of type 'int-enum'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -427,8 +427,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_google_chrome': '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!Google:Cat_Google
@@ -491,7 +491,7 @@
 
   def testStringEnumPolicy(self):
     # Tests a policy group with a single policy of type 'int-enum'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -518,8 +518,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_google_chrome': '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!Google:Cat_Google
@@ -582,7 +582,7 @@
 
   def testListPolicy(self):
     # Tests a policy group with a single policy of type 'list'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -605,8 +605,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         },
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -656,7 +656,7 @@
 
   def testStringEnumListPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum-list'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -685,8 +685,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         },
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -736,7 +736,7 @@
 
   def testDictionaryPolicy(self):
     # Tests a policy group with a single policy of type 'dict'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -757,8 +757,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -809,7 +809,7 @@
   def testNonSupportedPolicy(self):
     # Tests a policy that is not supported on Windows, so it shouldn't
     # be included in the ADM file.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -835,8 +835,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -859,7 +859,7 @@
 
   def testNonRecommendedPolicy(self):
     # Tests a policy that is not recommended, so it should be included.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -879,8 +879,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_google_chrome' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!Google:Cat_Google
@@ -919,7 +919,7 @@
 
   def testPolicyGroup(self):
     # Tests a policy group that has more than one policies.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -954,8 +954,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!chromium
@@ -1028,7 +1028,7 @@
   def testDuplicatedStringEnumPolicy(self):
     # Verifies that duplicated enum constants get merged, and that
     # string constants get escaped.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -1061,8 +1061,8 @@
             'text': 'Recommended', 'desc': 'bleh'
           }
         }
-      }''')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'adm', 'en')
+      }'''
+    output = self.GetOutput(policy_json, {'_google_chrome': '1'}, 'adm')
     expected_output = self.ConstructOutput(
         ['MACHINE', 'USER'], '''
   CATEGORY !!Google:Cat_Google
diff --git a/components/policy/tools/template_writers/writers/json_writer_unittest.py b/components/policy/tools/template_writers/writers/json_writer_unittest.py
index 8410b30..46380946 100755
--- a/components/policy/tools/template_writers/writers/json_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/json_writer_unittest.py
@@ -58,47 +58,47 @@
 
   def testEmpty(self):
     # Test the handling of an empty policy list.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": [],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium': '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium': '1'}, 'json')
     expected_output = TEMPLATE_HEADER + '}'
     self.CompareOutputs(output, expected_output)
 
   def testEmptyWithVersion(self):
     # Test the handling of an empty policy list.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": [],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
+    policy_json = '''
+        {
+          "policy_definitions": [],
+          "placeholders": [],
+          "messages": {},
+        }'''
     output = self.GetOutput(
-        grd, 'fr', {'_chromium': '1', 'version':'39.0.0.0'}, 'json', 'en')
+        policy_json, {'_chromium': '1', 'version':'39.0.0.0'}, 'json')
     expected_output = TEMPLATE_HEADER_WITH_VERSION + '}'
     self.CompareOutputs(output, expected_output)
 
   def testMainPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "MainPolicy",'
-        '      "type": "main",'
-        '      "caption": "Example Main Policy",'
-        '      "desc": "Example Main Policy",'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": True'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "MainPolicy",
+              "type": "main",
+              "caption": "Example Main Policy",
+              "desc": "Example Main Policy",
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": True
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example Main Policy\n' +
@@ -110,26 +110,26 @@
 
   def testRecommendedOnlyPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "MainPolicy",'
-        '      "type": "main",'
-        '      "caption": "Example Main Policy",'
-        '      "desc": "Example Main Policy",'
-        '      "features": {'
-        '        "can_be_recommended": True,'
-        '        "can_be_mandatory": False'
-        '      },'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": True'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "MainPolicy",
+              "type": "main",
+              "caption": "Example Main Policy",
+              "desc": "Example Main Policy",
+              "features": {
+                "can_be_recommended": True,
+                "can_be_mandatory": False
+              },
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": True
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Note: this policy is supported only in recommended mode.\n' +
@@ -144,22 +144,22 @@
 
   def testStringPolicy(self):
     # Tests a policy group with a single policy of type 'string'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "StringPolicy",'
-        '      "type": "string",'
-        '      "caption": "Example String Policy",'
-        '      "desc": "Example String Policy",'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": "hello, world!"'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "StringPolicy",
+              "type": "string",
+              "caption": "Example String Policy",
+              "desc": "Example String Policy",
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": "hello, world!"
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example String Policy\n' +
@@ -171,22 +171,22 @@
 
   def testIntPolicy(self):
     # Tests a policy group with a single policy of type 'string'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "IntPolicy",'
-        '      "type": "int",'
-        '      "caption": "Example Int Policy",'
-        '      "desc": "Example Int Policy",'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": 15'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "IntPolicy",
+              "type": "int",
+              "caption": "Example Int Policy",
+              "desc": "Example Int Policy",
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": 15
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example Int Policy\n' +
@@ -198,26 +198,26 @@
 
   def testIntEnumPolicy(self):
     # Tests a policy group with a single policy of type 'int-enum'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "EnumPolicy",'
-        '      "type": "int-enum",'
-        '      "caption": "Example Int Enum",'
-        '      "desc": "Example Int Enum",'
-        '      "items": ['
-        '        {"name": "ProxyServerDisabled", "value": 0, "caption": ""},'
-        '        {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},'
-        '      ],'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": 1'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "EnumPolicy",
+              "type": "int-enum",
+              "caption": "Example Int Enum",
+              "desc": "Example Int Enum",
+              "items": [
+                {"name": "ProxyServerDisabled", "value": 0, "caption": ""},
+                {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},
+              ],
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": 1
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome': '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example Int Enum\n' +
@@ -229,28 +229,28 @@
 
   def testStringEnumPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "EnumPolicy",'
-        '      "type": "string-enum",'
-        '      "caption": "Example String Enum",'
-        '      "desc": "Example String Enum",'
-        '      "items": ['
-        '        {"name": "ProxyServerDisabled", "value": "one",'
-        '         "caption": ""},'
-        '        {"name": "ProxyServerAutoDetect", "value": "two",'
-        '         "caption": ""},'
-        '      ],'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": "one"'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "EnumPolicy",
+              "type": "string-enum",
+              "caption": "Example String Enum",
+              "desc": "Example String Enum",
+              "items": [
+                {"name": "ProxyServerDisabled", "value": "one",
+                 "caption": ""},
+                {"name": "ProxyServerAutoDetect", "value": "two",
+                 "caption": ""},
+              ],
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": "one"
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome': '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example String Enum\n' +
@@ -262,22 +262,22 @@
 
   def testListPolicy(self):
     # Tests a policy group with a single policy of type 'list'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "ListPolicy",'
-        '      "type": "list",'
-        '      "caption": "Example List",'
-        '      "desc": "Example List",'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": ["foo", "bar"]'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "ListPolicy",
+              "type": "list",
+              "caption": "Example List",
+              "desc": "Example List",
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": ["foo", "bar"]
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example List\n' +
@@ -289,28 +289,28 @@
 
   def testStringEnumListPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum-list'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "ListPolicy",'
-        '      "type": "string-enum-list",'
-        '      "caption": "Example List",'
-        '      "desc": "Example List",'
-        '      "items": ['
-        '        {"name": "ProxyServerDisabled", "value": "one",'
-        '         "caption": ""},'
-        '        {"name": "ProxyServerAutoDetect", "value": "two",'
-        '         "caption": ""},'
-        '      ],'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": ["one", "two"]'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "ListPolicy",
+              "type": "string-enum-list",
+              "caption": "Example List",
+              "desc": "Example List",
+              "items": [
+                {"name": "ProxyServerDisabled", "value": "one",
+                 "caption": ""},
+                {"name": "ProxyServerAutoDetect", "value": "two",
+                 "caption": ""},
+              ],
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": ["one", "two"]
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example List\n' +
@@ -332,22 +332,22 @@
       'list': [1, 2, 3],
       'string': 'abc',
     }
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "DictionaryPolicy",'
-        '      "type": "dict",'
-        '      "caption": "Example Dictionary Policy",'
-        '      "desc": "Example Dictionary Policy",'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": ' + str(example) +
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "DictionaryPolicy",
+              "type": "dict",
+              "caption": "Example Dictionary Policy",
+              "desc": "Example Dictionary Policy",
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": ''' + str(example) + '''
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Example Dictionary Policy\n' +
@@ -361,56 +361,56 @@
   def testNonSupportedPolicy(self):
     # Tests a policy that is not supported on Linux, so it shouldn't
     # be included in the JSON file.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "NonLinuxPolicy",'
-        '      "type": "list",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.mac:8-"],'
-        '      "example_value": ["a"]'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "NonLinuxPolicy",
+              "type": "list",
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.mac:8-"],
+              "example_value": ["a"]
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
     expected_output = TEMPLATE_HEADER + '}'
     self.CompareOutputs(output, expected_output)
 
   def testPolicyGroup(self):
     # Tests a policy group that has more than one policies.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "Group1",'
-        '      "type": "group",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "policies": [{'
-        '        "name": "Policy1",'
-        '        "type": "list",'
-        '        "caption": "Policy One",'
-        '        "desc": "Policy One",'
-        '        "supported_on": ["chrome.linux:8-"],'
-        '        "example_value": ["a", "b"]'
-        '      },{'
-        '        "name": "Policy2",'
-        '        "type": "string",'
-        '        "caption": "Policy Two",'
-        '        "desc": "Policy Two",'
-        '        "supported_on": ["chrome.linux:8-"],'
-        '        "example_value": "c"'
-        '      }],'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "Group1",
+              "type": "group",
+              "caption": "",
+              "desc": "",
+              "policies": [{
+                "name": "Policy1",
+                "type": "list",
+                "caption": "Policy One",
+                "desc": "Policy One",
+                "supported_on": ["chrome.linux:8-"],
+                "example_value": ["a", "b"]
+              },{
+                "name": "Policy2",
+                "type": "string",
+                "caption": "Policy Two",
+                "desc": "Policy Two",
+                "supported_on": ["chrome.linux:8-"],
+                "example_value": "c"
+              }],
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'json')
     expected_output = (
         TEMPLATE_HEADER +
         '  // Policy One\n' +
diff --git a/components/policy/tools/template_writers/writers/plist_strings_writer_unittest.py b/components/policy/tools/template_writers/writers/plist_strings_writer_unittest.py
index a9ea6b0..93e3b17 100755
--- a/components/policy/tools/template_writers/writers/plist_strings_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/plist_strings_writer_unittest.py
@@ -21,7 +21,7 @@
 
   def testEmpty(self):
     # Test PListStringsWriter in case of empty polices.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [],
         'placeholders': [],
@@ -31,13 +31,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium': '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Chromium.pfm_title = "Chromium";\n'
         'Chromium.pfm_description = "Chromium preferen\\"ces";')
@@ -45,7 +43,7 @@
 
   def testEmptyVersion(self):
     # Test PListStringsWriter in case of empty polices.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [],
         'placeholders': [],
@@ -55,15 +53,13 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium': '1',
          'mac_bundle_id': 'com.example.Test',
          'version': '39.0.0.0'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         '/* chromium version: 39.0.0.0 */\n'
         'Chromium.pfm_title = "Chromium";\n'
@@ -72,7 +68,7 @@
 
   def testMainPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -96,13 +92,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_google_chrome' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Google_Chrome.pfm_title = "Google Chrome";\n'
         'Google_Chrome.pfm_description = "Preferences of Google Chrome";\n'
@@ -113,7 +107,7 @@
   def testStringPolicy(self):
     # Tests a policy group with a single policy of type 'string'. Also test
     # inheriting group description to policy description.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -139,13 +133,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Chromium.pfm_title = "Chromium";\n'
         'Chromium.pfm_description = "Preferences of Chromium";\n'
@@ -156,7 +148,7 @@
 
   def testStringListPolicy(self):
     # Tests a policy group with a single policy of type 'list'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -185,13 +177,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Chromium.pfm_title = "Chromium";\n'
         'Chromium.pfm_description = "Preferences of Chromium";\n'
@@ -202,7 +192,7 @@
 
   def testStringEnumListPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum-list'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -243,13 +233,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Chromium.pfm_title = "Chromium";\n'
         'Chromium.pfm_description = "Preferences of Chromium";\n'
@@ -261,7 +249,7 @@
 
   def testIntEnumPolicy(self):
     # Tests a policy group with a single policy of type 'int-enum'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -297,13 +285,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Google_Chrome.pfm_title = "Google Chrome";\n'
         'Google_Chrome.pfm_description = "Google Chrome preferences";\n'
@@ -315,7 +301,7 @@
 
   def testStringEnumPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -351,13 +337,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Google_Chrome.pfm_title = "Google Chrome";\n'
         'Google_Chrome.pfm_description = "Google Chrome preferences";\n'
@@ -370,7 +354,7 @@
   def testNonSupportedPolicy(self):
     # Tests a policy that is not supported on Mac, so its strings shouldn't
     # be included in the plist string table.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -394,13 +378,11 @@
             'desc': 'blah'
           }
         }
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
-        'plist_strings',
-        'en')
+        'plist_strings')
     expected_output = (
         'Google_Chrome.pfm_title = "Google Chrome";\n'
         'Google_Chrome.pfm_description = "Google Chrome preferences";')
diff --git a/components/policy/tools/template_writers/writers/plist_writer_unittest.py b/components/policy/tools/template_writers/writers/plist_writer_unittest.py
index 78b30d4..8ffa219 100755
--- a/components/policy/tools/template_writers/writers/plist_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/plist_writer_unittest.py
@@ -89,40 +89,36 @@
 
   def testEmpty(self):
     # Test PListWriter in case of empty polices.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
 
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium': '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '<array/>')
     self.assertEquals(output.strip(), expected_output.strip())
 
   def testEmptyVersion(self):
     # Test PListWriter in case of empty polices.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
 
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium': '1',
          'mac_bundle_id': 'com.example.Test',
          'version': '39.0.0.0'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputsWithVersion(
         'Chromium',
         'com.example.Test',
@@ -132,7 +128,7 @@
 
   def testMainPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -151,13 +147,11 @@
         ],
         'placeholders': [],
         'messages': {}
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -179,7 +173,7 @@
 
   def testRecommendedPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -201,13 +195,11 @@
         ],
         'placeholders': [],
         'messages': {}
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -230,7 +222,7 @@
 
   def testRecommendedOnlyPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -253,13 +245,11 @@
         ],
         'placeholders': [],
         'messages': {}
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -281,7 +271,7 @@
 
   def testStringPolicy(self):
     # Tests a policy group with a single policy of type 'string'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -300,13 +290,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -328,7 +316,7 @@
 
   def testListPolicy(self):
     # Tests a policy group with a single policy of type 'list'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -351,13 +339,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -386,7 +372,7 @@
 
   def testStringEnumListPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum-list'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -414,13 +400,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -449,7 +433,7 @@
 
   def testIntPolicy(self):
     # Tests a policy group with a single policy of type 'int'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -468,13 +452,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -496,7 +478,7 @@
 
   def testIntEnumPolicy(self):
     # Tests a policy group with a single policy of type 'int-enum'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -519,13 +501,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Google_Chrome', 'com.example.Test2', '''<array>
       <dict>
@@ -552,7 +532,7 @@
 
   def testStringEnumPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -575,13 +555,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Google_Chrome', 'com.example.Test2', '''<array>
       <dict>
@@ -608,7 +586,7 @@
 
   def testDictionaryPolicy(self):
     # Tests a policy group with a single policy of type 'dict'.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -627,13 +605,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Chromium', 'com.example.Test', '''<array>
       <dict>
@@ -656,7 +632,7 @@
   def testNonSupportedPolicy(self):
     # Tests a policy that is not supported on Mac, so it shouldn't
     # be included in the plist file.
-    grd = self.PrepareTest('''
+    policy_json = '''
       {
         'policy_definitions': [
           {
@@ -675,13 +651,11 @@
         ],
         'placeholders': [],
         'messages': {},
-      }''')
+      }'''
     output = self.GetOutput(
-        grd,
-        'fr',
+        policy_json,
         {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
-        'plist',
-        'en')
+        'plist')
     expected_output = self._GetExpectedOutputs(
         'Google_Chrome', 'com.example.Test2', '''<array/>''')
     self.assertEquals(output.strip(), expected_output.strip())
diff --git a/components/policy/tools/template_writers/writers/reg_writer_unittest.py b/components/policy/tools/template_writers/writers/reg_writer_unittest.py
index 7665f00..2e2d14e 100755
--- a/components/policy/tools/template_writers/writers/reg_writer_unittest.py
+++ b/components/policy/tools/template_writers/writers/reg_writer_unittest.py
@@ -38,49 +38,49 @@
 
   def testEmpty(self):
     # Test the handling of an empty policy list.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": [],'
-        '  "placeholders": [],'
-        '  "messages": {}'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium': '1', }, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [],
+          "placeholders": [],
+          "messages": {}
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium': '1', }, 'reg')
     expected_output = 'Windows Registry Editor Version 5.00'
     self.CompareOutputs(output, expected_output)
 
   def testEmptyVersion(self):
     # Test the handling of an empty policy list.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": [],'
-        '  "placeholders": [],'
-        '  "messages": {}'
-        '}')
+    policy_json = '''
+        {
+          "policy_definitions": [],
+          "placeholders": [],
+          "messages": {}
+        }'''
     output = self.GetOutput(
-        grd, 'fr', {'_chromium': '1', 'version': '39.0.0.0' }, 'reg', 'en')
+        policy_json, {'_chromium': '1', 'version': '39.0.0.0' }, 'reg')
     expected_output = ('Windows Registry Editor Version 5.00\r\n'
                        '; chromium version: 39.0.0.0\r\n')
     self.CompareOutputs(output, expected_output)
 
   def testMainPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "MainPolicy",'
-        '      "type": "main",'
-        '      "features": { "can_be_recommended": True },'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.win:8-"],'
-        '      "example_value": True'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "MainPolicy",
+              "type": "main",
+              "features": { "can_be_recommended": True },
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.win:8-"],
+              "example_value": True
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -93,26 +93,26 @@
 
   def testRecommendedMainPolicy(self):
     # Tests a policy group with a single policy of type 'main'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "MainPolicy",'
-        '      "type": "main",'
-        '      "features": {'
-        '        "can_be_recommended": True,'
-        '        "can_be_mandatory": False '
-        '      },'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.win:8-"],'
-        '      "example_value": True'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "MainPolicy",
+              "type": "main",
+              "features": {
+                "can_be_recommended": True,
+                "can_be_mandatory": False
+              },
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.win:8-"],
+              "example_value": True
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -122,22 +122,22 @@
 
   def testStringPolicy(self):
     # Tests a policy group with a single policy of type 'string'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "StringPolicy",'
-        '      "type": "string",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.win:8-"],'
-        '      "example_value": "hello, world! \\\" \\\\"'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "StringPolicy",
+              "type": "string",
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.win:8-"],
+              "example_value": "hello, world! \\\" \\\\"
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -147,22 +147,22 @@
 
   def testIntPolicy(self):
     # Tests a policy group with a single policy of type 'int'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "IntPolicy",'
-        '      "type": "int",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.win:8-"],'
-        '      "example_value": 26'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "IntPolicy",
+              "type": "int",
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.win:8-"],
+              "example_value": 26
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -172,26 +172,26 @@
 
   def testIntEnumPolicy(self):
     # Tests a policy group with a single policy of type 'int-enum'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "EnumPolicy",'
-        '      "type": "int-enum",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "items": ['
-        '        {"name": "ProxyServerDisabled", "value": 0, "caption": ""},'
-        '        {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},'
-        '      ],'
-        '      "supported_on": ["chrome.win:8-"],'
-        '      "example_value": 1'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "EnumPolicy",
+              "type": "int-enum",
+              "caption": "",
+              "desc": "",
+              "items": [
+                {"name": "ProxyServerDisabled", "value": 0, "caption": ""},
+                {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},
+              ],
+              "supported_on": ["chrome.win:8-"],
+              "example_value": 1
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome': '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -201,28 +201,26 @@
 
   def testStringEnumPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "EnumPolicy",'
-        '      "type": "string-enum",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "items": ['
-        '        {"name": "ProxyServerDisabled", "value": "one",'
-        '         "caption": ""},'
-        '        {"name": "ProxyServerAutoDetect", "value": "two",'
-                '         "caption": ""},'
-        '      ],'
-        '      "supported_on": ["chrome.win:8-"],'
-        '      "example_value": "two"'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "EnumPolicy",
+              "type": "string-enum",
+              "caption": "",
+              "desc": "",
+              "items": [
+                {"name": "ProxyServerDisabled", "value": "one", "caption": ""},
+                {"name": "ProxyServerAutoDetect", "value": "two","caption": ""},
+              ],
+              "supported_on": ["chrome.win:8-"],
+              "example_value": "two"
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_google_chrome': '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -232,22 +230,22 @@
 
   def testListPolicy(self):
     # Tests a policy group with a single policy of type 'list'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "ListPolicy",'
-        '      "type": "list",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": ["foo", "bar"]'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "ListPolicy",
+              "type": "list",
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": ["foo", "bar"]
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -257,28 +255,26 @@
 
   def testStringEnumListPolicy(self):
     # Tests a policy group with a single policy of type 'string-enum-list'.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "ListPolicy",'
-        '      "type": "string-enum-list",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "items": ['
-        '        {"name": "ProxyServerDisabled", "value": "foo",'
-        '         "caption": ""},'
-        '        {"name": "ProxyServerAutoDetect", "value": "bar",'
-                '         "caption": ""},'
-        '      ],'
-        '      "supported_on": ["chrome.linux:8-"],'
-        '      "example_value": ["foo", "bar"]'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "ListPolicy",
+              "type": "string-enum-list",
+              "caption": "",
+              "desc": "",
+              "items": [
+                {"name": "ProxyServerDisabled", "value": "foo", "caption": ""},
+                {"name": "ProxyServerAutoDetect", "value": "bar","caption": ""},
+              ],
+              "supported_on": ["chrome.linux:8-"],
+              "example_value": ["foo", "bar"]
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -298,22 +294,22 @@
       'list': [1, 2, 3],
       'string': 'abc',
     }
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "DictionaryPolicy",'
-        '      "type": "dict",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.win:8-"],'
-        '      "example_value": ' + str(example) +
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "DictionaryPolicy",
+              "type": "dict",
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.win:8-"],
+              "example_value": ''' + str(example) + '''
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
@@ -325,57 +321,57 @@
   def testNonSupportedPolicy(self):
     # Tests a policy that is not supported on Windows, so it shouldn't
     # be included in the .REG file.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "NonWindowsPolicy",'
-        '      "type": "list",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "supported_on": ["chrome.mac:8-"],'
-        '      "example_value": ["a"]'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "NonWindowsPolicy",
+              "type": "list",
+              "caption": "",
+              "desc": "",
+              "supported_on": ["chrome.mac:8-"],
+              "example_value": ["a"]
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00'])
     self.CompareOutputs(output, expected_output)
 
   def testPolicyGroup(self):
     # Tests a policy group that has more than one policies.
-    grd = self.PrepareTest(
-        '{'
-        '  "policy_definitions": ['
-        '    {'
-        '      "name": "Group1",'
-        '      "type": "group",'
-        '      "caption": "",'
-        '      "desc": "",'
-        '      "policies": [{'
-        '        "name": "Policy1",'
-        '        "type": "list",'
-        '        "caption": "",'
-        '        "desc": "",'
-        '        "supported_on": ["chrome.win:8-"],'
-        '        "example_value": ["a", "b"]'
-        '      },{'
-        '        "name": "Policy2",'
-        '        "type": "string",'
-        '        "caption": "",'
-        '        "desc": "",'
-        '        "supported_on": ["chrome.win:8-"],'
-        '        "example_value": "c"'
-        '      }],'
-        '    },'
-        '  ],'
-        '  "placeholders": [],'
-        '  "messages": {},'
-        '}')
-    output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+    policy_json = '''
+        {
+          "policy_definitions": [
+            {
+              "name": "Group1",
+              "type": "group",
+              "caption": "",
+              "desc": "",
+              "policies": [{
+                "name": "Policy1",
+                "type": "list",
+                "caption": "",
+                "desc": "",
+                "supported_on": ["chrome.win:8-"],
+                "example_value": ["a", "b"]
+              },{
+                "name": "Policy2",
+                "type": "string",
+                "caption": "",
+                "desc": "",
+                "supported_on": ["chrome.win:8-"],
+                "example_value": "c"
+              }],
+            },
+          ],
+          "placeholders": [],
+          "messages": {},
+        }'''
+    output = self.GetOutput(policy_json, {'_chromium' : '1'}, 'reg')
     expected_output = self.NEWLINE.join([
         'Windows Registry Editor Version 5.00',
         '',
diff --git a/components/policy/tools/template_writers/writers/writer_unittest_common.py b/components/policy/tools/template_writers/writers/writer_unittest_common.py
index 4e56d18..ee112ad 100755
--- a/components/policy/tools/template_writers/writers/writer_unittest_common.py
+++ b/components/policy/tools/template_writers/writers/writer_unittest_common.py
@@ -5,7 +5,6 @@
 
 '''Common tools for unit-testing writers.'''
 
-import os
 import unittest
 import policy_template_generator
 import template_formatter
@@ -15,13 +14,16 @@
 class WriterUnittestCommon(unittest.TestCase):
   '''Common class for unittesting writers.'''
 
-  # TODO(crbug.com/165412): Combine PrepareTest and GetOutput. In the first step
-  # of this bug, the structure was preserved to keep the CL size down.
-  def PrepareTest(self, policy_json):
-    '''Prepares the data structure of policies.
+  def GetOutput(self, policy_json, definitions, writer_type):
+    '''Generates an output of a writer.
 
     Args:
-      policy_json: The policy data structure in JSON format.
+      policy_json: Raw policy JSON string.
+      definitions: Definitions to create writer configurations.
+      writer_type: Writer type (e.g. 'admx'), see template_formatter.py.
+
+    Returns:
+      The string of the template created by the writer.
     '''
 
     # Evaluate policy_json. For convenience, fix indentation in statements like
@@ -30,22 +32,10 @@
     #     ...
     #   }''')
     start_idx = 1 if policy_json[0] == '\n' else 0
-    return eval(textwrap.dedent(policy_json[start_idx:]))
+    policy_data = eval(textwrap.dedent(policy_json[start_idx:]))
 
-  def GetOutput(self, policy_data, env_lang, env_defs, out_type, out_lang):
-    '''Generates an output of a writer.
-
-    Args:
-      policy_data: The data returned from PrepareTest().
-      env_lang: The environment language.
-      env_defs: Environment definitions.
-      out_type: Type of the output node for which output will be generated.
-        This selects the writer.
-      out_lang: Language of the output node for which output will be generated.
-    '''
-
-    config = writer_configuration.GetConfigurationForBuild(env_defs)
+    config = writer_configuration.GetConfigurationForBuild(definitions)
     policy_generator = \
         policy_template_generator.PolicyTemplateGenerator(config, policy_data)
-    writer = template_formatter.GetWriter(out_type, config)
+    writer = template_formatter.GetWriter(writer_type, config)
     return policy_generator.GetTemplateText(writer)
diff --git a/components/safe_browsing/BUILD.gn b/components/safe_browsing/BUILD.gn
index f2cb4a1a..974b9d7 100644
--- a/components/safe_browsing/BUILD.gn
+++ b/components/safe_browsing/BUILD.gn
@@ -37,8 +37,8 @@
     "//base:i18n",
     "//components/safe_browsing/common:common",
     "//components/safe_browsing/common:safe_browsing_prefs",
+    "//components/safe_browsing/db:database_manager",
     "//components/safe_browsing/web_ui:constants",
-    "//components/safe_browsing_db:database_manager",
     "//components/security_interstitials/core:core",
     "//content/public/browser:browser",
     "//content/public/common:common",
@@ -59,8 +59,8 @@
   deps = [
     "//base:base",
     "//components/data_use_measurement/core:core",
-    "//components/safe_browsing_db:hit_report",
-    "//components/safe_browsing_db:util",
+    "//components/safe_browsing/db:hit_report",
+    "//components/safe_browsing/db:util",
     "//content/public/browser:browser",
     "//net:net",
   ]
diff --git a/components/safe_browsing/DEPS b/components/safe_browsing/DEPS
index 227ca28..d333c88c 100644
--- a/components/safe_browsing/DEPS
+++ b/components/safe_browsing/DEPS
@@ -1,6 +1,5 @@
 include_rules = [
   "+components/data_use_measurement/core",
-  "+components/safe_browsing_db",
   "+components/security_interstitials/content",
   "+components/security_interstitials/core",
   "+content/public/browser",
diff --git a/components/safe_browsing/android/safe_browsing_api_handler_bridge.cc b/components/safe_browsing/android/safe_browsing_api_handler_bridge.cc
index 613f2db..06545ed9 100644
--- a/components/safe_browsing/android/safe_browsing_api_handler_bridge.cc
+++ b/components/safe_browsing/android/safe_browsing_api_handler_bridge.cc
@@ -12,7 +12,7 @@
 #include "base/containers/flat_set.h"
 #include "base/metrics/histogram_macros.h"
 #include "components/safe_browsing/db/safe_browsing_api_handler_util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/browser/browser_thread.h"
 #include "jni/SafeBrowsingApiBridge_jni.h"
 
diff --git a/components/safe_browsing/android/safe_browsing_api_handler_bridge.h b/components/safe_browsing/android/safe_browsing_api_handler_bridge.h
index 7161c8fd1..5a3d25e 100644
--- a/components/safe_browsing/android/safe_browsing_api_handler_bridge.h
+++ b/components/safe_browsing/android/safe_browsing_api_handler_bridge.h
@@ -15,7 +15,7 @@
 #include "base/android/jni_android.h"
 #include "base/macros.h"
 #include "components/safe_browsing/db/safe_browsing_api_handler.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "url/gurl.h"
 
 namespace safe_browsing {
diff --git a/components/safe_browsing/base_blocking_page.h b/components/safe_browsing/base_blocking_page.h
index 837498b9..62fc29ed 100644
--- a/components/safe_browsing/base_blocking_page.h
+++ b/components/safe_browsing/base_blocking_page.h
@@ -11,7 +11,7 @@
 
 #include "base/macros.h"
 #include "components/safe_browsing/base_ui_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/security_interstitials/content/security_interstitial_page.h"
 #include "components/security_interstitials/core/base_safe_browsing_error_ui.h"
 #include "components/security_interstitials/core/metrics_helper.h"
diff --git a/components/safe_browsing/base_ping_manager.h b/components/safe_browsing/base_ping_manager.h
index 562ab710..5b64c30 100644
--- a/components/safe_browsing/base_ping_manager.h
+++ b/components/safe_browsing/base_ping_manager.h
@@ -15,8 +15,8 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "components/safe_browsing_db/hit_report.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/hit_report.h"
+#include "components/safe_browsing/db/util.h"
 #include "content/public/browser/permission_type.h"
 #include "net/log/net_log_with_source.h"
 #include "net/url_request/url_fetcher_delegate.h"
diff --git a/components/safe_browsing/base_resource_throttle.cc b/components/safe_browsing/base_resource_throttle.cc
index e511d3fa..316c00ee 100644
--- a/components/safe_browsing/base_resource_throttle.cc
+++ b/components/safe_browsing/base_resource_throttle.cc
@@ -10,8 +10,8 @@
 #include "base/trace_event/trace_event.h"
 #include "components/safe_browsing/base_ui_manager.h"
 #include "components/safe_browsing/common/utils.h"
+#include "components/safe_browsing/db/util.h"
 #include "components/safe_browsing/web_ui/constants.h"
-#include "components/safe_browsing_db/util.h"
 #include "components/security_interstitials/content/unsafe_resource.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/resource_request_info.h"
diff --git a/components/safe_browsing/base_resource_throttle.h b/components/safe_browsing/base_resource_throttle.h
index 78d5dcc..685a7ce 100644
--- a/components/safe_browsing/base_resource_throttle.h
+++ b/components/safe_browsing/base_resource_throttle.h
@@ -12,9 +12,9 @@
 #include "base/time/time.h"
 #include "base/timer/timer.h"
 #include "components/safe_browsing/base_ui_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/net_event_logger.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "components/security_interstitials/content/unsafe_resource.h"
 #include "content/public/browser/resource_throttle.h"
 #include "content/public/common/resource_type.h"
diff --git a/components/safe_browsing/browser/BUILD.gn b/components/safe_browsing/browser/BUILD.gn
index 06540498..2121fb2 100644
--- a/components/safe_browsing/browser/BUILD.gn
+++ b/components/safe_browsing/browser/BUILD.gn
@@ -30,9 +30,9 @@
     "//components/safe_browsing:csd_proto",
     "//components/safe_browsing:safe_browsing",
     "//components/safe_browsing/common:common",
+    "//components/safe_browsing/db:database_manager",
     "//components/safe_browsing/web_ui:constants",
     "//components/safe_browsing/web_ui:web_ui",
-    "//components/safe_browsing_db:database_manager",
     "//components/security_interstitials/content:security_interstitial_page",
     "//content/public/browser:browser",
     "//net:extras",
diff --git a/components/safe_browsing/browser/safe_browsing_url_checker_impl.h b/components/safe_browsing/browser/safe_browsing_url_checker_impl.h
index 1da319d..ed0d806 100644
--- a/components/safe_browsing/browser/safe_browsing_url_checker_impl.h
+++ b/components/safe_browsing/browser/safe_browsing_url_checker_impl.h
@@ -12,7 +12,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/timer/timer.h"
 #include "components/safe_browsing/common/safe_browsing.mojom.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "content/public/common/resource_type.h"
 #include "net/http/http_request_headers.h"
 #include "url/gurl.h"
diff --git a/components/safe_browsing/browser/threat_details.cc b/components/safe_browsing/browser/threat_details.cc
index 6a977c1..bef69f6 100644
--- a/components/safe_browsing/browser/threat_details.cc
+++ b/components/safe_browsing/browser/threat_details.cc
@@ -20,8 +20,8 @@
 #include "components/safe_browsing/browser/threat_details_cache.h"
 #include "components/safe_browsing/browser/threat_details_history.h"
 #include "components/safe_browsing/common/safebrowsing_messages.h"
+#include "components/safe_browsing/db/hit_report.h"
 #include "components/safe_browsing/web_ui/safe_browsing_ui.h"
-#include "components/safe_browsing_db/hit_report.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
diff --git a/components/safe_browsing/browser/url_checker_delegate.h b/components/safe_browsing/browser/url_checker_delegate.h
index 3a375af..d55373b9 100644
--- a/components/safe_browsing/browser/url_checker_delegate.h
+++ b/components/safe_browsing/browser/url_checker_delegate.h
@@ -9,7 +9,7 @@
 
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 
 namespace content {
 class WebContents;
diff --git a/components/safe_browsing/db/BUILD.gn b/components/safe_browsing/db/BUILD.gn
index 9c30f265..b6de403 100644
--- a/components/safe_browsing/db/BUILD.gn
+++ b/components/safe_browsing/db/BUILD.gn
@@ -2,13 +2,18 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import("//third_party/protobuf/proto_library.gni")
+
+# android targets
+# TODO(timvolodine): move the android targets to /android, crbug.com/668515
+
 # This target is for the mobile version.
 group("safe_browsing_mobile") {
   deps = [
     ":remote_database_manager",
     ":safe_browsing_api_handler",
     ":safe_browsing_api_handler_util",
-    "//components/safe_browsing_db:safe_browsing_db_shared",
+    ":safe_browsing_db_shared",
   ]
 }
 
@@ -18,11 +23,11 @@
     "remote_database_manager.h",
   ]
   deps = [
+    ":database_manager",
     ":safe_browsing_api_handler",
+    ":v4_get_hash_protocol_manager",
+    ":v4_protocol_manager_util",
     "//base:base",
-    "//components/safe_browsing_db:database_manager",
-    "//components/safe_browsing_db:v4_get_hash_protocol_manager",
-    "//components/safe_browsing_db:v4_protocol_manager_util",
     "//components/variations",
     "//content/public/browser",
     "//net",
@@ -36,9 +41,9 @@
     "safe_browsing_api_handler_util.h",
   ]
   deps = [
+    ":metadata_proto",
+    ":util",
     "//base",
-    "//components/safe_browsing_db:metadata_proto",
-    "//components/safe_browsing_db:util",
   ]
 }
 
@@ -49,8 +54,8 @@
   ]
   deps = [
     ":safe_browsing_api_handler_util",
+    ":util",
     "//base",
-    "//components/safe_browsing_db:util",
     "//content/public/browser:browser",
     "//url",
   ]
@@ -71,14 +76,14 @@
     "safe_browsing_api_handler_unittest.cc",
   ]
   deps = [
+    ":metadata_proto",
     ":remote_database_manager",
     ":safe_browsing_api_handler",
     ":safe_browsing_api_handler_util",
+    ":unit_tests_shared",
+    ":util",
+    ":v4_test_util",
     "//base",
-    "//components/safe_browsing_db:metadata_proto",
-    "//components/safe_browsing_db:unit_tests_shared",
-    "//components/safe_browsing_db:util",
-    "//components/safe_browsing_db:v4_test_util",
     "//components/variations",
     "//content/test:test_support",
     "//testing/gtest",
@@ -89,3 +94,455 @@
     cflags = [ "/wd4267" ]  # Conversion from size_t to 'type'.
   }
 }
+
+# db targets
+
+proto_library("safebrowsing_proto") {
+  sources = [
+    "safebrowsing.proto",
+  ]
+}
+
+proto_library("v4_store_proto") {
+  sources = [
+    "v4_store.proto",
+  ]
+  deps = [
+    ":safebrowsing_proto",
+  ]
+}
+
+proto_library("metadata_proto") {
+  sources = [
+    "metadata.proto",
+  ]
+}
+
+# This target is shared between the desktop and mobile versions.
+group("safe_browsing_db_shared") {
+  deps = [
+    ":database_manager",
+    ":hit_report",
+    ":prefix_set",
+    ":safebrowsing_proto",
+    ":util",
+    ":v4_feature_list",  # Used by SafeBrowsingService
+    "//components/safe_browsing/common:safe_browsing_prefs",
+  ]
+}
+
+# This target is for the desktop version.
+group("db") {
+  deps = [
+    ":safe_browsing_db_shared",
+    ":v4_local_database_manager",
+  ]
+}
+
+static_library("database_manager") {
+  sources = [
+    "database_manager.cc",
+    "database_manager.h",
+  ]
+  deps = [
+    ":hit_report",
+    ":util",
+    ":v4_get_hash_protocol_manager",
+    ":v4_protocol_manager_util",
+    "//base",
+    "//content/public/browser",
+    "//content/public/common",
+    "//net",
+    "//url",
+  ]
+
+  public_deps = [
+    ":safebrowsing_proto",
+  ]
+}
+
+static_library("hit_report") {
+  sources = [
+    "hit_report.cc",
+    "hit_report.h",
+  ]
+  public_deps = [
+    ":util",
+  ]
+  deps = [
+    "//components/metrics",
+    "//components/safe_browsing/common:safe_browsing_prefs",
+    "//url",
+  ]
+}
+
+static_library("prefix_set") {
+  sources = [
+    "prefix_set.cc",
+    "prefix_set.h",
+  ]
+  deps = [
+    ":util",
+    "//base",
+  ]
+}
+
+static_library("test_database_manager") {
+  sources = [
+    "test_database_manager.cc",
+    "test_database_manager.h",
+  ]
+  deps = [
+    ":database_manager",
+    ":v4_protocol_manager_util",
+    "//base:base",
+    "//net",
+  ]
+}
+
+static_library("util") {
+  sources = [
+    "util.cc",
+    "util.h",
+  ]
+  public_deps = [
+    ":v4_protocol_manager_util",
+    "//components/safe_browsing/common:safe_browsing_prefs",
+  ]
+  deps = [
+    "//base",
+    "//components/version_info:version_info",
+    "//crypto",
+    "//google_apis:google_apis",
+    "//net",
+    "//url",
+  ]
+  if (is_win) {
+    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+    cflags = [ "/wd4267" ]  # Conversion from size_t to 'type'.
+  }
+}
+
+static_library("v4_database") {
+  sources = [
+    "v4_database.cc",
+    "v4_database.h",
+  ]
+  public_deps = [
+    ":safebrowsing_proto",
+  ]
+  deps = [
+    ":v4_protocol_manager_util",
+    ":v4_store",
+    "//base",
+    "//components/safe_browsing:webui_proto",
+    "//content/public/browser",
+  ]
+}
+
+static_library("v4_feature_list") {
+  sources = [
+    "v4_feature_list.cc",
+    "v4_feature_list.h",
+  ]
+  deps = [
+    "//base",
+    "//components/safe_browsing:features",
+  ]
+}
+
+static_library("v4_get_hash_protocol_manager") {
+  sources = [
+    "v4_get_hash_protocol_manager.cc",
+    "v4_get_hash_protocol_manager.h",
+  ]
+  public_deps = [
+    ":safebrowsing_proto",
+  ]
+  deps = [
+    ":util",
+    ":v4_protocol_manager_util",
+    "//base",
+    "//components/data_use_measurement/core",
+    "//components/safe_browsing:webui_proto",
+    "//content/public/browser",
+    "//net",
+    "//url",
+  ]
+}
+
+static_library("v4_local_database_manager") {
+  sources = [
+    "v4_local_database_manager.cc",
+    "v4_local_database_manager.h",
+  ]
+  deps = [
+    ":database_manager",
+    ":hit_report",
+    ":safebrowsing_proto",
+    ":v4_database",
+    ":v4_feature_list",
+    ":v4_get_hash_protocol_manager",
+    ":v4_protocol_manager_util",
+    ":v4_update_protocol_manager",
+    "//base",
+    "//components/safe_browsing:webui_proto",
+    "//content/public/browser",
+    "//net",
+    "//url",
+  ]
+}
+
+source_set("v4_protocol_manager_util") {
+  sources = [
+    "v4_protocol_manager_util.cc",
+    "v4_protocol_manager_util.h",
+  ]
+  public_deps = [
+    ":safebrowsing_proto",
+  ]
+  deps = [
+    "//base",
+    "//net",
+    "//url",
+  ]
+}
+
+if (is_android) {
+  import("//build/config/android/rules.gni")
+  java_cpp_enum("sb_threat_values") {
+    sources = [
+      "v4_protocol_manager_util.h",
+    ]
+  }
+}
+
+source_set("v4_rice") {
+  sources = [
+    "v4_rice.cc",
+    "v4_rice.h",
+  ]
+  deps = [
+    "//base",
+    "//third_party/protobuf:protobuf_lite",
+  ]
+}
+
+source_set("v4_store") {
+  sources = [
+    "v4_store.cc",
+    "v4_store.h",
+  ]
+  public_deps = [
+    ":safebrowsing_proto",
+    ":v4_store_proto",
+  ]
+  deps = [
+    ":v4_protocol_manager_util",
+    ":v4_rice",
+    "//base",
+    "//components/safe_browsing:webui_proto",
+    "//crypto",
+  ]
+}
+
+static_library("v4_test_util") {
+  testonly = true
+  sources = [
+    "v4_test_util.cc",
+    "v4_test_util.h",
+  ]
+  deps = [
+    ":util",
+    ":v4_protocol_manager_util",
+  ]
+}
+
+static_library("v4_update_protocol_manager") {
+  sources = [
+    "v4_update_protocol_manager.cc",
+    "v4_update_protocol_manager.h",
+  ]
+  deps = [
+    ":safebrowsing_proto",
+    ":util",
+    ":v4_protocol_manager_util",
+    "//base",
+    "//components/data_use_measurement/core",
+    "//components/safe_browsing:webui_proto",
+    "//components/safe_browsing/common:safe_browsing_prefs",
+    "//net",
+    "//url",
+  ]
+}
+
+source_set("v4_database_unittest") {
+  testonly = true
+  sources = [
+    "v4_database_unittest.cc",
+  ]
+  deps = [
+    ":v4_database",
+    ":v4_store",
+    "//base",
+    "//base/test:test_support",
+    "//content/test:test_support",
+    "//testing/gtest",
+  ]
+}
+
+source_set("v4_get_hash_protocol_manager_unittest") {
+  testonly = true
+  sources = [
+    "v4_get_hash_protocol_manager_unittest.cc",
+  ]
+  deps = [
+    ":safebrowsing_proto",
+    ":util",
+    ":v4_database",
+    ":v4_get_hash_protocol_manager",
+    ":v4_local_database_manager",
+    ":v4_test_util",
+    "//base",
+    "//base/test:test_support",
+    "//content/test:test_support",
+    "//net",
+    "//net:test_support",
+    "//testing/gtest",
+  ]
+}
+
+source_set("v4_local_database_manager_unittest") {
+  testonly = true
+  sources = [
+    "v4_local_database_manager_unittest.cc",
+  ]
+  deps = [
+    ":v4_database",
+    ":v4_local_database_manager",
+    ":v4_protocol_manager_util",
+    ":v4_test_util",
+    "//base",
+    "//base/test:test_support",
+    "//content/test:test_support",
+    "//net",
+    "//net:test_support",
+    "//testing/gtest",
+  ]
+}
+
+source_set("v4_update_protocol_manager_unittest") {
+  testonly = true
+  sources = [
+    "v4_update_protocol_manager_unittest.cc",
+  ]
+  deps = [
+    ":safebrowsing_proto",
+    ":util",
+    ":v4_test_util",
+    ":v4_update_protocol_manager",
+    "//base",
+    "//base/test:test_support",
+    "//net",
+    "//net:test_support",
+    "//testing/gtest",
+  ]
+}
+
+source_set("unit_tests_shared") {
+  testonly = true
+  sources = [
+    "database_manager_unittest.cc",
+    "prefix_set_unittest.cc",
+    "util_unittest.cc",
+    "v4_get_hash_protocol_manager_unittest.cc",
+    "v4_protocol_manager_util_unittest.cc",
+    "whitelist_checker_client_unittest.cc",
+  ]
+  deps = [
+    ":database_manager",
+    ":prefix_set",
+    ":safebrowsing_proto",
+    ":test_database_manager",
+    ":util",
+    ":v4_get_hash_protocol_manager",
+    ":v4_protocol_manager_util",
+    ":v4_test_util",
+    ":whitelist_checker_client",
+    "//base",
+    "//content/public/browser",
+    "//content/test:test_support",
+    "//net",
+    "//net:test_support",
+    "//testing/gtest",
+  ]
+  if (is_win) {
+    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+    cflags = [ "/wd4267" ]  # Conversion from size_t to 'type'.
+  }
+}
+
+source_set("unit_tests_desktop") {
+  testonly = true
+  sources = [
+    "v4_database_unittest.cc",
+    "v4_local_database_manager_unittest.cc",
+    "v4_rice_unittest.cc",
+    "v4_store_unittest.cc",
+    "v4_update_protocol_manager_unittest.cc",
+  ]
+  deps = [
+    ":unit_tests_shared",
+    ":util",
+    ":v4_database",
+    ":v4_local_database_manager",
+    ":v4_protocol_manager_util",
+    ":v4_rice",
+    ":v4_store",
+    ":v4_store_proto",
+    ":v4_test_util",
+    ":v4_update_protocol_manager",
+    "//base",
+    "//components/prefs:test_support",
+    "//components/safe_browsing/common:safe_browsing_prefs",
+    "//content/test:test_support",
+    "//crypto",
+    "//net",
+    "//net:test_support",
+    "//testing/gtest",
+    "//url",
+  ]
+  if (is_win) {
+    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
+    cflags = [ "/wd4267" ]  # Conversion from size_t to 'type'.
+  }
+}
+
+static_library("whitelist_checker_client") {
+  sources = [
+    "whitelist_checker_client.cc",
+    "whitelist_checker_client.h",
+  ]
+  deps = [
+    ":database_manager",
+    "//base:base",
+  ]
+}
+
+source_set("whitelist_checker_client_unittest") {
+  testonly = true
+  sources = [
+    "whitelist_checker_client_unittest.cc",
+  ]
+  deps = [
+    ":database_manager",
+    ":test_database_manager",
+    ":whitelist_checker_client",
+    "//base:base",
+    "//base/test:test_support",
+    "//content/public/browser",
+    "//content/test:test_support",
+    "//testing/gmock:gmock",
+    "//testing/gtest:gtest",
+  ]
+}
diff --git a/components/safe_browsing/db/DEPS b/components/safe_browsing/db/DEPS
index a9774be7..9e6effe 100644
--- a/components/safe_browsing/db/DEPS
+++ b/components/safe_browsing/db/DEPS
@@ -1,10 +1,19 @@
 include_rules = [
   "+base",
-  "+components/safe_browsing_db",
   "+components/variations",
+  "+components/data_use_measurement/core",
+  "+components/safe_browsing/common/safe_browsing_prefs.h",
+  "+components/safe_browsing/features.h",
+  "+components/safe_browsing/proto/webui.pb.h",
+  "+components/safe_browsing/web_ui/webui.pb.h",
+  "+components/version_info",
+  "+content/public/browser",
+  "+content/public/common",
   "+content/public/test",
+  "+crypto",
+  "+google_apis/google_api_keys.h",
   "+net",
   "+testing/gtest",
+  "+third_party/protobuf/src/google",
   "+url",
-  
 ]
diff --git a/components/safe_browsing_db/README b/components/safe_browsing/db/README
similarity index 100%
rename from components/safe_browsing_db/README
rename to components/safe_browsing/db/README
diff --git a/components/safe_browsing_db/database_manager.cc b/components/safe_browsing/db/database_manager.cc
similarity index 95%
rename from components/safe_browsing_db/database_manager.cc
rename to components/safe_browsing/db/database_manager.cc
index 6633c417..139795d5 100644
--- a/components/safe_browsing_db/database_manager.cc
+++ b/components/safe_browsing/db/database_manager.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 "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 
 #include "base/metrics/histogram_macros.h"
-#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/browser/browser_thread.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "url/gurl.h"
diff --git a/components/safe_browsing_db/database_manager.h b/components/safe_browsing/db/database_manager.h
similarity index 95%
rename from components/safe_browsing_db/database_manager.h
rename to components/safe_browsing/db/database_manager.h
index c50ef68..b40af3dc1 100644
--- a/components/safe_browsing_db/database_manager.h
+++ b/components/safe_browsing/db/database_manager.h
@@ -16,9 +16,9 @@
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted_delete_on_sequence.h"
-#include "components/safe_browsing_db/hit_report.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/hit_report.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/common/resource_type.h"
 #include "url/gurl.h"
 
@@ -66,8 +66,8 @@
                                           SBThreatType threat_type) {}
 
     // Called when the result of checking a set of extensions is known.
-    virtual void OnCheckExtensionsResult(
-        const std::set<std::string>& threats) {}
+    virtual void OnCheckExtensionsResult(const std::set<std::string>& threats) {
+    }
 
     // Called when the result of checking the resource blacklist is known.
     virtual void OnCheckResourceUrlResult(const GURL& url,
@@ -275,14 +275,11 @@
                            HandleGetHashesWithApisResultsNoMatch);
   FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
                            HandleGetHashesWithApisResultsMatches);
-  FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
-                           CancelApiCheck);
-  FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
-                           ResultsAreCached);
+  FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest, CancelApiCheck);
+  FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest, ResultsAreCached);
   FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
                            ResultsAreNotCachedOnNull);
-  FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
-                           GetCachedResults);
+  FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest, GetCachedResults);
   FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
                            CachedResultsMerged);
   FRIEND_TEST_ALL_PREFIXES(SafeBrowsingDatabaseManagerTest,
diff --git a/components/safe_browsing_db/database_manager_unittest.cc b/components/safe_browsing/db/database_manager_unittest.cc
similarity index 93%
rename from components/safe_browsing_db/database_manager_unittest.cc
rename to components/safe_browsing/db/database_manager_unittest.cc
index 5669978..6099c7b 100644
--- a/components/safe_browsing_db/database_manager_unittest.cc
+++ b/components/safe_browsing/db/database_manager_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/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 
 #include <stddef.h>
 
@@ -19,9 +19,9 @@
 #include "base/single_thread_task_runner.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "components/safe_browsing_db/test_database_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/test_database_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "crypto/sha2.h"
@@ -51,7 +51,7 @@
     return blocked_permissions_;
   }
 
-  bool callback_invoked() {return callback_invoked_;}
+  bool callback_invoked() { return callback_invoked_; }
 
  private:
   std::set<std::string> blocked_permissions_;
diff --git a/components/safe_browsing_db/hit_report.cc b/components/safe_browsing/db/hit_report.cc
similarity index 86%
rename from components/safe_browsing_db/hit_report.cc
rename to components/safe_browsing/db/hit_report.cc
index cd14044e..20c18729 100644
--- a/components/safe_browsing_db/hit_report.cc
+++ b/components/safe_browsing/db/hit_report.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/safe_browsing_db/hit_report.h"
+#include "components/safe_browsing/db/hit_report.h"
 
 namespace safe_browsing {
 
diff --git a/components/safe_browsing_db/hit_report.h b/components/safe_browsing/db/hit_report.h
similarity index 97%
rename from components/safe_browsing_db/hit_report.h
rename to components/safe_browsing/db/hit_report.h
index 134a9f9..87db01a 100644
--- a/components/safe_browsing_db/hit_report.h
+++ b/components/safe_browsing/db/hit_report.h
@@ -8,7 +8,7 @@
 #define COMPONENTS_SAFE_BROWSING_DB_HIT_REPORT_H_
 
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "url/gurl.h"
 
 namespace safe_browsing {
diff --git a/components/safe_browsing_db/metadata.proto b/components/safe_browsing/db/metadata.proto
similarity index 100%
rename from components/safe_browsing_db/metadata.proto
rename to components/safe_browsing/db/metadata.proto
diff --git a/components/safe_browsing_db/prefix_set.cc b/components/safe_browsing/db/prefix_set.cc
similarity index 88%
rename from components/safe_browsing_db/prefix_set.cc
rename to components/safe_browsing/db/prefix_set.cc
index 0701b8e2..815bce8 100644
--- a/components/safe_browsing_db/prefix_set.cc
+++ b/components/safe_browsing/db/prefix_set.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/safe_browsing_db/prefix_set.h"
+#include "components/safe_browsing/db/prefix_set.h"
 
 #include <limits.h>
 
@@ -88,8 +88,7 @@
   return a.first < b.first;
 }
 
-PrefixSet::PrefixSet() {
-}
+PrefixSet::PrefixSet() {}
 
 PrefixSet::PrefixSet(IndexVector* index,
                      std::vector<uint16_t>* deltas,
@@ -107,9 +106,8 @@
     return false;
 
   // Find the first position after |prefix| in |index_|.
-  IndexVector::const_iterator iter =
-      std::upper_bound(index_.begin(), index_.end(),
-                       IndexPair(prefix, 0), PrefixLess);
+  IndexVector::const_iterator iter = std::upper_bound(
+      index_.begin(), index_.end(), IndexPair(prefix, 0), PrefixLess);
 
   // |prefix| comes before anything that's in the set.
   if (iter == index_.begin())
@@ -135,8 +133,8 @@
 }
 
 bool PrefixSet::Exists(const SBFullHash& hash) const {
-  if (std::binary_search(full_hashes_.begin(), full_hashes_.end(),
-                         hash, SBFullHashLess)) {
+  if (std::binary_search(full_hashes_.begin(), full_hashes_.end(), hash,
+                         SBFullHashLess)) {
     return true;
   }
   return PrefixExists(hash.prefix);
@@ -208,8 +206,8 @@
       sizeof(full_hashes[0]) * header.full_hashes_size;
 
   // Check for bogus sizes before allocating any space.
-  const size_t expected_bytes = sizeof(header) +
-      index_bytes + deltas_bytes + full_hashes_bytes + sizeof(MD5Digest);
+  const size_t expected_bytes = sizeof(header) + index_bytes + deltas_bytes +
+                                full_hashes_bytes + sizeof(MD5Digest);
   if (static_cast<int64_t>(expected_bytes) != size_64)
     return nullptr;
 
@@ -221,9 +219,9 @@
     read = fread(&(index[0]), sizeof(index[0]), index.size(), file.get());
     if (read != index.size())
       return nullptr;
-    base::MD5Update(&context,
-                    base::StringPiece(reinterpret_cast<char*>(&(index[0])),
-                                      index_bytes));
+    base::MD5Update(
+        &context,
+        base::StringPiece(reinterpret_cast<char*>(&(index[0])), index_bytes));
   }
 
   // Read vector of deltas.
@@ -232,9 +230,9 @@
     read = fread(&(deltas[0]), sizeof(deltas[0]), deltas.size(), file.get());
     if (read != deltas.size())
       return nullptr;
-    base::MD5Update(&context,
-                    base::StringPiece(reinterpret_cast<char*>(&(deltas[0])),
-                                      deltas_bytes));
+    base::MD5Update(
+        &context,
+        base::StringPiece(reinterpret_cast<char*>(&(deltas[0])), deltas_bytes));
   }
 
   // Read vector of full hashes.
@@ -244,10 +242,9 @@
                  file.get());
     if (read != full_hashes.size())
       return nullptr;
-    base::MD5Update(&context,
-                    base::StringPiece(
-                        reinterpret_cast<char*>(&(full_hashes[0])),
-                        full_hashes_bytes));
+    base::MD5Update(
+        &context, base::StringPiece(reinterpret_cast<char*>(&(full_hashes[0])),
+                                    full_hashes_bytes));
   }
 
   base::MD5Digest calculated_digest;
@@ -300,26 +297,24 @@
   // contents of the vector by a pointer to an element.
   if (index_.size()) {
     const size_t index_bytes = sizeof(index_[0]) * index_.size();
-    written = fwrite(&(index_[0]), sizeof(index_[0]), index_.size(),
-                     file.get());
+    written =
+        fwrite(&(index_[0]), sizeof(index_[0]), index_.size(), file.get());
     if (written != index_.size())
       return false;
-    base::MD5Update(&context,
-                    base::StringPiece(
-                        reinterpret_cast<const char*>(&(index_[0])),
-                        index_bytes));
+    base::MD5Update(
+        &context, base::StringPiece(reinterpret_cast<const char*>(&(index_[0])),
+                                    index_bytes));
   }
 
   if (deltas_.size()) {
     const size_t deltas_bytes = sizeof(deltas_[0]) * deltas_.size();
-    written = fwrite(&(deltas_[0]), sizeof(deltas_[0]), deltas_.size(),
-                     file.get());
+    written =
+        fwrite(&(deltas_[0]), sizeof(deltas_[0]), deltas_.size(), file.get());
     if (written != deltas_.size())
       return false;
-    base::MD5Update(&context,
-                    base::StringPiece(
-                        reinterpret_cast<const char*>(&(deltas_[0])),
-                        deltas_bytes));
+    base::MD5Update(&context, base::StringPiece(
+                                  reinterpret_cast<const char*>(&(deltas_[0])),
+                                  deltas_bytes));
   }
 
   if (full_hashes_.size()) {
@@ -329,10 +324,10 @@
     written = fwrite(&(full_hashes_[0]), elt_size, elts, file.get());
     if (written != elts)
       return false;
-    base::MD5Update(&context,
-                    base::StringPiece(
-                        reinterpret_cast<const char*>(&(full_hashes_[0])),
-                        full_hashes_bytes));
+    base::MD5Update(
+        &context,
+        base::StringPiece(reinterpret_cast<const char*>(&(full_hashes_[0])),
+                          full_hashes_bytes));
   }
 
   base::MD5Digest digest;
@@ -362,9 +357,7 @@
   deltas_.insert(deltas_.end(), run_begin, run_end);
 }
 
-PrefixSetBuilder::PrefixSetBuilder()
-    : prefix_set_(new PrefixSet()) {
-}
+PrefixSetBuilder::PrefixSetBuilder() : prefix_set_(new PrefixSet()) {}
 
 PrefixSetBuilder::PrefixSetBuilder(const std::vector<SBPrefix>& prefixes)
     : prefix_set_(new PrefixSet()) {
@@ -373,8 +366,7 @@
   }
 }
 
-PrefixSetBuilder::~PrefixSetBuilder() {
-}
+PrefixSetBuilder::~PrefixSetBuilder() {}
 
 std::unique_ptr<const PrefixSet> PrefixSetBuilder::GetPrefixSet(
     const std::vector<SBFullHash>& hashes) {
diff --git a/components/safe_browsing_db/prefix_set.h b/components/safe_browsing/db/prefix_set.h
similarity index 99%
rename from components/safe_browsing_db/prefix_set.h
rename to components/safe_browsing/db/prefix_set.h
index 697e3fe..e5bbffc7 100644
--- a/components/safe_browsing_db/prefix_set.h
+++ b/components/safe_browsing/db/prefix_set.h
@@ -58,7 +58,7 @@
 
 #include "base/gtest_prod_util.h"
 #include "base/macros.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace base {
 class FilePath;
diff --git a/components/safe_browsing_db/prefix_set_unittest.cc b/components/safe_browsing/db/prefix_set_unittest.cc
similarity index 96%
rename from components/safe_browsing_db/prefix_set_unittest.cc
rename to components/safe_browsing/db/prefix_set_unittest.cc
index 72eb4105..68fb30b 100644
--- a/components/safe_browsing_db/prefix_set_unittest.cc
+++ b/components/safe_browsing/db/prefix_set_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/safe_browsing_db/prefix_set.h"
+#include "components/safe_browsing/db/prefix_set.h"
 
 #include <stddef.h>
 #include <stdint.h>
@@ -24,7 +24,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
 #include "build/build_config.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
@@ -81,7 +81,7 @@
   // that nearby elements are not (for lack of a more sensible set of
   // items to check for absence).
   static void CheckPrefixes(const PrefixSet& prefix_set,
-                            const std::vector<SBPrefix> &prefixes) {
+                            const std::vector<SBPrefix>& prefixes) {
     // The set can generate the prefixes it believes it has, so that's
     // a good starting point.
     std::set<SBPrefix> check(prefixes.begin(), prefixes.end());
@@ -167,7 +167,8 @@
 
   // Open |filename| and increment the uint32_t at |offset| by |inc|.
   // Then re-generate the checksum to account for the new contents.
-  void ModifyAndCleanChecksum(const base::FilePath& filename, long offset,
+  void ModifyAndCleanChecksum(const base::FilePath& filename,
+                              long offset,
                               int inc) {
     int64_t size_64;
     ASSERT_TRUE(base::GetFileSize(filename, &size_64));
@@ -280,8 +281,8 @@
   std::vector<SBPrefix> prefixes_copy;
   prefix_set->GetPrefixes(&prefixes_copy);
   ASSERT_EQ(prefixes_copy.size(), prefixes.size());
-  EXPECT_TRUE(std::equal(prefixes.begin(), prefixes.end(),
-                         prefixes_copy.begin()));
+  EXPECT_TRUE(
+      std::equal(prefixes.begin(), prefixes.end(), prefixes_copy.begin()));
 }
 
 // A range with only large deltas.
@@ -289,8 +290,8 @@
   std::vector<SBPrefix> prefixes;
 
   const unsigned kDelta = 10 * 1000 * 1000;
-  for (SBPrefix prefix = kHighBitClear;
-       prefix < kHighBitSet; prefix += kDelta) {
+  for (SBPrefix prefix = kHighBitClear; prefix < kHighBitSet;
+       prefix += kDelta) {
     prefixes.push_back(prefix);
   }
 
@@ -304,8 +305,8 @@
   prefix_set->GetPrefixes(&prefixes_copy);
   prefixes.erase(std::unique(prefixes.begin(), prefixes.end()), prefixes.end());
   EXPECT_EQ(prefixes_copy.size(), prefixes.size());
-  EXPECT_TRUE(std::equal(prefixes.begin(), prefixes.end(),
-                         prefixes_copy.begin()));
+  EXPECT_TRUE(
+      std::equal(prefixes.begin(), prefixes.end(), prefixes_copy.begin()));
 }
 
 // Use artificial inputs to test various edge cases in PrefixExists().  Items
@@ -358,8 +359,8 @@
   prefix_set->GetPrefixes(&prefixes_copy);
   prefixes.erase(std::unique(prefixes.begin(), prefixes.end()), prefixes.end());
   EXPECT_EQ(prefixes_copy.size(), prefixes.size());
-  EXPECT_TRUE(std::equal(prefixes.begin(), prefixes.end(),
-                         prefixes_copy.begin()));
+  EXPECT_TRUE(
+      std::equal(prefixes.begin(), prefixes.end(), prefixes_copy.begin()));
 
   // Items before and after the set are not present, and don't crash.
   EXPECT_FALSE(prefix_set->PrefixExists(kHighBitSet - 100));
@@ -473,8 +474,7 @@
   base::FilePath filename;
   ASSERT_TRUE(GetPrefixSetFile(&filename));
 
-  ASSERT_NO_FATAL_FAILURE(
-      ModifyAndCleanChecksum(filename, kMagicOffset, 1));
+  ASSERT_NO_FATAL_FAILURE(ModifyAndCleanChecksum(filename, kMagicOffset, 1));
   std::unique_ptr<const PrefixSet> prefix_set = PrefixSet::LoadFile(filename);
   ASSERT_FALSE(prefix_set.get());
 }
@@ -484,8 +484,7 @@
   base::FilePath filename;
   ASSERT_TRUE(GetPrefixSetFile(&filename));
 
-  ASSERT_NO_FATAL_FAILURE(
-      ModifyAndCleanChecksum(filename, kVersionOffset, 10));
+  ASSERT_NO_FATAL_FAILURE(ModifyAndCleanChecksum(filename, kVersionOffset, 10));
   std::unique_ptr<const PrefixSet> prefix_set = PrefixSet::LoadFile(filename);
   ASSERT_FALSE(prefix_set.get());
 }
@@ -597,7 +596,7 @@
   ASSERT_EQ(sizeof(delta), fwrite(&delta, 1, sizeof(delta), file.get()));
 
   // Leave space for the digest at the end, and regenerate it.
-  base::MD5Digest dummy = { { 0 } };
+  base::MD5Digest dummy = {{0}};
   ASSERT_EQ(sizeof(dummy), fwrite(&dummy, 1, sizeof(dummy), file.get()));
   ASSERT_TRUE(base::TruncateFile(file.get()));
   CleanChecksum(file.get());
@@ -678,7 +677,7 @@
   ASSERT_EQ(sizeof(delta), fwrite(&delta, 1, sizeof(delta), file.get()));
 
   // Leave space for the digest at the end, and regenerate it.
-  base::MD5Digest dummy = { { 0 } };
+  base::MD5Digest dummy = {{0}};
   ASSERT_EQ(sizeof(dummy), fwrite(&dummy, 1, sizeof(dummy), file.get()));
   ASSERT_TRUE(base::TruncateFile(file.get()));
   CleanChecksum(file.get());
diff --git a/components/safe_browsing/db/remote_database_manager.cc b/components/safe_browsing/db/remote_database_manager.cc
index 7a3d04b9..25bb061 100644
--- a/components/safe_browsing/db/remote_database_manager.cc
+++ b/components/safe_browsing/db/remote_database_manager.cc
@@ -12,8 +12,8 @@
 #include "base/strings/string_split.h"
 #include "base/timer/elapsed_timer.h"
 #include "components/safe_browsing/db/safe_browsing_api_handler.h"
-#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_thread.h"
 
diff --git a/components/safe_browsing/db/remote_database_manager.h b/components/safe_browsing/db/remote_database_manager.h
index c2a30ff..4a7efb18 100644
--- a/components/safe_browsing/db/remote_database_manager.h
+++ b/components/safe_browsing/db/remote_database_manager.h
@@ -16,7 +16,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "url/gurl.h"
 
 namespace net {
diff --git a/components/safe_browsing/db/safe_browsing_api_handler.h b/components/safe_browsing/db/safe_browsing_api_handler.h
index e83e19a..8d7ab6a 100644
--- a/components/safe_browsing/db/safe_browsing_api_handler.h
+++ b/components/safe_browsing/db/safe_browsing_api_handler.h
@@ -12,8 +12,8 @@
 #include <vector>
 
 #include "base/callback.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "url/gurl.h"
 
 namespace safe_browsing {
diff --git a/components/safe_browsing/db/safe_browsing_api_handler_unittest.cc b/components/safe_browsing/db/safe_browsing_api_handler_unittest.cc
index 2ee2e4f..3b003a72 100644
--- a/components/safe_browsing/db/safe_browsing_api_handler_unittest.cc
+++ b/components/safe_browsing/db/safe_browsing_api_handler_unittest.cc
@@ -7,9 +7,9 @@
 #include <string>
 
 #include "base/strings/stringprintf.h"
-#include "components/safe_browsing_db/metadata.pb.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/metadata.pb.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace safe_browsing {
diff --git a/components/safe_browsing/db/safe_browsing_api_handler_util.cc b/components/safe_browsing/db/safe_browsing_api_handler_util.cc
index d075550..be4254e 100644
--- a/components/safe_browsing/db/safe_browsing_api_handler_util.cc
+++ b/components/safe_browsing/db/safe_browsing_api_handler_util.cc
@@ -13,8 +13,8 @@
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/values.h"
-#include "components/safe_browsing_db/metadata.pb.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/metadata.pb.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace safe_browsing {
 namespace {
diff --git a/components/safe_browsing/db/safe_browsing_api_handler_util.h b/components/safe_browsing/db/safe_browsing_api_handler_util.h
index f3724808..60c864a 100644
--- a/components/safe_browsing/db/safe_browsing_api_handler_util.h
+++ b/components/safe_browsing/db/safe_browsing_api_handler_util.h
@@ -9,7 +9,7 @@
 
 #include <string>
 
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace safe_browsing {
 
diff --git a/components/safe_browsing_db/safebrowsing.proto b/components/safe_browsing/db/safebrowsing.proto
similarity index 100%
rename from components/safe_browsing_db/safebrowsing.proto
rename to components/safe_browsing/db/safebrowsing.proto
diff --git a/components/safe_browsing_db/test_database_manager.cc b/components/safe_browsing/db/test_database_manager.cc
similarity index 97%
rename from components/safe_browsing_db/test_database_manager.cc
rename to components/safe_browsing/db/test_database_manager.cc
index 343ce15..7eb06c5 100644
--- a/components/safe_browsing_db/test_database_manager.cc
+++ b/components/safe_browsing/db/test_database_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/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 
 #include <set>
 #include <string>
diff --git a/components/safe_browsing_db/test_database_manager.h b/components/safe_browsing/db/test_database_manager.h
similarity index 92%
rename from components/safe_browsing_db/test_database_manager.h
rename to components/safe_browsing/db/test_database_manager.h
index 5118372..e873c219 100644
--- a/components/safe_browsing_db/test_database_manager.h
+++ b/components/safe_browsing/db/test_database_manager.h
@@ -9,8 +9,8 @@
 #include <string>
 #include <vector>
 
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 
 namespace safe_browsing {
 
@@ -18,8 +18,7 @@
 // interface.  It's used in tests by overriding only the functions that get
 // called, and it'll complain if you call one that isn't overriden. The
 // non-abstract methods in the base class are not overridden.
-class TestSafeBrowsingDatabaseManager
-    : public SafeBrowsingDatabaseManager {
+class TestSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
  public:
   // SafeBrowsingDatabaseManager implementation:
   void CancelCheck(Client* client) override;
diff --git a/components/safe_browsing_db/util.cc b/components/safe_browsing/db/util.cc
similarity index 94%
rename from components/safe_browsing_db/util.cc
rename to components/safe_browsing/db/util.cc
index b59573c0..64b25e65 100644
--- a/components/safe_browsing_db/util.cc
+++ b/components/safe_browsing/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/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 #include <stddef.h>
 
@@ -83,9 +83,9 @@
 const char kResourceBlacklist[] = "goog-badresource-shavar";
 
 const char* kAllLists[10] = {
-    kMalwareList,        kPhishingList,       kBinUrlList,  kCsdWhiteList,
-    kDownloadWhiteList,  kExtensionBlacklist, kIPBlacklist, kUnwantedUrlList,
-    kModuleWhitelist,    kResourceBlacklist,
+    kMalwareList,       kPhishingList,       kBinUrlList,  kCsdWhiteList,
+    kDownloadWhiteList, kExtensionBlacklist, kIPBlacklist, kUnwantedUrlList,
+    kModuleWhitelist,   kResourceBlacklist,
 };
 
 ListType GetListId(const base::StringPiece& name) {
@@ -155,7 +155,6 @@
   return true;
 }
 
-
 SBFullHash SBFullHashForString(const base::StringPiece& str) {
   SBFullHash h;
   crypto::SHA256HashString(str, &h.full_hash, sizeof(h.full_hash));
@@ -200,15 +199,14 @@
 
   for (const std::string& host : hosts) {
     for (const std::string& path : paths) {
-      full_hashes->push_back(
-          SBFullHashForString(host + path));
+      full_hashes->push_back(SBFullHashForString(host + path));
 
       // We may have /foo as path-prefix in the whitelist which should
       // also match with /foo/bar and /foo?bar.  Hence, for every path
       // that ends in '/' we also add the path without the slash.
       if (include_whitelist_hashes && path.size() > 1 && path.back() == '/') {
-        full_hashes->push_back(SBFullHashForString(
-            host + path.substr(0, path.size() - 1)));
+        full_hashes->push_back(
+            SBFullHashForString(host + path.substr(0, path.size() - 1)));
       }
     }
   }
diff --git a/components/safe_browsing_db/util.h b/components/safe_browsing/db/util.h
similarity index 97%
rename from components/safe_browsing_db/util.h
rename to components/safe_browsing/db/util.h
index 43f4d24..e90404e 100644
--- a/components/safe_browsing_db/util.h
+++ b/components/safe_browsing/db/util.h
@@ -17,7 +17,7 @@
 #include "base/strings/string_piece.h"
 #include "base/time/time.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 
 class GURL;
 
@@ -166,7 +166,6 @@
 SBFullHash StringToSBFullHash(const std::string& hash_in);
 std::string SBFullHashToString(const SBFullHash& hash_out);
 
-
 // Maps a list name to ListType.
 ListType GetListId(const base::StringPiece& name);
 
@@ -178,7 +177,8 @@
 // to match against the csd whitelist.  E.g., if the path-prefix /foo is on the
 // whitelist it should also match /foo/bar which is not the case for all the
 // other lists.  We'll also always add a pattern for the empty path.
-void UrlToFullHashes(const GURL& url, bool include_whitelist_hashes,
+void UrlToFullHashes(const GURL& url,
+                     bool include_whitelist_hashes,
                      std::vector<SBFullHash>* full_hashes);
 
 struct SafeBrowsingProtocolConfig {
diff --git a/components/safe_browsing_db/util_unittest.cc b/components/safe_browsing/db/util_unittest.cc
similarity index 69%
rename from components/safe_browsing_db/util_unittest.cc
rename to components/safe_browsing/db/util_unittest.cc
index c105c4a..082aa38c 100644
--- a/components/safe_browsing_db/util_unittest.cc
+++ b/components/safe_browsing/db/util_unittest.cc
@@ -8,7 +8,7 @@
 
 #include "base/macros.h"
 #include "base/strings/stringprintf.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -20,16 +20,15 @@
   UrlToFullHashes(url, false, &results);
 
   EXPECT_EQ(6UL, results.size());
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("evil.com/"),
-                                                  results[0]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("evil.com/evil1/"),
-                                                  results[1]));
+  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("evil.com/"), results[0]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("evil.com/evil1/"), results[1]));
   EXPECT_TRUE(SBFullHashEqual(
       SBFullHashForString("evil.com/evil1/evilness.html"), results[2]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("www.evil.com/"),
-                                                  results[3]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("www.evil.com/evil1/"),
-                                                  results[4]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("www.evil.com/"), results[3]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("www.evil.com/evil1/"), results[4]));
   EXPECT_TRUE(SBFullHashEqual(
       SBFullHashForString("www.evil.com/evil1/evilness.html"), results[5]));
 
@@ -38,20 +37,19 @@
   UrlToFullHashes(url2, true, &results);
 
   EXPECT_EQ(8UL, results.size());
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("evil.com/"),
-                                                  results[0]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("evil.com/evil1/"),
-                                                  results[1]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("evil.com/evil1"),
-                                                  results[2]));
+  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("evil.com/"), results[0]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("evil.com/evil1/"), results[1]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("evil.com/evil1"), results[2]));
   EXPECT_TRUE(SBFullHashEqual(
       SBFullHashForString("evil.com/evil1/evilness.html"), results[3]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("www.evil.com/"),
-                                                  results[4]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("www.evil.com/evil1/"),
-                                                  results[5]));
-  EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("www.evil.com/evil1"),
-                                                  results[6]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("www.evil.com/"), results[4]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("www.evil.com/evil1/"), results[5]));
+  EXPECT_TRUE(
+      SBFullHashEqual(SBFullHashForString("www.evil.com/evil1"), results[6]));
   EXPECT_TRUE(SBFullHashEqual(
       SBFullHashForString("www.evil.com/evil1/evilness.html"), results[7]));
 }
diff --git a/components/safe_browsing_db/v4_database.cc b/components/safe_browsing/db/v4_database.cc
similarity index 99%
rename from components/safe_browsing_db/v4_database.cc
rename to components/safe_browsing/db/v4_database.cc
index f380624..bd547ec3 100644
--- a/components/safe_browsing_db/v4_database.cc
+++ b/components/safe_browsing/db/v4_database.cc
@@ -11,8 +11,8 @@
 #include "base/metrics/histogram_macros.h"
 #include "base/task_runner_util.h"
 #include "base/threading/thread_task_runner_handle.h"
+#include "components/safe_browsing/db/v4_database.h"
 #include "components/safe_browsing/proto/webui.pb.h"
-#include "components/safe_browsing_db/v4_database.h"
 #include "content/public/browser/browser_thread.h"
 
 using content::BrowserThread;
diff --git a/components/safe_browsing_db/v4_database.h b/components/safe_browsing/db/v4_database.h
similarity index 98%
rename from components/safe_browsing_db/v4_database.h
rename to components/safe_browsing/db/v4_database.h
index 1e276e6..5d15bdf 100644
--- a/components/safe_browsing_db/v4_database.h
+++ b/components/safe_browsing/db/v4_database.h
@@ -16,9 +16,9 @@
 #include "base/memory/weak_ptr.h"
 #include "base/sequenced_task_runner.h"
 #include "base/single_thread_task_runner.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_store.h"
 #include "components/safe_browsing/proto/webui.pb.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
-#include "components/safe_browsing_db/v4_store.h"
 
 class TestSafeBrowsingDatabaseHelper;
 
diff --git a/components/safe_browsing_db/v4_database_unittest.cc b/components/safe_browsing/db/v4_database_unittest.cc
similarity index 99%
rename from components/safe_browsing_db/v4_database_unittest.cc
rename to components/safe_browsing/db/v4_database_unittest.cc
index de42e1a3..e41dd0d 100644
--- a/components/safe_browsing_db/v4_database_unittest.cc
+++ b/components/safe_browsing/db/v4_database_unittest.cc
@@ -10,8 +10,8 @@
 #include "base/memory/ptr_util.h"
 #include "base/run_loop.h"
 #include "base/test/test_simple_task_runner.h"
-#include "components/safe_browsing_db/v4_database.h"
-#include "components/safe_browsing_db/v4_store.h"
+#include "components/safe_browsing/db/v4_database.h"
+#include "components/safe_browsing/db/v4_store.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "testing/platform_test.h"
 
diff --git a/components/safe_browsing_db/v4_feature_list.cc b/components/safe_browsing/db/v4_feature_list.cc
similarity index 89%
rename from components/safe_browsing_db/v4_feature_list.cc
rename to components/safe_browsing/db/v4_feature_list.cc
index 1ae3346..2213692 100644
--- a/components/safe_browsing_db/v4_feature_list.cc
+++ b/components/safe_browsing/db/v4_feature_list.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/safe_browsing_db/v4_feature_list.h"
+#include "components/safe_browsing/db/v4_feature_list.h"
 
 #include "base/feature_list.h"
 #include "components/safe_browsing/features.h"
diff --git a/components/safe_browsing_db/v4_feature_list.h b/components/safe_browsing/db/v4_feature_list.h
similarity index 100%
rename from components/safe_browsing_db/v4_feature_list.h
rename to components/safe_browsing/db/v4_feature_list.h
diff --git a/components/safe_browsing_db/v4_get_hash_protocol_manager.cc b/components/safe_browsing/db/v4_get_hash_protocol_manager.cc
similarity index 99%
rename from components/safe_browsing_db/v4_get_hash_protocol_manager.cc
rename to components/safe_browsing/db/v4_get_hash_protocol_manager.cc
index 22368b1b..9d94cf002 100644
--- a/components/safe_browsing_db/v4_get_hash_protocol_manager.cc
+++ b/components/safe_browsing/db/v4_get_hash_protocol_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/safe_browsing_db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
 
 #include <utility>
 
diff --git a/components/safe_browsing_db/v4_get_hash_protocol_manager.h b/components/safe_browsing/db/v4_get_hash_protocol_manager.h
similarity index 98%
rename from components/safe_browsing_db/v4_get_hash_protocol_manager.h
rename to components/safe_browsing/db/v4_get_hash_protocol_manager.h
index 967c0ef..5d34b68 100644
--- a/components/safe_browsing_db/v4_get_hash_protocol_manager.h
+++ b/components/safe_browsing/db/v4_get_hash_protocol_manager.h
@@ -24,10 +24,10 @@
 #include "base/time/default_clock.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/proto/webui.pb.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "net/url_request/url_fetcher_delegate.h"
 
 class GURL;
diff --git a/components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc b/components/safe_browsing/db/v4_get_hash_protocol_manager_unittest.cc
similarity index 99%
rename from components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc
rename to components/safe_browsing/db/v4_get_hash_protocol_manager_unittest.cc
index a030574..b81555c 100644
--- a/components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc
+++ b/components/safe_browsing/db/v4_get_hash_protocol_manager_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/safe_browsing_db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
 
 #include <memory>
 #include <vector>
@@ -13,9 +13,9 @@
 #include "base/strings/stringprintf.h"
 #include "base/test/simple_test_clock.h"
 #include "base/time/time.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "net/base/escape.h"
 #include "net/base/load_flags.h"
diff --git a/components/safe_browsing_db/v4_local_database_manager.cc b/components/safe_browsing/db/v4_local_database_manager.cc
similarity index 97%
rename from components/safe_browsing_db/v4_local_database_manager.cc
rename to components/safe_browsing/db/v4_local_database_manager.cc
index fe8dc0db..da446ab 100644
--- a/components/safe_browsing_db/v4_local_database_manager.cc
+++ b/components/safe_browsing/db/v4_local_database_manager.cc
@@ -5,7 +5,7 @@
 // This file should not be build on Android but is currently getting built.
 // TODO(vakh): Fix that: http://crbug.com/621647
 
-#include "components/safe_browsing_db/v4_local_database_manager.h"
+#include "components/safe_browsing/db/v4_local_database_manager.h"
 
 #include <vector>
 
@@ -17,8 +17,8 @@
 #include "base/metrics/histogram_functions.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/task_scheduler/post_task.h"
-#include "components/safe_browsing_db/v4_feature_list.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_feature_list.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "content/public/browser/browser_thread.h"
 #include "crypto/sha2.h"
 
@@ -38,14 +38,14 @@
 const char* const kStoreFileNamesToDelete[] = {"AnyIpMalware.store"};
 
 ListInfos GetListInfos() {
-  // NOTE(vakh): When adding a store here, add the corresponding store-specific
-  // histograms also.
-  // The first argument to ListInfo specifies whether to sync hash prefixes for
-  // that list. This can be false for two reasons:
-  // - The server doesn't support that list yet. Once the server adds support
-  //   for it, it can be changed to true.
-  // - The list doesn't have hash prefixes to match. All requests lead to full
-  //   hash checks. For instance: GetChromeUrlApiId()
+// NOTE(vakh): When adding a store here, add the corresponding store-specific
+// histograms also.
+// The first argument to ListInfo specifies whether to sync hash prefixes for
+// that list. This can be false for two reasons:
+// - The server doesn't support that list yet. Once the server adds support
+//   for it, it can be changed to true.
+// - The list doesn't have hash prefixes to match. All requests lead to full
+//   hash checks. For instance: GetChromeUrlApiId()
 
 #if defined(GOOGLE_CHROME_BUILD)
   const bool kSyncOnlyOnChromeBuilds = true;
diff --git a/components/safe_browsing_db/v4_local_database_manager.h b/components/safe_browsing/db/v4_local_database_manager.h
similarity index 97%
rename from components/safe_browsing_db/v4_local_database_manager.h
rename to components/safe_browsing/db/v4_local_database_manager.h
index 8bc3fbffb..bb96c6ba 100644
--- a/components/safe_browsing_db/v4_local_database_manager.h
+++ b/components/safe_browsing/db/v4_local_database_manager.h
@@ -12,13 +12,13 @@
 #include <unordered_set>
 
 #include "base/memory/weak_ptr.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/hit_report.h"
+#include "components/safe_browsing/db/v4_database.h"
+#include "components/safe_browsing/db/v4_get_hash_protocol_manager.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_update_protocol_manager.h"
 #include "components/safe_browsing/proto/webui.pb.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/hit_report.h"
-#include "components/safe_browsing_db/v4_database.h"
-#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
-#include "components/safe_browsing_db/v4_update_protocol_manager.h"
 #include "url/gurl.h"
 
 namespace safe_browsing {
diff --git a/components/safe_browsing_db/v4_local_database_manager_unittest.cc b/components/safe_browsing/db/v4_local_database_manager_unittest.cc
similarity index 99%
rename from components/safe_browsing_db/v4_local_database_manager_unittest.cc
rename to components/safe_browsing/db/v4_local_database_manager_unittest.cc
index ef7e8fe6..c7073a8d 100644
--- a/components/safe_browsing_db/v4_local_database_manager_unittest.cc
+++ b/components/safe_browsing/db/v4_local_database_manager_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/safe_browsing_db/v4_local_database_manager.h"
+#include "components/safe_browsing/db/v4_local_database_manager.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/memory/ptr_util.h"
@@ -11,9 +11,9 @@
 #include "base/run_loop.h"
 #include "base/test/test_simple_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "components/safe_browsing_db/v4_database.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/v4_database.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "crypto/sha2.h"
 #include "net/url_request/test_url_fetcher_factory.h"
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.cc b/components/safe_browsing/db/v4_protocol_manager_util.cc
similarity index 99%
rename from components/safe_browsing_db/v4_protocol_manager_util.cc
rename to components/safe_browsing/db/v4_protocol_manager_util.cc
index 5153d4a..bbd8c2b 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.cc
+++ b/components/safe_browsing/db/v4_protocol_manager_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/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 
 #include "base/base64.h"
 #include "base/hash.h"
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.h b/components/safe_browsing/db/v4_protocol_manager_util.h
similarity index 99%
rename from components/safe_browsing_db/v4_protocol_manager_util.h
rename to components/safe_browsing/db/v4_protocol_manager_util.h
index 03b94ed..927cc33 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.h
+++ b/components/safe_browsing/db/v4_protocol_manager_util.h
@@ -19,7 +19,7 @@
 #include "base/containers/flat_set.h"
 #include "base/gtest_prod_util.h"
 #include "base/strings/string_piece.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
 #include "net/url_request/url_request_status.h"
 #include "url/gurl.h"
 
diff --git a/components/safe_browsing_db/v4_protocol_manager_util_unittest.cc b/components/safe_browsing/db/v4_protocol_manager_util_unittest.cc
similarity index 97%
rename from components/safe_browsing_db/v4_protocol_manager_util_unittest.cc
rename to components/safe_browsing/db/v4_protocol_manager_util_unittest.cc
index 8018a9a8..b346da2 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util_unittest.cc
+++ b/components/safe_browsing/db/v4_protocol_manager_util_unittest.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 "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 
 #include <vector>
 
 #include "base/base64.h"
 #include "base/strings/stringprintf.h"
 #include "base/time/time.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
 #include "net/base/escape.h"
 #include "net/http/http_request_headers.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -28,8 +28,7 @@
 
 namespace safe_browsing {
 
-class V4ProtocolManagerUtilTest : public testing::Test {
-};
+class V4ProtocolManagerUtilTest : public testing::Test {};
 
 TEST_F(V4ProtocolManagerUtilTest, TestBackOffLogic) {
   size_t error_count = 0, back_off_multiplier = 1;
@@ -253,8 +252,8 @@
           true, "192.168.1.1",
           "X\xF8\xA1\x17I\xE6Pl\xFD\xDB\xBB\xA0\f\x2\x9D#\n|\xE7\xCD\x80"),
       std::make_tuple(
-          true, "::",
-          "\xE1)\xF2|Q\x3\xBC\\\xC4K\xCD\xF0\xA1^\x16\rDPf\xFF\x80")};
+          true,
+          "::", "\xE1)\xF2|Q\x3\xBC\\\xC4K\xCD\xF0\xA1^\x16\rDPf\xFF\x80")};
   for (size_t i = 0; i < test_cases.size(); i++) {
     DVLOG(1) << "Running case: " << i;
     bool success = std::get<0>(test_cases[i]);
diff --git a/components/safe_browsing_db/v4_rice.cc b/components/safe_browsing/db/v4_rice.cc
similarity index 99%
rename from components/safe_browsing_db/v4_rice.cc
rename to components/safe_browsing/db/v4_rice.cc
index c8376ae..a9c38ff 100644
--- a/components/safe_browsing_db/v4_rice.cc
+++ b/components/safe_browsing/db/v4_rice.cc
@@ -9,7 +9,7 @@
 #include "base/numerics/safe_math.h"
 #include "base/strings/stringprintf.h"
 #include "build/build_config.h"
-#include "components/safe_browsing_db/v4_rice.h"
+#include "components/safe_browsing/db/v4_rice.h"
 
 #if defined(OS_WIN)
 #include <winsock2.h>
diff --git a/components/safe_browsing_db/v4_rice.h b/components/safe_browsing/db/v4_rice.h
similarity index 100%
rename from components/safe_browsing_db/v4_rice.h
rename to components/safe_browsing/db/v4_rice.h
diff --git a/components/safe_browsing_db/v4_rice_unittest.cc b/components/safe_browsing/db/v4_rice_unittest.cc
similarity index 86%
rename from components/safe_browsing_db/v4_rice_unittest.cc
rename to components/safe_browsing/db/v4_rice_unittest.cc
index 7f97bef..cfc369c 100644
--- a/components/safe_browsing_db/v4_rice_unittest.cc
+++ b/components/safe_browsing/db/v4_rice_unittest.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 "components/safe_browsing/db/v4_rice.h"
 #include "base/logging.h"
-#include "components/safe_browsing_db/v4_rice.h"
 #include "testing/platform_test.h"
 
 using ::google::protobuf::RepeatedField;
@@ -83,57 +83,65 @@
           "\xfe\x58\x3c\xa3\xd6\xa5\xf2\x10\x8c\x4a\x59"
           "\x56\x00"),
       RiceDecodingTestInfo(
-          28, {26067715, 344823336, 8420095, 399843890, 95029378, 731622412,
-               35811335, 1047558127, 1117722715, 78698892},
+          28,
+          {26067715, 344823336, 8420095, 399843890, 95029378, 731622412,
+           35811335, 1047558127, 1117722715, 78698892},
           "\x06\x86\x1b\x23\x14\xcb\x46\xf2\xaf\x07\x08\xc9\x88\x54\x1f\x41\x04"
           "\xd5\x1a\x03\xeb\xe6\x3a\x80\x13\x91\x7b\xbf\x83\xf3\xb7\x85\xf1\x29"
           "\x18\xb3\x61\x09"),
       RiceDecodingTestInfo(
-          27, {225846818, 328287420, 166748623, 29117720, 552397365, 350353215,
-               558267528, 4738273, 567093445, 28563065, 55077698, 73091685,
-               339246010, 98242620, 38060941, 63917830, 206319759, 137700744},
+          27,
+          {225846818, 328287420, 166748623, 29117720, 552397365, 350353215,
+           558267528, 4738273, 567093445, 28563065, 55077698, 73091685,
+           339246010, 98242620, 38060941, 63917830, 206319759, 137700744},
           "\x89\x98\xd8\x75\xbc\x44\x91\xeb\x39\x0c\x3e\x30\x9a\x78\xf3\x6a\xd4"
           "\xd9\xb1\x9f\xfb\x70\x3e\x44\x3e\xa3\x08\x67\x42\xc2\x2b\x46\x69\x8e"
           "\x3c\xeb\xd9\x10\x5a\x43\x9a\x32\xa5\x2d\x4e\x77\x0f\x87\x78\x20\xb6"
           "\xab\x71\x98\x48\x0c\x9e\x9e\xd7\x23\x0c\x13\x43\x2c\xa9\x01"),
       RiceDecodingTestInfo(
-          28, {339784008, 263128563, 63871877, 69723256, 826001074, 797300228,
-               671166008, 207712688},
+          28,
+          {339784008, 263128563, 63871877, 69723256, 826001074, 797300228,
+           671166008, 207712688},
           std::string("\x21\xc5\x02\x91\xf9\x82\xd7\x57\xb8\xe9\x3c\xf0\xc8\x4f"
                       "\xe8\x64\x8d\x77\x62\x04\xd6\x85\x3f\x1c\x97\x00\x04\x1b"
                       "\x17\xc6",
                       30)),
       RiceDecodingTestInfo(
-          28, {471820069, 196333855, 855579133, 122737976, 203433838, 85354544,
-               1307949392, 165938578, 195134475, 553930435, 49231136},
+          28,
+          {471820069, 196333855, 855579133, 122737976, 203433838, 85354544,
+           1307949392, 165938578, 195134475, 553930435, 49231136},
           "\x95\x9c\x7d\xb0\x8f\xe8\xd9\xbd\xfe\x8c\x7f\x81\x53\x0d\x75\xdc\x4e"
           "\x40\x18\x0c\x9a\x45\x3d\xa8\xdc\xfa\x26\x59\x40\x9e\x16\x08\x43\x77"
           "\xc3\x4e\x04\x01\xa4\xe6\x5d\x00"),
       RiceDecodingTestInfo(
-          27, {87336845, 129291033, 30906211, 433549264, 30899891, 53207875,
-               11959529, 354827862, 82919275, 489637251, 53561020, 336722992,
-               408117728, 204506246, 188216092, 9047110, 479817359, 230317256},
+          27,
+          {87336845, 129291033, 30906211, 433549264, 30899891, 53207875,
+           11959529, 354827862, 82919275, 489637251, 53561020, 336722992,
+           408117728, 204506246, 188216092, 9047110, 479817359, 230317256},
           "\x1a\x4f\x69\x2a\x63\x9a\xf6\xc6\x2e\xaf\x73\xd0\x6f\xd7\x31\xeb\x77"
           "\x1d\x43\xe3\x2b\x93\xce\x67\x8b\x59\xf9\x98\xd4\xda\x4f\x3c\x6f\xb0"
           "\xe8\xa5\x78\x8d\x62\x36\x18\xfe\x08\x1e\x78\xd8\x14\x32\x24\x84\x61"
           "\x1c\xf3\x37\x63\xc4\xa0\x88\x7b\x74\xcb\x64\xc8\x5c\xba\x05"),
       RiceDecodingTestInfo(
-          28, {297968956, 19709657, 259702329, 76998112, 1023176123, 29296013,
-               1602741145, 393745181, 177326295, 55225536, 75194472},
+          28,
+          {297968956, 19709657, 259702329, 76998112, 1023176123, 29296013,
+           1602741145, 393745181, 177326295, 55225536, 75194472},
           "\xf1\x94\x0a\x87\x6c\x5f\x96\x90\xe3\xab\xf7\xc0\xcb\x2d\xe9\x76\xdb"
           "\xf8\x59\x63\xc1\x6f\x7c\x99\xe3\x87\x5f\xc7\x04\xde\xb9\x46\x8e\x54"
           "\xc0\xac\x4a\x03\x0d\x6c\x8f\x00"),
       RiceDecodingTestInfo(
-          28, {532220688, 780594691, 436816483, 163436269, 573044456, 1069604,
-               39629436, 211410997, 227714491, 381562898, 75610008, 196754597,
-               40310339, 15204118, 99010842},
+          28,
+          {532220688, 780594691, 436816483, 163436269, 573044456, 1069604,
+           39629436, 211410997, 227714491, 381562898, 75610008, 196754597,
+           40310339, 15204118, 99010842},
           "\x41\x2c\xe4\xfe\x06\xdc\x0d\xbd\x31\xa5\x04\xd5\x6e\xdd\x9b\x43\xb7"
           "\x3f\x11\x24\x52\x10\x80\x4f\x96\x4b\xd4\x80\x67\xb2\xdd\x52\xc9\x4e"
           "\x02\xc6\xd7\x60\xde\x06\x92\x52\x1e\xdd\x35\x64\x71\x26\x2c\xfe\xcf"
           "\x81\x46\xb2\x79\x01"),
       RiceDecodingTestInfo(
-          28, {219354713, 389598618, 750263679, 554684211, 87381124, 4523497,
-               287633354, 801308671, 424169435, 372520475, 277287849},
+          28,
+          {219354713, 389598618, 750263679, 554684211, 87381124, 4523497,
+           287633354, 801308671, 424169435, 372520475, 277287849},
           "\xb2\x2c\x26\x3a\xcd\x66\x9c\xdb\x5f\x07\x2e\x6f\xe6\xf9\x21\x10\x52"
           "\xd5\x94\xf4\x82\x22\x48\xf9\x9d\x24\xf6\xff\x2f\xfc\x6d\x3f\x21\x65"
           "\x1b\x36\x34\x56\xea\xc4\x21\x00"),
diff --git a/components/safe_browsing_db/v4_store.cc b/components/safe_browsing/db/v4_store.cc
similarity index 99%
rename from components/safe_browsing_db/v4_store.cc
rename to components/safe_browsing/db/v4_store.cc
index 2d51d61c..7015e0cd 100644
--- a/components/safe_browsing_db/v4_store.cc
+++ b/components/safe_browsing/db/v4_store.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/safe_browsing_db/v4_store.h"
+#include "components/safe_browsing/db/v4_store.h"
 
 #include "base/base64.h"
 #include "base/bind.h"
@@ -12,9 +12,9 @@
 #include "base/metrics/sparse_histogram.h"
 #include "base/stl_util.h"
 #include "base/strings/stringprintf.h"
+#include "components/safe_browsing/db/v4_rice.h"
+#include "components/safe_browsing/db/v4_store.pb.h"
 #include "components/safe_browsing/proto/webui.pb.h"
-#include "components/safe_browsing_db/v4_rice.h"
-#include "components/safe_browsing_db/v4_store.pb.h"
 #include "crypto/secure_hash.h"
 #include "crypto/sha2.h"
 
diff --git a/components/safe_browsing_db/v4_store.h b/components/safe_browsing/db/v4_store.h
similarity index 99%
rename from components/safe_browsing_db/v4_store.h
rename to components/safe_browsing/db/v4_store.h
index 392d841c..6d43b4bb 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing/db/v4_store.h
@@ -13,8 +13,8 @@
 #include "base/memory/ref_counted.h"
 #include "base/sequenced_task_runner.h"
 #include "base/single_thread_task_runner.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/proto/webui.pb.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 
 namespace safe_browsing {
 
diff --git a/components/safe_browsing_db/v4_store.proto b/components/safe_browsing/db/v4_store.proto
similarity index 100%
rename from components/safe_browsing_db/v4_store.proto
rename to components/safe_browsing/db/v4_store.proto
diff --git a/components/safe_browsing_db/v4_store_unittest.cc b/components/safe_browsing/db/v4_store_unittest.cc
similarity index 99%
rename from components/safe_browsing_db/v4_store_unittest.cc
rename to components/safe_browsing/db/v4_store_unittest.cc
index 575b340..c37efae 100644
--- a/components/safe_browsing_db/v4_store_unittest.cc
+++ b/components/safe_browsing/db/v4_store_unittest.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/safe_browsing/db/v4_store.h"
 #include "base/base64.h"
 #include "base/bind.h"
 #include "base/files/file_util.h"
@@ -10,8 +11,7 @@
 #include "base/run_loop.h"
 #include "base/test/test_simple_task_runner.h"
 #include "base/time/time.h"
-#include "components/safe_browsing_db/v4_store.h"
-#include "components/safe_browsing_db/v4_store.pb.h"
+#include "components/safe_browsing/db/v4_store.pb.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "crypto/sha2.h"
 #include "testing/platform_test.h"
@@ -562,7 +562,7 @@
   EXPECT_EQ(WRITE_SUCCESS, write_store.WriteToDisk(Checksum()));
   EXPECT_TRUE(base::PathExists(write_store.store_path_));
 
-  V4Store read_store (task_runner_, store_path_);
+  V4Store read_store(task_runner_, store_path_);
   EXPECT_EQ(READ_SUCCESS, read_store.ReadFromDisk());
   EXPECT_EQ("test_client_state", read_store.state_);
   ASSERT_EQ(2u, read_store.hash_prefix_map_.size());
diff --git a/components/safe_browsing_db/v4_test_util.cc b/components/safe_browsing/db/v4_test_util.cc
similarity index 88%
rename from components/safe_browsing_db/v4_test_util.cc
rename to components/safe_browsing/db/v4_test_util.cc
index a3727956..8fe288af5 100644
--- a/components/safe_browsing_db/v4_test_util.cc
+++ b/components/safe_browsing/db/v4_test_util.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 "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
+#include "components/safe_browsing/db/util.h"
 
 namespace safe_browsing {
 
diff --git a/components/safe_browsing_db/v4_test_util.h b/components/safe_browsing/db/v4_test_util.h
similarity index 100%
rename from components/safe_browsing_db/v4_test_util.h
rename to components/safe_browsing/db/v4_test_util.h
diff --git a/components/safe_browsing_db/v4_update_protocol_manager.cc b/components/safe_browsing/db/v4_update_protocol_manager.cc
similarity index 98%
rename from components/safe_browsing_db/v4_update_protocol_manager.cc
rename to components/safe_browsing/db/v4_update_protocol_manager.cc
index ef8d302..02197c9 100644
--- a/components/safe_browsing_db/v4_update_protocol_manager.cc
+++ b/components/safe_browsing/db/v4_update_protocol_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/safe_browsing_db/v4_update_protocol_manager.h"
+#include "components/safe_browsing/db/v4_update_protocol_manager.h"
 
 #include <utility>
 
@@ -13,7 +13,7 @@
 #include "base/rand_util.h"
 #include "base/timer/timer.h"
 #include "components/data_use_measurement/core/data_use_user_data.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
 #include "net/base/load_flags.h"
 #include "net/http/http_response_headers.h"
 #include "net/http/http_status_code.h"
diff --git a/components/safe_browsing_db/v4_update_protocol_manager.h b/components/safe_browsing/db/v4_update_protocol_manager.h
similarity index 97%
rename from components/safe_browsing_db/v4_update_protocol_manager.h
rename to components/safe_browsing/db/v4_update_protocol_manager.h
index 73f076f6..c692807 100644
--- a/components/safe_browsing_db/v4_update_protocol_manager.h
+++ b/components/safe_browsing/db/v4_update_protocol_manager.h
@@ -22,10 +22,10 @@
 #include "base/time/time.h"
 #include "base/timer/timer.h"
 #include "components/safe_browsing/common/safe_browsing_prefs.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/proto/webui.pb.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "net/url_request/url_fetcher_delegate.h"
 
 class GURL;
diff --git a/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc b/components/safe_browsing/db/v4_update_protocol_manager_unittest.cc
similarity index 98%
rename from components/safe_browsing_db/v4_update_protocol_manager_unittest.cc
rename to components/safe_browsing/db/v4_update_protocol_manager_unittest.cc
index 170880f..b9f3f57b 100644
--- a/components/safe_browsing_db/v4_update_protocol_manager_unittest.cc
+++ b/components/safe_browsing/db/v4_update_protocol_manager_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/safe_browsing_db/v4_update_protocol_manager.h"
+#include "components/safe_browsing/db/v4_update_protocol_manager.h"
 
 #include <memory>
 #include <utility>
@@ -14,9 +14,9 @@
 #include "base/test/test_simple_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/time/time.h"
-#include "components/safe_browsing_db/safebrowsing.pb.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_test_util.h"
+#include "components/safe_browsing/db/safebrowsing.pb.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_test_util.h"
 #include "net/base/escape.h"
 #include "net/base/load_flags.h"
 #include "net/base/net_errors.h"
diff --git a/components/safe_browsing_db/whitelist_checker_client.cc b/components/safe_browsing/db/whitelist_checker_client.cc
similarity index 97%
rename from components/safe_browsing_db/whitelist_checker_client.cc
rename to components/safe_browsing/db/whitelist_checker_client.cc
index 4691ddd..02269dce 100644
--- a/components/safe_browsing_db/whitelist_checker_client.cc
+++ b/components/safe_browsing/db/whitelist_checker_client.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/safe_browsing_db/whitelist_checker_client.h"
+#include "components/safe_browsing/db/whitelist_checker_client.h"
 
 #include "base/bind.h"
 
diff --git a/components/safe_browsing_db/whitelist_checker_client.h b/components/safe_browsing/db/whitelist_checker_client.h
similarity index 96%
rename from components/safe_browsing_db/whitelist_checker_client.h
rename to components/safe_browsing/db/whitelist_checker_client.h
index c2878261..a93a904 100644
--- a/components/safe_browsing_db/whitelist_checker_client.h
+++ b/components/safe_browsing/db/whitelist_checker_client.h
@@ -8,7 +8,7 @@
 #include "base/memory/ptr_util.h"
 #include "base/memory/weak_ptr.h"
 #include "base/timer/timer.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 
 namespace safe_browsing {
 
diff --git a/components/safe_browsing_db/whitelist_checker_client_unittest.cc b/components/safe_browsing/db/whitelist_checker_client_unittest.cc
similarity index 97%
rename from components/safe_browsing_db/whitelist_checker_client_unittest.cc
rename to components/safe_browsing/db/whitelist_checker_client_unittest.cc
index 0b78df22..a470475 100644
--- a/components/safe_browsing_db/whitelist_checker_client_unittest.cc
+++ b/components/safe_browsing/db/whitelist_checker_client_unittest.cc
@@ -1,7 +1,7 @@
 // Copyright 2017 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 "components/safe_browsing_db/whitelist_checker_client.h"
+#include "components/safe_browsing/db/whitelist_checker_client.h"
 
 #include "base/bind.h"
 #include "base/message_loop/message_loop.h"
@@ -9,7 +9,7 @@
 #include "base/test/mock_callback.h"
 #include "base/test/test_mock_time_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
-#include "components/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/test/test_browser_thread.h"
 #include "testing/gmock/include/gmock/gmock.h"
diff --git a/components/safe_browsing/password_protection/BUILD.gn b/components/safe_browsing/password_protection/BUILD.gn
index 125f4b2..c9a914a 100644
--- a/components/safe_browsing/password_protection/BUILD.gn
+++ b/components/safe_browsing/password_protection/BUILD.gn
@@ -23,9 +23,9 @@
       "//components/password_manager/core/browser:browser",
       "//components/safe_browsing:csd_proto",
       "//components/safe_browsing:features",
-      "//components/safe_browsing_db:database_manager",
-      "//components/safe_browsing_db:v4_protocol_manager_util",
-      "//components/safe_browsing_db:whitelist_checker_client",
+      "//components/safe_browsing/db:database_manager",
+      "//components/safe_browsing/db:v4_protocol_manager_util",
+      "//components/safe_browsing/db:whitelist_checker_client",
       "//content/public/browser:browser",
       "//net:net",
       "//third_party/protobuf:protobuf_lite",
@@ -47,7 +47,7 @@
       "//components/history/core/browser:browser",
       "//components/password_manager/core/browser:browser",
       "//components/safe_browsing:features",
-      "//components/safe_browsing_db:test_database_manager",
+      "//components/safe_browsing/db:test_database_manager",
       "//components/sync_preferences:test_support",
       "//content/test:test_support",
       "//net:test_support",
diff --git a/components/safe_browsing/password_protection/password_protection_request.cc b/components/safe_browsing/password_protection/password_protection_request.cc
index 7e42c11..df34677 100644
--- a/components/safe_browsing/password_protection/password_protection_request.cc
+++ b/components/safe_browsing/password_protection/password_protection_request.cc
@@ -9,7 +9,7 @@
 #include "base/metrics/histogram_macros.h"
 #include "components/data_use_measurement/core/data_use_user_data.h"
 #include "components/password_manager/core/browser/password_reuse_detector.h"
-#include "components/safe_browsing_db/whitelist_checker_client.h"
+#include "components/safe_browsing/db/whitelist_checker_client.h"
 #include "content/public/browser/web_contents.h"
 #include "net/base/escape.h"
 #include "net/base/load_flags.h"
diff --git a/components/safe_browsing/password_protection/password_protection_service.cc b/components/safe_browsing/password_protection/password_protection_service.cc
index b66a717..c27edb7db 100644
--- a/components/safe_browsing/password_protection/password_protection_service.cc
+++ b/components/safe_browsing/password_protection/password_protection_service.cc
@@ -20,10 +20,10 @@
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/history/core/browser/history_service.h"
 #include "components/password_manager/core/browser/password_reuse_detector.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/whitelist_checker_client.h"
 #include "components/safe_browsing/features.h"
 #include "components/safe_browsing/password_protection/password_protection_request.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/whitelist_checker_client.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/web_contents.h"
 #include "google_apis/google_api_keys.h"
diff --git a/components/safe_browsing/password_protection/password_protection_service.h b/components/safe_browsing/password_protection/password_protection_service.h
index 5a227f2..e90c999 100644
--- a/components/safe_browsing/password_protection/password_protection_service.h
+++ b/components/safe_browsing/password_protection/password_protection_service.h
@@ -18,8 +18,8 @@
 #include "base/task/cancelable_task_tracker.h"
 #include "base/values.h"
 #include "components/history/core/browser/history_service_observer.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/safe_browsing/proto/csd.pb.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
 
diff --git a/components/safe_browsing/password_protection/password_protection_service_unittest.cc b/components/safe_browsing/password_protection/password_protection_service_unittest.cc
index 1d7ba8e..daf6abe 100644
--- a/components/safe_browsing/password_protection/password_protection_service_unittest.cc
+++ b/components/safe_browsing/password_protection/password_protection_service_unittest.cc
@@ -11,9 +11,9 @@
 #include "base/test/null_task_runner.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/password_manager/core/browser/password_reuse_detector.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "components/safe_browsing/features.h"
 #include "components/safe_browsing/password_protection/password_protection_request.h"
-#include "components/safe_browsing_db/test_database_manager.h"
 #include "components/sync_preferences/testing_pref_service_syncable.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "net/url_request/test_url_fetcher_factory.h"
diff --git a/components/safe_browsing/web_ui/BUILD.gn b/components/safe_browsing/web_ui/BUILD.gn
index 49fabac3..3c17276e 100644
--- a/components/safe_browsing/web_ui/BUILD.gn
+++ b/components/safe_browsing/web_ui/BUILD.gn
@@ -19,7 +19,7 @@
     "//components/safe_browsing:features",
     "//components/safe_browsing:webui_proto",
     "//components/safe_browsing/common:safe_browsing_prefs",
-    "//components/safe_browsing_db:v4_local_database_manager",
+    "//components/safe_browsing/db:v4_local_database_manager",
     "//components/strings:components_strings_grit",
     "//components/user_prefs:user_prefs",
     "//content/public/browser",
diff --git a/components/safe_browsing/web_ui/safe_browsing_ui.cc b/components/safe_browsing/web_ui/safe_browsing_ui.cc
index 6d588ab..2fdb069 100644
--- a/components/safe_browsing/web_ui/safe_browsing_ui.cc
+++ b/components/safe_browsing/web_ui/safe_browsing_ui.cc
@@ -28,7 +28,7 @@
 #include "content/public/browser/browser_context.h"
 
 #if SAFE_BROWSING_DB_LOCAL
-#include "components/safe_browsing_db/v4_local_database_manager.h"
+#include "components/safe_browsing/db/v4_local_database_manager.h"
 #endif
 
 using base::Time;
diff --git a/components/safe_browsing_db/BUILD.gn b/components/safe_browsing_db/BUILD.gn
deleted file mode 100644
index bf1ea05..0000000
--- a/components/safe_browsing_db/BUILD.gn
+++ /dev/null
@@ -1,455 +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.
-
-import("//third_party/protobuf/proto_library.gni")
-
-proto_library("safebrowsing_proto") {
-  sources = [
-    "safebrowsing.proto",
-  ]
-}
-
-proto_library("v4_store_proto") {
-  sources = [
-    "v4_store.proto",
-  ]
-  deps = [
-    ":safebrowsing_proto",
-  ]
-}
-
-proto_library("metadata_proto") {
-  sources = [
-    "metadata.proto",
-  ]
-}
-
-# This target is shared between the desktop and mobile versions.
-group("safe_browsing_db_shared") {
-  deps = [
-    ":database_manager",
-    ":hit_report",
-    ":prefix_set",
-    ":safebrowsing_proto",
-    ":util",
-    ":v4_feature_list",  # Used by SafeBrowsingService
-    "//components/safe_browsing/common:safe_browsing_prefs",
-  ]
-}
-
-# This target is for the desktop version.
-group("safe_browsing_db") {
-  deps = [
-    ":safe_browsing_db_shared",
-    ":v4_local_database_manager",
-  ]
-}
-
-static_library("database_manager") {
-  sources = [
-    "database_manager.cc",
-    "database_manager.h",
-  ]
-  deps = [
-    ":hit_report",
-    ":util",
-    ":v4_get_hash_protocol_manager",
-    ":v4_protocol_manager_util",
-    "//base",
-    "//content/public/browser",
-    "//content/public/common",
-    "//net",
-    "//url",
-  ]
-
-  public_deps = [
-    ":safebrowsing_proto",
-  ]
-}
-
-static_library("hit_report") {
-  sources = [
-    "hit_report.cc",
-    "hit_report.h",
-  ]
-  public_deps = [
-    ":util",
-  ]
-  deps = [
-    "//components/metrics",
-    "//components/safe_browsing/common:safe_browsing_prefs",
-    "//url",
-  ]
-}
-
-static_library("prefix_set") {
-  sources = [
-    "prefix_set.cc",
-    "prefix_set.h",
-  ]
-  deps = [
-    ":util",
-    "//base",
-  ]
-}
-
-static_library("test_database_manager") {
-  sources = [
-    "test_database_manager.cc",
-    "test_database_manager.h",
-  ]
-  deps = [
-    ":database_manager",
-    ":v4_protocol_manager_util",
-    "//base:base",
-    "//net",
-  ]
-}
-
-static_library("util") {
-  sources = [
-    "util.cc",
-    "util.h",
-  ]
-  public_deps = [
-    ":v4_protocol_manager_util",
-    "//components/safe_browsing/common:safe_browsing_prefs",
-  ]
-  deps = [
-    "//base",
-    "//components/version_info:version_info",
-    "//crypto",
-    "//google_apis:google_apis",
-    "//net",
-    "//url",
-  ]
-  if (is_win) {
-    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
-    cflags = [ "/wd4267" ]  # Conversion from size_t to 'type'.
-  }
-}
-
-static_library("v4_database") {
-  sources = [
-    "v4_database.cc",
-    "v4_database.h",
-  ]
-  public_deps = [
-    ":safebrowsing_proto",
-  ]
-  deps = [
-    ":v4_protocol_manager_util",
-    ":v4_store",
-    "//base",
-    "//components/safe_browsing:webui_proto",
-    "//content/public/browser",
-  ]
-}
-
-static_library("v4_feature_list") {
-  sources = [
-    "v4_feature_list.cc",
-    "v4_feature_list.h",
-  ]
-  deps = [
-    "//base",
-    "//components/safe_browsing:features",
-  ]
-}
-
-static_library("v4_get_hash_protocol_manager") {
-  sources = [
-    "v4_get_hash_protocol_manager.cc",
-    "v4_get_hash_protocol_manager.h",
-  ]
-  public_deps = [
-    ":safebrowsing_proto",
-  ]
-  deps = [
-    ":util",
-    ":v4_protocol_manager_util",
-    "//base",
-    "//components/data_use_measurement/core",
-    "//components/safe_browsing:webui_proto",
-    "//content/public/browser",
-    "//net",
-    "//url",
-  ]
-}
-
-static_library("v4_local_database_manager") {
-  sources = [
-    "v4_local_database_manager.cc",
-    "v4_local_database_manager.h",
-  ]
-  deps = [
-    ":database_manager",
-    ":hit_report",
-    ":safebrowsing_proto",
-    ":v4_database",
-    ":v4_feature_list",
-    ":v4_get_hash_protocol_manager",
-    ":v4_protocol_manager_util",
-    ":v4_update_protocol_manager",
-    "//base",
-    "//components/safe_browsing:webui_proto",
-    "//content/public/browser",
-    "//net",
-    "//url",
-  ]
-}
-
-source_set("v4_protocol_manager_util") {
-  sources = [
-    "v4_protocol_manager_util.cc",
-    "v4_protocol_manager_util.h",
-  ]
-  public_deps = [
-    ":safebrowsing_proto",
-  ]
-  deps = [
-    "//base",
-    "//net",
-    "//url",
-  ]
-}
-
-if (is_android) {
-  import("//build/config/android/rules.gni")
-  java_cpp_enum("sb_threat_values") {
-    sources = [
-      "v4_protocol_manager_util.h",
-    ]
-  }
-}
-
-source_set("v4_rice") {
-  sources = [
-    "v4_rice.cc",
-    "v4_rice.h",
-  ]
-  deps = [
-    "//base",
-    "//third_party/protobuf:protobuf_lite",
-  ]
-}
-
-source_set("v4_store") {
-  sources = [
-    "v4_store.cc",
-    "v4_store.h",
-  ]
-  public_deps = [
-    ":safebrowsing_proto",
-    ":v4_store_proto",
-  ]
-  deps = [
-    ":v4_protocol_manager_util",
-    ":v4_rice",
-    "//base",
-    "//components/safe_browsing:webui_proto",
-    "//crypto",
-  ]
-}
-
-static_library("v4_test_util") {
-  testonly = true
-  sources = [
-    "v4_test_util.cc",
-    "v4_test_util.h",
-  ]
-  deps = [
-    ":util",
-    ":v4_protocol_manager_util",
-  ]
-}
-
-static_library("v4_update_protocol_manager") {
-  sources = [
-    "v4_update_protocol_manager.cc",
-    "v4_update_protocol_manager.h",
-  ]
-  deps = [
-    ":safebrowsing_proto",
-    ":util",
-    ":v4_protocol_manager_util",
-    "//base",
-    "//components/data_use_measurement/core",
-    "//components/safe_browsing:webui_proto",
-    "//components/safe_browsing/common:safe_browsing_prefs",
-    "//net",
-    "//url",
-  ]
-}
-
-source_set("v4_database_unittest") {
-  testonly = true
-  sources = [
-    "v4_database_unittest.cc",
-  ]
-  deps = [
-    ":v4_database",
-    ":v4_store",
-    "//base",
-    "//base/test:test_support",
-    "//content/test:test_support",
-    "//testing/gtest",
-  ]
-}
-
-source_set("v4_get_hash_protocol_manager_unittest") {
-  testonly = true
-  sources = [
-    "v4_get_hash_protocol_manager_unittest.cc",
-  ]
-  deps = [
-    ":safebrowsing_proto",
-    ":util",
-    ":v4_database",
-    ":v4_get_hash_protocol_manager",
-    ":v4_local_database_manager",
-    ":v4_test_util",
-    "//base",
-    "//base/test:test_support",
-    "//content/test:test_support",
-    "//net",
-    "//net:test_support",
-    "//testing/gtest",
-  ]
-}
-
-source_set("v4_local_database_manager_unittest") {
-  testonly = true
-  sources = [
-    "v4_local_database_manager_unittest.cc",
-  ]
-  deps = [
-    ":v4_database",
-    ":v4_local_database_manager",
-    ":v4_protocol_manager_util",
-    ":v4_test_util",
-    "//base",
-    "//base/test:test_support",
-    "//content/test:test_support",
-    "//net",
-    "//net:test_support",
-    "//testing/gtest",
-  ]
-}
-
-source_set("v4_update_protocol_manager_unittest") {
-  testonly = true
-  sources = [
-    "v4_update_protocol_manager_unittest.cc",
-  ]
-  deps = [
-    ":safebrowsing_proto",
-    ":util",
-    ":v4_test_util",
-    ":v4_update_protocol_manager",
-    "//base",
-    "//base/test:test_support",
-    "//net",
-    "//net:test_support",
-    "//testing/gtest",
-  ]
-}
-
-source_set("unit_tests_shared") {
-  testonly = true
-  sources = [
-    "database_manager_unittest.cc",
-    "prefix_set_unittest.cc",
-    "util_unittest.cc",
-    "v4_get_hash_protocol_manager_unittest.cc",
-    "v4_protocol_manager_util_unittest.cc",
-    "whitelist_checker_client_unittest.cc",
-  ]
-  deps = [
-    ":database_manager",
-    ":prefix_set",
-    ":safebrowsing_proto",
-    ":test_database_manager",
-    ":util",
-    ":v4_get_hash_protocol_manager",
-    ":v4_protocol_manager_util",
-    ":v4_test_util",
-    ":whitelist_checker_client",
-    "//base",
-    "//content/public/browser",
-    "//content/test:test_support",
-    "//net",
-    "//net:test_support",
-    "//testing/gtest",
-  ]
-  if (is_win) {
-    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
-    cflags = [ "/wd4267" ]  # Conversion from size_t to 'type'.
-  }
-}
-
-source_set("unit_tests_desktop") {
-  testonly = true
-  sources = [
-    "v4_database_unittest.cc",
-    "v4_local_database_manager_unittest.cc",
-    "v4_rice_unittest.cc",
-    "v4_store_unittest.cc",
-    "v4_update_protocol_manager_unittest.cc",
-  ]
-  deps = [
-    ":unit_tests_shared",
-    ":util",
-    ":v4_database",
-    ":v4_local_database_manager",
-    ":v4_protocol_manager_util",
-    ":v4_rice",
-    ":v4_store",
-    ":v4_store_proto",
-    ":v4_test_util",
-    ":v4_update_protocol_manager",
-    "//base",
-    "//components/prefs:test_support",
-    "//components/safe_browsing/common:safe_browsing_prefs",
-    "//content/test:test_support",
-    "//crypto",
-    "//net",
-    "//net:test_support",
-    "//testing/gtest",
-    "//url",
-  ]
-  if (is_win) {
-    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
-    cflags = [ "/wd4267" ]  # Conversion from size_t to 'type'.
-  }
-}
-
-static_library("whitelist_checker_client") {
-  sources = [
-    "whitelist_checker_client.cc",
-    "whitelist_checker_client.h",
-  ]
-  deps = [
-    ":database_manager",
-    "//base:base",
-  ]
-}
-
-source_set("whitelist_checker_client_unittest") {
-  testonly = true
-  sources = [
-    "whitelist_checker_client_unittest.cc",
-  ]
-  deps = [
-    ":database_manager",
-    ":test_database_manager",
-    ":whitelist_checker_client",
-    "//base:base",
-    "//base/test:test_support",
-    "//content/public/browser",
-    "//content/test:test_support",
-    "//testing/gmock:gmock",
-    "//testing/gtest:gtest",
-  ]
-}
diff --git a/components/safe_browsing_db/DEPS b/components/safe_browsing_db/DEPS
deleted file mode 100644
index ce3c7b9..0000000
--- a/components/safe_browsing_db/DEPS
+++ /dev/null
@@ -1,17 +0,0 @@
-include_rules = [
-  "+components/data_use_measurement/core",
-  "+components/safe_browsing/common/safe_browsing_prefs.h",
-  "+components/safe_browsing/db/safe_browsing_api_handler.h",
-  "+components/safe_browsing/features.h",
-  "+components/safe_browsing/proto/webui.pb.h",
-  "+components/safe_browsing/web_ui/webui.pb.h",
-  "+components/variations",
-  "+components/version_info",
-  "+content/public/browser",
-  "+content/public/common",
-  "+content/public/test",
-  "+crypto",
-  "+google_apis/google_api_keys.h",
-  "+third_party/protobuf/src/google",
-  "+net",
-]
diff --git a/components/safe_browsing_db/OWNERS b/components/safe_browsing_db/OWNERS
deleted file mode 100644
index 50851251..0000000
--- a/components/safe_browsing_db/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-jialiul@chromium.org
-nparker@chromium.org
-vakh@chromium.org
diff --git a/components/security_interstitials/content/BUILD.gn b/components/security_interstitials/content/BUILD.gn
index d3e598a..022d556 100644
--- a/components/security_interstitials/content/BUILD.gn
+++ b/components/security_interstitials/content/BUILD.gn
@@ -13,7 +13,7 @@
   ]
 
   public_deps = [
-    "//components/safe_browsing_db:hit_report",
+    "//components/safe_browsing/db:hit_report",
   ]
 
   deps = [
@@ -21,8 +21,8 @@
     "//components/prefs:prefs",
     "//components/resources",
     "//components/safe_browsing/common:safe_browsing_prefs",
-    "//components/safe_browsing_db:hit_report",
-    "//components/safe_browsing_db:util",
+    "//components/safe_browsing/db:hit_report",
+    "//components/safe_browsing/db:util",
     "//components/security_interstitials/core:core",
     "//content/public/browser",
     "//content/public/common",
diff --git a/components/security_interstitials/content/DEPS b/components/security_interstitials/content/DEPS
index ec5cfcd..3cd103b1 100644
--- a/components/security_interstitials/content/DEPS
+++ b/components/security_interstitials/content/DEPS
@@ -2,7 +2,7 @@
   "+components/grit/components_resources.h",
   "+components/prefs",
   "+components/safe_browsing/common",
-  "+components/safe_browsing_db",
+  "+components/safe_browsing/db",
   "+components/security_interstitials/core",
   "+content/public/browser",
   "+content/public/common",
diff --git a/components/security_interstitials/content/unsafe_resource.h b/components/security_interstitials/content/unsafe_resource.h
index 1df982f..5f7a488 100644
--- a/components/security_interstitials/content/unsafe_resource.h
+++ b/components/security_interstitials/content/unsafe_resource.h
@@ -10,8 +10,8 @@
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
 #include "base/single_thread_task_runner.h"
-#include "components/safe_browsing_db/hit_report.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/hit_report.h"
+#include "components/safe_browsing/db/util.h"
 #include "url/gurl.h"
 
 namespace content {
diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc
index c595f989..189e6cd 100644
--- a/components/signin/core/browser/account_reconcilor.cc
+++ b/components/signin/core/browser/account_reconcilor.cc
@@ -240,6 +240,10 @@
   StartReconcile();
 }
 
+void AccountReconcilor::OnRefreshTokensLoaded() {
+  StartReconcile();
+}
+
 void AccountReconcilor::GoogleSigninSucceeded(const std::string& account_id,
                                               const std::string& username) {
   VLOG(1) << "AccountReconcilor::GoogleSigninSucceeded: signed in";
@@ -280,6 +284,9 @@
 }
 
 void AccountReconcilor::StartReconcile() {
+  if (is_reconcile_started_)
+    return;
+
   if (IsReconcileBlocked()) {
     VLOG(1) << "AccountReconcilor::StartReconcile: "
             << "Reconcile is blocked, scheduling for later.";
@@ -288,18 +295,22 @@
     return;
   }
 
-  for (auto& observer : observer_list_)
-    observer.OnStartReconcile();
-
-  reconcile_start_time_ = base::Time::Now();
 
   if (!IsEnabled() || !client_->AreSigninCookiesAllowed()) {
     VLOG(1) << "AccountReconcilor::StartReconcile: !enabled or no cookies";
     return;
   }
 
-  if (is_reconcile_started_)
+  // Do not reconcile if tokens are not loaded yet.
+  if (!IsTokenServiceReady()) {
+    VLOG(1)
+        << "AccountReconcilor::StartReconcile: token service *not* ready yet.";
     return;
+  }
+
+  reconcile_start_time_ = base::Time::Now();
+  for (auto& observer : observer_list_)
+    observer.OnStartReconcile();
 
   // Reset state for validating gaia cookie.
   gaia_accounts_.clear();
@@ -343,11 +354,6 @@
           << "Error was " << error.ToString();
   if (error.state() == GoogleServiceAuthError::NONE) {
     gaia_accounts_ = accounts;
-
-    // It is possible that O2RT is not available at this moment.
-    if (!IsTokenServiceReady())
-      return;
-
     is_reconcile_started_ ? FinishReconcile() : StartReconcile();
   } else {
     if (is_reconcile_started_)
diff --git a/components/signin/core/browser/account_reconcilor.h b/components/signin/core/browser/account_reconcilor.h
index 670d738..519f7ee5 100644
--- a/components/signin/core/browser/account_reconcilor.h
+++ b/components/signin/core/browser/account_reconcilor.h
@@ -117,6 +117,7 @@
   FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, DiceLastKnownFirstAccount);
   FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
                            DiceReconcileReuseGaiaFirstAccount);
+  FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest, TokensNotLoaded);
   FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
                            StartReconcileCookiesDisabled);
   FRIEND_TEST_ALL_PREFIXES(AccountReconcilorTest,
@@ -208,6 +209,7 @@
 
   // Overriden from OAuth2TokenService::Observer.
   void OnEndBatchChanges() override;
+  void OnRefreshTokensLoaded() override;
 
   // Overriden from SigninManagerBase::Observer.
   void GoogleSigninSucceeded(const std::string& account_id,
diff --git a/components/signin/core/browser/android/OWNERS b/components/signin/core/browser/android/OWNERS
new file mode 100644
index 0000000..e50e23c
--- /dev/null
+++ b/components/signin/core/browser/android/OWNERS
@@ -0,0 +1,3 @@
+bsazonov@chromium.org
+
+# COMPONENT: Services>SignIn
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java
index 9099a12..fdfc4b968 100644
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountManagerFacade.java
@@ -7,7 +7,6 @@
 import android.accounts.Account;
 import android.accounts.AuthenticatorDescription;
 import android.app.Activity;
-import android.content.Context;
 import android.os.AsyncTask;
 import android.support.annotation.AnyThread;
 import android.support.annotation.MainThread;
@@ -132,13 +131,11 @@
      * Unlike initializeAccountManagerFacade, this will override the existing instance of
      * AccountManagerFacade if any. Only for use in Tests.
      *
-     * @param context the applicationContext is retrieved from the context used as an argument.
      * @param delegate the custom AccountManagerDelegate to use.
      */
     @VisibleForTesting
     @AnyThread
-    public static void overrideAccountManagerFacadeForTests(
-            Context context, AccountManagerDelegate delegate) {
+    public static void overrideAccountManagerFacadeForTests(AccountManagerDelegate delegate) {
         sInstance.set(new AccountManagerFacade(delegate));
     }
 
@@ -193,15 +190,12 @@
      */
     @MainThread
     public void tryGetGoogleAccountNames(final Callback<List<String>> callback) {
-        tryGetGoogleAccounts(new Callback<Account[]>() {
-            @Override
-            public void onResult(Account[] accounts) {
-                List<String> accountNames = new ArrayList<>();
-                for (Account account : accounts) {
-                    accountNames.add(account.name);
-                }
-                callback.onResult(accountNames);
+        tryGetGoogleAccounts(accounts -> {
+            List<String> accountNames = new ArrayList<>();
+            for (Account account : accounts) {
+                accountNames.add(account.name);
             }
+            callback.onResult(accountNames);
         });
     }
 
@@ -211,21 +205,18 @@
     @MainThread
     public void getGoogleAccountNames(
             final Callback<AccountManagerResult<List<String>>> callback) {
-        getGoogleAccounts(new Callback<AccountManagerResult<Account[]>>() {
-            @Override
-            public void onResult(AccountManagerResult<Account[]> accounts) {
-                final AccountManagerResult<List<String>> result;
-                if (accounts.hasValue()) {
-                    List<String> accountNames = new ArrayList<>(accounts.getValue().length);
-                    for (Account account : accounts.getValue()) {
-                        accountNames.add(account.name);
-                    }
-                    result = new AccountManagerResult<>(accountNames);
-                } else {
-                    result = new AccountManagerResult<>(accounts.getException());
+        getGoogleAccounts(accounts -> {
+            final AccountManagerResult<List<String>> result;
+            if (accounts.hasValue()) {
+                List<String> accountNames = new ArrayList<>(accounts.getValue().length);
+                for (Account account : accounts.getValue()) {
+                    accountNames.add(account.name);
                 }
-                callback.onResult(result);
+                result = new AccountManagerResult<>(accountNames);
+            } else {
+                result = new AccountManagerResult<>(accounts.getException());
             }
+            callback.onResult(result);
         });
     }
 
@@ -309,12 +300,7 @@
      */
     @MainThread
     public void hasGoogleAccounts(final Callback<Boolean> callback) {
-        tryGetGoogleAccounts(new Callback<Account[]>() {
-            @Override
-            public void onResult(Account[] accounts) {
-                callback.onResult(accounts.length > 0);
-            }
-        });
+        tryGetGoogleAccounts(accounts -> callback.onResult(accounts.length > 0));
     }
 
     private String canonicalizeName(String name) {
@@ -352,18 +338,15 @@
     @MainThread
     public void getAccountFromName(String accountName, final Callback<Account> callback) {
         final String canonicalName = canonicalizeName(accountName);
-        tryGetGoogleAccounts(new Callback<Account[]>() {
-            @Override
-            public void onResult(Account[] accounts) {
-                Account accountForName = null;
-                for (Account account : accounts) {
-                    if (canonicalizeName(account.name).equals(canonicalName)) {
-                        accountForName = account;
-                        break;
-                    }
+        tryGetGoogleAccounts(accounts -> {
+            Account accountForName = null;
+            for (Account account : accounts) {
+                if (canonicalizeName(account.name).equals(canonicalName)) {
+                    accountForName = account;
+                    break;
                 }
-                callback.onResult(accountForName);
             }
+            callback.onResult(accountForName);
         });
     }
 
@@ -383,12 +366,7 @@
     @VisibleForTesting
     @MainThread
     public void hasAccountForName(String accountName, final Callback<Boolean> callback) {
-        getAccountFromName(accountName, new Callback<Account>() {
-            @Override
-            public void onResult(Account account) {
-                callback.onResult(account != null);
-            }
-        });
+        getAccountFromName(accountName, account -> callback.onResult(account != null));
     }
 
     /**
@@ -530,7 +508,7 @@
         private final AtomicBoolean mIsTransientError;
 
         public static <T> void runAuthTask(AuthTask<T> authTask) {
-            new ConnectionRetry<T>(authTask).attempt();
+            new ConnectionRetry<>(authTask).attempt();
         }
 
         private ConnectionRetry(AuthTask<T> authTask) {
@@ -541,7 +519,7 @@
 
         /**
          * Tries running the {@link AuthTask} in the background. This object is never registered
-         * as a {@link ConnectionTypeObserver} when this method is called.
+         * as a {@link NetworkChangeNotifier.ConnectionTypeObserver} when this method is called.
          */
         private void attempt() {
             ThreadUtils.assertOnUiThread();
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
index 4778569..a402720 100644
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
@@ -10,7 +10,6 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 
-import org.chromium.base.Callback;
 import org.chromium.base.ContextUtils;
 import org.chromium.base.Log;
 import org.chromium.base.ThreadUtils;
@@ -70,12 +69,8 @@
 
     private void fetch() {
         Log.d(TAG, "Checking child account status for %s", mAccount.name);
-        AccountManagerFacade.get().checkChildAccount(mAccount, new Callback<Boolean>() {
-            @Override
-            public void onResult(Boolean isChildAccount) {
-                setIsChildAccount(isChildAccount);
-            }
-        });
+        AccountManagerFacade.get().checkChildAccount(
+                mAccount, isChildAccount -> setIsChildAccount(isChildAccount));
     }
 
     @CalledByNative
@@ -91,9 +86,8 @@
 
     @CalledByNative
     private static void initializeForTests() {
-        Context context = ContextUtils.getApplicationContext();
         AccountManagerDelegate delegate = new SystemAccountManagerDelegate();
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(context, delegate);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(delegate);
     }
 
     private static native void nativeSetIsChildAccount(
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
index eeb03a89..86b1ac5 100644
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
@@ -8,7 +8,6 @@
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
 import android.accounts.AuthenticatorDescription;
 import android.accounts.AuthenticatorException;
 import android.accounts.OperationCanceledException;
@@ -204,32 +203,24 @@
         ThreadUtils.assertOnUiThread();
         if (!hasManageAccountsPermission()) {
             if (callback != null) {
-                ThreadUtils.postOnUiThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        callback.onResult(false);
-                    }
-                });
+                ThreadUtils.postOnUiThread(() -> callback.onResult(false));
             }
             return;
         }
 
-        AccountManagerCallback<Bundle> realCallback = new AccountManagerCallback<Bundle>() {
-            @Override
-            public void run(AccountManagerFuture<Bundle> future) {
-                Bundle bundle = null;
-                try {
-                    bundle = future.getResult();
-                } catch (AuthenticatorException | IOException e) {
-                    Log.e(TAG, "Error while update credentials: ", e);
-                } catch (OperationCanceledException e) {
-                    Log.w(TAG, "Updating credentials was cancelled.");
-                }
-                boolean success = bundle != null
-                        && bundle.getString(AccountManager.KEY_ACCOUNT_TYPE) != null;
-                if (callback != null) {
-                    callback.onResult(success);
-                }
+        AccountManagerCallback<Bundle> realCallback = future -> {
+            Bundle bundle = null;
+            try {
+                bundle = future.getResult();
+            } catch (AuthenticatorException | IOException e) {
+                Log.e(TAG, "Error while update credentials: ", e);
+            } catch (OperationCanceledException e) {
+                Log.w(TAG, "Updating credentials was cancelled.");
+            }
+            boolean success =
+                    bundle != null && bundle.getString(AccountManager.KEY_ACCOUNT_TYPE) != null;
+            if (callback != null) {
+                callback.onResult(success);
             }
         };
         // Android 4.4 throws NullPointerException if null is passed
diff --git a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java
index f83af1b..a6f97d9 100644
--- a/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java
+++ b/components/signin/core/browser/android/javatests/src/org/chromium/components/signin/test/AccountManagerFacadeTest.java
@@ -5,8 +5,6 @@
 package org.chromium.components.signin.test;
 
 import android.accounts.Account;
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.annotation.UiThreadTest;
 import android.support.test.filters.SmallTest;
 import android.support.test.rule.UiThreadTestRule;
@@ -39,11 +37,10 @@
 
     @Before
     public void setUp() throws Exception {
-        Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
         mDelegate = new FakeAccountManagerDelegate(
                 FakeAccountManagerDelegate.ENABLE_PROFILE_DATA_SOURCE);
         Assert.assertFalse(mDelegate.isRegisterObserversCalled());
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(context, mDelegate);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mDelegate);
         Assert.assertTrue(mDelegate.isRegisterObserversCalled());
         mHelper = AccountManagerFacade.get();
     }
diff --git a/components/signin/core/browser/profile_oauth2_token_service.h b/components/signin/core/browser/profile_oauth2_token_service.h
index 3372a92..6bd6ce2 100644
--- a/components/signin/core/browser/profile_oauth2_token_service.h
+++ b/components/signin/core/browser/profile_oauth2_token_service.h
@@ -61,6 +61,10 @@
   // is no such instance.
   const net::BackoffEntry* GetDelegateBackoffEntry();
 
+  void set_all_credentials_loaded_for_testing(bool loaded) {
+    all_credentials_loaded_ = loaded;
+  }
+
  private:
   void OnRefreshTokenAvailable(const std::string& account_id) override;
   void OnRefreshTokenRevoked(const std::string& account_id) override;
diff --git a/components/subresource_filter/content/browser/BUILD.gn b/components/subresource_filter/content/browser/BUILD.gn
index 74c520e..a6d8980 100644
--- a/components/subresource_filter/content/browser/BUILD.gn
+++ b/components/subresource_filter/content/browser/BUILD.gn
@@ -35,8 +35,8 @@
   ]
   deps = [
     "//base",
-    "//components/safe_browsing_db:database_manager",
-    "//components/safe_browsing_db:util",
+    "//components/safe_browsing/db:database_manager",
+    "//components/safe_browsing/db:util",
     "//components/subresource_filter/content/common",
     "//components/subresource_filter/core/browser",
     "//components/subresource_filter/core/common",
@@ -70,8 +70,8 @@
     "//url",
   ]
   public_deps = [
-    "//components/safe_browsing_db:test_database_manager",
-    "//components/safe_browsing_db:util",
+    "//components/safe_browsing/db:test_database_manager",
+    "//components/safe_browsing/db:util",
   ]
 }
 
@@ -90,7 +90,7 @@
     ":browser",
     ":test_support",
     "//base/test:test_support",
-    "//components/safe_browsing_db:util",
+    "//components/safe_browsing/db:util",
     "//components/subresource_filter/content/common",
     "//components/subresource_filter/core/browser",
     "//components/subresource_filter/core/browser:test_support",
diff --git a/components/subresource_filter/content/browser/DEPS b/components/subresource_filter/content/browser/DEPS
index 4f7ee79..a5d03b57 100644
--- a/components/subresource_filter/content/browser/DEPS
+++ b/components/subresource_filter/content/browser/DEPS
@@ -1,5 +1,5 @@
 include_rules = [
-  "+components/safe_browsing_db",
+  "+components/safe_browsing/db",
   "+content/public/browser",
   "+net/base",
   "+ui/base/page_transition_types.h",
diff --git a/components/subresource_filter/content/browser/content_activation_list_utils.h b/components/subresource_filter/content/browser/content_activation_list_utils.h
index 645648cd..45bcfd5 100644
--- a/components/subresource_filter/content/browser/content_activation_list_utils.h
+++ b/components/subresource_filter/content/browser/content_activation_list_utils.h
@@ -5,7 +5,7 @@
 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_ACTIVATION_LIST_UTILS_H_
 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_ACTIVATION_LIST_UTILS_H_
 
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 #include "components/subresource_filter/core/common/activation_list.h"
 
 namespace subresource_filter {
diff --git a/components/subresource_filter/content/browser/fake_safe_browsing_database_manager.h b/components/subresource_filter/content/browser/fake_safe_browsing_database_manager.h
index 4409468..5c7e52c 100644
--- a/components/subresource_filter/content/browser/fake_safe_browsing_database_manager.h
+++ b/components/subresource_filter/content/browser/fake_safe_browsing_database_manager.h
@@ -9,7 +9,7 @@
 #include <set>
 
 #include "base/macros.h"
-#include "components/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "content/public/common/resource_type.h"
 
 class GURL;
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer.h b/components/subresource_filter/content/browser/subresource_filter_observer.h
index cdad5c6..3b8845c 100644
--- a/components/subresource_filter/content/browser/subresource_filter_observer.h
+++ b/components/subresource_filter/content/browser/subresource_filter_observer.h
@@ -5,7 +5,7 @@
 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_OBSERVER_H_
 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_OBSERVER_H_
 
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/subresource_filter/core/common/activation_decision.h"
 #include "components/subresource_filter/core/common/load_policy.h"
 
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h b/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h
index 677a4ed..301f9e99 100644
--- a/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h
+++ b/components/subresource_filter/content/browser/subresource_filter_observer_test_utils.h
@@ -11,8 +11,8 @@
 #include "base/macros.h"
 #include "base/optional.h"
 #include "base/scoped_observer.h"
-#include "components/safe_browsing_db/util.h"
-#include "components/safe_browsing_db/v4_protocol_manager_util.h"
+#include "components/safe_browsing/db/util.h"
+#include "components/safe_browsing/db/v4_protocol_manager_util.h"
 #include "components/subresource_filter/content/browser/subresource_filter_observer.h"
 #include "components/subresource_filter/content/browser/subresource_filter_observer_manager.h"
 #include "components/subresource_filter/core/common/activation_decision.h"
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
index b8838ba8..b3993b5d 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
@@ -15,7 +15,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "base/time/time.h"
-#include "components/safe_browsing_db/database_manager.h"
+#include "components/safe_browsing/db/database_manager.h"
 #include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h"
 #include "components/subresource_filter/core/browser/subresource_filter_features.h"
 #include "components/subresource_filter/core/common/activation_decision.h"
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
index 8c0e410..a2adc69 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
@@ -18,7 +18,7 @@
 #include "base/test/histogram_tester.h"
 #include "base/test/test_mock_time_task_runner.h"
 #include "build/build_config.h"
-#include "components/safe_browsing_db/test_database_manager.h"
+#include "components/safe_browsing/db/test_database_manager.h"
 #include "components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h"
 #include "components/subresource_filter/content/browser/fake_safe_browsing_database_manager.h"
 #include "components/subresource_filter/content/browser/subresource_filter_client.h"
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h
index 36961c4..2817038 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h
@@ -14,7 +14,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/util.h"
 
 class GURL;
 
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client_request.h b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client_request.h
index 2560050d..5f01046 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client_request.h
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_client_request.h
@@ -11,8 +11,8 @@
 #include "base/memory/ref_counted.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
-#include "components/safe_browsing_db/database_manager.h"
-#include "components/safe_browsing_db/util.h"
+#include "components/safe_browsing/db/database_manager.h"
+#include "components/safe_browsing/db/util.h"
 #include "url/gurl.h"
 
 namespace base {
diff --git a/components/subresource_filter/core/common/DEPS b/components/subresource_filter/core/common/DEPS
index e579f59..2b9cbe0b 100644
--- a/components/subresource_filter/core/common/DEPS
+++ b/components/subresource_filter/core/common/DEPS
@@ -1,3 +1,3 @@
 include_rules = [
-  "+components/safe_browsing_db/util.h",
+  "+components/safe_browsing/db/util.h",
 ]
diff --git a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java
index 0190b97..145d0df 100644
--- a/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java
+++ b/components/sync/android/javatests/src/org/chromium/components/sync/AndroidSyncSettingsTest.java
@@ -115,7 +115,7 @@
         mNumberOfCallsToWait = 0;
         mCallbackHelper = new CallbackHelper();
         mContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
-        setupTestAccounts(mContext);
+        setupTestAccounts();
         // Set signed in account to mAccount before initializing AndroidSyncSettings to let
         // AndroidSyncSettings establish correct assumptions.
         ChromeSigninController.get().setSignedInAccountName(mAccount.name);
@@ -130,10 +130,10 @@
 
     }
 
-    private void setupTestAccounts(Context context) {
+    private void setupTestAccounts() {
         mAccountManager = new FakeAccountManagerDelegate(
                 FakeAccountManagerDelegate.DISABLE_PROFILE_DATA_SOURCE);
-        AccountManagerFacade.overrideAccountManagerFacadeForTests(context, mAccountManager);
+        AccountManagerFacade.overrideAccountManagerFacadeForTests(mAccountManager);
         mAccount = setupTestAccount("account@example.com");
         mAlternateAccount = setupTestAccount("alternate@example.com");
     }
diff --git a/components/translate/core/browser/BUILD.gn b/components/translate/core/browser/BUILD.gn
index 8262979..3673643 100644
--- a/components/translate/core/browser/BUILD.gn
+++ b/components/translate/core/browser/BUILD.gn
@@ -47,6 +47,7 @@
     "//base:i18n",
     "//components/data_use_measurement/core",
     "//components/keyed_service/core",
+    "//components/language/core/browser",
     "//components/language_usage_metrics",
     "//components/machine_intelligence",
     "//components/machine_intelligence/proto",
@@ -107,6 +108,7 @@
     ":browser",
     "//base",
     "//components/infobars/core",
+    "//components/language/core/browser",
     "//components/machine_intelligence",
     "//components/machine_intelligence/proto",
     "//components/metrics/proto",
diff --git a/components/translate/core/browser/translate_manager.cc b/components/translate/core/browser/translate_manager.cc
index 5292f00..fc976e83 100644
--- a/components/translate/core/browser/translate_manager.cc
+++ b/components/translate/core/browser/translate_manager.cc
@@ -15,6 +15,7 @@
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
 #include "base/time/time.h"
+#include "components/language/core/browser/language_model.h"
 #include "components/metrics/proto/translate_event.pb.h"
 #include "components/prefs/pref_service.h"
 #include "components/translate/core/browser/language_state.h"
@@ -475,28 +476,41 @@
 }
 
 // static
-std::string TranslateManager::GetTargetLanguage(const TranslatePrefs* prefs) {
-  // Get target language from ULP if the ULP experiment is enabled.
-  std::string language = TranslateManager::GetTargetLanguageFromULP(prefs);
-  if (!language.empty())
-    return language;
+std::string TranslateManager::GetTargetLanguage(
+    const TranslatePrefs* prefs,
+    language::LanguageModel* language_model) {
+  if (language_model) {
+    // Use the first language from the model that translate supports.
+    for (const auto& lang : language_model->GetLanguages()) {
+      std::string lang_code =
+          TranslateDownloadManager::GetLanguageCode(lang.lang_code);
+      translate::ToTranslateLanguageSynonym(&lang_code);
+      if (TranslateDownloadManager::IsSupportedLanguage(lang_code))
+        return lang_code;
+    }
+  } else {
+    // Get target language from ULP if the ULP experiment is enabled.
+    std::string language = TranslateManager::GetTargetLanguageFromULP(prefs);
+    if (!language.empty())
+      return language;
 
-  // Get the browser's user interface language.
-  language = TranslateDownloadManager::GetLanguageCode(
-      TranslateDownloadManager::GetInstance()->application_locale());
-  // Map 'he', 'nb', 'fil' back to 'iw', 'no', 'tl'
-  translate::ToTranslateLanguageSynonym(&language);
-  if (TranslateDownloadManager::IsSupportedLanguage(language))
-    return language;
+    // Get the browser's user interface language.
+    language = TranslateDownloadManager::GetLanguageCode(
+        TranslateDownloadManager::GetInstance()->application_locale());
+    // Map 'he', 'nb', 'fil' back to 'iw', 'no', 'tl'
+    translate::ToTranslateLanguageSynonym(&language);
+    if (TranslateDownloadManager::IsSupportedLanguage(language))
+      return language;
 
-  // Will translate to the first supported language on the Accepted Language
-  // list or not at all if no such candidate exists.
-  std::vector<std::string> accept_languages_list;
-  prefs->GetLanguageList(&accept_languages_list);
-  for (const auto& lang : accept_languages_list) {
-    std::string lang_code = TranslateDownloadManager::GetLanguageCode(lang);
-    if (TranslateDownloadManager::IsSupportedLanguage(lang_code))
-      return lang_code;
+    // Will translate to the first supported language on the Accepted Language
+    // list or not at all if no such candidate exists.
+    std::vector<std::string> accept_languages_list;
+    prefs->GetLanguageList(&accept_languages_list);
+    for (const auto& lang : accept_languages_list) {
+      std::string lang_code = TranslateDownloadManager::GetLanguageCode(lang);
+      if (TranslateDownloadManager::IsSupportedLanguage(lang_code))
+        return lang_code;
+    }
   }
 
   return std::string();
diff --git a/components/translate/core/browser/translate_manager.h b/components/translate/core/browser/translate_manager.h
index daf58a5..02b9073c 100644
--- a/components/translate/core/browser/translate_manager.h
+++ b/components/translate/core/browser/translate_manager.h
@@ -18,9 +18,13 @@
 #include "components/translate/core/browser/language_state.h"
 #include "components/translate/core/common/translate_errors.h"
 
+namespace language {
+class LanguageModel;
+}  // namespace language
+
 namespace metrics {
 class TranslateEventProto;
-}
+}  // namespace metrics
 
 namespace translate {
 
@@ -65,14 +69,21 @@
     return translate_event_.get();
   }
 
-  // Returns the language to translate to. The language returned is the
-  // first language found in the following list that is supported by the
-  // translation service:
+  // Returns the language to translate to.
+  //
+  // If provided a language model, returns the first language from the model
+  // that is supported by the translation service.
+  //
+  // Otherwise, returns the first language found in the following list that is
+  // supported by the translation service:
   //     High confidence and high probability reading language in ULP
   //     the UI language
   //     the accept-language list
+  //
   // If no language is found then an empty string is returned.
-  static std::string GetTargetLanguage(const TranslatePrefs* prefs);
+  static std::string GetTargetLanguage(
+      const TranslatePrefs* prefs,
+      language::LanguageModel* language_model = nullptr);
 
   // Returns the language to automatically translate to. |original_language| is
   // the webpage's original language.
diff --git a/components/translate/core/browser/translate_manager_unittest.cc b/components/translate/core/browser/translate_manager_unittest.cc
index dfc4a0d6..f15f3ca 100644
--- a/components/translate/core/browser/translate_manager_unittest.cc
+++ b/components/translate/core/browser/translate_manager_unittest.cc
@@ -13,6 +13,7 @@
 #include "base/test/scoped_feature_list.h"
 #include "build/build_config.h"
 #include "components/infobars/core/infobar.h"
+#include "components/language/core/browser/language_model.h"
 #include "components/metrics/proto/translate_event.pb.h"
 #include "components/pref_registry/pref_registry_syncable.h"
 #include "components/sync_preferences/testing_pref_service_syncable.h"
@@ -89,6 +90,14 @@
           arg.event_type() == tep.event_type());
 }
 
+// A language model that just returns its instance variable.
+class MockLanguageModel : public language::LanguageModel {
+ public:
+  std::vector<LanguageDetails> GetLanguages() override { return details; }
+
+  std::vector<LanguageDetails> details;
+};
+
 }  // namespace
 
 namespace testing {
@@ -265,31 +274,57 @@
   EXPECT_EQ("no", TranslateManager::GetTargetLanguage(&translate_prefs_));
 }
 
-// If the application locale's language is not supported, the target language
-// falls back to the first supported language in |accept_languages_list|. If
-// none of the languages in |accept_language_list| is supported, the target
-// language is empty.
-TEST_F(TranslateManagerTest, GetTargetLanguageAcceptLangFallback) {
-  std::vector<std::string> accept_language_list;
+// Test that the language model is used if provided.
+TEST_F(TranslateManagerTest, GetTargetLanguageFromModel) {
+  MockLanguageModel mock_language_model;
 
-  // Ensure locale is set to a not-supported language.
-  ASSERT_FALSE(TranslateDownloadManager::IsSupportedLanguage("xy"));
-  manager_->set_application_locale("xy");
-
-  // Default return is empty string.
-  EXPECT_EQ("", TranslateManager::GetTargetLanguage(&translate_prefs_));
-
-  // Unsupported languages still result in the empty string.
-  ASSERT_FALSE(TranslateDownloadManager::IsSupportedLanguage("zy"));
-  accept_language_list.push_back("zy");
-  translate_prefs_.UpdateLanguageList(accept_language_list);
-  EXPECT_EQ("", TranslateManager::GetTargetLanguage(&translate_prefs_));
-
-  // First supported language is the fallback language.
+  // Try with a single, supported language.
   ASSERT_TRUE(TranslateDownloadManager::IsSupportedLanguage("en"));
-  accept_language_list.push_back("en");
-  translate_prefs_.UpdateLanguageList(accept_language_list);
-  EXPECT_EQ("en", TranslateManager::GetTargetLanguage(&translate_prefs_));
+  mock_language_model.details = {MockLanguageModel::LanguageDetails("en", 1.0)};
+  EXPECT_EQ("en",
+            TranslateManager::GetTargetLanguage(nullptr, &mock_language_model));
+
+  // Try with two supported languages.
+  ASSERT_TRUE(TranslateDownloadManager::IsSupportedLanguage("de"));
+  mock_language_model.details = {MockLanguageModel::LanguageDetails("de", 1.0),
+                                 MockLanguageModel::LanguageDetails("en", 0.5)};
+  EXPECT_EQ("de",
+            TranslateManager::GetTargetLanguage(nullptr, &mock_language_model));
+
+  // Try with first supported language lower in the list.
+  ASSERT_FALSE(TranslateDownloadManager::IsSupportedLanguage("xx"));
+  mock_language_model.details = {MockLanguageModel::LanguageDetails("xx", 1.0),
+                                 MockLanguageModel::LanguageDetails("en", 0.5)};
+  EXPECT_EQ("en",
+            TranslateManager::GetTargetLanguage(nullptr, &mock_language_model));
+
+  // Try with no supported languages.
+  ASSERT_FALSE(TranslateDownloadManager::IsSupportedLanguage("yy"));
+  mock_language_model.details = {MockLanguageModel::LanguageDetails("xx", 1.0),
+                                 MockLanguageModel::LanguageDetails("yy", 0.5)};
+  EXPECT_EQ("",
+            TranslateManager::GetTargetLanguage(nullptr, &mock_language_model));
+
+  // Try non standard codes.
+  // 'he', 'fil', 'nb' => 'iw', 'tl', 'no'
+  ASSERT_TRUE(TranslateDownloadManager::IsSupportedLanguage("iw"));
+  ASSERT_FALSE(TranslateDownloadManager::IsSupportedLanguage("he"));
+  mock_language_model.details = {MockLanguageModel::LanguageDetails("he", 1.0)};
+  EXPECT_EQ("iw",
+            TranslateManager::GetTargetLanguage(nullptr, &mock_language_model));
+
+  ASSERT_TRUE(TranslateDownloadManager::IsSupportedLanguage("tl"));
+  ASSERT_FALSE(TranslateDownloadManager::IsSupportedLanguage("fil"));
+  mock_language_model.details = {
+      MockLanguageModel::LanguageDetails("fil", 1.0)};
+  EXPECT_EQ("tl",
+            TranslateManager::GetTargetLanguage(nullptr, &mock_language_model));
+
+  ASSERT_TRUE(TranslateDownloadManager::IsSupportedLanguage("no"));
+  ASSERT_FALSE(TranslateDownloadManager::IsSupportedLanguage("nb"));
+  mock_language_model.details = {MockLanguageModel::LanguageDetails("nb", 1.0)};
+  EXPECT_EQ("no",
+            TranslateManager::GetTargetLanguage(nullptr, &mock_language_model));
 }
 
 TEST_F(TranslateManagerTest, DontTranslateOffline) {
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index 740f8d3..3c32adb7 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.cc
@@ -49,6 +49,7 @@
 // certificate |cert|, and if so, logs a console warning in |web_contents|.
 void MaybeLogLegacySymantecWarning(
     const LoadCommittedDetails& details,
+    const scoped_refptr<net::X509Certificate>& cert,
     const net::HashValueVector& public_key_hashes,
     content::WebContents* web_contents) {
   // No need to log on same-page navigations, because the message would be
@@ -57,13 +58,21 @@
     return;
   if (!net::IsLegacySymantecCert(public_key_hashes))
     return;
+  std::string content_client_message;
+  GURL url = details.entry->GetURL();
+  bool message_overridden =
+      GetContentClient()->browser()->OverrideLegacySymantecCertConsoleMessage(
+          url, cert, &content_client_message);
   web_contents->GetMainFrame()->AddMessageToConsole(
       CONSOLE_MESSAGE_LEVEL_WARNING,
-      "The certificate used to load " + details.entry->GetURL().spec() +
-          " uses an SSL certificate that will be distrusted in an upcoming "
-          "release of Chrome. Once distrusted, users will be prevented from "
-          "loading this resource. See https://g.co/chrome/symantecpkicerts for "
-          "more information.");
+      message_overridden ? content_client_message
+                         : "The certificate used to load " + url.spec() +
+                               " uses an SSL certificate that will be "
+                               "distrusted in the future. "
+                               "Once distrusted, users will be prevented from "
+                               "loading this resource. See "
+                               "https://g.co/chrome/symantecpkicerts for "
+                               "more information.");
 }
 
 void OnAllowCertificateWithRecordDecision(
@@ -218,7 +227,8 @@
   int add_content_status_flags = 0;
   int remove_content_status_flags = 0;
 
-  MaybeLogLegacySymantecWarning(details, entry->GetSSL().public_key_hashes,
+  MaybeLogLegacySymantecWarning(details, entry->GetSSL().certificate,
+                                entry->GetSSL().public_key_hashes,
                                 controller_->delegate()->GetWebContents());
 
   if (!details.is_main_frame) {
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index fda157fa..3b5f1b51 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -507,4 +507,11 @@
   return network_context;
 }
 
+bool ContentBrowserClient::OverrideLegacySymantecCertConsoleMessage(
+    const GURL& url,
+    const scoped_refptr<net::X509Certificate>& cert,
+    std::string* console_messsage) {
+  return false;
+}
+
 }  // namespace content
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index ec1019e..4734a72 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -850,6 +850,17 @@
       BrowserContext* context,
       bool in_memory,
       const base::FilePath& relative_partition_path);
+
+  // Called when a main-frame navigation to |url| commits using a legacy
+  // Symantec certificate that will be distrusted in future. Allows the embedder
+  // to override the message that is added to the console to inform developers
+  // that their certificate will be distrusted in future. If the method returns
+  // true, then |*console_message| will be printed to the console; otherwise a
+  // generic mesage will be used.
+  virtual bool OverrideLegacySymantecCertConsoleMessage(
+      const GURL& url,
+      const scoped_refptr<net::X509Certificate>& cert,
+      std::string* console_messsage);
 };
 
 }  // namespace content
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 3567bc8c..942d9c8 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -5378,9 +5378,16 @@
   // If we didn't call didFailProvisionalLoad or there wasn't a
   // GetProvisionalDocumentLoader(), LoadNavigationErrorPage wasn't called, so
   // do it now.
+  // Note: the load of the error page can result in this frame being removed.
+  // Use a WeakPtr as an easy way to detect whether this has occured. If so,
+  // this method should return immediately and not touch any part of the object,
+  // otherwise it will result in a use-after-free bug.
   if (request_params.nav_entry_id != 0 || !had_provisional_document_loader) {
+    base::WeakPtr<RenderFrameImpl> weak_this = weak_factory_.GetWeakPtr();
     LoadNavigationErrorPage(failed_request, error, replace,
                             history_entry.get());
+    if (!weak_this)
+      return;
   }
 
   browser_side_navigation_pending_ = false;
diff --git a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc
index 9b6c50b..1aa04976 100644
--- a/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc
+++ b/content/renderer/service_worker/web_service_worker_installed_scripts_manager_impl.cc
@@ -163,8 +163,6 @@
     // script_container_->Wait() will return false if the script hasn't been
     // added yet.
     script_container_->OnAllDataAddedOnIOThread();
-    // Temporary for debugging https://crbug.com/760427.
-    CHECK(running_receivers_.empty());
   }
 
   // Implements mojom::ServiceWorkerInstalledScriptsManager.
diff --git a/headless/lib/headless_web_contents_browsertest.cc b/headless/lib/headless_web_contents_browsertest.cc
index 59ddf9d..ed3e323 100644
--- a/headless/lib/headless_web_contents_browsertest.cc
+++ b/headless/lib/headless_web_contents_browsertest.cc
@@ -994,7 +994,8 @@
   TestInMemoryProtocolHandler* http_handler_;  // NOT OWNED
 };
 
-class DisableResourceSchedulerTest : public ResourceSchedulerTest {
+// TODO(alexclarke): Fix the flakes. http://crbug.com/766884
+class DISABLED_DisableResourceSchedulerTest : public ResourceSchedulerTest {
  public:
   bool GetEnableResourceScheduler() override { return false; }
 
@@ -1005,7 +1006,7 @@
   }
 };
 
-HEADLESS_ASYNC_DEVTOOLED_TEST_F(DisableResourceSchedulerTest);
+HEADLESS_ASYNC_DEVTOOLED_TEST_F(DISABLED_DisableResourceSchedulerTest);
 
 class EnableResourceSchedulerTest : public ResourceSchedulerTest {
  public:
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm
index c62937d..4cda094 100644
--- a/ios/chrome/app/main_controller.mm
+++ b/ios/chrome/app/main_controller.mm
@@ -350,6 +350,10 @@
 @property(nonatomic, readwrite)
     NTPTabOpeningPostOpeningAction NTPActionAfterTabSwitcherDismissal;
 
+// Activates browsing and enables web views if |enabled| is YES.
+// Disables browsing and purges web views if |enabled| is NO.
+// Must be called only on the main thread.
+- (void)setWebUsageEnabled:(BOOL)enabled;
 // Activates |mainBVC| and |otrBVC| and sets |currentBVC| as primary iff
 // |currentBVC| can be made active.
 - (void)activateBVCAndMakeCurrentBVCPrimary;
@@ -820,6 +824,16 @@
   return _browsingDataRemovalController;
 }
 
+- (void)setWebUsageEnabled:(BOOL)enabled {
+  DCHECK([NSThread isMainThread]);
+  if (enabled) {
+    [self activateBVCAndMakeCurrentBVCPrimary];
+  } else {
+    [self.mainBVC setActive:NO];
+    [self.otrBVC setActive:NO];
+  }
+}
+
 - (void)activateBVCAndMakeCurrentBVCPrimary {
   // If there are pending removal operations, the activation will be deferred
   // until the callback for |removeBrowsingDataFromBrowserState:| is received.
@@ -1932,8 +1946,13 @@
                                       mask:(int)mask
                                 timePeriod:(browsing_data::TimePeriod)timePeriod
                          completionHandler:(ProceduralBlock)completionHandler {
-
+  // TODO(crbug.com/632772): Remove web usage disabling once
+  // https://bugs.webkit.org/show_bug.cgi?id=149079 has been fixed.
+  if (mask & IOSChromeBrowsingDataRemover::REMOVE_SITE_DATA) {
+    [self setWebUsageEnabled:NO];
+  }
   ProceduralBlock browsingDataRemoved = ^{
+    [self setWebUsageEnabled:YES];
     if (completionHandler) {
       completionHandler();
     }
diff --git a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc
index e51732c6..d73fcc6 100644
--- a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc
+++ b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc
@@ -133,7 +133,8 @@
           chrome_browser_state);
   std::unique_ptr<ntp_snippets::CategoryRanker> category_ranker =
       ntp_snippets::BuildSelectedCategoryRanker(
-          prefs, base::MakeUnique<base::DefaultClock>());
+          prefs, base::MakeUnique<base::DefaultClock>(),
+          /*is_chrome_home_enabled=*/false);
   std::unique_ptr<ContentSuggestionsService> service =
       base::MakeUnique<ContentSuggestionsService>(
           State::ENABLED, signin_manager, history_service, large_icon_service,
diff --git a/ios/chrome/browser/ui/bookmarks/bars/bookmark_context_bar.mm b/ios/chrome/browser/ui/bookmarks/bars/bookmark_context_bar.mm
index 3d86fc41..b7459441 100644
--- a/ios/chrome/browser/ui/bookmarks/bars/bookmark_context_bar.mm
+++ b/ios/chrome/browser/ui/bookmarks/bars/bookmark_context_bar.mm
@@ -6,6 +6,7 @@
 #include "base/logging.h"
 #include "ios/chrome/browser/ui/rtl_geometry.h"
 #import "ios/chrome/browser/ui/uikit_ui_util.h"
+#import "ios/chrome/browser/ui/util/constraints_ui_util.h"
 #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
 #import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
 #include "ui/base/l10n/l10n_util_mac.h"
@@ -16,9 +17,11 @@
 
 namespace {
 // Shadow opacity for the BookmarkContextBar.
-CGFloat kShadowOpacity = 0.2f;
+const CGFloat kShadowOpacity = 0.2f;
 // Horizontal margin for the contents of BookmarkContextBar.
-CGFloat kHorizontalMargin = 8.0f;
+const CGFloat kHorizontalMargin = 8.0f;
+// Height of the part of the toolbar containing content.
+const CGFloat kToolbarHeight = 48.0f;
 }  // namespace
 
 @interface BookmarkContextBar () {
@@ -129,16 +132,26 @@
     [self addSubview:_stackView];
     _stackView.translatesAutoresizingMaskIntoConstraints = NO;
     _stackView.layoutMarginsRelativeArrangement = YES;
-    [NSLayoutConstraint activateConstraints:@[
-      [_stackView.layoutMarginsGuide.leadingAnchor
-          constraintEqualToAnchor:self.leadingAnchor
-                         constant:kHorizontalMargin],
-      [_stackView.layoutMarginsGuide.trailingAnchor
-          constraintEqualToAnchor:self.trailingAnchor
-                         constant:-kHorizontalMargin],
-      [_stackView.topAnchor constraintEqualToAnchor:self.topAnchor],
-      [_stackView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
-    ]];
+    if (@available(iOS 11.0, *)) {
+      [NSLayoutConstraint activateConstraints:@[
+        [self.safeAreaLayoutGuide.topAnchor
+            constraintEqualToAnchor:_stackView.topAnchor],
+        [self.safeAreaLayoutGuide.leadingAnchor
+            constraintEqualToAnchor:_stackView.leadingAnchor],
+        [self.safeAreaLayoutGuide.trailingAnchor
+            constraintEqualToAnchor:_stackView.trailingAnchor],
+        [self.safeAreaLayoutGuide.bottomAnchor
+            constraintEqualToAnchor:_stackView.bottomAnchor],
+      ]];
+    } else {
+      AddSameConstraints(_stackView, self);
+    }
+    [_stackView.heightAnchor constraintEqualToConstant:kToolbarHeight].active =
+        YES;
+
+    _stackView.layoutMarginsRelativeArrangement = YES;
+    _stackView.layoutMargins =
+        UIEdgeInsetsMake(0, kHorizontalMargin, 0, kHorizontalMargin);
 
     [self setBackgroundColor:[UIColor whiteColor]];
     [[self layer] setShadowOpacity:kShadowOpacity];
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
index 91124a36..b13b2fd2 100644
--- a/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
+++ b/ios/chrome/browser/ui/bookmarks/bookmark_home_view_controller.mm
@@ -1186,7 +1186,7 @@
         @"topGuide" : self.topLayoutGuide,
       };
       NSArray* constraints = @[
-        @"V:|[topGuide][tableView][contextBar(==48)]|",
+        @"V:|[topGuide][tableView][contextBar]|",
         @"H:|[tableView]|",
         @"H:|[contextBar]|",
       ];
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
index a24eb4b..da7d7d3 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_egtest.mm
@@ -134,6 +134,13 @@
 
 + (void)setUp {
   [super setUp];
+  if (IsIPadIdiom()) {
+    // Make sure we are on the Home panel on iPad.
+    chrome_test_util::OpenNewTab();
+    [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
+        performAction:grey_typeText(@"chrome://newtab/#most_visited\n")];
+  }
+
   [self closeAllTabs];
   ios::ChromeBrowserState* browserState =
       chrome_test_util::GetOriginalBrowserState();
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
index 6a902e66..9dcae0d9 100644
--- a/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_egtest.mm
@@ -82,7 +82,14 @@
 @implementation NTPHomeTestCase
 
 + (void)setUp {
-  [super setUp];
+  if (IsIPadIdiom()) {
+    [super setUp];
+    // Make sure we are on the Home panel on iPad.
+    chrome_test_util::OpenNewTab();
+    [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
+        performAction:grey_typeText(@"chrome://newtab/#most_visited\n")];
+  }
+
   [self closeAllTabs];
   ios::ChromeBrowserState* browserState =
       chrome_test_util::GetOriginalBrowserState();
@@ -268,9 +275,6 @@
 
 // Tests that the promo is correctly displayed and removed once tapped.
 - (void)testPromoTap {
-  // TODO(crbug.com/767095): Enable this test.
-  EARL_GREY_TEST_DISABLED(@"Test disabled.");
-
   // Setup the promo.
   NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
   [defaults setInteger:experimental_flags::WHATS_NEW_APP_RATING
@@ -302,9 +306,6 @@
 // Tests that the position of the collection view is restored when navigating
 // back to the NTP.
 - (void)testPositionRestored {
-  // TODO(crbug.com/767095): Enable this test.
-  EARL_GREY_TEST_DISABLED(@"Test disabled.");
-
   [self addMostVisitedTile];
 
   // Add suggestions to be able to scroll on iPad.
@@ -342,9 +343,6 @@
 // and moved up, the scroll position restored is the position before the omnibox
 // is selected.
 - (void)testPositionRestoredWithOmniboxFocused {
-  // TODO(crbug.com/767095): Enable this test.
-  EARL_GREY_TEST_DISABLED(@"Test disabled.");
-
   [self addMostVisitedTile];
 
   // Add suggestions to be able to scroll on iPad.
@@ -385,9 +383,6 @@
 
 // Tests that tapping the fake omnibox focuses the real omnibox.
 - (void)testTapFakeOmnibox {
-  // TODO(crbug.com/767095): Enable this test.
-  EARL_GREY_TEST_DISABLED(@"Test disabled.");
-
   // Setup the server.
   self.testServer->RegisterRequestHandler(base::Bind(&StandardResponse));
   GREYAssertTrue(self.testServer->Start(), @"Test server failed to start.");
@@ -405,9 +400,6 @@
 
 // Tests that tapping the fake omnibox moves the collection.
 - (void)testTapFakeOmniboxScroll {
-  // TODO(crbug.com/767095): Enable this test.
-  EARL_GREY_TEST_DISABLED(@"Test disabled.");
-
   // Get the collection and its layout.
   UIView* collection = ntp_home::CollectionView();
   GREYAssertTrue([collection isKindOfClass:[UICollectionView class]],
@@ -463,9 +455,6 @@
 // Tests that tapping the fake omnibox then unfocusing it moves the collection
 // back to where it was.
 - (void)testTapFakeOmniboxScrollScrolled {
-  // TODO(crbug.com/767095): Enable this test.
-  EARL_GREY_TEST_DISABLED(@"Test disabled.");
-
   // Get the collection and its layout.
   UIView* collection = ntp_home::CollectionView();
   GREYAssertTrue([collection isKindOfClass:[UICollectionView class]],
diff --git a/ios/chrome/test/perf/BUILD.gn b/ios/chrome/test/perf/BUILD.gn
index 445c761..93723b00 100644
--- a/ios/chrome/test/perf/BUILD.gn
+++ b/ios/chrome/test/perf/BUILD.gn
@@ -6,7 +6,7 @@
   configs += [ "//build/config/compiler:enable_arc" ]
   testonly = true
   sources = [
-    "chrome_perf_egtests.mm",
+    "chrome_perf_egtest.mm",
   ]
   deps = [
     "//ios/chrome/test/app:test_support",
diff --git a/ios/chrome/test/perf/chrome_perf_egtests.mm b/ios/chrome/test/perf/chrome_perf_egtest.mm
similarity index 100%
rename from ios/chrome/test/perf/chrome_perf_egtests.mm
rename to ios/chrome/test/perf/chrome_perf_egtest.mm
diff --git a/ios/clean/chrome/test/perf/BUILD.gn b/ios/clean/chrome/test/perf/BUILD.gn
index 60417e0..0ead211c 100644
--- a/ios/clean/chrome/test/perf/BUILD.gn
+++ b/ios/clean/chrome/test/perf/BUILD.gn
@@ -43,7 +43,7 @@
   info_plist_target = ":info_plist"
 
   sources = [
-    "startup_egtests.mm",
+    "startup_egtest.mm",
   ]
 
   deps = [
diff --git a/ios/clean/chrome/test/perf/startup_egtests.mm b/ios/clean/chrome/test/perf/startup_egtest.mm
similarity index 100%
rename from ios/clean/chrome/test/perf/startup_egtests.mm
rename to ios/clean/chrome/test/perf/startup_egtest.mm
diff --git a/ios/web/public/test/crw_mock_web_state_delegate.h b/ios/web/public/test/crw_mock_web_state_delegate.h
index cd01a22d..e4273095 100644
--- a/ios/web/public/test/crw_mock_web_state_delegate.h
+++ b/ios/web/public/test/crw_mock_web_state_delegate.h
@@ -32,6 +32,20 @@
 // Whether |webState:didRequestHTTPAuthForProtectionSpace:...| has been called
 // or not.
 @property(nonatomic, readonly) BOOL authenticationRequested;
+// Specifies the return value of |webState:shouldPreviewLinkWithURL:|.
+@property(nonatomic) BOOL shouldPreviewLinkWithURLReturnValue;
+// linkURL received in |webState:shouldPreviewLinkWithURL:| and
+// |webState:previewingViewControllerForLinkWithURL:| calls.
+@property(nonatomic, readonly) GURL linkURL;
+// Specifies the return value of
+// |webState:previewingViewControllerForLinkWithURL:|.
+@property(nonatomic)
+    UIViewController* previewingViewControllerForLinkWithURLReturnValue;
+// previewingViewController received in
+// |webState:commitPreviewingViewController:| call.
+@property(nonatomic, readonly) UIViewController* previewingViewController;
+// Whether |webState:commitPreviewingViewController:| has been called or not.
+@property(nonatomic, readonly) BOOL commitPreviewingViewControllerRequested;
 
 @end
 
diff --git a/ios/web/public/test/crw_mock_web_state_delegate.mm b/ios/web/public/test/crw_mock_web_state_delegate.mm
index e5b80f30..21eeae2 100644
--- a/ios/web/public/test/crw_mock_web_state_delegate.mm
+++ b/ios/web/public/test/crw_mock_web_state_delegate.mm
@@ -25,6 +25,14 @@
 @synthesize webStateClosingRequested = _webStateClosingRequested;
 @synthesize repostFormWarningRequested = _repostFormWarningRequested;
 @synthesize authenticationRequested = _authenticationRequested;
+@synthesize shouldPreviewLinkWithURLReturnValue =
+    _shouldPreviewLinkWithURLReturnValue;
+@synthesize linkURL = _linkURL;
+@synthesize previewingViewControllerForLinkWithURLReturnValue =
+    _previewingViewControllerForLinkWithURLReturnValue;
+@synthesize previewingViewController = _previewingViewController;
+@synthesize commitPreviewingViewControllerRequested =
+    _commitPreviewingViewControllerRequested;
 
 - (web::WebState*)webState:(web::WebState*)webState
     createNewWebStateForURL:(const GURL&)URL
@@ -87,4 +95,25 @@
   return _javaScriptDialogPresenterRequested;
 }
 
+- (BOOL)webState:(web::WebState*)webState
+    shouldPreviewLinkWithURL:(const GURL&)linkURL {
+  _webState = webState;
+  _linkURL = linkURL;
+  return _shouldPreviewLinkWithURLReturnValue;
+}
+
+- (UIViewController*)webState:(web::WebState*)webState
+    previewingViewControllerForLinkWithURL:(const GURL&)linkURL {
+  _webState = webState;
+  _linkURL = linkURL;
+  return _previewingViewControllerForLinkWithURLReturnValue;
+}
+
+- (void)webState:(web::WebState*)webState
+    commitPreviewingViewController:(UIViewController*)previewingViewController {
+  _webState = webState;
+  _previewingViewController = previewingViewController;
+  _commitPreviewingViewControllerRequested = YES;
+}
+
 @end
diff --git a/ios/web/public/test/fakes/test_web_state_delegate.h b/ios/web/public/test/fakes/test_web_state_delegate.h
index bf11900e..3902d16 100644
--- a/ios/web/public/test/fakes/test_web_state_delegate.h
+++ b/ios/web/public/test/fakes/test_web_state_delegate.h
@@ -90,6 +90,12 @@
                       NSURLProtectionSpace* protection_space,
                       NSURLCredential* proposed_credential,
                       const AuthCallback& callback) override;
+  bool ShouldPreviewLink(WebState* source, const GURL& link_url) override;
+  UIViewController* GetPreviewingViewController(WebState* source,
+                                                const GURL& link_url) override;
+  void CommitPreviewingViewController(
+      WebState* source,
+      UIViewController* previewing_view_controller) override;
 
   // Allows popups requested by a page with |opener_url|.
   void allow_popups(const GURL& opener_url) {
@@ -146,6 +152,37 @@
     last_authentication_request_.reset();
   }
 
+  // Returns the last link URL passed to |ShouldPreviewLink| or
+  // |GetPreviewingViewController|.
+  GURL last_link_url() const { return last_link_url_; }
+
+  // Clears the last link URL passed to |ShouldPreviewLink| or
+  // |GetPreviewingViewController|.
+  void ClearLastLinkURL() { last_link_url_ = GURL(); }
+
+  // Sets the return value of |ShouldPreviewLink|.
+  void SetShouldPreviewLink(bool should_preview_link) {
+    should_preview_link_ = should_preview_link;
+  }
+
+  // Sets the return value of |GetPreviewingViewController|.
+  void SetPreviewingViewController(
+      UIViewController* previewing_view_controller) {
+    previewing_view_controller_ = previewing_view_controller;
+  }
+
+  // Returns the last previewing view controller passed to
+  // |CommitPreviewingViewController|.
+  UIViewController* last_previewing_view_controller() const {
+    return last_previewing_view_controller_;
+  }
+
+  // Clears the last previewing view controller passed to
+  // |CommitPreviewingViewController|.
+  void ClearLastPreviewingViewController() {
+    last_previewing_view_controller_ = nil;
+  }
+
  private:
   std::vector<std::unique_ptr<WebState>> child_windows_;
   // WebStates that were closed via |CloseWebState| callback.
@@ -162,6 +199,10 @@
   bool get_java_script_dialog_presenter_called_ = false;
   TestJavaScriptDialogPresenter java_script_dialog_presenter_;
   std::unique_ptr<TestAuthenticationRequest> last_authentication_request_;
+  GURL last_link_url_;
+  bool should_preview_link_ = false;
+  UIViewController* previewing_view_controller_ = nil;
+  UIViewController* last_previewing_view_controller_ = nil;
 };
 
 }  // namespace web
diff --git a/ios/web/public/test/fakes/test_web_state_delegate.mm b/ios/web/public/test/fakes/test_web_state_delegate.mm
index 4fff4b5..251232bb 100644
--- a/ios/web/public/test/fakes/test_web_state_delegate.mm
+++ b/ios/web/public/test/fakes/test_web_state_delegate.mm
@@ -126,4 +126,23 @@
   last_authentication_request_->auth_callback = callback;
 }
 
+bool TestWebStateDelegate::ShouldPreviewLink(WebState* source,
+                                             const GURL& link_url) {
+  last_link_url_ = link_url;
+  return should_preview_link_;
+}
+
+UIViewController* TestWebStateDelegate::GetPreviewingViewController(
+    WebState* source,
+    const GURL& link_url) {
+  last_link_url_ = link_url;
+  return previewing_view_controller_;
+}
+
+void TestWebStateDelegate::CommitPreviewingViewController(
+    WebState* source,
+    UIViewController* previewing_view_controller) {
+  last_previewing_view_controller_ = previewing_view_controller;
+}
+
 }  // namespace web
diff --git a/ios/web/public/web_state/web_state_delegate.h b/ios/web/public/web_state/web_state_delegate.h
index 7a17190b..ce8615c 100644
--- a/ios/web/public/web_state/web_state_delegate.h
+++ b/ios/web/public/web_state/web_state_delegate.h
@@ -12,6 +12,8 @@
 #include "base/callback.h"
 #import "ios/web/public/web_state/web_state.h"
 
+@class UIViewController;
+
 namespace web {
 
 struct ContextMenuParams;
@@ -72,6 +74,21 @@
                               NSURLCredential* proposed_credential,
                               const AuthCallback& callback) = 0;
 
+  // Determines whether the given link with |link_url| should show a preview on
+  // force touch.
+  virtual bool ShouldPreviewLink(WebState* source, const GURL& link_url);
+  // Called when the user performs a peek action on a link with |link_url| with
+  // force touch. Returns a view controller shown as a pop-up. Uses Webkit's
+  // default preview behavior when it returns nil.
+  virtual UIViewController* GetPreviewingViewController(WebState* source,
+                                                        const GURL& link_url);
+  // Called when the user performs a pop action on the preview on force touch.
+  // |previewing_view_controller| is the view controller that is popped.
+  // It should display |previewing_view_controller| inside the app.
+  virtual void CommitPreviewingViewController(
+      WebState* source,
+      UIViewController* previewing_view_controller);
+
  protected:
   virtual ~WebStateDelegate();
 
diff --git a/ios/web/public/web_state/web_state_delegate_bridge.h b/ios/web/public/web_state/web_state_delegate_bridge.h
index 7add0ba..fccb073 100644
--- a/ios/web/public/web_state/web_state_delegate_bridge.h
+++ b/ios/web/public/web_state/web_state_delegate_bridge.h
@@ -9,6 +9,8 @@
 
 #import "ios/web/public/web_state/web_state_delegate.h"
 
+@class UIViewController;
+
 // Objective-C interface for web::WebStateDelegate.
 @protocol CRWWebStateDelegate<NSObject>
 @optional
@@ -58,6 +60,24 @@
                       proposedCredential:(NSURLCredential*)proposedCredential
                        completionHandler:(void (^)(NSString* username,
                                                    NSString* password))handler;
+
+// Determines whether the given link with |linkURL| should show a preview on
+// force touch.
+- (BOOL)webState:(web::WebState*)webState
+    shouldPreviewLinkWithURL:(const GURL&)linkURL;
+
+// Called when the user performs a peek action on a link with |linkURL| with
+// force touch. Returns a view controller shown as a pop-up. Uses Webkit's
+// default preview behavior when it returns nil.
+- (UIViewController*)webState:(web::WebState*)webState
+    previewingViewControllerForLinkWithURL:(const GURL&)linkURL;
+
+// Called when the user performs a pop action on the preview on force touch.
+// |previewing_view_controller| is the view controller that is popped.
+// It should display |previewingViewController| inside the app.
+- (void)webState:(web::WebState*)webState
+    commitPreviewingViewController:(UIViewController*)previewingViewController;
+
 @end
 
 namespace web {
@@ -87,6 +107,12 @@
                       NSURLProtectionSpace* protection_space,
                       NSURLCredential* proposed_credential,
                       const AuthCallback& callback) override;
+  bool ShouldPreviewLink(WebState* web_state, const GURL& link_url) override;
+  UIViewController* GetPreviewingViewController(WebState* source,
+                                                const GURL& link_url) override;
+  void CommitPreviewingViewController(
+      WebState* source,
+      UIViewController* previewing_view_controller) override;
 
  private:
   // CRWWebStateDelegate which receives forwarded calls.
diff --git a/ios/web/web_state/js/context_menu_js_unittest.mm b/ios/web/web_state/js/context_menu_js_unittest.mm
index 0c5b3c4..fe44539 100644
--- a/ios/web/web_state/js/context_menu_js_unittest.mm
+++ b/ios/web/web_state/js/context_menu_js_unittest.mm
@@ -8,6 +8,7 @@
 #import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
 
+#include "base/ios/ios_util.h"
 #include "base/macros.h"
 #include "base/strings/stringprintf.h"
 #import "ios/web/public/test/web_test_with_web_state.h"
@@ -90,6 +91,14 @@
 
 // Tests that __gCrWeb.getElementFromPoint function returns correct src.
 TEST_F(ContextMenuJsTest, GetImageUrlAtPoint) {
+// TODO(crbug.com/767339): This is extremely flaky on iPhone device with iOS 11.
+// Fix it and reenable it.
+#if !TARGET_IPHONE_SIMULATOR
+  if (base::ios::IsRunningOnIOS11OrLater()) {
+    return;
+  }
+#endif
+
   NSString* html =
       @"<img id='foo' style='width:200;height:200;' src='file:///bogus'/>";
   NSDictionary* expected_value = @{
@@ -126,6 +135,13 @@
 }
 
 TEST_F(ContextMenuJsTest, TextAreaStopsProximity) {
+// TODO(crbug.com/767339): This is extremely flaky on iPhone device with iOS 11.
+// Fix it and reenable it.
+#if !TARGET_IPHONE_SIMULATOR
+  if (base::ios::IsRunningOnIOS11OrLater()) {
+    return;
+  }
+#endif
   NSString* html =
       @"<html><body style='margin-left:10px;margin-top:10px;'>"
        "<div style='width:100px;height:100px;'>"
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 30f5856c..b72f6b9 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -4179,6 +4179,26 @@
                        }];
 }
 
+- (BOOL)webView:(WKWebView*)webView
+    shouldPreviewElement:(WKPreviewElementInfo*)elementInfo {
+  return self.webStateImpl->ShouldPreviewLink(
+      net::GURLWithNSURL(elementInfo.linkURL));
+}
+
+- (UIViewController*)webView:(WKWebView*)webView
+    previewingViewControllerForElement:(WKPreviewElementInfo*)elementInfo
+                        defaultActions:
+                            (NSArray<id<WKPreviewActionItem>>*)previewActions {
+  return self.webStateImpl->GetPreviewingViewController(
+      net::GURLWithNSURL(elementInfo.linkURL));
+}
+
+- (void)webView:(WKWebView*)webView
+    commitPreviewingViewController:(UIViewController*)previewingViewController {
+  return self.webStateImpl->CommitPreviewingViewController(
+      previewingViewController);
+}
+
 #pragma mark -
 #pragma mark WKNavigationDelegate Methods
 
diff --git a/ios/web/web_state/web_state_delegate.mm b/ios/web/web_state/web_state_delegate.mm
index 5278666..1512bb6 100644
--- a/ios/web/web_state/web_state_delegate.mm
+++ b/ios/web/web_state/web_state_delegate.mm
@@ -57,6 +57,21 @@
   callback.Run(nil, nil);
 }
 
+bool WebStateDelegate::ShouldPreviewLink(WebState* source,
+                                         const GURL& link_url) {
+  return false;
+}
+
+UIViewController* WebStateDelegate::GetPreviewingViewController(
+    WebState* source,
+    const GURL& link_url) {
+  return nullptr;
+}
+
+void WebStateDelegate::CommitPreviewingViewController(
+    WebState* source,
+    UIViewController* previewing_view_controller) {}
+
 void WebStateDelegate::Attach(WebState* source) {
   DCHECK(attached_states_.find(source) == attached_states_.end());
   attached_states_.insert(source);
diff --git a/ios/web/web_state/web_state_delegate_bridge.mm b/ios/web/web_state/web_state_delegate_bridge.mm
index c18d886..8e72a11 100644
--- a/ios/web/web_state/web_state_delegate_bridge.mm
+++ b/ios/web/web_state/web_state_delegate_bridge.mm
@@ -102,4 +102,34 @@
   }
 }
 
+bool WebStateDelegateBridge::ShouldPreviewLink(WebState* source,
+                                               const GURL& link_url) {
+  if ([delegate_
+          respondsToSelector:@selector(webState:shouldPreviewLinkWithURL:)]) {
+    return [delegate_ webState:source shouldPreviewLinkWithURL:link_url];
+  }
+  return false;
+}
+
+UIViewController* WebStateDelegateBridge::GetPreviewingViewController(
+    WebState* source,
+    const GURL& link_url) {
+  if ([delegate_ respondsToSelector:@selector
+                 (webState:previewingViewControllerForLinkWithURL:)]) {
+    return [delegate_ webState:source
+        previewingViewControllerForLinkWithURL:link_url];
+  }
+  return nil;
+}
+
+void WebStateDelegateBridge::CommitPreviewingViewController(
+    WebState* source,
+    UIViewController* previewing_view_controller) {
+  if ([delegate_ respondsToSelector:@selector
+                 (webState:commitPreviewingViewController:)]) {
+    [delegate_ webState:source
+        commitPreviewingViewController:previewing_view_controller];
+  }
+}
+
 }  // web
diff --git a/ios/web/web_state/web_state_delegate_bridge_unittest.mm b/ios/web/web_state/web_state_delegate_bridge_unittest.mm
index 26308b2..79745387 100644
--- a/ios/web/web_state/web_state_delegate_bridge_unittest.mm
+++ b/ios/web/web_state/web_state_delegate_bridge_unittest.mm
@@ -47,11 +47,11 @@
   }
 
   void TearDown() override {
-    EXPECT_OCMOCK_VERIFY(delegate_);
+    EXPECT_OCMOCK_VERIFY((OCMockObject*)delegate_);
     PlatformTest::TearDown();
   }
 
-  id delegate_;
+  CRWMockWebStateDelegate* delegate_;
   id empty_delegate_;
   std::unique_ptr<WebStateDelegateBridge> bridge_;
   std::unique_ptr<WebStateDelegateBridge> empty_delegate_bridge_;
@@ -171,4 +171,49 @@
   EXPECT_EQ(&test_web_state_, [delegate_ webState]);
 }
 
+// Tests |ShouldPreviewLink| forwarding.
+TEST_F(WebStateDelegateBridgeTest, ShouldPreviewLinkWithURL) {
+  GURL link_url("http://link.test/");
+  EXPECT_FALSE(delegate_.webState);
+
+  delegate_.shouldPreviewLinkWithURLReturnValue = YES;
+  EXPECT_TRUE(bridge_->ShouldPreviewLink(&test_web_state_, link_url));
+  EXPECT_EQ(&test_web_state_, delegate_.webState);
+  EXPECT_EQ(link_url, delegate_.linkURL);
+
+  delegate_.shouldPreviewLinkWithURLReturnValue = NO;
+  EXPECT_FALSE(bridge_->ShouldPreviewLink(&test_web_state_, link_url));
+  EXPECT_EQ(&test_web_state_, delegate_.webState);
+  EXPECT_EQ(link_url, delegate_.linkURL);
+}
+
+// Tests |GetPreviewingViewController| forwarding.
+TEST_F(WebStateDelegateBridgeTest, GetPreviewingViewController) {
+  GURL link_url("http://link.test/");
+  UIViewController* previewing_view_controller =
+      OCMClassMock([UIViewController class]);
+
+  EXPECT_FALSE(delegate_.webState);
+  delegate_.previewingViewControllerForLinkWithURLReturnValue =
+      previewing_view_controller;
+  EXPECT_EQ(previewing_view_controller,
+            bridge_->GetPreviewingViewController(&test_web_state_, link_url));
+  EXPECT_EQ(&test_web_state_, delegate_.webState);
+  EXPECT_EQ(link_url, delegate_.linkURL);
+}
+
+// Tests |CommitPreviewingViewController| forwarding.
+TEST_F(WebStateDelegateBridgeTest, CommitPreviewingViewController) {
+  UIViewController* previewing_view_controller =
+      OCMClassMock([UIViewController class]);
+
+  EXPECT_FALSE(delegate_.webState);
+  EXPECT_FALSE(delegate_.previewingViewController);
+  bridge_->CommitPreviewingViewController(&test_web_state_,
+                                          previewing_view_controller);
+  EXPECT_TRUE(delegate_.commitPreviewingViewControllerRequested);
+  EXPECT_EQ(&test_web_state_, delegate_.webState);
+  EXPECT_EQ(previewing_view_controller, delegate_.previewingViewController);
+}
+
 }  // namespace web
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h
index 319bca5fb..2875261b 100644
--- a/ios/web/web_state/web_state_impl.h
+++ b/ios/web/web_state/web_state_impl.h
@@ -31,6 +31,7 @@
 @class NSURLRequest;
 @class NSURLResponse;
 @protocol CRWWebViewNavigationProxy;
+@class UIViewController;
 
 namespace net {
 class HttpResponseHeaders;
@@ -167,6 +168,19 @@
   // allowed to continue by asking its policy deciders. Defaults to true.
   bool ShouldAllowResponse(NSURLResponse* response, bool for_main_frame);
 
+  // Determines whether the given link with |link_url| should show a preview on
+  // force touch.
+  bool ShouldPreviewLink(const GURL& link_url);
+  // Called when the user performs a peek action on a link with |link_url| with
+  // force touch. Returns a view controller shown as a pop-up. Uses Webkit's
+  // default preview behavior when it returns nil.
+  UIViewController* GetPreviewingViewController(const GURL& link_url);
+  // Called when the user performs a pop action on the preview on force touch.
+  // |previewing_view_controller| is the view controller that is popped.
+  // It should display |previewing_view_controller| inside the app.
+  void CommitPreviewingViewController(
+      UIViewController* previewing_view_controller);
+
   // WebState:
   WebStateDelegate* GetDelegate() override;
   void SetDelegate(WebStateDelegate* delegate) override;
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
index c0ceb33d..a43cc33 100644
--- a/ios/web/web_state/web_state_impl.mm
+++ b/ios/web/web_state/web_state_impl.mm
@@ -512,6 +512,23 @@
   return true;
 }
 
+bool WebStateImpl::ShouldPreviewLink(const GURL& link_url) {
+  return delegate_ && delegate_->ShouldPreviewLink(this, link_url);
+}
+
+UIViewController* WebStateImpl::GetPreviewingViewController(
+    const GURL& link_url) {
+  return delegate_ ? delegate_->GetPreviewingViewController(this, link_url)
+                   : nil;
+}
+
+void WebStateImpl::CommitPreviewingViewController(
+    UIViewController* previewing_view_controller) {
+  if (delegate_) {
+    delegate_->CommitPreviewingViewController(this, previewing_view_controller);
+  }
+}
+
 #pragma mark - RequestTracker management
 
 WebStateInterfaceProvider* WebStateImpl::GetWebStateInterfaceProvider() {
diff --git a/ios/web/web_state/web_state_impl_unittest.mm b/ios/web/web_state/web_state_impl_unittest.mm
index 3f9a60b..7b68b31 100644
--- a/ios/web/web_state/web_state_impl_unittest.mm
+++ b/ios/web/web_state/web_state_impl_unittest.mm
@@ -8,6 +8,8 @@
 
 #include <memory>
 
+#import <OCMock/OCMock.h>
+
 #include "base/base64.h"
 #include "base/bind.h"
 #include "base/logging.h"
@@ -535,6 +537,32 @@
   EXPECT_EQ(delegate.last_authentication_request()->protection_space,
             protection_space);
   EXPECT_EQ(delegate.last_authentication_request()->credential, credential);
+
+  // Test that ShouldPreviewLink() is delegated correctly.
+  GURL link_url("http://link.test/");
+  delegate.SetShouldPreviewLink(false);
+  delegate.ClearLastLinkURL();
+  EXPECT_FALSE(web_state_->ShouldPreviewLink(link_url));
+  EXPECT_EQ(link_url, delegate.last_link_url());
+  delegate.SetShouldPreviewLink(true);
+  delegate.ClearLastLinkURL();
+  EXPECT_TRUE(web_state_->ShouldPreviewLink(link_url));
+  EXPECT_EQ(link_url, delegate.last_link_url());
+
+  // Test that GetPreviewingViewController() is delegated correctly.
+  UIViewController* previewing_view_controller =
+      OCMClassMock([UIViewController class]);
+  delegate.SetPreviewingViewController(previewing_view_controller);
+  delegate.ClearLastLinkURL();
+  EXPECT_EQ(previewing_view_controller,
+            web_state_->GetPreviewingViewController(link_url));
+  EXPECT_EQ(link_url, delegate.last_link_url());
+
+  // Test that CommitPreviewingViewController() is called.
+  delegate.ClearLastPreviewingViewController();
+  web_state_->CommitPreviewingViewController(previewing_view_controller);
+  EXPECT_EQ(previewing_view_controller,
+            delegate.last_previewing_view_controller());
 }
 
 // Verifies that GlobalWebStateObservers are called when expected.
diff --git a/ios/web/web_state/web_view_internal_creation_util.mm b/ios/web/web_state/web_view_internal_creation_util.mm
index 0fa0b81..595b141 100644
--- a/ios/web/web_state/web_view_internal_creation_util.mm
+++ b/ios/web/web_state/web_view_internal_creation_util.mm
@@ -57,12 +57,6 @@
   // reasonable value.
   web_view.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
 
-  // Starting in iOS10, |allowsLinkPreview| defaults to YES.  This should be
-  // disabled since the default implementation will open the link in Safari.
-  // TODO(crbug.com/622746): Remove once web// link preview implementation is
-  // created.
-  web_view.allowsLinkPreview = NO;
-
   if (context_menu_delegate) {
     CRWContextMenuController* context_menu_controller = [
         [CRWContextMenuController alloc] initWithWebView:web_view
@@ -74,6 +68,10 @@
                              OBJC_ASSOCIATION_RETAIN_NONATOMIC);
   }
 
+  // Uses the default value for |allowsLinkPreview| i.e., YES in iOS 10 or
+  // later, and NO for iOS 9 or before. But the link preview is still disabled
+  // by default on iOS 10 or later. You need to return true from
+  // web::WebStateDelegate::ShouldPreviewLink() to enable the preview.
   return web_view;
 }
 
diff --git a/ios/web_view/BUILD.gn b/ios/web_view/BUILD.gn
index 53d9af3..5c4320c 100644
--- a/ios/web_view/BUILD.gn
+++ b/ios/web_view/BUILD.gn
@@ -30,6 +30,7 @@
   "public/cwv_navigation_delegate.h",
   "public/cwv_navigation_type.h",
   "public/cwv_preferences.h",
+  "public/cwv_preview_element_info.h",
   "public/cwv_scroll_view.h",
   "public/cwv_scroll_view_delegate.h",
   "public/cwv_translation_controller.h",
@@ -56,6 +57,8 @@
   "internal/cwv_navigation_type_internal.h",
   "internal/cwv_preferences.mm",
   "internal/cwv_preferences_internal.h",
+  "internal/cwv_preview_element_info.mm",
+  "internal/cwv_preview_element_info_internal.h",
   "internal/cwv_scroll_view.mm",
   "internal/cwv_scroll_view_internal.h",
   "internal/cwv_user_content_controller.mm",
@@ -171,6 +174,7 @@
   testonly = true
   sources = [
     "internal/cwv_html_element_unittest.mm",
+    "internal/cwv_preview_element_info_unittest.mm",
   ]
   sources += ios_web_view_sources
 
diff --git a/ios/web_view/internal/cwv_preview_element_info.mm b/ios/web_view/internal/cwv_preview_element_info.mm
new file mode 100644
index 0000000..aa94500
--- /dev/null
+++ b/ios/web_view/internal/cwv_preview_element_info.mm
@@ -0,0 +1,24 @@
+// Copyright 2017 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 "ios/web_view/public/cwv_preview_element_info.h"
+#import "ios/web_view/internal/cwv_preview_element_info_internal.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@implementation CWVPreviewElementInfo
+
+@synthesize linkURL = _linkURL;
+
+- (instancetype)initWithLinkURL:(NSURL*)linkURL {
+  self = [super init];
+  if (self) {
+    _linkURL = linkURL;
+  }
+  return self;
+}
+
+@end
diff --git a/ios/web_view/internal/cwv_preview_element_info_internal.h b/ios/web_view/internal/cwv_preview_element_info_internal.h
new file mode 100644
index 0000000..cc2541c
--- /dev/null
+++ b/ios/web_view/internal/cwv_preview_element_info_internal.h
@@ -0,0 +1,22 @@
+// Copyright 2017 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 IOS_WEB_VIEW_INTERNAL_CWV_PREVIEW_ELEMENT_INFO_INTERNAL_H_
+#define IOS_WEB_VIEW_INTERNAL_CWV_PREVIEW_ELEMENT_INFO_INTERNAL_H_
+
+#import <Foundation/Foundation.h>
+
+#import "ios/web_view/public/cwv_preview_element_info.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface CWVPreviewElementInfo ()
+
+- (instancetype)initWithLinkURL:(NSURL*)linkURL NS_DESIGNATED_INITIALIZER;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif  // IOS_WEB_VIEW_INTERNAL_CWV_PREVIEW_ELEMENT_INFO_INTERNAL_H_
diff --git a/ios/web_view/internal/cwv_preview_element_info_unittest.mm b/ios/web_view/internal/cwv_preview_element_info_unittest.mm
new file mode 100644
index 0000000..8f1a7b7
--- /dev/null
+++ b/ios/web_view/internal/cwv_preview_element_info_unittest.mm
@@ -0,0 +1,24 @@
+// Copyright 2017 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 "ios/web_view/internal/cwv_preview_element_info_internal.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#import "testing/gtest_mac.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace ios_web_view {
+
+// Tests CWVPreviewElementInfoTest initialization.
+TEST(CWVPreviewElementInfoTest, Initialization) {
+  NSURL* const linkURL = [NSURL URLWithString:@"https://chromium.test"];
+  CWVPreviewElementInfo* element =
+      [[CWVPreviewElementInfo alloc] initWithLinkURL:linkURL];
+  EXPECT_NSEQ(linkURL, element.linkURL);
+}
+
+}  // namespace ios_web_view
diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm
index f793199..108f323 100644
--- a/ios/web_view/internal/cwv_web_view.mm
+++ b/ios/web_view/internal/cwv_web_view.mm
@@ -33,6 +33,7 @@
 #import "ios/web_view/internal/web_view_java_script_dialog_presenter.h"
 #import "ios/web_view/internal/web_view_web_state_policy_decider.h"
 #import "ios/web_view/public/cwv_navigation_delegate.h"
+#import "ios/web_view/public/cwv_preview_element_info.h"
 #import "ios/web_view/public/cwv_ui_delegate.h"
 #import "ios/web_view/public/cwv_web_view_configuration.h"
 #import "net/base/mac/url_conversions.h"
@@ -327,6 +328,38 @@
   return _javaScriptDialogPresenter.get();
 }
 
+- (BOOL)webState:(web::WebState*)webState
+    shouldPreviewLinkWithURL:(const GURL&)linkURL {
+  SEL selector = @selector(webView:shouldPreviewElement:);
+  if ([_UIDelegate respondsToSelector:selector]) {
+    CWVPreviewElementInfo* elementInfo = [[CWVPreviewElementInfo alloc]
+        initWithLinkURL:net::NSURLWithGURL(linkURL)];
+    return [_UIDelegate webView:self shouldPreviewElement:elementInfo];
+  }
+  return NO;
+}
+
+- (UIViewController*)webState:(web::WebState*)webState
+    previewingViewControllerForLinkWithURL:(const GURL&)linkURL {
+  SEL selector = @selector(webView:previewingViewControllerForElement:);
+  if ([_UIDelegate respondsToSelector:selector]) {
+    CWVPreviewElementInfo* elementInfo = [[CWVPreviewElementInfo alloc]
+        initWithLinkURL:net::NSURLWithGURL(linkURL)];
+    return [_UIDelegate webView:self
+        previewingViewControllerForElement:elementInfo];
+  }
+  return nil;
+}
+
+- (void)webState:(web::WebState*)webState
+    commitPreviewingViewController:(UIViewController*)previewingViewController {
+  SEL selector = @selector(webView:commitPreviewingViewController:);
+  if ([_UIDelegate respondsToSelector:selector]) {
+    [_UIDelegate webView:self
+        commitPreviewingViewController:previewingViewController];
+  }
+}
+
 #pragma mark - Translation
 
 - (CWVTranslationController*)translationController {
diff --git a/ios/web_view/public/ChromeWebView.h b/ios/web_view/public/ChromeWebView.h
index fdc4017..1ac3892 100644
--- a/ios/web_view/public/ChromeWebView.h
+++ b/ios/web_view/public/ChromeWebView.h
@@ -15,6 +15,7 @@
 #import "cwv_navigation_delegate.h"
 #import "cwv_navigation_type.h"
 #import "cwv_preferences.h"
+#import "cwv_preview_element_info.h"
 #import "cwv_scroll_view.h"
 #import "cwv_scroll_view_delegate.h"
 #import "cwv_translation_controller.h"
diff --git a/ios/web_view/public/cwv_preview_element_info.h b/ios/web_view/public/cwv_preview_element_info.h
new file mode 100644
index 0000000..8cb31ab
--- /dev/null
+++ b/ios/web_view/public/cwv_preview_element_info.h
@@ -0,0 +1,29 @@
+// Copyright 2017 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 IOS_WEB_VIEW_PUBLIC_CWV_PREVIEW_ELEMENT_INFO_H_
+#define IOS_WEB_VIEW_PUBLIC_CWV_PREVIEW_ELEMENT_INFO_H_
+
+#import <Foundation/Foundation.h>
+
+#import "cwv_export.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+// An object which contains information for previewing a webpage.
+CWV_EXPORT
+@interface CWVPreviewElementInfo : NSObject
+
+// The link for the webpage to be previewed.
+@property(nonatomic, readonly) NSURL* linkURL;
+
+- (instancetype)initWithLinkURL:(NSURL*)linkURL NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif  // IOS_WEB_VIEW_PUBLIC_CWV_PREVIEW_ELEMENT_INFO_H_
diff --git a/ios/web_view/public/cwv_ui_delegate.h b/ios/web_view/public/cwv_ui_delegate.h
index 9d5b918..e08c9a76 100644
--- a/ios/web_view/public/cwv_ui_delegate.h
+++ b/ios/web_view/public/cwv_ui_delegate.h
@@ -11,6 +11,7 @@
 #import "cwv_export.h"
 
 @class CWVHTMLElement;
+@class CWVPreviewElementInfo;
 @class CWVWebView;
 @class CWVWebViewConfiguration;
 @class CWVNavigationAction;
@@ -65,6 +66,22 @@
                         completionHandler:
                             (void (^)(NSString*))completionHandler;
 
+// Determines whether the given link with |linkURL| should show a preview on
+// force touch. Return value NO is assumed if the method is not implemented.
+- (BOOL)webView:(CWVWebView*)webView
+    shouldPreviewElement:(CWVPreviewElementInfo*)elementInfo;
+
+// Called when the user performs a peek action on a link with |linkURL| with
+// force touch. Returns a view controller shown as a pop-up. Uses Webkit's
+// default preview behavior when it returns nil.
+- (UIViewController*)webView:(CWVWebView*)webView
+    previewingViewControllerForElement:(CWVPreviewElementInfo*)elementInfo;
+
+// Instructs the delegate to display |previewingViewController| inside the app,
+// in response to the user's pop action on the preview on force touch.
+- (void)webView:(CWVWebView*)webView
+    commitPreviewingViewController:(UIViewController*)previewingViewController;
+
 @end
 
 #endif  // IOS_WEB_VIEW_PUBLIC_CWV_UI_DELEGATE_H_
diff --git a/ios/web_view/shell/shell_view_controller.m b/ios/web_view/shell/shell_view_controller.m
index 311ed36..b280b94 100644
--- a/ios/web_view/shell/shell_view_controller.m
+++ b/ios/web_view/shell/shell_view_controller.m
@@ -464,4 +464,21 @@
   NSLog(@"%@", NSStringFromSelector(_cmd));
 }
 
+- (BOOL)webView:(CWVWebView*)webView
+    shouldPreviewElement:(CWVPreviewElementInfo*)elementInfo {
+  NSLog(@"%@", NSStringFromSelector(_cmd));
+  return YES;
+}
+
+- (UIViewController*)webView:(CWVWebView*)webView
+    previewingViewControllerForElement:(CWVPreviewElementInfo*)elementInfo {
+  NSLog(@"%@", NSStringFromSelector(_cmd));
+  return nil;
+}
+
+- (void)webView:(CWVWebView*)webView
+    commitPreviewingViewController:(UIViewController*)previewingViewController {
+  NSLog(@"%@", NSStringFromSelector(_cmd));
+}
+
 @end
diff --git a/media/gpu/OWNERS b/media/gpu/OWNERS
index e1fa7a4..e4a1176d 100644
--- a/media/gpu/OWNERS
+++ b/media/gpu/OWNERS
@@ -1,4 +1,5 @@
 dalecurtis@chromium.org
+kcwu@chromium.org
 posciak@chromium.org
 sandersd@chromium.org
 wuchengli@chromium.org
diff --git a/net/data/ssl/certificates/README b/net/data/ssl/certificates/README
index 338602b..e703162 100644
--- a/net/data/ssl/certificates/README
+++ b/net/data/ssl/certificates/README
@@ -181,7 +181,10 @@
 - pre_june_2016.pem
 - post_june_2016.pem
    Certs to test that policies related to enforcing CT on Symantec are
-   properly gated on the issuance date.
+   properly gated on the issuance date. These files also contain legacy
+   Symantec roots to simulate a chain for testing the upcoming Symantec
+   distrust events; see https://g.co/chrome/symantecpkicerts. (Note,
+   however, that the leaf and root do not actually form a chain.)
 
 - tls_feature_extension.pem
   A certificate that contains the TLS Feature Extension.
diff --git a/net/data/ssl/certificates/post_june_2016.pem b/net/data/ssl/certificates/post_june_2016.pem
index cc272ad..0c10c1e 100644
--- a/net/data/ssl/certificates/post_june_2016.pem
+++ b/net/data/ssl/certificates/post_june_2016.pem
@@ -82,3 +82,76 @@
 O/9W/X1XdF+cFJKzPo/2C/D1JU8LBd6th5pP5Le0Ld4xLBRJv+8KDLZPHlPUUCPH
 tHhm
 -----END CERTIFICATE-----
+
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number: 903804111 (0x35def4cf)
+    Signature Algorithm: sha1WithRSAEncryption
+        Issuer: C=US, O=Equifax, OU=Equifax Secure Certificate Authority
+        Validity
+            Not Before: Aug 22 16:41:51 1998 GMT
+            Not After : Aug 22 16:41:51 2018 GMT
+        Subject: C=US, O=Equifax, OU=Equifax Secure Certificate Authority
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (1024 bit)
+                Modulus:
+                    00:c1:5d:b1:58:67:08:62:ee:a0:9a:2d:1f:08:6d:
+                    91:14:68:98:0a:1e:fe:da:04:6f:13:84:62:21:c3:
+                    d1:7c:ce:9f:05:e0:b8:01:f0:4e:34:ec:e2:8a:95:
+                    04:64:ac:f1:6b:53:5f:05:b3:cb:67:80:bf:42:02:
+                    8e:fe:dd:01:09:ec:e1:00:14:4f:fc:fb:f0:0c:dd:
+                    43:ba:5b:2b:e1:1f:80:70:99:15:57:93:16:f1:0f:
+                    97:6a:b7:c2:68:23:1c:cc:4d:59:30:ac:51:1e:3b:
+                    af:2b:d6:ee:63:45:7b:c5:d9:5f:50:d2:e3:50:0f:
+                    3a:88:e7:bf:14:fd:e0:c7:b9
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 CRL Distribution Points: 
+
+                Full Name:
+                  DirName: C = US, O = Equifax, OU = Equifax Secure Certificate Authority, CN = CRL1
+
+            X509v3 Private Key Usage Period: 
+                Not After: Aug 22 16:41:51 2018 GMT
+            X509v3 Key Usage: 
+                Certificate Sign, CRL Sign
+            X509v3 Authority Key Identifier: 
+                keyid:48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
+
+            X509v3 Subject Key Identifier: 
+                48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
+            X509v3 Basic Constraints: 
+                CA:TRUE
+            1.2.840.113533.7.65.0: 
+                0...V3.0c....
+    Signature Algorithm: sha1WithRSAEncryption
+         58:ce:29:ea:fc:f7:de:b5:ce:02:b9:17:b5:85:d1:b9:e3:e0:
+         95:cc:25:31:0d:00:a6:92:6e:7f:b6:92:63:9e:50:95:d1:9a:
+         6f:e4:11:de:63:85:6e:98:ee:a8:ff:5a:c8:d3:55:b2:66:71:
+         57:de:c0:21:eb:3d:2a:a7:23:49:01:04:86:42:7b:fc:ee:7f:
+         a2:16:52:b5:67:67:d3:40:db:3b:26:58:b2:28:77:3d:ae:14:
+         77:61:d6:fa:2a:66:27:a0:0d:fa:a7:73:5c:ea:70:f1:94:21:
+         65:44:5f:fa:fc:ef:29:68:a9:a2:87:79:ef:79:ef:4f:ac:07:
+         77:38
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
+UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
+dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
+MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
+dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
+AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
+BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
+cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
+AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
+MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
+aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
+ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
+IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
+MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
+A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
+7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
+1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
+-----END CERTIFICATE-----
+
diff --git a/net/data/ssl/certificates/pre_june_2016.pem b/net/data/ssl/certificates/pre_june_2016.pem
index 10d5aef..766f3e9 100644
--- a/net/data/ssl/certificates/pre_june_2016.pem
+++ b/net/data/ssl/certificates/pre_june_2016.pem
@@ -82,3 +82,76 @@
 0ITN48tFFoE7WoB82ZZ4dp/frpNhjrgxKNaibICGZwYzG3F9c2Lf/OFsAbRtcxlQ
 /h5H
 -----END CERTIFICATE-----
+
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number: 903804111 (0x35def4cf)
+    Signature Algorithm: sha1WithRSAEncryption
+        Issuer: C=US, O=Equifax, OU=Equifax Secure Certificate Authority
+        Validity
+            Not Before: Aug 22 16:41:51 1998 GMT
+            Not After : Aug 22 16:41:51 2018 GMT
+        Subject: C=US, O=Equifax, OU=Equifax Secure Certificate Authority
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+                Public-Key: (1024 bit)
+                Modulus:
+                    00:c1:5d:b1:58:67:08:62:ee:a0:9a:2d:1f:08:6d:
+                    91:14:68:98:0a:1e:fe:da:04:6f:13:84:62:21:c3:
+                    d1:7c:ce:9f:05:e0:b8:01:f0:4e:34:ec:e2:8a:95:
+                    04:64:ac:f1:6b:53:5f:05:b3:cb:67:80:bf:42:02:
+                    8e:fe:dd:01:09:ec:e1:00:14:4f:fc:fb:f0:0c:dd:
+                    43:ba:5b:2b:e1:1f:80:70:99:15:57:93:16:f1:0f:
+                    97:6a:b7:c2:68:23:1c:cc:4d:59:30:ac:51:1e:3b:
+                    af:2b:d6:ee:63:45:7b:c5:d9:5f:50:d2:e3:50:0f:
+                    3a:88:e7:bf:14:fd:e0:c7:b9
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 CRL Distribution Points: 
+
+                Full Name:
+                  DirName: C = US, O = Equifax, OU = Equifax Secure Certificate Authority, CN = CRL1
+
+            X509v3 Private Key Usage Period: 
+                Not After: Aug 22 16:41:51 2018 GMT
+            X509v3 Key Usage: 
+                Certificate Sign, CRL Sign
+            X509v3 Authority Key Identifier: 
+                keyid:48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
+
+            X509v3 Subject Key Identifier: 
+                48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4
+            X509v3 Basic Constraints: 
+                CA:TRUE
+            1.2.840.113533.7.65.0: 
+                0...V3.0c....
+    Signature Algorithm: sha1WithRSAEncryption
+         58:ce:29:ea:fc:f7:de:b5:ce:02:b9:17:b5:85:d1:b9:e3:e0:
+         95:cc:25:31:0d:00:a6:92:6e:7f:b6:92:63:9e:50:95:d1:9a:
+         6f:e4:11:de:63:85:6e:98:ee:a8:ff:5a:c8:d3:55:b2:66:71:
+         57:de:c0:21:eb:3d:2a:a7:23:49:01:04:86:42:7b:fc:ee:7f:
+         a2:16:52:b5:67:67:d3:40:db:3b:26:58:b2:28:77:3d:ae:14:
+         77:61:d6:fa:2a:66:27:a0:0d:fa:a7:73:5c:ea:70:f1:94:21:
+         65:44:5f:fa:fc:ef:29:68:a9:a2:87:79:ef:79:ef:4f:ac:07:
+         77:38
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
+UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
+dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
+MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
+dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
+AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
+BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
+cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
+AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
+MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
+aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
+ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
+IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
+MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
+A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
+7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
+1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
+-----END CERTIFICATE-----
+
diff --git a/services/shape_detection/BUILD.gn b/services/shape_detection/BUILD.gn
index 8fd0971..3765c024 100644
--- a/services/shape_detection/BUILD.gn
+++ b/services/shape_detection/BUILD.gn
@@ -120,5 +120,8 @@
       "//ui/gfx",
       "//ui/gl",
     ]
+    data = [
+      "//services/test/data/mona_lisa.jpg",
+    ]
   }
 }
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java
index 72927d5..d9242c4 100644
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BitmapUtils.java
@@ -48,11 +48,7 @@
             return null;
         }
 
-        try {
-            // This constructor implies a pixel format conversion to YUV.
-            return new Frame.Builder().setBitmap(bitmap).build();
-        } catch (IllegalArgumentException | IllegalStateException ex) {
-            return null;
-        }
+        // This constructor implies a pixel format conversion to YUV.
+        return new Frame.Builder().setBitmap(bitmap).build();
     }
 }
diff --git a/services/shape_detection/face_detection_impl_mac_unittest.mm b/services/shape_detection/face_detection_impl_mac_unittest.mm
index 83ea57e..5c92d20 100644
--- a/services/shape_detection/face_detection_impl_mac_unittest.mm
+++ b/services/shape_detection/face_detection_impl_mac_unittest.mm
@@ -6,8 +6,10 @@
 
 #include "base/base64.h"
 #include "base/command_line.h"
+#include "base/files/file_util.h"
 #include "base/mac/scoped_nsobject.h"
 #include "base/message_loop/message_loop.h"
+#include "base/path_service.h"
 #include "base/run_loop.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -26,12 +28,9 @@
   closure.Run();
 }
 
-// Base64 encoding of the Mona Lisa Face thumbnail from:
-// https://commons.wikimedia.org/wiki/File:Mona_Lisa_face_800x800px.jpg
-// TODO: Use services/test/data/mona_lisa.jpg.  See https://crbug.com/729653.
 const int kJpegImageWidth = 120;
 const int kJpegImageHeight = 120;
-const char kJpegImageInBase64[]="/9j/4AAQSkZJRgABAQEAZABkAAD//gBSRmlsZSBzb3VyY2U6IGh0dHA6Ly9jb21tb25zLndpa2ltZWRpYS5vcmcvd2lraS9GaWxlOk1vbmFfTGlzYV9mYWNlXzgwMHg4MDBweC5qcGf/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAB4AHgDAREAAhEBAxEB/8QAHAAAAgIDAQEAAAAAAAAAAAAABQYEBwEDCAIA/8QAOxAAAgECBQIEBAQFAwMFAAAAAQIDBBEABRIhMQZBEyJRYQcycYEUkaGxFUJiwfAjJOEWF9ElM1LC8f/EABoBAAIDAQEAAAAAAAAAAAAAAAIDAQQFAAb/xAAvEQACAgICAgAEBQQCAwAAAAAAAQIRAyESMQRBBRMiUTJhcaGxFCNSgZHwweHx/9oADAMBAAIRAxEAPwBqiIChT5t7gEYwX1ssJUbY0ErKBHpFu498Q3fRKTMmJVNm2POo9/tiG2kTFG+FfIAq9t2ta2BtvsKtkqKmDE2UgMDiUn2C3ugTnvVGRdPy6M2zKFJxv+HivLN6i6LuPvbDsalPaRPy29Cw/wAYOn1kPgUmYS3OxZUjJvwbFrgYfHx8hziqCVF8V+namVUnSvojzqlp9SkD3QkYGWKa62SsY5ZVmVDmlMKnLamCqgvu8bBgPYjkH64U3x/FpkcWF4yT8oG4337YBzdUgVHezEwN1N1BxzurslJGI1uSpJG3bvjlew2bYUN+fS+Cj12DJkqEWNgOeL4OM66AaNscXkb2vziVK47ZD0IkcG1r/X/PthVWFZLRNKqAAdiCT9cC19jk77MRpqILKNjfi/tbCpcug40SooAz6tNyfLsOPbBQhslsrH4n/ECXLa+Tp7IZvBrxaOprEXU0Fx8if1+/a/ri3i8e1zn1/P8A6Ba6oR8h6YqY8szKshpauaWdNCzBHkZifmYk778ffAZvIU5Qg3pMsQg4xbS2KmcZQKPUaqmqItVhqeEqL9rnGhjzc3SaZXyY63QGDvSuJaScofVfMp57YsOPLUkLUnHcQplXUFfQZrFV5bK2XZkll8SEWRx6MnBB9D+mEywppqW0N+by/U6Y+EvXdP1rlrJKkVNnVMAtVTLsrDgSJ30nj2O3pjLz4XhlXr0d+JWh6eJQCy2b6DEOKAT+55hQrYsNrW98TH2S2ToAATYG5GwI4wUqSYPZuSEBNXAIBO2E8eO0TZ8UZVtf5hvbE7RHYkQRG6kix7f2wuMnexjr0SvDZiqpf6dsH30D12bIKe77gna7W7bYHbbCtIFdf9R0/R3S9VmcrIJFHh06t/PKR5Rbk+v0GLMISk1CK2wE03begP8ACHommhy6LM8zjhqM0qf9eeoljEjhm3sL7D7b++KmXK8+Tin9K0l+hcUflwTrbLXFHCABftYdvtthbjRHNgjOsoiqKaaJ9TqykFWAKn88Vsip6HwlfZzV8R+kKeikeSjS128wCD+2NT4f57yfTP0I8jCltFWyJJEXul0vYkLce4JxtqSfRRoJ9K5/WdNdSUOb5a7iWmbUVPEkZI1o3qCt/wBMBmxLLjcP+P1IjOpWztvJa+lzTJ6PMqF9dJVxLLG47qwuPpbi2MqP0Opd9ByV9E2KNWF97AbNiWlu2crN8cIABIFxyL7YW2yTZGhlNr7eltscnZD0ZkpyI++1+cMcVVg3sUUWMxRtHpbVc3GKr4voYrM063k32YEi9t9zhiTXRDJVHAzSB3uoK2F/bEwm4u7OaT0UL8cs9TqHPsqyZEH+nWxaWvuus7KB6keYn6Dti5gySm5Zn0kyflrGlBdtl7dNWp6FFY2awU39RjFxx1aNHJ9g6pdWa5LX3J9MS27aE0uyHXiSRCFN9rG3OEThyGxaQi9UdOpXwyCW1muDb/PbC4J4ZckNdTVM5u63y5cpzeemilCQDzebuff9bY9R4eV5cak+zMzxUJUhVmbUNQt6W9bC++LpWaSOjvgT1JK/w+ho5mtHl9Y1OD6o1pB9hrP5Yy/Mhxm697Gp3Wy0aXNhNMsIYi29u1j2v37Yq7fZLetB01arE5DKVQaRY8m+/wDbHUxTnvQRplvbcaTuL+/GIXdMY2bwbxFd2wXNtUD07KMyvqid3WGnLvqszF0PIB8o/LfEairZNT9D109mYzSmMiRaJUkMbjmxIDCx+hwacpNEKadk3Nq38HlE8oGpvw7sthvcKdsLlG6TCUt0jkbrCsaXramzCGSNr10MmkfNrUqtxfsQBtjS8eP9hwf2f7jJ25KS+6Lv/wC6VBDlQq0lSipEm/DhqpZSddr2IRG08H5iDtxjGXi5XJQjt1fa6L7yQrkx1n6p0dKSZwIwAE4vca+BY973B++KXJyfFd9B/LS2xLTq7NKbIWzvOfHpaeRxGFWkknILfKCFsBe3rg/lKWR48cr/ADbpHcmo3JAOLrjqHPcwio8uyeaohcj/AHUaSJGBv5jrUabW4P64tT8XHjjynk39tX+wr5km6jErP4oUM8Od+JUfM/zC99/rjT+GZYvHSRV8lNSViSmmF2XUrM1wQefe2NTsp7uix/hJWFKDNaUMViM0E5AYgsNJUi/2GKHmR/C/ZPWi5MkzgykxMYlABszCxuP32xVUFsGWR+w1Lm0cNJHGAJRIw3U302bfbne2IpdsSOXT9UKqEsHLJqBH0HbFKVqSTLqaadByJ/D1FgbW2vhuO07BbXRydQZocvqqclJCW31XA3IsSe1zfbFiWHndC1krQfyLrl6TI5KKFNFTGDaULfU1yGJ/NQCe2AyYJJ/T0Hjkktk2l6tmoTmVI0zSrBEqwySG5RmZthc8AXIxPy3KCZy1Oijxoi67yiKUf7eHNI1Z73DDxRck+v8A4xou/wCnlXbi/wCBqf1x17OwP4TBW05RJqiJTJ4jBQu7X3O4Nj7jHmFBTjyTNNzcHRo6ioUk6ckprBYGlBFxfYf/AIMdwaWiLTeyblGXRnLYYWqaiOwsdDDf87jELFyVSOlNx/Caa5abKKdjCZGL3LNI5YnC5pQdRQULkrZyz8YcwNZ1G3hFrIeB2/y2PRfCYccNv2Z/lu5UhEcuXErWYHdibbE/2xq1ZRHz4VpNP1BVU1I0i+PRlyq2a5V1P/2/XFPyopQTfoJLk9Fy5TRVkMjvLTVMpA3ZrHew/I/bvijyW9kSg0uiWIK2PSYaGpYA7CwvxyT3xzURLvsaukq2opJSKiCWJGJtZCdz9sJlFdpjMc2tMbJMxQqbyMCb8jAPI1sclZyPmMBZ2ZZWGkeJqLaix4A+mNODr0IaNbMYiDDJIAbgMBbUpAO4F9r3/K+J2yaT7AGeVdTYtHIG1Pu3qTcbn7n8sWMUVQSb5C3mFayrGYXa8bhyrdiDdbHvxh0YJ6GznpUdk9I9QJmuUUciOC00aEXO1iAf748jNPHcH6dGy6nUgN8QOuafpqloqGty+tkr5m3iiFw68albhhxxv64b4+CedaaSX3ETlHG7e7GLpPMzU9OUlZVRS0krhv8AQlPnUajpv72thTSg2rug/wASTFzrTNZTCywgkr9sLjHnJX6Dk6WjmLrCoaozeWR7sdR2btvwceq8VVjSRlZvxAaWcNEpK2f+axPGLCEMNdLVMkWYRmJn8UkqpHuLf87emByxuLvoh7LbynM8wphrSSrjB8xW1lJ2/wA7YoNKnQDeg7H1DXooAmrFckWUbn9rdsQ8a9CqDtB1XUJvUzh1202sDv625tgJwXVEptK7CY6jlqoisTygggGy7geuFcFdkcm/pbOdpa7xpQzCXzeQG2s27WONCMKHHppnlHhqg1KbhhtfjkG37euJBe2Q81y92y8vM6HUy2AI8p3P9t//ADgoZVy0iYJ3QqThI4NBVZJmc3bkqB6fXFlNt2Ntca9l5fA7qWlzTp6PJ6ipNPmVIDGrgjV4d/Kwvza9vtjznxXBKGR5K+mX8ml4mVTgoe0WR1OlR4UUZrcwqHUXSdcvjk29yLAfljN0pW/5LXoh5DA1NMZszrKyrn07LKiokYHoFHJuNyTiZSjJrVV+oKX52LvXGcwDxI42BYgjbfe22H+Pi5y2LyTpUc/Z9KZcwZ2Yl2a/t7DHqMKSjSMvK9gyVlvZCRtp+vqcNQtumFMhDfjIWifS9wb3taxwvJJKLOirLlpljjdYiulnF/KfNuNhx9+cZnPTdC3HVBCSjUxqZFOlPMCU77knb2xHNN7YFM30ckEQIAXTfY6fMLd8Tr2CyfJnsUKlIULNfsPl55PpxiJQV2FG0ikqKoLlRpRlbSCjC4O/Fr8k+98aEo/caHaWYyOVMOXBRIWCSHYj6ffCZxXabIoL5hl0/wD05WySJQNEkQmURhiWCkG1jyQL++EJrmtjIqip8x8JpnnkRXZyQNPC27n12tjSiq0TrtkGOtlocziqsullp54SGjkDWa+3+Wwc4KUeM9pkW4SuLOi+kfjrlz9PxwZ0r0+ZIgWTSl0f+ofX0x5/P8Kywf8Aa3H+DRx+VCf4tMEZ/wDEuOoB/A6UjI80kjC/5emBx/DZ95Dp511ErvMuojVvppr1EzXJfgL32vzjSx+Lw70V5ZL62LVXSy+O5ZjIxNy9tgMXLVUV3FoinQiG+7WNiB++D7AJuWzGJ1K3BUcn7EYiULVExdOy6qLNoTl1LIWEr2XSVIsGNr77d7jb9cZrwtXE7l7DdVXxVETeV4ybKoQ727m3bfCfkxUrBcrVUQBXwq7GJZmXRqKActf0+ww2Ka0C4Jn1TnETVI0sCC1iBGPU/p+3ptjpJvs5QS9i1Q0IVUctAlmuPCjB/ckg4a5xYwPUpiiZ1srPqHnbw9TahyABzta+Ikv8URFm+oqA0Eo8VDGV0MqkEDm4P14++EO09DE12UbnlGtPn1VTh2aNJLIVTc+VSARtv5gMa2KVwUgX2BZUu6nURcXJY73w7sGSoO9ARUcnWuUQ5giyUk1QIXRvl84Ki/3IxW8vl8mTi6dB4GlkXItXqb4WU8JY0EcSWO5AuAMZGH4nKL4z2Wsnjp7RAynonTIgnjUpcCygj8v3wefzk1pnQxv2TOrOlBT5S/gRqiqoJ2tbfck+mEeN5vLJ9TGSxaKlqKfwigdGUgHy25B4xvRmn0UZRNog8GjSWQeQFjbttYYlTTlR0o0rLL6OzCiqMshK1FPSLpWO7garj5u3YnnFDKppvt//AEFRTHVYacgQ0udQSMynWGS4tzzqxUtydyQTiq0YfpseHLWawaYC6u3kPoCvub4OOWvpbI4ezbTdJxC0r1XhIx1aW8oUn1v/AJvivPzI39DsdHx5PtUVPoneOVpayRKlKZfCaJiCdyTvck2F/uMaXKnpavYiiMnW1Y9OwqxTtO6C0ynQoIuo1AA78/8AGHy8aL6YN0eM16rr5qeHxggpp0CzaYwLMrndTyLGx9MQvHjvfR1+hPramevr6iaSZpJJZS2vgsext9hixGKjFJE22fZbltZmtctLQwy1FQ+yJGNRv+1vfHTyQhHnkdImMJSfFLZevw3+EUcEyV2czh6lfkVR5EbtYnk+/tjB8n4m8v0YVS/cu4vGUPql2XFJl5MAWYaibD5f8tjIk0XEjNNkSIxa2jfa/wCWBa+xNkHPMnSajdbgEIwIbv6XHpgVqXJBJXo5zqsnEWdGjIWS8oVSG+XU9h9bb3HbHpoZ+WHn+RQljqVEHqOkENFDSqiMq1UxW3JF7H7XXj64d487lyv0hWRar8wJk0arVCJ2RUJJ1MdlbixPobYt5HcW0V0iysiyTMa6ro2pqOi0RvdHjk1K+2wIBJIxk5pwjabewoxd2hpHRvU1TmFFXVGZapoTdjqKge3Nj2H0AxXl5eOMWlHsOOCTY7ZjUTUmVwrLL+JrVGyKCdbD1P8ALz3OMzDH63JaTLkp8Y17KG6k8OOKopKGIvII1GuxBtxb2G55/vj0HjqTlym/ZTlVUhPqqA/wWREVS8Uha+m+w2IB/LjGgprmhDTI2awuuVUxmLqI49Kqex1E2PvucdGVzdE1SsG0ccktSqxX1Dvbgep/PBt0rOirejpj4C9IJQ5TLWTxXnqW1K9iCYx8ot6Hn7jHmfifkPNlUU9L+TVwY/lw/Nl009Ivg2CgWsRccHFSNpWiW7dGWijuBGLXbAPYa12bWj0wGx78WxMlUQU9i91AqpSzCUnwyp498VcjldD8Zz7EIaTOqd6dkll/EukjWuCQbkqSeNyfXtvj0D5TxvkvVlZ1FiP1DXvJmwicqRCWN/fUf73xqePjUcdr2UMsvqPa5LVVVG88dNK8RYBNKni3Jt62wXz4xbi2FxbV0Fum80qKevSnqZXpp1kChilib8bYR5GFSi5R2LafRfGW9RR1FHFBUxzyGMJTuIxpAfgAXtfb19748/ODT2WYz0e6l6GOnWVzXxr4nhp8urUb3BBa/wBzhP1ctfuE6rZVOe0aNCskauXSO7Kw0rIO2/pe36Y1sGRp02VpxdWKeeS02V5PGs0aLUMRaPuSMaGLnlyWnoBpRVsQayplq5DJMQVDHSnZfYY0IxSWhTdlp/B3pMZtRzVksPiXa2+1gP2A2NxvjH+JeY8clCJf8TEmuTOm+k8pGU5VBT69ciLubW1H1AxhOTcm37LcpWHwBYDa/e+Du9AL7mDGRp3IOq9sQ4vom/Z9UJqW1rEbHvgZHJ7EvrVo48qqBJJa6FTcHk9vU4RdzikWI9MpSopZ6itCUdGoUEkuyhUDXW9zfbgbcXxtQmlG5S3/AOCrkT6iiZknw5paurmq5JRmFbK5Z1SIyxq1727Ltfe57YXk+JTSUIql+4C8ZW5NhvOsloaOkZMwzGKIR/8AtJNVrCL8GyxrueRtfAYcuSTk4x3+l/yFOMUtspvq5MtjrUejqF8YfM0c0rgenzqP0ON7xnkcWpr+DPy1eiT0v17XZUwhqJmeEEBJlVQwP9RNwdu/IwryPAhkuUdMnHlcdMtTJ/iHPDCGzFEZJPKr+EmpbDctpA59TvjMn4bb+mi1GQKp0myd2rM8rqengC6pUldW2K7WUEkX+vNhbA5az/Rhi2/0ohfRuWim+r83Gd59PVxK0dKvkp47Wsg9vfnHofGwfIxqDdv2Uck+UrQMjjaQrCpbzDg84baQNM6J+Due02Vwfgc5XRS2DxS6SFF+dQ/Kx+2PM/EcDlk+bD/Zq+PlShxZfFPXUtTRGqpqiOSMjV4isCCPrx3xm8lX2D4uyTSFpRrIIU4OKs6TrROATQe/IGHqOhLbs1SeGgYHn62H1wuSDTbK862rqGOOZDLrYA/JJpAJG4v22v72xWWJzmmh/wAxQVMqPMetMloJJHaMZhU2IjhtaFe3H83bnGvj+HZsi/xX7lV+RFO3sWM++JOdVkfgzVy5fSqDppqRLEDi5tsP0Pti/g+F4obrl+bEy8lvrQjVuc1Uxv8AiZyp/pA3+u+NKOCEVVFdzb7YPeeRyLs7G9zra+DSSAb9mI9QG1irHcDg46jhx6Unlqf/AEzYTIC8bjctYElSODtc7+n0xUz41H+5/wB/UtYJuX0P/v5A3rmeq/i38PqleMU41OjC12Nz+gNh9cT4UY8OcfYnNafF+hZbbzXv7W74t0IDmQQJJI81TfSGAuDxte+/+cYRlbWkGl9xsjzYitpIqYMksqDQNfyKCbk32vYHn/5DFT5Sabl6GqdPQcyjNJTI6ZfO1KsVtbU8ugsx33HDADfj88V8mBNXJXY6GV9Idss+IWf5epi/iaT6AAyVFOCRe1hdbeo5v2xVfiQ7imv9jVlT7C8HxZro95IKCcKbF4y4J/Q/TAf0kv8AIJzh3REz74pVE1NIbU9DDGt5JSS+/ZFIFy1+w3+g3wEfDcpV2BLyIpfSVD1D1f40FU5m8JpzaOJV8SZ151MSdMYNztuxxq4PD4ta6/4/19ytPNYjPXSyE+CCt99iSxPqTycaKikV07C2X5bClI1bVgtHTjdb7SPvZfzt+uFSnLkox7YVLshVcaRKseka7NyNgbL/AM4bFtnPQLWOQm6q5ABJ8p49T7e+D5AbZ6VvmNh2sL8Y6yVYRy+qemqaadLiSFw4sObdt8RJcotP2HGTi7XZ/9k=";
+const char kJpegImagePath[] = "services/test/data/mona_lisa.jpg";
 
 }  // anonymous namespace
 
@@ -69,12 +68,16 @@
   options->fast_mode = GetParam();
   impl_ = base::MakeUnique<FaceDetectionImplMac>(std::move(options));
 
-  std::string image_as_jpeg;
-  ASSERT_TRUE(base::Base64Decode(kJpegImageInBase64, &image_as_jpeg));
+  // Load image data from test directory.
+  base::FilePath image_path;
+  ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &image_path));
+  image_path = image_path.AppendASCII(kJpegImagePath);
+  ASSERT_TRUE(base::PathExists(image_path));
+  std::string image_data;
+  ASSERT_TRUE(base::ReadFileToString(image_path, &image_data));
 
   std::unique_ptr<SkBitmap> image = gfx::JPEGCodec::Decode(
-      reinterpret_cast<const uint8_t*>(image_as_jpeg.data()),
-      image_as_jpeg.size());
+      reinterpret_cast<const uint8_t*>(image_data.data()), image_data.size());
   ASSERT_TRUE(image);
   ASSERT_EQ(kJpegImageWidth, image->width());
   ASSERT_EQ(kJpegImageHeight, image->height());
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
index de442077..0aa8c3d 100644
--- a/testing/variations/fieldtrial_testing_config.json
+++ b/testing/variations/fieldtrial_testing_config.json
@@ -1714,6 +1714,21 @@
             ]
         }
     ],
+    "NTPBreakingNewsPush": [
+        {
+            "platforms": [
+                "android"
+            ],
+            "experiments": [
+                {
+                    "name": "Enabled",
+                    "enable_features": [
+                        "BreakingNewsPush"
+                    ]
+                }
+            ]
+        }
+    ],
     "NTPCondensedLayout": [
         {
             "platforms": [
@@ -1788,26 +1803,6 @@
             ]
         }
     ],
-    "NTPPersonalizedSectionRanking": [
-        {
-            "platforms": [
-                "android"
-            ],
-            "experiments": [
-                {
-                    "name": "Enabled-ClickBasedRanker-InitialOrderEM",
-                    "params": {
-                        "category_order": "emerging_markets_oriented",
-                        "category_ranker": "click_based"
-                    },
-                    "enable_features": [
-                        "ContentSuggestionsCategoryOrder",
-                        "ContentSuggestionsCategoryRanker"
-                    ]
-                }
-            ]
-        }
-    ],
     "NTPPopularSites": [
         {
             "platforms": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
index 79b53d9..e072c999 100644
--- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
+++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -2657,6 +2657,10 @@
 crbug.com/591099 external/wpt/css/css-flexbox-1/ttwf-reftest-flex-align-content-start.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-flexbox-1/ttwf-reftest-flex-base.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-flexbox-1/ttwf-reftest-flex-order.html [ Failure ]
+crbug.com/591099 external/wpt/css/css-grid-1/abspos/absolute-positioning-grid-container-parent-001.html [ Failure ]
+crbug.com/591099 external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-rtl-001.html [ Failure ]
+crbug.com/591099 external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-001.html [ Failure ]
+crbug.com/591099 external/wpt/css/css-grid-1/abspos/grid-sizing-positioned-items-001.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/abspos/orthogonal-positioned-grid-items-007.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/abspos/orthogonal-positioned-grid-items-009.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/abspos/orthogonal-positioned-grid-items-013.html [ Failure ]
@@ -2665,6 +2669,8 @@
 crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-009.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-016.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-017.html [ Failure ]
+crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-should-not-take-up-space-001.html [ Failure ]
+crbug.com/591099 external/wpt/css/css-grid-1/abspos/positioned-grid-items-sizing-001.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/alignment/self-baseline/grid-self-baseline-changes-grid-area-size-007.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/alignment/self-baseline/grid-self-baseline-changes-grid-area-size-008.html [ Failure ]
 crbug.com/591099 external/wpt/css/css-grid-1/alignment/self-baseline/grid-self-baseline-changes-grid-area-size-009.html [ Failure ]
@@ -3750,7 +3756,7 @@
 crbug.com/591099 fast/canvas/fill-stroke-clip-reset-path.html [ Failure ]
 crbug.com/591099 fast/canvas/fillrect_gradient.html [ Failure ]
 crbug.com/591099 fast/canvas/patternfill-repeat.html [ Failure ]
-crbug.com/591099 fast/canvas/toDataURL-supportedTypes.html [ Failure ]
+crbug.com/591099 fast/canvas-api/toDataURL-supportedTypes.html [ Failure ]
 crbug.com/591099 fast/clip/001.html [ Failure ]
 crbug.com/591099 fast/clip/004.html [ Failure ]
 crbug.com/591099 fast/clip/008.html [ Failure ]
@@ -3810,7 +3816,6 @@
 crbug.com/591099 fast/css-generated-content/table-with-before.html [ Failure ]
 crbug.com/591099 fast/css-generated-content/visibleContentHiddenParent.html [ Failure ]
 crbug.com/591099 fast/css-generated-content/wbr-with-before-content.html [ Failure ]
-crbug.com/591099 fast/css-grid-layout/absolute-positioning-grid-container-parent.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/auto-content-resolution-columns.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/breadth-size-resolution-grid.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/calc-resolution-grid-item.html [ Failure ]
@@ -3862,8 +3867,6 @@
 crbug.com/591099 fast/css-grid-layout/grid-item-with-percent-height-in-auto-height-grid-resolution.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-item-with-percent-height-replaced-element.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-item-with-percent-min-max-height-dynamic.html [ Failure ]
-crbug.com/591099 fast/css-grid-layout/grid-positioned-items-background-rtl.html [ Failure ]
-crbug.com/591099 fast/css-grid-layout/grid-positioned-items-background.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-self-baseline-01.html [ Crash Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-self-baseline-02-b.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-self-baseline-02.html [ Failure ]
@@ -3895,7 +3898,6 @@
 crbug.com/591099 fast/css-grid-layout/grid-self-baseline-vertical-rl-06.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-self-baseline-vertical-rl-07.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-shorthand-get-set.html [ Timeout ]
-crbug.com/591099 fast/css-grid-layout/grid-sizing-positioned-items.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/grid-template-columns-rows-computed-style-gaps-content-alignment.html [ Timeout ]
 crbug.com/591099 fast/css-grid-layout/grid-template-shorthand-get-set.html [ Timeout ]
 crbug.com/591099 fast/css-grid-layout/implicit-columns-auto-resolution.html [ Failure ]
@@ -3926,8 +3928,6 @@
 crbug.com/591099 fast/css-grid-layout/percent-resolution-grid-item.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/percent-track-breadths-regarding-container-size.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/positioned-grid-container-item-percentage-size.html [ Failure ]
-crbug.com/591099 fast/css-grid-layout/positioned-grid-items-should-not-take-up-space.html [ Failure ]
-crbug.com/591099 fast/css-grid-layout/positioned-grid-items-sizing.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/quirks-mode-percent-resolution-grid-item.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/scrolled-grid-painting-overflow.html [ Failure ]
 crbug.com/591099 fast/css-grid-layout/scrolled-grid-painting.html [ Failure ]
@@ -8252,7 +8252,6 @@
 crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/fillrect_gradient.html [ Failure ]
 crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/image-object-in-canvas.html [ Crash Failure ]
 crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/patternfill-repeat.html [ Failure ]
-crbug.com/591099 virtual/display_list_2d_canvas/fast/canvas/toDataURL-supportedTypes.html [ Failure ]
 crbug.com/591099 virtual/exotic-color-space/ [ Skip ]
 crbug.com/591099 virtual/feature-policy-experimental-features/ [ Skip ]
 crbug.com/591099 virtual/feature-policy/http/tests/feature-policy/payment-disabled.php [ Pass ]
@@ -8359,7 +8358,6 @@
 crbug.com/591099 virtual/gpu/fast/canvas/fillrect_gradient.html [ Failure ]
 crbug.com/591099 virtual/gpu/fast/canvas/image-object-in-canvas.html [ Crash Failure ]
 crbug.com/591099 virtual/gpu/fast/canvas/patternfill-repeat.html [ Failure ]
-crbug.com/591099 virtual/gpu/fast/canvas/toDataURL-supportedTypes.html [ Failure ]
 crbug.com/591099 virtual/high-contrast-mode/paint/high-contrast-mode/image-filter-all/text-on-backgrounds.html [ Crash Failure ]
 crbug.com/591099 virtual/layout_ng/ [ Skip ]
 crbug.com/591099 virtual/mojo-blobs/ [ Skip ]
diff --git a/third_party/WebKit/LayoutTests/SlowTests b/third_party/WebKit/LayoutTests/SlowTests
index ef71ba4..f0842ef 100644
--- a/third_party/WebKit/LayoutTests/SlowTests
+++ b/third_party/WebKit/LayoutTests/SlowTests
@@ -78,7 +78,6 @@
 crbug.com/24182 virtual/gpu/fast/canvas/canvas-incremental-repaint.html [ Slow ]
 crbug.com/24182 virtual/gpu/fast/canvas/canvas-strokePath-gradient-shadow.html [ Slow ]
 crbug.com/24182 virtual/gpu/fast/canvas/canvas-strokeRect-gradient-shadow.html [ Slow ]
-crbug.com/24182 virtual/gpu/fast/canvas/canvas-toDataURL-jpeg-crash.html [ Slow ]
 crbug.com/24182 fast/dom/timer-throttling-background-page-near-alignment-interval.html [ Slow ]
 crbug.com/24182 http/tests/perf/large-inlined-script.html [ Slow ]
 crbug.com/24182 virtual/mojo-loading/http/tests/perf/large-inlined-script.html [ Slow ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
index e2775bf..9ff2bcc4 100644
--- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
+++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -236522,7 +236522,7 @@
    "manual"
   ],
   "css/css-ui-3/cursor-image-005-nfs.html": [
-   "93029cc439245985a3cf93d39898f051d8d7ef00",
+   "ca07822b75d3299c3530fa72d33feb6bdcf7fa36",
    "manual"
   ],
   "css/css-ui-3/cursor-image-005.html": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-changing-containing-block-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-changing-containing-block-001-ref.html
new file mode 100644
index 0000000..07e297f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-changing-containing-block-001-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Absolute positioning changing containing block reference file</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<style>
+.wrapper {
+  width: 100px;
+  height: 100px;
+  margin-bottom: 25px;
+  background: purple;
+}
+
+.grid {
+  width: 50px;
+  height: 50px;
+  background: lightblue;
+}
+
+.item {
+  width: 75%;
+  height: 75%;
+  background: orange;
+}
+</style>
+
+<p>The test PASS if you see an orange box inside a purple box on top and a small orange box inside a light blue box inside a purple box on bottom.</p>
+
+<div class="wrapper">
+  <div class="item"></div>
+</div>
+<div class="wrapper">
+  <div class="grid">
+    <div class="item"></div>
+  </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-changing-containing-block-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-changing-containing-block-001.html
new file mode 100644
index 0000000..3103083
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-changing-containing-block-001.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html lang=en class="reftest-wait">
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Absolute positioning changing containing block</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="absolute-positioning-changing-containing-block-001-ref.html">
+<meta name="assert" content="This test checks that absolutelly positioned children of a grid are properly sized when the containing block switches between the grid container and a grid ancestor.">
+<style>
+.wrapper {
+  width: 100px;
+  height: 100px;
+  margin-bottom: 25px;
+  background: purple;
+  position: relative;
+}
+
+.grid {
+  display: grid;
+  grid-template: 10px / 10px;
+  width: 50px;
+  height: 50px;
+  background: lightblue;
+}
+
+.item {
+  width: 75%;
+  height: 75%;
+  background: orange;
+  position: absolute;
+}
+</style>
+
+<p>The test PASS if you see an orange box inside a purple box on top and a small orange box inside a light blue box inside a purple box on bottom.</p>
+
+<div class="wrapper">
+  <div id="grid-as-cb" class="grid" style="position: relative;">
+    <div class="item"></div>
+  </div>
+</div>
+<div class="wrapper">
+  <div id="grid-as-parent" class="grid">
+    <div class="item"></div>
+  </div>
+</div>
+
+<script>
+  window.requestAnimationFrame(() => {
+    document.getElementById("grid-as-cb").style.position = "initial";
+    document.getElementById("grid-as-parent").style.position = "relative";
+    document.body.offsetLeft;
+    document.documentElement.classList.remove('reftest-wait');
+  });
+</script>
+
+</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-definite-sizes-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-definite-sizes-001.html
new file mode 100644
index 0000000..1249a142
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-definite-sizes-001.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Absolute positioning definite sizes</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="flags" content="ahem">
+<meta name="assert" content="Items should extend to fill the width of the absolutely positioned grid container.">
+<style>
+.grid {
+  display: grid;
+  grid-template: 50px 1fr / 1fr;
+
+  position: absolute;
+  left: 50px;
+  top: 50px;
+
+  width: 200px;
+  height: 200px;
+
+  border: 7px solid #ccc;
+  font: 10px/1 Ahem;
+}
+
+.row1 {
+  grid-row-start: 1;
+  background-color: yellow;
+}
+
+.row2 {
+  grid-row-start: 2;
+  background-color: cyan;
+}
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="row1" data-expected-height="50"  data-expected-width="200">XXX X</div>
+  <div class="row2" data-expected-height="150" data-expected-width="200">XX XXX XX</div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-grid-container-containing-block-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-grid-container-containing-block-001.html
new file mode 100644
index 0000000..65a358e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-grid-container-containing-block-001.html
@@ -0,0 +1,352 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Absolute positioning grid container containing block</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks the behavior of the absolutely positioned elements with a grid container as containing block.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 50px 100px 150px 200px;
+  grid-template-rows: 50px 100px 150px 200px;
+  width: 500px;
+  height: 500px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.thirdRowThirdColumnSpanning2Rows {
+  grid-column: 3;
+  grid-row: 3 / span 2;
+  background-color: maroon;
+}
+
+.thirdRowThirdColumnSpanning2Rows2Columns {
+  grid-column: 3 / span 2;
+  grid-row: 3 / span 2;
+  background-color: aqua;
+}
+
+.endFirstRowEndFirstColumn {
+  background-color: blue;
+  grid-column-end: 2;
+  grid-row-end: 2;
+}
+
+.endFirstRowEndSecondColumn {
+  background-color: lime;
+  grid-column-end: 3;
+  grid-row-end: 2;
+}
+
+.endSecondRowEndFirstColumn {
+  background-color: purple;
+  grid-column-end: 2;
+  grid-row-end: 3;
+}
+
+.endThirdRowEndThirdColumnSpanning2Rows {
+  grid-column-end: 4;
+  grid-row: span 2 / 4;
+  background-color: maroon;
+}
+
+.endThirdRowEndThirdColumnSpanning2Rows2Columns {
+  grid-column: span 2 / 4;
+  grid-row: span 2 / 4;
+  background-color: aqua;
+}
+
+.onlyThirdRowOnlyThirdColumnSpanning2Rows {
+  grid-column: 3 / 4;
+  grid-row: 3 / 5;
+  background-color: maroon;
+}
+
+.onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns {
+  grid-column: 3 / 5;
+  grid-row: 3 / 5;
+  background-color: aqua;
+}
+
+.offsetLeft25 {
+  left: 25px;
+}
+
+.offsetRight50 {
+  right: 50px;
+}
+
+.offsetTop75 {
+  top: 75px;
+}
+
+.offsetBottom100 {
+  bottom: 100px;
+}
+
+.offsetLeftMinus20 {
+  left: -20px;
+}
+
+.offsetRightMinus40 {
+  right: -40px;
+}
+
+.offsetTopMinus60 {
+  top: -60px;
+}
+
+.offsetBottomMinus80 {
+  bottom: -80px;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="530">
+  </div>
+  <div class="sizedToGridArea absolute firstRowFirstColumn"
+    data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowFirstColumn"
+    data-offset-x="15" data-offset-y="65" data-expected-width="515" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute firstRowSecondColumn"
+    data-offset-x="65" data-offset-y="15" data-expected-width="465" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowSecondColumn"
+    data-offset-x="65" data-offset-y="65" data-expected-width="465" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows"
+    data-offset-x="165" data-offset-y="165" data-expected-width="365" data-expected-height="350">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns"
+    data-offset-x="165" data-offset-y="165" data-expected-width="350" data-expected-height="350">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows"
+    data-offset-x="0" data-offset-y="65" data-expected-width="315" data-expected-height="250">
+  </div>
+  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows2Columns"
+    data-offset-x="65" data-offset-y="65" data-expected-width="250" data-expected-height="250">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="165" data-expected-height="165">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndFirstColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="65" data-expected-height="165">
+  </div>
+  <div class="sizedToGridArea absolute endFirstRowEndSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="165" data-expected-height="65">
+  </div>
+  <div class="sizedToGridArea absolute endFirstRowEndFirstColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="65" data-expected-height="65">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn"
+    data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlyFirstColumn"
+    data-offset-x="15" data-offset-y="65" data-expected-width="50" data-expected-height="100">
+  </div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlySecondColumn"
+    data-offset-x="65" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
+    data-offset-x="65" data-offset-y="65" data-expected-width="100" data-expected-height="100">
+  </div>
+  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns"
+    data-offset-x="165" data-offset-y="165" data-expected-width="350" data-expected-height="350">
+  </div>
+  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows"
+    data-offset-x="165" data-offset-y="165" data-expected-width="150" data-expected-height="350">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
+    data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
+  </div>
+  <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
+    data-offset-x="55" data-offset-y="95" data-expected-width="515" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
+    data-offset-x="-35" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
+    data-offset-x="45" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
+    data-offset-x="15" data-offset-y="140" data-expected-width="465" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
+    data-offset-x="190" data-offset-y="65" data-expected-width="365" data-expected-height="350">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
+    data-offset-x="145" data-offset-y="105" data-expected-width="350" data-expected-height="350">
+  </div>
+</div>
+
+<div class="grid">
+  <div>
+    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
+      data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
+    </div>
+    <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
+      data-offset-x="55" data-offset-y="95" data-expected-width="515" data-expected-height="515">
+    </div>
+    <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
+      data-offset-x="-35" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
+    </div>
+    <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
+      data-offset-x="45" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
+    </div>
+    <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
+      data-offset-x="15" data-offset-y="140" data-expected-width="465" data-expected-height="465">
+    </div>
+    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
+      data-offset-x="190" data-offset-y="65" data-expected-width="365" data-expected-height="350">
+    </div>
+    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
+      data-offset-x="145" data-offset-y="105" data-expected-width="350" data-expected-height="350">
+    </div>
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sizedToGridArea absolute autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="530">
+  </div>
+  <div class="sizedToGridArea absolute firstRowFirstColumn"
+    data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowFirstColumn"
+    data-offset-x="0" data-offset-y="65" data-expected-width="515" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute firstRowSecondColumn"
+    data-offset-x="0" data-offset-y="15" data-expected-width="465" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowSecondColumn"
+    data-offset-x="0" data-offset-y="65" data-expected-width="465" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows"
+    data-offset-x="0" data-offset-y="165" data-expected-width="365" data-expected-height="350">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns"
+    data-offset-x="15" data-offset-y="165" data-expected-width="350" data-expected-height="350">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows"
+    data-offset-x="215" data-offset-y="65" data-expected-width="315" data-expected-height="250">
+  </div>
+  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows2Columns"
+    data-offset-x="215" data-offset-y="65" data-expected-width="250" data-expected-height="250">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
+    data-offset-x="365" data-offset-y="0" data-expected-width="165" data-expected-height="165">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndFirstColumn"
+    data-offset-x="465" data-offset-y="0" data-expected-width="65" data-expected-height="165">
+  </div>
+  <div class="sizedToGridArea absolute endFirstRowEndSecondColumn"
+    data-offset-x="365" data-offset-y="0" data-expected-width="165" data-expected-height="65">
+  </div>
+  <div class="sizedToGridArea absolute endFirstRowEndFirstColumn"
+    data-offset-x="465" data-offset-y="0" data-expected-width="65" data-expected-height="65">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn"
+    data-offset-x="465" data-offset-y="15" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlyFirstColumn"
+    data-offset-x="465" data-offset-y="65" data-expected-width="50" data-expected-height="100">
+  </div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlySecondColumn"
+    data-offset-x="365" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
+    data-offset-x="365" data-offset-y="65" data-expected-width="100" data-expected-height="100">
+  </div>
+  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns"
+    data-offset-x="15" data-offset-y="165" data-expected-width="350" data-expected-height="350">
+  </div>
+  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows"
+    data-offset-x="215" data-offset-y="165" data-expected-width="150" data-expected-height="350">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
+    data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
+  </div>
+  <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
+    data-offset-x="40" data-offset-y="95" data-expected-width="515" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
+    data-offset-x="-50" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
+    data-offset-x="-20" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
+  </div>
+  <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
+    data-offset-x="-50" data-offset-y="140" data-expected-width="465" data-expected-height="465">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
+    data-offset-x="25" data-offset-y="65" data-expected-width="365" data-expected-height="350">
+  </div>
+  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
+    data-offset-x="-35" data-offset-y="105" data-expected-width="350" data-expected-height="350">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div>
+    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
+      data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
+    </div>
+    <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
+      data-offset-x="40" data-offset-y="95" data-expected-width="515" data-expected-height="515">
+    </div>
+    <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
+      data-offset-x="-50" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
+    </div>
+    <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
+      data-offset-x="-20" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
+    </div>
+    <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
+      data-offset-x="-50" data-offset-y="140" data-expected-width="465" data-expected-height="465">
+    </div>
+    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
+      data-offset-x="25" data-offset-y="65" data-expected-width="365" data-expected-height="350">
+    </div>
+    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
+      data-offset-x="-35" data-offset-y="105" data-expected-width="350" data-expected-height="350">
+    </div>
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-grid-container-parent-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-grid-container-parent-001.html
new file mode 100644
index 0000000..3ea36c7d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/absolute-positioning-grid-container-parent-001.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Absolute positioning grid container parent</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks the behavior of the absolutely positioned elements with a grid container as parent.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 50px 100px 150px;
+  grid-template-rows: 25px 50px 100px;
+  width: 300px;
+  height: 200px;
+  border: 5px solid black;
+  margin: 20px 30px;
+  padding: 5px 15px;
+}
+
+.container {
+  width: 500px;
+  height: 400px;
+}
+
+.relative {
+  /* Ensures that the element is the containing block of the absolutely positioned elements. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+<body onload="checkLayout('.container')">
+
+<div id="log"></div>
+
+<div class="container relative">
+  <div class="grid">
+    <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="35" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
+  </div>
+</div>
+
+<div class="container relative">
+  <div class="grid">
+    <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="35" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
+  </div>
+</div>
+
+<div class="container relative">
+  <div class="grid">
+    <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="35" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
+  </div>
+</div>
+
+<div class="container">
+  <div class="grid relative">
+    <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="0" data-offset-y="0" data-expected-width="330" data-expected-height="210"></div>
+  </div>
+</div>
+
+<div class="container">
+  <div class="grid relative">
+    <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="15" data-offset-y="5" data-expected-width="315" data-expected-height="205"></div>
+  </div>
+</div>
+
+<div class="container">
+  <div class="grid relative">
+    <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="65" data-offset-y="30" data-expected-width="265" data-expected-height="180"></div>
+  </div>
+</div>
+
+<div class="container relative">
+  <div class="grid directionRTL">
+    <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="-135" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
+  </div>
+</div>
+
+<div class="container relative">
+  <div class="grid directionRTL">
+    <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="-135" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
+  </div>
+</div>
+
+<div class="container relative">
+  <div class="grid directionRTL">
+    <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="-135" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
+  </div>
+</div>
+
+<div class="container">
+  <div class="grid relative directionRTL">
+    <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="0" data-offset-y="0" data-expected-width="330" data-expected-height="210"></div>
+  </div>
+</div>
+
+<div class="container">
+  <div class="grid relative directionRTL">
+    <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="0" data-offset-y="5" data-expected-width="315" data-expected-height="205"></div>
+  </div>
+</div>
+
+<div class="container">
+  <div class="grid relative directionRTL">
+    <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="0" data-offset-y="30" data-expected-width="265" data-expected-height="180"></div>
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-item-absolute-positioning-dynamic-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-item-absolute-positioning-dynamic-001.html
new file mode 100644
index 0000000..bcd5dbaa
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-item-absolute-positioning-dynamic-001.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html lang=en class="reftest-wait">
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid item absolute positioning dynamic</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
+<meta name="assert" content="This test checks that a grid item which becomes an absolutelly positioned children of a grid.">
+<style>
+#wrapper {
+  width: 200px;
+  height: 200px;
+  position: relative;
+  background: red;
+}
+
+#grid {
+  display: grid;
+  grid: 100px / 100px;
+}
+
+#item {
+  background: green;
+  width: 100%;
+  height: 100%;
+}
+</style>
+
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+
+<div id="wrapper">
+  <div id="grid">
+    <div id="item"></div>
+  </div>
+</div>
+
+<script>
+  window.requestAnimationFrame(() => {
+    document.getElementById("item").style.position = "absolute";
+    document.body.offsetLeft;
+    document.documentElement.classList.remove('reftest-wait');
+  });
+</script>
+
+</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-paint-positioned-children-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-paint-positioned-children-001-ref.html
new file mode 100644
index 0000000..ac2a95e7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-paint-positioned-children-001-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid paint positioned children reference file</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<style>
+.grid {
+  border: 2px solid black;
+  width: 100px;
+  height: 40px;
+  background: gray;
+}
+
+.abs {
+  height: 5px;
+  float: left;
+}
+
+#item {
+  width: 90px;
+  height: 30px;
+  margin-top: 10px;
+}
+</style>
+
+<p>This test passes if you see a gray box with a black border color with 5 rectangles inside. The first line contains a purple, orange, yellow and magenta boxes. Bellow them you should see a 90px cyan box.</p>
+
+<div class="grid">
+  <div class="abs" style="background: purple; width: 10px;"></div>
+  <div class="abs" style="background: orange; width: 20px;"></div>
+  <div class="abs" style="background: yellow; width: 30px;"></div>
+  <div class="abs" style="background: magenta; width: 40px;"></div>
+  <div id="item" style="background: cyan;"</div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-paint-positioned-children-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-paint-positioned-children-001.html
new file mode 100644
index 0000000..7528b08
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-paint-positioned-children-001.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid paint positioned children</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="grid-paint-positioned-children-001-ref.html">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+.grid {
+  border: 2px solid black;
+  position: relative;
+  width: 100px;
+
+  grid-template-columns: 10px 20px 30px 40px;
+
+  padding-top: 10px;
+}
+
+.abs {
+  height: 5px;
+  position: absolute;
+  width: 100%;
+}
+
+#item {
+  width: 90px;
+  height: 30px;
+}
+
+</style>
+
+<p>This test passes if you see a gray box with a black border color with 5 rectangles inside. The first line contains a purple, orange, yellow and magenta boxes. Bellow them you should see a 90px cyan box.</p>
+
+<div class="grid">
+  <div id="item" style="grid-column: 1 / -1; background: cyan;"></div>
+  <div class="abs" style="grid-column: 1 / 2; background: purple;"></div>
+  <div class="abs" style="grid-column: 2 / 3; background: orange;"></div>
+  <div class="abs" style="grid-column: 3 / 4; background: yellow;"></div>
+  <div class="abs" style="grid-column: 4 / 5; background: magenta;"></div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-children-writing-modes-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-children-writing-modes-001-ref.html
new file mode 100644
index 0000000..3610cd3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-children-writing-modes-001-ref.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned children writing modes reference test</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  display: block;
+  margin: 5px;
+  width: 100px;
+  height: 75px;
+  padding: 5px 10px 15px 20px;
+  border-style: solid;
+  border-width: 5px 10px 15px 20px;
+  float: left;
+}
+
+.green {
+  background-color: green;
+  width: 30px;
+  height: 20px;
+  font: 10px/1 Ahem;
+}
+
+.verticalSize {
+  width: 20px;
+  height: 30px;
+}
+
+</style>
+
+<p>For the test to pass you should see no red and only green boxes. The black box will be positioned depending on the writing mode and text direction values.</p>
+
+<div class="grid">
+  <div class="green">XX</div>
+</div>
+
+<div class="grid verticalRL">
+  <div class="green verticalSize">XX</div>
+</div>
+
+<div class="grid verticalLR">
+  <div class="green verticalSize">XX</div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="green">XX</div>
+</div>
+
+<div class="grid verticalRL directionRTL">
+  <div class="green verticalSize">XX</div>
+</div>
+
+<div class="grid verticalLR directionRTL">
+  <div class="green verticalSize">XX</div>
+</div>
+
+<div class="grid">
+  <div class="green">XX</div>
+</div>
+
+<div class="grid verticalRL">
+  <div class="green verticalSize">XX</div>
+</div>
+
+<div class="grid verticalLR">
+  <div class="green verticalSize">XX</div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="green">XX</div>
+</div>
+
+<div class="grid verticalRL directionRTL">
+  <div class="green verticalSize">XX</div>
+</div>
+
+<div class="grid verticalLR directionRTL">
+  <div class="green verticalSize">XX</div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-children-writing-modes-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-children-writing-modes-001.html
new file mode 100644
index 0000000..b922639
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-children-writing-modes-001.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned children writing modes</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="grid-positioned-children-writing-modes-001-ref.html">
+<meta name="assert" content="This test checks the behavior of the positioned grid children in combination with the writing modes and text direction properties.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  margin: 5px;
+  width: 100px;
+  height: 75px;
+  grid: 20px / 30px;
+  padding: 5px 10px 15px 20px;
+  border-style: solid;
+  border-width: 5px 10px 15px 20px;
+  float: left;
+  /* Ensures that the grid container is the containing block of the grid children. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.onlyFirstRowOnlyFirstColumn {
+  background-color: green;
+  grid-column: 1 / 2;
+  grid-row: 1 / 2;
+}
+
+.offsets {
+  left: 0;
+  top: 0;
+}
+
+.red {
+  background-color: red;
+}
+
+</style>
+
+<p>For the test to pass you should see no red and only green boxes. The black box will be positioned depending on the writing mode and text direction values.</p>
+
+<div class="grid">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalRL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalLR">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalRL directionRTL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalLR directionRTL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalRL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalLR">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalRL directionRTL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
+
+<div class="grid verticalLR directionRTL">
+  <div class="red"></div>
+  <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-item-dynamic-change-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-item-dynamic-change-001.html
new file mode 100644
index 0000000..ff0c04e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-item-dynamic-change-001.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html lang=en class="reftest-wait">
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned item dynamic change</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
+<meta name="assert" content="This test checks that positioned items can be dynamically changed.">
+<style>
+.grid {
+  display: grid;
+  grid: 50px 50px / 50px 50px;
+  position: relative;
+}
+
+.green {
+  background: green;
+}
+
+.red {
+  background: red;
+}
+
+#item {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  grid-column: 1 / 2;
+  grid-row: 1 / 2;
+}
+</style>
+
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+
+<div class="grid">
+  <div class="green"></div>
+  <div class="green"></div>
+  <div class="green"></div>
+  <div class="red"></div>
+  <div id="item" class="green"></div>
+</div>
+
+<script>
+  document.body.offsetLeft;
+
+  var item = document.getElementById("item");
+  item.style.gridColumn = "2 / 3";
+  item.style.gridRow = "2 / 3";
+
+  document.documentElement.classList.remove('reftest-wait');
+</script>
+
+</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-001-ref.html
new file mode 100644
index 0000000..899dc98
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-001-ref.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items background reference file</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<style>
+.grid {
+  width: 500px;
+  height: 300px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+}
+
+.container {
+  position: relative;
+  float: left;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.green {
+  background-color: green;
+}
+</style>
+
+<p>The test passes if you see 4 green boxes and no red.</p>
+
+<div class="container">
+  <div class="grid"></div>
+  <div class="absolute green" style="left: 55px; top: 50px; width: 100px; height: 50px"></div>
+  <div class="absolute green" style="left: 290px; top: 50px; width: 50px; height: 20px"></div>
+  <div class="absolute green" style="left: 50px; top: 115px; width: 50px; height: 30px"></div>
+  <div class="absolute green" style="left: 175px; top: 135px; width: 145px; height: 75px"></div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-001.html
new file mode 100644
index 0000000..2b299cd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-001.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items background</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="grid-positioned-items-background-001-ref.html">
+<meta name="assert" content="This test checks that the background of positioned items is painted in the right position">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 200px;
+  grid-template-rows: 50px 150px;
+  width: 500px;
+  height: 300px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+  background-color: transparent;
+}
+
+.container {
+  position: relative;
+  float: left;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.grid > div {
+  background-color: green;
+}
+
+.lengthSize {
+  width: 50px;
+  height: 20px;
+}
+
+.percentageSize {
+  width: 50%;
+  height: 20%;
+}
+
+.offsetsSize {
+  left: 25px;
+  right: 30px;
+  top: 35px;
+  bottom: 40px;
+}
+
+.red {
+  background-color: red;
+}
+</style>
+
+<p>The test passes if you see 4 green boxes and no red.</p>
+
+<div class="container">
+  <div class="absolute red" style="left: 55px; top: 50px; width: 100px; height: 50px"></div>
+  <div class="absolute red" style="left: 290px; top: 50px; width: 50px; height: 20px"></div>
+  <div class="absolute red" style="left: 50px; top: 115px; width: 50px; height: 30px"></div>
+  <div class="absolute red" style="left: 175px; top: 135px; width: 145px; height: 75px"></div>
+  <div class="grid">
+    <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
+      style="left: 5px;">
+    </div>
+    <div class="absolute onlyFirstRowOnlySecondColumn lengthSize"
+      style="right: 10px;">
+    </div>
+    <div class="absolute onlySecondRowOnlyFirstColumn percentageSize"
+      style="top: 15px;">
+    </div>
+    <div class="absolute onlySecondRowOnlySecondColumn offsetsSize"></div>
+  </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-rtl-001-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-rtl-001-ref.html
new file mode 100644
index 0000000..f57f496
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-rtl-001-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items background RTL reference file</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<html>
+<style>
+.grid {
+  width: 500px;
+  height: 300px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+}
+
+.container {
+  position: relative;
+  float: left;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.green {
+  background-color: green;
+}
+</style>
+
+<p>The test passes if you see 4 green boxes and no red.</p>
+
+<div class="container">
+  <div class="grid"></div>
+  <div class="absolute green" style="left: 455px; top: 50px; width: 100px; height: 50px"></div>
+  <div class="absolute green" style="left: 390px; top: 50px; width: 50px; height: 20px"></div>
+  <div class="absolute green" style="left: 500px; top: 115px; width: 50px; height: 30px"></div>
+  <div class="absolute green" style="left: 275px; top: 135px; width: 145px; height: 75px"></div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-rtl-001.html
new file mode 100644
index 0000000..50741e2f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-background-rtl-001.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items background RTL</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="grid-positioned-items-background-rtl-001-ref.html">
+<meta name="assert" content="This test checks that the background of positioned items is painted in the right position using RTL direction.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 200px;
+  grid-template-rows: 50px 150px;
+  width: 500px;
+  height: 300px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+  background-color: transparent;
+}
+
+.container {
+  position: relative;
+  float: left;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.grid > div {
+  background-color: green;
+}
+
+.lengthSize {
+  width: 50px;
+  height: 20px;
+}
+
+.percentageSize {
+  width: 50%;
+  height: 20%;
+}
+
+.offsetsSize {
+  left: 25px;
+  right: 30px;
+  top: 35px;
+  bottom: 40px;
+}
+
+.red {
+  background-color: red;
+}
+</style>
+
+<p>The test passes if you see 4 green boxes and no red.</p>
+
+<div class="container">
+  <div class="absolute red" style="left: 455px; top: 50px; width: 100px; height: 50px"></div>
+  <div class="absolute red" style="left: 390px; top: 50px; width: 50px; height: 20px"></div>
+  <div class="absolute red" style="left: 500px; top: 115px; width: 50px; height: 30px"></div>
+  <div class="absolute red" style="left: 275px; top: 135px; width: 145px; height: 75px"></div>
+  <div class="grid directionRTL">
+    <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
+      style="left: 5px;">
+    </div>
+    <div class="absolute onlyFirstRowOnlySecondColumn lengthSize"
+      style="right: 10px;">
+    </div>
+    <div class="absolute onlySecondRowOnlyFirstColumn percentageSize"
+      style="top: 15px;">
+    </div>
+    <div class="absolute onlySecondRowOnlySecondColumn offsetsSize"></div>
+  </div>
+</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-content-alignment-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-content-alignment-001.html
new file mode 100644
index 0000000..d92c9b7c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-content-alignment-001.html
@@ -0,0 +1,403 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items content alignment</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align" title="10.5. Aligning the Grid: the justify-content and align-content properties">
+<meta name="assert" content="This test checks the behavior of the positioned items in a grid using content alignment.">
+<link rel="stylesheet" href="../support/grid.css">
+<link rel="stylesheet" href="../support/grid-alignment.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 50px;
+  grid-template-rows: 70px 30px;
+  width: 400px;
+  height: 200px;
+  margin: 5px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.grid > div {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  background-color: lime;
+}
+
+.offsets {
+  left: 0;
+  top: 0;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid contentStart">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="125" data-offset-y="50" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="125" data-offset-y="50" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="250" data-offset-y="100" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="250" data-offset-y="100" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="63" data-offset-y="25" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="63" data-offset-y="25" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="83" data-offset-y="33" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="83" data-offset-y="33" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="100" data-offset-y="70" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="100" data-offset-y="70" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="225" data-offset-y="120" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="225" data-offset-y="120" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="288" data-offset-y="145" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="288" data-offset-y="145" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="267" data-offset-y="137" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="267" data-offset-y="137" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="225" data-expected-height="120">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="225" data-expected-height="120">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="350" data-expected-height="170">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="350" data-expected-height="170">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="163" data-expected-height="95">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="163" data-expected-height="95">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="183" data-expected-height="103">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="183" data-expected-height="103">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="100" data-offset-y="70" data-expected-width="300" data-expected-height="130">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="100" data-offset-y="70" data-expected-width="300" data-expected-height="130">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="225" data-offset-y="120" data-expected-width="175" data-expected-height="80">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="225" data-offset-y="120" data-expected-width="175" data-expected-height="80">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="288" data-offset-y="145" data-expected-width="112" data-expected-height="55">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="288" data-offset-y="145" data-expected-width="112" data-expected-height="55">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="267" data-offset-y="137" data-expected-width="133" data-expected-height="63">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="267" data-offset-y="137" data-expected-width="133" data-expected-height="63">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentStart">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentCenter">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentEnd">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentSpaceBetween">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentSpaceAround">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid contentSpaceEvenly">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-content-alignment-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-content-alignment-rtl-001.html
new file mode 100644
index 0000000..748cb6f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-content-alignment-rtl-001.html
@@ -0,0 +1,403 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items content alignment RTL</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align" title="10.5. Aligning the Grid: the justify-content and align-content properties">
+<meta name="assert" content="This test checks the behavior of the positioned items in a grid using content alignment in RTL.">
+<link rel="stylesheet" href="../support/grid.css">
+<link rel="stylesheet" href="../support/grid-alignment.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 50px;
+  grid-template-rows: 70px 30px;
+  width: 400px;
+  height: 200px;
+  margin: 5px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.grid > div {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  background-color: lime;
+}
+
+.offsets {
+  left: 0;
+  top: 0;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid directionRTL contentStart">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="175" data-offset-y="50" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="175" data-offset-y="50" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="50" data-offset-y="100" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="50" data-offset-y="100" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="238" data-offset-y="25" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="238" data-offset-y="25" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="217" data-offset-y="33" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="217" data-offset-y="33" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="250" data-offset-y="70" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="250" data-offset-y="70" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="125" data-offset-y="120" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="125" data-offset-y="120" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="63" data-offset-y="145" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="63" data-offset-y="145" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="83" data-offset-y="137" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="83" data-offset-y="137" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="175" data-offset-y="0" data-expected-width="225" data-expected-height="120">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="175" data-offset-y="0" data-expected-width="225" data-expected-height="120">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="50" data-offset-y="0" data-expected-width="350" data-expected-height="170">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="50" data-offset-y="0" data-expected-width="350" data-expected-height="170">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="238" data-offset-y="0" data-expected-width="162" data-expected-height="95">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="238" data-offset-y="0" data-expected-width="162" data-expected-height="95">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="217" data-offset-y="0" data-expected-width="183" data-expected-height="103">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="217" data-offset-y="0" data-expected-width="183" data-expected-height="103">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="70" data-expected-width="300" data-expected-height="130">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="70" data-expected-width="300" data-expected-height="130">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="120" data-expected-width="175" data-expected-height="80">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="120" data-expected-width="175" data-expected-height="80">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="145" data-expected-width="113" data-expected-height="55">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="145" data-expected-width="113" data-expected-height="55">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="137" data-expected-width="133" data-expected-height="63">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="137" data-expected-width="133" data-expected-height="63">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentStart">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentCenter">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentEnd">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceBetween">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceAround">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL contentSpaceEvenly">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-gaps-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-gaps-001.html
new file mode 100644
index 0000000..5869bfb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-gaps-001.html
@@ -0,0 +1,309 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items gaps</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#gutters" title="10.1. Gutters: the row-gap, column-gap, and gap properties">
+<meta name="assert" content="This test checks the behavior of the positioned items in a grid container with gaps.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 100px 100px 100px;
+  grid-template-rows: 50px 50px;
+  grid-gap: 25px 50px;
+  width: 800px;
+  height: 200px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.grid > div {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  background-color: lime;
+}
+
+.offsets {
+  left: 0;
+  top: 0;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 1 / auto; grid-row: 1 / auto;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 1 / auto; grid-row: 1 / auto;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 1 / 3; grid-row: 1 / 3;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="250" data-expected-height="125">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 1 / 3; grid-row: 1 / 3;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="250" data-expected-height="125">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 1 / 4; grid-row: 1 / 4;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="400" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 1 / 4; grid-row: 1 / 4;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="400" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 1 / 5; grid-row: 1 / 5;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="550" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 1 / 5; grid-row: 1 / 5;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="550" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 1 / 6; grid-row: 1 / 6;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 1 / 6; grid-row: 1 / 6;"
+    data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 2 / 4; grid-row: 2 / 4;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="250" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 2 / 4; grid-row: 2 / 4;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="250" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 2 / 5; grid-row: 2 / 5;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="400" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 2 / 5; grid-row: 2 / 5;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="400" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 2 / 6; grid-row: 2 / 6;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 2 / 6; grid-row: 2 / 6;"
+    data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="315" data-offset-y="140" data-expected-width="515" data-expected-height="90">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="315" data-offset-y="140" data-expected-width="515" data-expected-height="90">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 4 / auto; grid-row: 4 / auto;"
+    data-offset-x="465" data-offset-y="0" data-expected-width="365" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 4 / auto; grid-row: 4 / auto;"
+    data-offset-x="465" data-offset-y="0" data-expected-width="365" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 5 / auto; grid-row: 5 / auto;"
+    data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 5 / auto; grid-row: 5 / auto;"
+    data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: 6 / auto; grid-row: 6 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: 6 / auto; grid-row: 6 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="115" data-expected-height="65">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="115" data-expected-height="65">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: auto / 3; grid-row: auto / 3;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: auto / 3; grid-row: auto / 3;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: auto / 4; grid-row: auto / 4;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="415" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: auto / 4; grid-row: auto / 4;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="415" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: auto / 5; grid-row: auto / 5;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="565" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: auto / 5; grid-row: auto / 5;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="565" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div style="grid-column: auto / 6; grid-row: auto / 6;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="offsets" style="grid-column: auto / 6; grid-row: auto / 6;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-gaps-rtl-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-gaps-rtl-001.html
new file mode 100644
index 0000000..e6fe7c2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-gaps-rtl-001.html
@@ -0,0 +1,309 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items gaps RTL</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#gutters" title="10.1. Gutters: the row-gap, column-gap, and gap properties">
+<meta name="assert" content="This test checks the behavior of the positioned items in a grid container with gaps in RTL.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 100px 100px 100px;
+  grid-template-rows: 50px 50px;
+  grid-gap: 25px 50px;
+  width: 800px;
+  height: 200px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.grid > div {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  background-color: lime;
+}
+
+.offsets {
+  left: 0;
+  top: 0;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 1 / auto; grid-row: 1 / auto;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 1 / auto; grid-row: 1 / auto;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="715" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
+    data-offset-x="715" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 1 / 3; grid-row: 1 / 3;"
+    data-offset-x="565" data-offset-y="15" data-expected-width="250" data-expected-height="125">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 1 / 3; grid-row: 1 / 3;"
+    data-offset-x="565" data-offset-y="15" data-expected-width="250" data-expected-height="125">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 1 / 4; grid-row: 1 / 4;"
+    data-offset-x="415" data-offset-y="15" data-expected-width="400" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 1 / 4; grid-row: 1 / 4;"
+    data-offset-x="415" data-offset-y="15" data-expected-width="400" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 1 / 5; grid-row: 1 / 5;"
+    data-offset-x="265" data-offset-y="15" data-expected-width="550" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 1 / 5; grid-row: 1 / 5;"
+    data-offset-x="265" data-offset-y="15" data-expected-width="550" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 1 / 6; grid-row: 1 / 6;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 1 / 6; grid-row: 1 / 6;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="565" data-offset-y="90" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
+    data-offset-x="565" data-offset-y="90" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 2 / 4; grid-row: 2 / 4;"
+    data-offset-x="415" data-offset-y="90" data-expected-width="250" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 2 / 4; grid-row: 2 / 4;"
+    data-offset-x="415" data-offset-y="90" data-expected-width="250" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 2 / 5; grid-row: 2 / 5;"
+    data-offset-x="265" data-offset-y="90" data-expected-width="400" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 2 / 5; grid-row: 2 / 5;"
+    data-offset-x="265" data-offset-y="90" data-expected-width="400" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 2 / 6; grid-row: 2 / 6;"
+    data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 2 / 6; grid-row: 2 / 6;"
+    data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="0" data-offset-y="140" data-expected-width="515" data-expected-height="90">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="0" data-offset-y="140" data-expected-width="515" data-expected-height="90">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 4 / auto; grid-row: 4 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="365" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 4 / auto; grid-row: 4 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="365" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 5 / auto; grid-row: 5 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 5 / auto; grid-row: 5 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: 6 / auto; grid-row: 6 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: 6 / auto; grid-row: 6 / auto;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="815" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="815" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="715" data-offset-y="0" data-expected-width="115" data-expected-height="65">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="715" data-offset-y="0" data-expected-width="115" data-expected-height="65">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: auto / 3; grid-row: auto / 3;"
+    data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: auto / 3; grid-row: auto / 3;"
+    data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="140">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: auto / 4; grid-row: auto / 4;"
+    data-offset-x="415" data-offset-y="0" data-expected-width="415" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: auto / 4; grid-row: auto / 4;"
+    data-offset-x="415" data-offset-y="0" data-expected-width="415" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: auto / 5; grid-row: auto / 5;"
+    data-offset-x="265" data-offset-y="0" data-expected-width="565" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: auto / 5; grid-row: auto / 5;"
+    data-offset-x="265" data-offset-y="0" data-expected-width="565" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div style="grid-column: auto / 6; grid-row: auto / 6;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="offsets" style="grid-column: auto / 6; grid-row: auto / 6;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-implicit-grid-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-implicit-grid-001.html
new file mode 100644
index 0000000..063da56f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-implicit-grid-001.html
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items implicit grid</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#implicit-grids" title="7.5. The Implicit Grid">
+<meta name="assert" content="This test checks the behavior of the absolutely positioned grid items placed on the implicit grid.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  width: 200px;
+  height: 200px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.grid-columns-rows {
+  grid-template-columns: 100px;
+  grid-template-rows: 50px;
+}
+
+.absolute {
+  position: absolute;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute secondRowSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid grid-columns-rows">
+  <div class="sizedToGridArea absolute secondRowSecondColumn"
+    data-offset-x="115" data-offset-y="65" data-expected-width="115" data-expected-height="165">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
+    data-offset-x="115" data-offset-y="65" data-expected-width="115" data-expected-height="165">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sizedToGridArea absolute secondRowSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+</div>
+
+<div class="grid grid-columns-rows directionRTL">
+  <div class="sizedToGridArea absolute secondRowSecondColumn"
+    data-offset-x="0" data-offset-y="65" data-expected-width="115" data-expected-height="165">
+  </div>
+  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
+  </div>
+  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
+    data-offset-x="0" data-offset-y="65" data-expected-width="115" data-expected-height="165">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-implicit-grid-line-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-implicit-grid-line-001.html
new file mode 100644
index 0000000..908ea39e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-implicit-grid-line-001.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items implicit grid line</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#implicit-grids" title="7.5. The Implicit Grid">
+<meta name="assert" content="This test checks that grid placement properties of absolutely positioned items using implicit grid lines are treated as 'auto'.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 200px;
+  grid-template-rows: 50px 150px;
+  width: 500px;
+  height: 300px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.startImplicitLine {
+  background-color: blue;
+  grid-column: 5;
+  grid-row: 8;
+}
+
+.endImplicitLine {
+  background-color: orange;
+  grid-column: 1 / 5;
+  grid-row: 1 / 8;
+}
+
+.startImplicitLineSpan {
+  background-color: blue;
+  grid-column: span 5;
+  grid-row: span 8;
+}
+
+.endImplicitLineSpan {
+  background-color: orange;
+  grid-column: 1 / span 5;
+  grid-row: 1 / span 8;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="absolute sizedToGridArea startImplicitLine"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
+  </div>
+  <div class="absolute sizedToGridArea endImplicitLine"
+    data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="absolute sizedToGridArea startImplicitLineSpan"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
+  </div>
+  <div class="absolute sizedToGridArea endImplicitLineSpan"
+    data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="absolute sizedToGridArea startImplicitLine"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
+  </div>
+  <div class="absolute sizedToGridArea endImplicitLine"
+    data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="absolute sizedToGridArea startImplicitLineSpan"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
+  </div>
+  <div class="absolute sizedToGridArea endImplicitLineSpan"
+    data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-padding-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-padding-001.html
new file mode 100644
index 0000000..5a7244c7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-padding-001.html
@@ -0,0 +1,251 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items padding</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks that positioned grid items can be placed directly on the padding.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 200px;
+  grid-template-rows: 50px 150px;
+  width: 500px;
+  height: 300px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.autoFit {
+  grid-template-columns: repeat(auto-fit, 100px);
+  grid-template-rows: repeat(auto-fit, 100px);
+}
+
+.absolute {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: lime;
+}
+
+.gap { grid-gap: 10px; }
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: auto / 1;"
+    data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: auto / 1; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / auto;"
+    data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / auto; grid-row: 2 / 3;"
+    data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="absolute" style="grid-column: -5 / 1; grid-row: -5 / 1;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: -5 / 1;"
+    data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: -5 / 1; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / 5; grid-row: 3 / 5;"
+    data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / 5;"
+    data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / 5; grid-row: 2 / 3;"
+    data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="absolute" style="grid-column: span 2 / 1; grid-row: span 2 / 1;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: span 2 / 1;"
+    data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: span 2 / 1; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / span 2; grid-row: 3 / span 2;"
+    data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / span 2;"
+    data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / span 2; grid-row: 2 / 3;"
+    data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="absolute" style="grid-column: foo / 1; grid-row: foo / 1;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: foo / 1;"
+    data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: foo / 1; grid-row: 1 / 2;"
+    data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / foo; grid-row: 3 / foo;"
+    data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / foo;"
+    data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / foo; grid-row: 2 / 3;"
+    data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: auto / 1;"
+    data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: auto / 1; grid-row: 1 / 2;"
+    data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / auto;"
+    data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / auto; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="absolute" style="grid-column: -5 / 1; grid-row: -5 / 1;"
+    data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: -5 / 1;"
+    data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: -5 / 1; grid-row: 1 / 2;"
+    data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / 5; grid-row: 3 / 5;"
+    data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / 5;"
+    data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / 5; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="absolute" style="grid-column: span 2 / 1; grid-row: span 2 / 1;"
+    data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: span 2 / 1;"
+    data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: span 2 / 1; grid-row: 1 / 2;"
+    data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / span 2; grid-row: 3 / span 2;"
+    data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / span 2;"
+    data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / span 2; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="absolute" style="grid-column: foo / 1; grid-row: foo / 1;"
+    data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: 1 / 2; grid-row: foo / 1;"
+    data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: foo / 1; grid-row: 1 / 2;"
+    data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
+  </div>
+  <div class="absolute" style="grid-column: 3 / foo; grid-row: 3 / foo;"
+    data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / foo;"
+    data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
+  </div>
+  <div class="absolute" style="grid-column: 3 / foo; grid-row: 2 / 3;"
+    data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
+  </div>
+</div>
+
+<div class="grid autoFit gap">
+  <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
+     data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: -1 / auto; grid-row: -1 / auto;"
+     data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+<div class="grid autoFit gap">
+  <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
+     data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: -2 / auto; grid-row: -2 / auto;"
+     data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+<div class="grid autoFit directionRTL gap">
+  <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
+     data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: -1 / auto; grid-row: -1 / auto;"
+     data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+<div class="grid autoFit directionRTL gap">
+  <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
+     data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
+  </div>
+  <div class="absolute" style="grid-column: -2 / auto; grid-row: -2 / auto;"
+     data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-unknown-named-grid-line-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-unknown-named-grid-line-001.html
new file mode 100644
index 0000000..6aee082
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-unknown-named-grid-line-001.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items unknown named grid line</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks that grid placement properties of absolutely positioned items using unknown named grid lines are treated as 'auto'.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 100px 200px;
+  grid-template-rows: 50px 150px;
+  width: 500px;
+  height: 300px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.startUnknownLine {
+  background-color: blue;
+  grid-column: foo / 3;
+  grid-row: bar / 3;
+}
+
+.endUnknownLine {
+  background-color: orange;
+  grid-column: 1 / foo;
+  grid-row: 1 / bar;
+}
+
+.startAndEndUnknownLines {
+  background-color: green;
+  grid-column: foo / bar;
+  grid-row: foo / bar;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="absolute sizedToGridArea startAndEndUnknownLines"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
+  </div>
+  <div class="absolute sizedToGridArea endUnknownLine"
+    data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+  <div class="absolute sizedToGridArea startUnknownLine"
+    data-offset-x="0" data-offset-y="0" data-expected-width="315" data-expected-height="215">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="absolute sizedToGridArea startAndEndUnknownLines"
+    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
+  </div>
+  <div class="absolute sizedToGridArea endUnknownLine"
+    data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
+  </div>
+  <div class="absolute sizedToGridArea startUnknownLine"
+    data-offset-x="215" data-offset-y="0" data-expected-width="315" data-expected-height="215">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-within-grid-implicit-track-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-within-grid-implicit-track-001.html
new file mode 100644
index 0000000..1c82feb0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-positioned-items-within-grid-implicit-track-001.html
@@ -0,0 +1,193 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid positioned items within grid implicit track</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#implicit-grids" title="7.5. The Implicit Grid">
+<meta name="assert" content="This test checks that positioned grid items are placed properly (including implicit tracks) even if the grid has implicit tracks.">
+<link rel="stylesheet" href="../support/grid.css">
+<style>
+
+.grid {
+  grid-template-columns: 200px 300px;
+  grid-template-rows: 150px 250px;
+  grid-auto-columns: 100px;
+  grid-auto-rows: 50px;
+  width: 800px;
+  height: 600px;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background: cyan;
+}
+
+.sixRowsAndSixColumns {
+  background: magenta;
+  grid-row: -5 / 5;
+  grid-column: -5 / 5;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="215" data-expected-height="115">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="0" data-offset-y="0" data-expected-width="415" data-expected-height="265">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="715" data-offset-y="515" data-expected-width="115" data-expected-height="115">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="415" data-offset-y="265" data-expected-width="415" data-expected-height="365">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: -4 / 1; grid-row: -4 / 1;"
+    data-offset-x="115" data-offset-y="65" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: -4 / 2; grid-row: -4 / 2;"
+    data-offset-x="115" data-offset-y="65" data-expected-width="300" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 3 / 4; grid-row: 3 / 4;"
+    data-offset-x="715" data-offset-y="515" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 4; grid-row: 2 / 4;"
+    data-offset-x="415" data-offset-y="265" data-expected-width="400" data-expected-height="300">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
+    data-offset-x="615" data-offset-y="0" data-expected-width="215" data-expected-height="115">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
+    data-offset-x="415" data-offset-y="0" data-expected-width="415" data-expected-height="265">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
+    data-offset-x="0" data-offset-y="515" data-expected-width="115" data-expected-height="115">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 2 / auto; grid-row: 2 / auto;"
+    data-offset-x="0" data-offset-y="265" data-expected-width="415" data-expected-height="365">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: -4 / 1; grid-row: -4 / 1;"
+    data-offset-x="615" data-offset-y="65" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: -4 / 2; grid-row: -4 / 2;"
+    data-offset-x="415" data-offset-y="65" data-expected-width="300" data-expected-height="200">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 3 / 4; grid-row: 3 / 4;"
+    data-offset-x="15" data-offset-y="515" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid directionRTL">
+  <div class="sixRowsAndSixColumns"
+    data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
+  </div>
+  <div class="absolute" style="grid-column: 2 / 4; grid-row: 2 / 4;"
+    data-offset-x="15" data-offset-y="265" data-expected-width="400" data-expected-height="300">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-sizing-positioned-items-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-sizing-positioned-items-001.html
new file mode 100644
index 0000000..4bd43cc9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/grid-sizing-positioned-items-001.html
@@ -0,0 +1,200 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid sizing positioned items</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks the different size options for absolutely positioned grid items.">
+<link href="../support/grid.css" rel="stylesheet">
+<style>
+
+.grid {
+  grid-template-columns: 100px 200px;
+  grid-template-rows: 50px 150px;
+  width: 100%;
+  height: 100%;
+  border: 5px solid black;
+  margin: 30px;
+  padding: 15px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.lengthSize {
+  width: 50px;
+  height: 20px;
+}
+
+.percentageSize {
+  width: 50%;
+  height: 20%;
+}
+
+.offsets {
+  left: 5px;
+  right: 10px;
+  top: 15px;
+  bottom: 20px;
+}
+
+.onlyFirstRowOnlyFirstColumn {
+  background-color: blue;
+  grid-column: 1 / 2;
+  grid-row: 1 / 2;
+}
+
+.endSecondRowEndSecondColumn {
+  background-color: orange;
+  grid-column-end: 3;
+  grid-row-end: 3;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="unconstrainedContainer">
+  <div class="grid">
+    <div class="absolute autoRowAutoColumn sizedToGridArea"
+      data-offset-x="0" data-offset-y="0" data-expected-width="1030" data-expected-height="1030">
+    </div>
+    <div class="absolute secondRowSecondColumn sizedToGridArea"
+      data-offset-x="115" data-offset-y="65" data-expected-width="915" data-expected-height="965">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
+      data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn sizedToGridArea"
+      data-offset-x="0" data-offset-y="0" data-expected-width="315" data-expected-height="215">
+    </div>
+  </div>
+</div>
+
+<div class="unconstrainedContainer">
+  <div class="grid">
+    <div class="absolute autoRowAutoColumn lengthSize"
+      data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+    </div>
+    <div class="absolute secondRowSecondColumn lengthSize"
+      data-offset-x="115" data-offset-y="65" data-expected-width="50" data-expected-height="20">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn lengthSize"
+      data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="20">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn lengthSize"
+      data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+    </div>
+  </div>
+</div>
+
+<div class="unconstrainedContainer">
+  <div class="grid">
+    <div class="absolute autoRowAutoColumn percentageSize"
+      data-offset-x="0" data-offset-y="0" data-expected-width="515" data-expected-height="206">
+    </div>
+    <div class="absolute secondRowSecondColumn percentageSize"
+      data-offset-x="115" data-offset-y="65" data-expected-width="457.5" data-expected-height="193">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn percentageSize"
+      data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="10">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn percentageSize"
+      data-offset-x="0" data-offset-y="0" data-expected-width="157.5" data-expected-height="43">
+    </div>
+  </div>
+</div>
+
+<div class="unconstrainedContainer">
+  <div class="grid">
+    <div class="absolute autoRowAutoColumn offsets"
+      data-offset-x="5" data-offset-y="15" data-expected-width="1015" data-expected-height="995">
+    </div>
+    <div class="absolute secondRowSecondColumn offsets"
+      data-offset-x="120" data-offset-y="80" data-expected-width="900" data-expected-height="930">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn offsets"
+      data-offset-x="20" data-offset-y="30" data-expected-width="85" data-expected-height="15">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn offsets"
+      data-offset-x="5" data-offset-y="15" data-expected-width="300" data-expected-height="180">
+    </div>
+  </div>
+</div>
+
+<div class="unconstrainedContainer">
+  <div class="grid directionRTL">
+    <div class="absolute autoRowAutoColumn sizedToGridArea"
+      data-offset-x="0" data-offset-y="0" data-expected-width="1030" data-expected-height="1030">
+    </div>
+    <div class="absolute secondRowSecondColumn sizedToGridArea"
+      data-offset-x="0" data-offset-y="65" data-expected-width="915" data-expected-height="965">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
+      data-offset-x="915" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn sizedToGridArea"
+      data-offset-x="715" data-offset-y="0" data-expected-width="315" data-expected-height="215">
+    </div>
+  </div>
+</div>
+
+<div class="unconstrainedContainer">
+  <div class="grid directionRTL">
+    <div class="absolute autoRowAutoColumn lengthSize"
+      data-offset-x="980" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+    </div>
+    <div class="absolute secondRowSecondColumn lengthSize"
+      data-offset-x="865" data-offset-y="65" data-expected-width="50" data-expected-height="20">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn lengthSize"
+      data-offset-x="965" data-offset-y="15" data-expected-width="50" data-expected-height="20">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn lengthSize"
+      data-offset-x="980" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+    </div>
+  </div>
+</div>
+
+<div class="unconstrainedContainer">
+  <div class="grid directionRTL">
+    <div class="absolute autoRowAutoColumn percentageSize"
+      data-offset-x="515" data-offset-y="0" data-expected-width="515" data-expected-height="206">
+    </div>
+    <div class="absolute secondRowSecondColumn percentageSize"
+      data-offset-x="457.5" data-offset-y="65" data-expected-width="457.5" data-expected-height="193">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn percentageSize"
+      data-offset-x="965" data-offset-y="15" data-expected-width="50" data-expected-height="10">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn percentageSize"
+      data-offset-x="873" data-offset-y="0" data-expected-width="157.5" data-expected-height="43">
+    </div>
+  </div>
+</div>
+
+<div class="unconstrainedContainer">
+  <div class="grid directionRTL">
+    <div class="absolute autoRowAutoColumn offsets"
+      data-offset-x="5" data-offset-y="15" data-expected-width="1015" data-expected-height="995">
+    </div>
+    <div class="absolute secondRowSecondColumn offsets"
+      data-offset-x="5" data-offset-y="80" data-expected-width="900" data-expected-height="930">
+    </div>
+    <div class="absolute onlyFirstRowOnlyFirstColumn offsets"
+      data-offset-x="920" data-offset-y="30" data-expected-width="85" data-expected-height="15">
+    </div>
+    <div class="absolute endSecondRowEndSecondColumn offsets"
+      data-offset-x="720" data-offset-y="15" data-expected-width="300" data-expected-height="180">
+    </div>
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-should-not-create-implicit-tracks-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-should-not-create-implicit-tracks-001.html
new file mode 100644
index 0000000..25881a4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-should-not-create-implicit-tracks-001.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Positioned grid items should not create implicit tracks</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks that positioned items shouldn't create implicit tracks on the grid.">
+<link href="../support/grid.css" rel="stylesheet">
+<style>
+
+.grid {
+  grid-auto-columns: 100px;
+  grid-auto-rows: 50px;
+  width: 400px;
+  height: 300px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+}
+
+.absolute {
+  position: absolute;
+}
+
+.seventhRowFourthColumn {
+  background-color: coral;
+  grid-column: 4;
+  grid-row: 7;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute seventhRowFourthColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="300">
+  </div>
+  <div class="autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+  </div>
+  <div class="autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="50" data-expected-width="100" data-expected-height="50">
+  </div>
+  <div class="autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="100" data-expected-width="100" data-expected-height="50">
+  </div>
+  <div class="autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="150" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-should-not-take-up-space-001.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-should-not-take-up-space-001.html
new file mode 100644
index 0000000..c7983671
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-should-not-take-up-space-001.html
@@ -0,0 +1,190 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Positioned grid items should not take up space</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks that positioned items shouldn't take up space or otherwise participate in the layout of the grid.">
+<link href="../support/grid.css" rel="stylesheet">
+<style>
+
+.grid {
+  grid-template-columns: 50px 100px;
+  grid-template-rows: 50px 100px;
+  width: 150px;
+  height: 150px;
+  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+  position: relative;
+  /* Ensures that the grid container is the containing block of the fixed positioned grid children. */
+  transform: translate(10px, 20px);
+}
+
+.absolute {
+  position: absolute;
+}
+
+.fixed {
+  position: fixed;
+}
+
+.offsetLeft100 {
+  left: 100px;
+}
+
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/check-layout-th.js"></script>
+
+<body onload="checkLayout('.grid')">
+
+<div id="log"></div>
+
+<p>Absolutely positioned:</p>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft100"
+    data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea absolute autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft100"
+    data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+    <div class="sizedToGridArea absolute autoRowAutoColumn"
+      data-offset-x="50" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+    </div>
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft100"
+      data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+    </div>
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
+  </div>
+</div>
+
+<p>Fixed positioned:</p>
+
+<div class="grid">
+  <div class="sizedToGridArea fixed autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea fixed autoRowAutoColumn offsetLeft100"
+    data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea fixed autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea fixed autoRowAutoColumn offsetLeft100"
+    data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+    <div class="sizedToGridArea fixed autoRowAutoColumn"
+      data-offset-x="50" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+    </div>
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
+  </div>
+</div>
+
+<div class="grid">
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
+    <div class="sizedToGridArea fixed autoRowAutoColumn offsetLeft100"
+      data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
+    </div>
+  </div>
+  <div class="sizedToGridArea autoRowAutoColumn"
+    data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
+  </div>
+</div>
+
+</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-sizing-expected.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-sizing-001-ref.html
similarity index 88%
rename from third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-sizing-expected.html
rename to third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-sizing-001-ref.html
index eda8c1f..a468863 100644
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-sizing-expected.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-sizing-001-ref.html
@@ -1,5 +1,9 @@
 <!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Positioned grid items sizing reference file</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<meta name="flags" content="ahem">
+<link href="../support/grid.css" rel="stylesheet">
 <style>
 
 .grid {
@@ -18,7 +22,6 @@
 
 </style>
 
-<p>This test checks that the sizing of positioned grid items without specific dimensions or offsets is equivalent to the size of regular items.</p>
 <p>The test passes if it has the same output than the reference.</p>
 
 <div class="grid">
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-sizing.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-sizing-001.html
similarity index 78%
rename from third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-sizing.html
rename to third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-sizing-001.html
index e9b6de0..ae12806 100644
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-sizing.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/abspos/positioned-grid-items-sizing-001.html
@@ -1,6 +1,12 @@
 <!DOCTYPE html>
-<link rel="match" href="positioned-grid-items-sizing-expected.html">
-<link href="resources/grid.css" rel="stylesheet">
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Positioned grid items sizing</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<link rel="match" href="positioned-grid-items-sizing-001-ref.html">
+<meta name="assert" content="This test checks that the sizing of positioned grid items without specific dimensions or offsets is equivalent to the size of regular items.">
+<meta name="flags" content="ahem">
+<link href="../support/grid.css" rel="stylesheet">
 <style>
 
 .grid {
@@ -21,10 +27,8 @@
   position: absolute;
 }
 
-
 </style>
 
-<p>This test checks that the sizing of positioned grid items without specific dimensions or offsets is equivalent to the size of regular items.</p>
 <p>The test passes if it has the same output than the reference.</p>
 
 <div class="grid">
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/support/grid-alignment.css b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/support/grid-alignment.css
new file mode 100644
index 0000000..4cf50154
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/support/grid-alignment.css
@@ -0,0 +1,240 @@
+/* align-self */
+.alignSelfAuto { align-self: auto; }
+.alignSelfStretch { align-self: stretch; }
+.alignSelfStart { align-self: start; }
+.alignSelfEnd { align-self: end; }
+.alignSelfCenter { align-self: center; }
+.alignSelfRight { align-self: right; }
+.alignSelfLeft { align-self: left; }
+
+.alignSelfFlexStart { align-self: flex-start; }
+.alignSelfFlexEnd { align-self: flex-end; }
+
+.alignSelfSelfStart { align-self: self-start; }
+.alignSelfSelfEnd { align-self: self-end; }
+
+.alignSelfCenterSafe { align-self: center safe; }
+.alignSelfCenterUnsafe { align-self: center unsafe; }
+.alignSelfEndSafe { align-self: end safe; }
+.alignSelfEndUnsafe { align-self: end unsafe; }
+
+.alignSelfBaseline { align-self: baseline; }
+
+/* align-items */
+.alignItemsAuto { align-items: auto; }
+.alignItemsStretch { align-items: stretch; }
+.alignItemsStart { align-items: start; }
+.alignItemsCenter { align-items: center; }
+.alignItemsEnd { align-items: end; }
+.alignItemsBaseline { align-items: baseline; }
+
+.alignItemsCenterSafe { align-items: center safe; }
+.alignItemsCenterUnsafe { align-items: center unsafe; }
+.alignItemsEndSafe { align-items: end safe; }
+.alignItemsEndUnsafe { align-items: end unsafe; }
+
+/* align-content */
+.alignContentBaseline { align-content: baseline; }
+.alignContentLastBaseline { align-content: last-baseline; }
+.alignContentStart { align-content: start; }
+.alignContentEnd { align-content: end; }
+.alignContentCenter { align-content: center; }
+.alignContentLeft { align-content: left; }
+.alignContentRight { align-content: right; }
+.alignContentFlexStart { align-content: flex-start; }
+.alignContentFlexEnd { align-content: flex-end; }
+.alignContentSpaceBetween { align-content: space-between; }
+.alignContentSpaceAround { align-content: space-around; }
+.alignContentSpaceEvenly { align-content: space-evenly; }
+.alignContentStretch { align-content: stretch; }
+
+/* justify-self */
+.justifySelfAuto { justify-self: auto; }
+.justifySelfStretch { justify-self: stretch; }
+.justifySelfStart { justify-self: start; }
+.justifySelfCenter { justify-self: center; }
+.justifySelfEnd { justify-self: end; }
+.justifySelfRight { justify-self: right; }
+.justifySelfLeft { justify-self: left; }
+
+.justifySelfFlexStart { justify-self: flex-start; }
+.justifySelfFlexEnd { justify-self: flex-end; }
+
+.justifySelfSelfStart { justify-self: self-start; }
+.justifySelfSelfEnd { justify-self: self-end; }
+
+.justifySelfCenterSafe { justify-self: center safe; }
+.justifySelfCenterUnsafe { justify-self: center unsafe; }
+
+.justifySelfBaseline { justify-self: baseline; }
+
+/* justify-items */
+.justifyItemsAuto { justify-items: auto; }
+.justifyItemsStretch { justify-items: stretch; }
+.justifyItemsStart { justify-items: start; }
+.justifyItemsCenter { justify-items: center; }
+.justifyItemsEnd { justify-items: end; }
+
+.justifyItemsCenterSafe { justify-items: center safe; }
+.justifyItemsCenterUnsafe { justify-items: center unsafe; }
+.justifyItemsEndSafe { justify-items: end safe; }
+.justifyItemsEndUnsafe { justify-items: end unsafe; }
+
+.justifyItemsBaseline { justify-items: baseline; }
+
+/* justify-content */
+.justifyContentBaseline { justify-content: baseline; }
+.justifyContentLastBaseline { justify-content: last-baseline; }
+.justifyContentStart { justify-content: start; }
+.justifyContentEnd { justify-content: end; }
+.justifyContentCenter { justify-content: center; }
+.justifyContentLeft { justify-content: left; }
+.justifyContentRight { justify-content: right; }
+.justifyContentFlexStart { justify-content: flex-start; }
+.justifyContentFlexEnd { justify-content: flex-end; }
+.justifyContentSpaceBetween { justify-content: space-between; }
+.justifyContentSpaceAround { justify-content: space-around; }
+.justifyContentSpaceEvenly { justify-content: space-evenly; }
+.justifyContentStretch { justify-content: stretch; }
+
+/* Both align-items and justify-items */
+.itemsNormal {
+  align-items: normal;
+  justify-items: normal;
+}
+
+.itemsStretch {
+  align-items: stretch;
+  justify-items: stretch;
+}
+
+.itemsStart {
+  align-items: start;
+  justify-items: start;
+}
+
+.itemsCenter {
+  align-items: center;
+  justify-items: center;
+}
+
+.itemsEnd {
+  align-items: end;
+  justify-items: end;
+}
+
+.itemsLeft {
+  align-items: left;
+  justify-items: left;
+}
+
+.itemsRight {
+  align-items: right;
+  justify-items: right;
+}
+
+.itemsSelfStart {
+  align-items: self-start;
+  justify-items: self-start;
+}
+
+.itemsSelfEnd {
+  align-items: self-end;
+  justify-items: self-end;
+}
+.itemsBaseline {
+  align-items: baseline;
+  justify-items: baseline;
+}
+
+/* Both align-self and justify-self */
+.selfStretch {
+  align-self: stretch;
+  justify-self: stretch;
+}
+.selfStart {
+  align-self: start;
+  justify-self: start;
+}
+.selfEnd {
+  align-self: end;
+  justify-self: end;
+}
+.selfCenter {
+  align-self: center;
+  justify-self: center;
+}
+.selfRight {
+  align-self: right;
+  justify-self: right;
+}
+.selfLeft {
+  align-self: left;
+  justify-self: left;
+}
+.selfSelfStart {
+  align-self: self-start;
+  justify-self: self-start;
+}
+.selfSelfEnd {
+  align-self: self-end;
+  justify-self: self-end;
+}
+.selfBaseline {
+  align-self: baseline;
+  justify-self: baseline;
+}
+
+/* Both align-content and justify-content */
+.contentStart {
+  align-content: start;
+  justify-content: start;
+}
+.contentCenter {
+  align-content: center;
+  justify-content: center;
+}
+.contentEnd {
+  align-content: end;
+  justify-content: end;
+}
+
+.contentCenterSafe {
+  align-content: center safe;
+  justify-content: center safe;
+}
+
+.contentCenterUnsafe {
+  align-content: center unsafe;
+  justify-content: center unsafe;
+}
+
+.contentEndSafe {
+  align-content: end safe;
+  justify-content: end safe;
+}
+
+.contentEndUnsafe {
+  align-content: end unsafe;
+  justify-content: end unsafe;
+}
+
+.contentSpaceBetween {
+  justify-content: space-between;
+  align-content: space-between;
+}
+
+.contentSpaceAround {
+  justify-content: space-around;
+  align-content: space-around;
+}
+
+.contentSpaceEvenly {
+  justify-content: space-evenly;
+  align-content: space-evenly;
+}
+
+.contentStretch {
+  justify-content: stretch;
+  align-content: stretch;
+}
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/support/grid.css b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/support/grid.css
new file mode 100644
index 0000000..602e114
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid-1/support/grid.css
@@ -0,0 +1,277 @@
+.grid {
+  display: grid;
+  background-color: grey;
+}
+
+.inline-grid {
+  display: inline-grid;
+  background-color: grey;
+}
+
+.firstRowFirstColumn {
+  background-color: blue;
+  grid-column: 1;
+  grid-row: 1;
+}
+
+.onlyFirstRowOnlyFirstColumn {
+  background-color: blue;
+  grid-column: 1 / 2;
+  grid-row: 1 / 2;
+}
+
+.firstRowSecondColumn {
+  background-color: lime;
+  grid-column: 2;
+  grid-row: 1;
+}
+
+.onlyFirstRowOnlySecondColumn {
+  background-color: lime;
+  grid-column: 2 / 3;
+  grid-row: 1 / 2;
+}
+
+.secondRowFirstColumn {
+  background-color: purple;
+  grid-column: 1;
+  grid-row: 2;
+}
+
+.onlySecondRowOnlyFirstColumn {
+  background-color: purple;
+  grid-column: 1 / 2;
+  grid-row: 2 / 3;
+}
+
+.secondRowSecondColumn {
+  background-color: orange;
+  grid-column: 2;
+  grid-row: 2;
+}
+
+.onlySecondRowOnlySecondColumn {
+  background-color: orange;
+  grid-column: 2 / 3;
+  grid-row: 2 / 3;
+}
+
+.endSecondRowEndSecondColumn {
+  background-color: orange;
+  grid-column-end: 3;
+  grid-row-end: 3;
+}
+
+.thirdRowSecondColumn {
+  background-color: red;
+  grid-column: 2;
+  grid-row: 3;
+}
+
+.firstRowThirdColumn {
+  background-color: magenta;
+  grid-column: 3;
+  grid-row: 1;
+}
+
+.secondRowThirdColumn {
+  background-color: navy;
+  grid-column: 3;
+  grid-row: 2;
+}
+
+.firstRowFourthColumn {
+  background-color: green;
+  grid-column: 4;
+  grid-row: 1;
+}
+
+.secondRowFourthColumn {
+  background-color: pink;
+  grid-column: 4;
+  grid-row: 2;
+}
+
+.firstAutoRowSecondAutoColumn {
+  grid-row: 1 / auto;
+  grid-column: 2 / auto;
+}
+
+.autoLastRowAutoLastColumn {
+  grid-row: auto / -1;
+  grid-column: auto / -1;
+}
+
+.autoSecondRowAutoFirstColumn {
+  grid-row: auto / 2;
+  grid-column: auto / 1;
+}
+
+.firstRowBothColumn {
+  grid-row: 1;
+  grid-column: 1 / -1;
+}
+
+.secondRowBothColumn {
+  grid-row: 2;
+  grid-column: 1 / -1;
+}
+
+.bothRowFirstColumn {
+  grid-row: 1 / -1;
+  grid-column: 1;
+}
+
+.bothRowSecondColumn {
+  grid-row: 1 / -1;
+  grid-column: 2;
+}
+
+.bothRowBothColumn {
+  grid-row: 1 / -1;
+  grid-column: 1 / -1;
+}
+
+/* Auto column / row. */
+.autoRowAutoColumn {
+  background-color: pink;
+  grid-column: auto;
+  grid-row: auto;
+}
+
+.firstRowAutoColumn {
+  background-color: blue;
+  grid-column: auto;
+  grid-row: 1;
+}
+
+.secondRowAutoColumn {
+  background-color: purple;
+  grid-column: auto;
+  grid-row: 2;
+}
+
+.thirdRowAutoColumn {
+  background-color: navy;
+  grid-column: auto;
+  grid-row: 3;
+}
+
+.autoRowFirstColumn {
+  background-color: lime;
+  grid-column: 1;
+  grid-row: auto;
+}
+
+.autoRowSecondColumn {
+  background-color: orange;
+  grid-column: 2;
+  grid-row: auto;
+}
+
+.autoRowThirdColumn {
+  background-color: magenta;
+  grid-column: 3;
+  grid-row: auto;
+}
+
+.autoRowAutoColumnSpanning2 {
+  background-color: maroon;
+  grid-column: span 2;
+  grid-row: auto;
+}
+
+.autoRowSpanning2AutoColumn {
+  background-color: aqua;
+  grid-column: auto;
+  grid-row: span 2;
+}
+
+.autoRowSpanning2AutoColumnSpanning3 {
+  background-color: olive;
+  grid-column: span 3;
+  grid-row: span 2;
+}
+
+.autoRowSpanning3AutoColumnSpanning2 {
+  background-color: indigo;
+  grid-column: span 2;
+  grid-row: span 3;
+}
+
+.autoRowFirstColumnSpanning2 {
+  background-color: maroon;
+  grid-column: 1 / span 2;
+  grid-row: auto;
+}
+
+.autoRowSecondColumnSpanning2 {
+  background-color: olive;
+  grid-column: 2 / span 2;
+  grid-row: auto;
+}
+
+.firstRowSpanning2AutoColumn {
+  background-color: maroon;
+  grid-column: auto;
+  grid-row: 1 / span 2;
+  height: 100%;
+}
+
+.secondRowSpanning2AutoColumn {
+  background-color: olive;
+  grid-column: auto;
+  grid-row: 2 / span 2;
+  height: 100%;
+}
+
+/* Grid element flow. */
+.gridAutoFlowColumnSparse {
+  grid-auto-flow: column;
+}
+
+.gridAutoFlowColumnDense {
+  grid-auto-flow: column dense;
+}
+
+.gridAutoFlowRowSparse {
+  grid-auto-flow: row;
+}
+
+.gridAutoFlowRowDense {
+  grid-auto-flow: row dense;
+}
+
+/* This rule makes sure the container is smaller than any grid items to avoid distributing any extra logical space to them. */
+.constrainedContainer {
+  width: 10px;
+  height: 10px;
+}
+
+.unconstrainedContainer {
+  width: 1000px;
+  height: 1000px;
+}
+
+.sizedToGridArea {
+  font: 10px/1 Ahem;
+  /* Make us fit our grid area. */
+  width: 100%;
+  height: 100%;
+}
+
+.verticalRL {
+  writing-mode: vertical-rl;
+}
+.verticalLR {
+  writing-mode: vertical-lr;
+}
+.horizontalTB {
+  writing-mode: horizontal-tb;
+}
+.directionRTL {
+  direction: rtl;
+}
+.directionLTR {
+  direction: ltr;
+}
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/cursor-image-005-nfs.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/cursor-image-005-nfs.html
index 6b84196..e7396d21 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/cursor-image-005-nfs.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-ui-3/cursor-image-005-nfs.html
@@ -4,7 +4,7 @@
 <link rel="reviewer" title="Florian Rivoal" href="http://florian.rivoal.net/"> <!-- 2015-04-12 -->
 <link rel="help" href="http://www.w3.org/TR/css3-ui/#cursor">
 <link rel="help" href="http://www.w3.org/TR/css3-images/#default-object-size">
-<meta name="flags" content="interact svg">
+<meta name="flags" content="interact svg may">
 <meta charset="UTF-8">
 <meta name="assert" content="Test checks that an SVG image with no fixed size is supported as a custom cursor at the default object size for cursor images.">
 <style>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/CanvasRendering2D-prototype-chain.html b/third_party/WebKit/LayoutTests/fast/canvas-api/CanvasRendering2D-prototype-chain.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/CanvasRendering2D-prototype-chain.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/CanvasRendering2D-prototype-chain.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-isPointInPath-isPointInStroke.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-2d-isPointInPath-isPointInStroke.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-isPointInPath-isPointInStroke.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-2d-isPointInPath-isPointInStroke.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-commit-promise.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-commit-promise.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-commit-promise.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-commit-promise.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-constructor-in-worker-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-constructor-in-worker-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-constructor-in-worker-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-constructor-in-worker-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-constructor-in-worker.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-constructor-in-worker.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-constructor-in-worker.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-constructor-in-worker.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-convertToBlob-exceptions.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-convertToBlob-exceptions.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-getContext-in-worker.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-getContext-in-worker.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.js b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-getContext-in-worker.js
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext-in-worker.js
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-getContext-in-worker.js
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-getContext.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-getContext.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-getContext.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args-in-worker-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-invalid-args-in-worker-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args-in-worker-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-invalid-args-in-worker-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args-in-worker.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-invalid-args-in-worker.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args-in-worker.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-invalid-args-in-worker.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-invalid-args.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-invalid-args.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-invalid-args.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-multiple-worker-commit.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-multiple-worker-commit.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-multiple-worker-commit.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-multiple-worker-commit.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferControlToOffscreen.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferControlToOffscreen.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferControlToOffscreen.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable-exceptions-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable-exceptions-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable-exceptions.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-exceptions.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable-exceptions.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable.html b/third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferable.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/OffscreenCanvas-transferable.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/access-zero-sized-canvas.html b/third_party/WebKit/LayoutTests/fast/canvas-api/access-zero-sized-canvas.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/access-zero-sized-canvas.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/access-zero-sized-canvas.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-2d-imageData-create-nonfinite-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-imageData-create-nonfinite-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-2d-imageData-create-nonfinite-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-imageData-create-nonfinite.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-2d-imageData-create-nonfinite.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-2d-imageData-create-nonfinite.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-2d-imageData-create-nonfinite.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ImageBitmap-close-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-ImageBitmap-close-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-ImageBitmap-close-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-ImageBitmap-close-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-ImageBitmap-close.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-ImageBitmap-close.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-ImageBitmap-close.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-ImageBitmap-close.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-context-attributes-default-value.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-context-attributes-default-value.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-context-attributes-default-value.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-context-gc-custom-properties.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-context-gc-custom-properties.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-context-gc-custom-properties.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-filter-value.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-filter-value.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-filter-value.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getContext-invalid-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getContext-invalid-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getContext-invalid-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getContext-invalid-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getContext-invalid.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getContext-invalid.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getContext-invalid.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getContext-invalid.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-invalid-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-invalid-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-invalid-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-invalid-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-invalid.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-invalid.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-invalid.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-invalid.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-large-crash.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-large-crash.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-large-crash.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-large-crash.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-largeNonintegralDimensions.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-largeNonintegralDimensions.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-largeNonintegralDimensions.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-largeNonintegralDimensions.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-negative-source.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-negative-source.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-negative-source.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-negative-source.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-rounding.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-rounding.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-getImageData-rounding.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-getImageData-rounding.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-accessibility-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-accessibility-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-basic-test-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-basic-test-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-basic-test-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-basic-test-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-basic-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-basic-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-basic-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-basic-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clear-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-clear-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clear-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-clear-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-clip-test-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-clip-test-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-clip-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-clip-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-css-transform-test-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-css-transform-test-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-css-transform-test-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-css-transform-test-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-css-transform-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-css-transform-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-css-transform-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-css-transform-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-device-pixel-ratio-test-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-device-pixel-ratio-test-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-device-pixel-ratio-test-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-device-pixel-ratio-test-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-device-pixel-ratio-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-device-pixel-ratio-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-device-pixel-ratio-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-device-pixel-ratio-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-event-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-event-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-event-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-event-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-exception-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-exception-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-exception-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-exception-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test-1.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fallback-element-test-1.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test-1.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fallback-element-test-1.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test-2.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fallback-element-test-2.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test-2.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fallback-element-test-2.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test-3.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fallback-element-test-3.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fallback-element-test-3.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fallback-element-test-3.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fill-rule-test-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fill-rule-test-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fill-rule-test-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fill-rule-test-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fill-rule-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fill-rule-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-fill-rule-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-fill-rule-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-path2d-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-path2d-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-transform-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-path2d-transform-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-transform-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-path2d-transform-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-scale-factor-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-scale-factor-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-scale-factor-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-scale-factor-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-scale-factor.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-scale-factor.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-scale-factor.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-scale-factor.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-transform-test.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-transform-test.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-transform-test.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-hit-regions-transform-test.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-fillstyle.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-fillstyle.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-fillstyle.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-fillstyle.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-strokestyle.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-strokestyle.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-strokestyle.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-strokestyle.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-values-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-values-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-values-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-values-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-values.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-values.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-values.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-values.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-video-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-video-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-video-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-video-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-video.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-video.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-invalid-video.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-invalid-video.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInPath-winding-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInPath-winding-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInPath-winding-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInPath-winding-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInPath-winding.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInPath-winding.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInPath-winding.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInPath-winding.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInStroke-with-path.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInStroke-with-path.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInStroke-with-path.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInStroke-with-path.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInStroke.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInStroke.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-isPointInStroke.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-isPointInStroke.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-layerBridgeCrashTest.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-layerBridgeCrashTest.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-layerBridgeCrashTest.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-layerBridgeCrashTest.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-input-sequence-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-input-sequence-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-input-sequence.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-input-sequence.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-invalid-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-invalid-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-invalid-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-invalid-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-invalid.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-invalid.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-invalid.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lineDash-invalid.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-longlived-context.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-longlived-context.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-longlived-context.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-longlived-context.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lose-restore-googol-size.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lose-restore-googol-size.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-lose-restore-googol-size.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lose-restore-googol-size.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-lose-restore-max-int-size.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lose-restore-max-int-size.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-lose-restore-max-int-size.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-lose-restore-max-int-size.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-drawImage-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-drawImage-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-drawImage.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-drawImage.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-drawImage.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-drawImage.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-fillText-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-fillText-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-fillText-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-fillText-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-fillText.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-fillText.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-fillText.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-fillText.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeText-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-strokeText-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeText-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-strokeText-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeText.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-strokeText.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-overloads-strokeText.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-overloads-strokeText.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-path-object.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-path-object.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-path-object.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-path-object.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-skia-excessive-size.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-skia-excessive-size.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-skia-excessive-size.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-skia-excessive-size.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toBlob-case-insensitive-mimetype.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toBlob-case-insensitive-mimetype.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toBlob-file-vs-blob.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-file-vs-blob.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toBlob-file-vs-blob.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toBlob-invalid.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-invalid.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toBlob-invalid.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-case-insensitive-mimetype.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toDataURL-case-insensitive-mimetype.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-case-insensitive-mimetype.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toDataURL-case-insensitive-mimetype.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-crash.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toDataURL-crash.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-crash.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toDataURL-crash.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-jpeg-crash.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toDataURL-jpeg-crash.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-jpeg-crash.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-toDataURL-jpeg-crash.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-whitespace-parsing.html b/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-whitespace-parsing.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/canvas-whitespace-parsing.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/canvas-whitespace-parsing.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/change-context.html b/third_party/WebKit/LayoutTests/fast/canvas-api/change-context.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/change-context.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/change-context.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/currentTransform-null-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/currentTransform-null-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/currentTransform-null-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/currentTransform-null-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/currentTransform-null.html b/third_party/WebKit/LayoutTests/fast/canvas-api/currentTransform-null.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/currentTransform-null.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/currentTransform-null.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-bad-canvas.html b/third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-bad-canvas.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-bad-canvas.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-bad-canvas.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-broken-image-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-broken-image-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-broken-image-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-broken-image-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-broken-image.html b/third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-broken-image.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-broken-image.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-broken-image.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-valid-image-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-valid-image-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-valid-image-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-valid-image-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-valid-image.html b/third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-valid-image.html
similarity index 98%
rename from third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-valid-image.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-valid-image.html
index fb1c9a6..825defd 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/drawImage-with-valid-image.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas-api/drawImage-with-valid-image.html
@@ -11,7 +11,7 @@
 
 // Create image
 var myImage = new Image();
-var img_src = 'resources/apple.gif';
+var img_src = '../canvas/resources/apple.gif';
 myImage.src = img_src;
 
 var bitmap;
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/fallback-content.html b/third_party/WebKit/LayoutTests/fast/canvas-api/fallback-content.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/fallback-content.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/fallback-content.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.html b/third_party/WebKit/LayoutTests/fast/canvas-api/painting-on-bad-canvas.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/painting-on-bad-canvas.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/painting-on-bad-canvas.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/pointInPath.html b/third_party/WebKit/LayoutTests/fast/canvas-api/pointInPath.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/pointInPath.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/pointInPath.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/radialGradient-infinite-values-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/radialGradient-infinite-values-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/radialGradient-infinite-values-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/radialGradient-infinite-values-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/radialGradient-infinite-values.html b/third_party/WebKit/LayoutTests/fast/canvas-api/radialGradient-infinite-values.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/radialGradient-infinite-values.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/radialGradient-infinite-values.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/resources/OffscreenCanvas-transferable.js b/third_party/WebKit/LayoutTests/fast/canvas-api/resources/OffscreenCanvas-transferable.js
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/resources/OffscreenCanvas-transferable.js
rename to third_party/WebKit/LayoutTests/fast/canvas-api/resources/OffscreenCanvas-transferable.js
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js b/third_party/WebKit/LayoutTests/fast/canvas-api/resources/canvas-2d-imageData-create-nonfinite.js
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/resources/canvas-2d-imageData-create-nonfinite.js
rename to third_party/WebKit/LayoutTests/fast/canvas-api/resources/canvas-2d-imageData-create-nonfinite.js
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/resources/canvas-hit-region-event.js b/third_party/WebKit/LayoutTests/fast/canvas-api/resources/canvas-hit-region-event.js
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/resources/canvas-hit-region-event.js
rename to third_party/WebKit/LayoutTests/fast/canvas-api/resources/canvas-hit-region-event.js
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/resources/test-helpers.js b/third_party/WebKit/LayoutTests/fast/canvas-api/resources/test-helpers.js
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/resources/test-helpers.js
rename to third_party/WebKit/LayoutTests/fast/canvas-api/resources/test-helpers.js
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/set-empty-font-crash.html b/third_party/WebKit/LayoutTests/fast/canvas-api/set-empty-font-crash.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/set-empty-font-crash.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/set-empty-font-crash.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/strokeText-missing-args-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/strokeText-missing-args-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/strokeText-missing-args-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/strokeText-missing-args-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/strokeText-missing-args.html b/third_party/WebKit/LayoutTests/fast/canvas-api/strokeText-missing-args.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/strokeText-missing-args.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/strokeText-missing-args.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/toDataURL-supportedTypes-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas-api/toDataURL-supportedTypes-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/toDataURL-supportedTypes-expected.txt
rename to third_party/WebKit/LayoutTests/fast/canvas-api/toDataURL-supportedTypes-expected.txt
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/toDataURL-supportedTypes.html b/third_party/WebKit/LayoutTests/fast/canvas-api/toDataURL-supportedTypes.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/toDataURL-supportedTypes.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/toDataURL-supportedTypes.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/winding-enumeration.html b/third_party/WebKit/LayoutTests/fast/canvas-api/winding-enumeration.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/winding-enumeration.html
rename to third_party/WebKit/LayoutTests/fast/canvas-api/winding-enumeration.html
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-changing-containing-block-expected.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-changing-containing-block-expected.html
deleted file mode 100644
index 57d8037..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-changing-containing-block-expected.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-
-<style>
- .wrapper {
-     width: 100px;
-     height: 100px;
-     margin-bottom: 25px;
-     background: purple;
- }
-
- .grid {
-     width: 50px;
-     height: 50px;
-     background: lightblue;
- }
-
- .item {
-     width: 75%;
-     height: 75%;
-     background: orange;
- }
-</style>
-
-<p>This test checks that absolutelly positioned children of a grid are properly sized when the containing block switches between the grid container and a grid ancestor.</p>
-<p>The test PASS if you see an orange box inside a purple box on top and a small orange box inside a light blue box inside a purple box on bottom.</p>
-
-<div class="wrapper">
-    <div class="item"></div>
-</div>
-<div class="wrapper">
-    <div class="grid">
-	<div class="item"></div>
-    </div>
-</div>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-changing-containing-block.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-changing-containing-block.html
deleted file mode 100644
index a9b9e4a..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-changing-containing-block.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-
-<style>
- .wrapper {
-     width: 100px;
-     height: 100px;
-     margin-bottom: 25px;
-     background: purple;
-     position: relative;
- }
-
- .grid {
-     display: grid;
-     grid-template: 10px / 10px;
-     width: 50px;
-     height: 50px;
-     background: lightblue;
- }
-
- .item {
-     width: 75%;
-     height: 75%;
-     background: orange;
-     position: absolute;
- }
-</style>
-
-<p>This test checks that absolutelly positioned children of a grid are properly sized when the containing block switches between the grid container and a grid ancestor.</p>
-<p>The test PASS if you see an orange box inside a purple box on top and a small orange box inside a light blue box inside a purple box on bottom.</p>
-
-<div class="wrapper">
-    <div id="grid-as-cb" class="grid" style="position: relative;">
-	<div class="item"></div>
-    </div>
-</div>
-<div class="wrapper">
-    <div id="grid-as-parent" class="grid">
-	<div class="item"></div>
-    </div>
-</div>
-
-<script>
- if (window.testRunner)
-     testRunner.waitUntilDone();
- function test() {
-     document.getElementById("grid-as-cb").style.position = "initial";
-     document.getElementById("grid-as-parent").style.position = "relative";
-     document.body.offsetLeft;
-     testRunner.notifyDone();
- }
- setTimeout(test, 0);
-</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-definite-sizes-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-definite-sizes-expected.txt
deleted file mode 100644
index 25cbd8d6..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-definite-sizes-expected.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Items should extend to fill the width of the absolutely positioned grid container.
-
-XXX X
-XX XXX XX
-PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-definite-sizes.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-definite-sizes.html
deleted file mode 100644
index 1fbd9b8..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-definite-sizes.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-.grid {
-    grid-template: 50px 1fr / 1fr;
-
-    position: absolute;
-    left: 50px;
-    top: 50px;
-
-    width: 200px;
-    height: 200px;
-
-    border: 7px solid #ccc;
-    font: 10px/1 Ahem;
-}
-
-.row1 {
-    grid-row-start: 1;
-    background-color: yellow;
-}
-
-.row2 {
-    grid-row-start: 2;
-    background-color: cyan;
-}
-</style>
-
-<p>Items should extend to fill the width of the absolutely positioned grid container.</p>
-<script src="../../resources/check-layout.js"></script>
-<body onload="checkLayout('.grid')">
-
-<div class="grid">
-    <div class="row1" data-expected-height="50"  data-expected-width="200">XXX X</div>
-    <div class="row2" data-expected-height="150" data-expected-width="200">XX XXX XX</div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-containing-block.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-containing-block.html
deleted file mode 100644
index 540a4c3..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-containing-block.html
+++ /dev/null
@@ -1,350 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 50px 100px 150px 200px;
-    grid-template-rows: 50px 100px 150px 200px;
-    width: 500px;
-    height: 500px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.thirdRowThirdColumnSpanning2Rows {
-    grid-column: 3;
-    grid-row: 3 / span 2;
-    background-color: maroon;
-}
-
-.thirdRowThirdColumnSpanning2Rows2Columns {
-    grid-column: 3 / span 2;
-    grid-row: 3 / span 2;
-    background-color: aqua;
-}
-
-.endFirstRowEndFirstColumn {
-    background-color: blue;
-    grid-column-end: 2;
-    grid-row-end: 2;
-}
-
-.endFirstRowEndSecondColumn {
-    background-color: lime;
-    grid-column-end: 3;
-    grid-row-end: 2;
-}
-
-.endSecondRowEndFirstColumn {
-    background-color: purple;
-    grid-column-end: 2;
-    grid-row-end: 3;
-}
-
-.endThirdRowEndThirdColumnSpanning2Rows {
-    grid-column-end: 4;
-    grid-row: span 2 / 4;
-    background-color: maroon;
-}
-
-.endThirdRowEndThirdColumnSpanning2Rows2Columns {
-    grid-column: span 2 / 4;
-    grid-row: span 2 / 4;
-    background-color: aqua;
-}
-
-.onlyThirdRowOnlyThirdColumnSpanning2Rows {
-    grid-column: 3 / 4;
-    grid-row: 3 / 5;
-    background-color: maroon;
-}
-
-.onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns {
-    grid-column: 3 / 5;
-    grid-row: 3 / 5;
-    background-color: aqua;
-}
-
-.offsetLeft25 {
-    left: 25px;
-}
-
-.offsetRight50 {
-    right: 50px;
-}
-
-.offsetTop75 {
-    top: 75px;
-}
-
-.offsetBottom100 {
-    bottom: 100px;
-}
-
-.offsetLeftMinus20 {
-    left: -20px;
-}
-
-.offsetRightMinus40 {
-    right: -40px;
-}
-
-.offsetTopMinus60 {
-    top: -60px;
-}
-
-.offsetBottomMinus80 {
-    bottom: -80px;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks the behavior of the absolutely positioned elements with a grid container as containing block.</p>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="530">
-    </div>
-    <div class="sizedToGridArea absolute firstRowFirstColumn"
-        data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowFirstColumn"
-        data-offset-x="15" data-offset-y="65" data-expected-width="515" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute firstRowSecondColumn"
-        data-offset-x="65" data-offset-y="15" data-expected-width="465" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowSecondColumn"
-        data-offset-x="65" data-offset-y="65" data-expected-width="465" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows"
-        data-offset-x="165" data-offset-y="165" data-expected-width="365" data-expected-height="350">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns"
-        data-offset-x="165" data-offset-y="165" data-expected-width="350" data-expected-height="350">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows"
-        data-offset-x="0" data-offset-y="65" data-expected-width="315" data-expected-height="250">
-    </div>
-    <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows2Columns"
-        data-offset-x="65" data-offset-y="65" data-expected-width="250" data-expected-height="250">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="165" data-expected-height="165">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndFirstColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="65" data-expected-height="165">
-    </div>
-    <div class="sizedToGridArea absolute endFirstRowEndSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="165" data-expected-height="65">
-    </div>
-    <div class="sizedToGridArea absolute endFirstRowEndFirstColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="65" data-expected-height="65">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn"
-        data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlyFirstColumn"
-        data-offset-x="15" data-offset-y="65" data-expected-width="50" data-expected-height="100">
-    </div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlySecondColumn"
-        data-offset-x="65" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
-        data-offset-x="65" data-offset-y="65" data-expected-width="100" data-expected-height="100">
-    </div>
-    <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns"
-        data-offset-x="165" data-offset-y="165" data-expected-width="350" data-expected-height="350">
-    </div>
-    <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows"
-        data-offset-x="165" data-offset-y="165" data-expected-width="150" data-expected-height="350">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
-        data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
-    </div>
-    <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
-        data-offset-x="55" data-offset-y="95" data-expected-width="515" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
-        data-offset-x="-35" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
-        data-offset-x="45" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
-        data-offset-x="15" data-offset-y="140" data-expected-width="465" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
-        data-offset-x="190" data-offset-y="65" data-expected-width="365" data-expected-height="350">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
-        data-offset-x="145" data-offset-y="105" data-expected-width="350" data-expected-height="350">
-    </div>
-</div>
-
-<div class="grid">
-    <div>
-        <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
-            data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
-        </div>
-        <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
-            data-offset-x="55" data-offset-y="95" data-expected-width="515" data-expected-height="515">
-        </div>
-        <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
-            data-offset-x="-35" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
-        </div>
-        <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
-            data-offset-x="45" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
-        </div>
-        <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
-            data-offset-x="15" data-offset-y="140" data-expected-width="465" data-expected-height="465">
-        </div>
-        <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
-            data-offset-x="190" data-offset-y="65" data-expected-width="365" data-expected-height="350">
-        </div>
-        <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
-            data-offset-x="145" data-offset-y="105" data-expected-width="350" data-expected-height="350">
-        </div>
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sizedToGridArea absolute autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="530">
-    </div>
-    <div class="sizedToGridArea absolute firstRowFirstColumn"
-        data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowFirstColumn"
-        data-offset-x="0" data-offset-y="65" data-expected-width="515" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute firstRowSecondColumn"
-        data-offset-x="0" data-offset-y="15" data-expected-width="465" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowSecondColumn"
-        data-offset-x="0" data-offset-y="65" data-expected-width="465" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows"
-        data-offset-x="0" data-offset-y="165" data-expected-width="365" data-expected-height="350">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns"
-        data-offset-x="15" data-offset-y="165" data-expected-width="350" data-expected-height="350">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows"
-        data-offset-x="215" data-offset-y="65" data-expected-width="315" data-expected-height="250">
-    </div>
-    <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows2Columns"
-        data-offset-x="215" data-offset-y="65" data-expected-width="250" data-expected-height="250">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
-        data-offset-x="365" data-offset-y="0" data-expected-width="165" data-expected-height="165">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndFirstColumn"
-        data-offset-x="465" data-offset-y="0" data-expected-width="65" data-expected-height="165">
-    </div>
-    <div class="sizedToGridArea absolute endFirstRowEndSecondColumn"
-        data-offset-x="365" data-offset-y="0" data-expected-width="165" data-expected-height="65">
-    </div>
-    <div class="sizedToGridArea absolute endFirstRowEndFirstColumn"
-        data-offset-x="465" data-offset-y="0" data-expected-width="65" data-expected-height="65">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn"
-        data-offset-x="465" data-offset-y="15" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlyFirstColumn"
-        data-offset-x="465" data-offset-y="65" data-expected-width="50" data-expected-height="100">
-    </div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlySecondColumn"
-        data-offset-x="365" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
-        data-offset-x="365" data-offset-y="65" data-expected-width="100" data-expected-height="100">
-    </div>
-    <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns"
-        data-offset-x="15" data-offset-y="165" data-expected-width="350" data-expected-height="350">
-    </div>
-    <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows"
-        data-offset-x="215" data-offset-y="165" data-expected-width="150" data-expected-height="350">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
-        data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
-    </div>
-    <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
-        data-offset-x="40" data-offset-y="95" data-expected-width="515" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
-        data-offset-x="-50" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
-        data-offset-x="-20" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
-    </div>
-    <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
-        data-offset-x="-50" data-offset-y="140" data-expected-width="465" data-expected-height="465">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
-        data-offset-x="25" data-offset-y="65" data-expected-width="365" data-expected-height="350">
-    </div>
-    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
-        data-offset-x="-35" data-offset-y="105" data-expected-width="350" data-expected-height="350">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div>
-        <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
-            data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
-        </div>
-        <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
-            data-offset-x="40" data-offset-y="95" data-expected-width="515" data-expected-height="515">
-        </div>
-        <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
-            data-offset-x="-50" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
-        </div>
-        <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
-            data-offset-x="-20" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
-        </div>
-        <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
-            data-offset-x="-50" data-offset-y="140" data-expected-width="465" data-expected-height="465">
-        </div>
-        <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
-            data-offset-x="25" data-offset-y="65" data-expected-width="365" data-expected-height="350">
-        </div>
-        <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
-            data-offset-x="-35" data-offset-y="105" data-expected-width="350" data-expected-height="350">
-        </div>
-    </div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-parent.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-parent.html
deleted file mode 100644
index 27366094..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/absolute-positioning-grid-container-parent.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 50px 100px 150px;
-    grid-template-rows: 25px 50px 100px;
-    width: 300px;
-    height: 200px;
-    border: 5px solid black;
-    margin: 20px 30px;
-    padding: 5px 15px;
-}
-
-.container {
-    width: 500px;
-    height: 400px;
-}
-
-.relative {
-    /* Ensures that the element is the containing block of the absolutely positioned elements. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.container')">
-<div id="log"></div>
-
-<p>This test checks the behavior of the absolutely positioned elements with a grid container as parent.</p>
-
-<div class="container relative">
-    <div class="grid">
-        <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="35" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
-    </div>
-</div>
-
-<div class="container relative">
-    <div class="grid">
-        <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="35" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
-    </div>
-</div>
-
-<div class="container relative">
-    <div class="grid">
-        <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="35" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
-    </div>
-</div>
-
-<div class="container">
-    <div class="grid relative">
-        <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="0" data-offset-y="0" data-expected-width="330" data-expected-height="210"></div>
-    </div>
-</div>
-
-<div class="container">
-    <div class="grid relative">
-        <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="15" data-offset-y="5" data-expected-width="315" data-expected-height="205"></div>
-    </div>
-</div>
-
-<div class="container">
-    <div class="grid relative">
-        <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="65" data-offset-y="30" data-expected-width="265" data-expected-height="180"></div>
-    </div>
-</div>
-
-<div class="container relative">
-    <div class="grid directionRTL">
-        <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="-135" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
-    </div>
-</div>
-
-<div class="container relative">
-    <div class="grid directionRTL">
-        <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="-135" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
-    </div>
-</div>
-
-<div class="container relative">
-    <div class="grid directionRTL">
-        <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="-135" data-offset-y="5" data-expected-width="500" data-expected-height="400"></div>
-    </div>
-</div>
-
-<div class="container">
-    <div class="grid relative directionRTL">
-        <div class="sizedToGridArea absolute autoRowAutoColumn" data-offset-x="0" data-offset-y="0" data-expected-width="330" data-expected-height="210"></div>
-    </div>
-</div>
-
-<div class="container">
-    <div class="grid relative directionRTL">
-        <div class="sizedToGridArea absolute firstRowFirstColumn" data-offset-x="0" data-offset-y="5" data-expected-width="315" data-expected-height="205"></div>
-    </div>
-</div>
-
-<div class="container">
-    <div class="grid relative directionRTL">
-        <div class="sizedToGridArea absolute secondRowSecondColumn" data-offset-x="0" data-offset-y="30" data-expected-width="265" data-expected-height="180"></div>
-    </div>
-</div>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-absolute-positioning-dynamic-expected.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-absolute-positioning-dynamic-expected.html
deleted file mode 100644
index f996eec..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-absolute-positioning-dynamic-expected.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-
-<style>
- #wrapper {
-     width: 200px;
-     height: 200px;
-     position: relative;
-     background: red;
- }
- #item {
-     background: green;
-     width: 100%;
-     height: 100%;
- }
-</style>
-
-<p>This test checks that a grid item which becomes an absolutelly positioned children of a grid.</p>
-<p>The test PASS if you see a green box.</p>
-
-<div id="wrapper">
-    <div id="item"></div>
-</div>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-absolute-positioning-dynamic.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-absolute-positioning-dynamic.html
deleted file mode 100644
index 1fe839658..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-absolute-positioning-dynamic.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<style>
- #wrapper {
-     width: 200px;
-     height: 200px;
-     position: relative;
-     background: red;
- }
-
- #grid {
-     display: grid;
-     grid: 100px / 100px;
- }
-
- #item {
-     background: green;
-     width: 100%;
-     height: 100%;
- }
-</style>
-
-<p>This test checks that a grid item which becomes an absolutelly positioned children of a grid.</p>
-<p>The test PASS if you see a green box.</p>
-
-<div id="wrapper">
-  <div id="grid">
-      <div id="item"></div>
-  </div>
-</div>
-
-<script>
- if (window.testRunner)
-     testRunner.waitUntilDone();
- function test() {
-     document.getElementById("item").style.position = "absolute";
-     document.body.offsetLeft;
-     testRunner.notifyDone();
- }
- setTimeout(test, 0);
-</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-paint-positioned-children-expected.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-paint-positioned-children-expected.html
deleted file mode 100644
index 5a23c73..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-paint-positioned-children-expected.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<style>
-.grid {
-    border: 2px solid black;
-    width: 100px;
-    height: 40px;
-    background: gray;
-}
-
-.abs { height: 5px; float: left; }
-
-#item {
-    width: 90px;
-    height: 30px;
-    margin-top: 10px;
-}
-</style>
-
-<p>This test passes if you see a gray box with a black border color with 5 rectangles inside. The first line contains a purple, orange, yellow and magenta boxes. Bellow them you should see a 90px cyan box.</p>
-
-<div class="grid">
-    <div class="abs" style="background: purple; width: 10px;"></div>
-    <div class="abs" style="background: orange; width: 20px;"></div>
-    <div class="abs" style="background: yellow; width: 30px;"></div>
-    <div class="abs" style="background: magenta; width: 40px;"></div>
-    <div id="item" style="background: cyan;"</div>
-</div>
-
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-paint-positioned-children.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-paint-positioned-children.html
deleted file mode 100644
index d20fa7aa..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-paint-positioned-children.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
-<link rel="match" href="grid-paint-positioned-children-expected.html">
-<style>
-.grid {
-    border: 2px solid black;
-    position: relative;
-    width: 100px;
-
-    grid-template-columns: 10px 20px 30px 40px;
-
-    padding-top: 10px;
-}
-
-.abs {
-    height: 5px;
-    position: absolute;
-    width: 100%;
-}
-
-#item {
-    width: 90px;
-    height: 30px;
-}
-
-</style>
-
-<p>This test passes if you see a gray box with a black border color with 5 rectangles inside. The first line contains a purple, orange, yellow and magenta boxes. Bellow them you should see a 90px cyan box.</p>
-
-<div class="grid">
-    <div id="item" style="grid-column: 1 / -1; background: cyan;"></div>
-    <div class="abs" style="grid-column: 1 / 2; background: purple;"></div>
-    <div class="abs" style="grid-column: 2 / 3; background: orange;"></div>
-    <div class="abs" style="grid-column: 3 / 4; background: yellow;"></div>
-    <div class="abs" style="grid-column: 4 / 5; background: magenta;"></div>
-</div>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-children-writing-modes-expected.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-children-writing-modes-expected.html
deleted file mode 100644
index ce58ab0f..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-children-writing-modes-expected.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    display: block;
-    margin: 5px;
-    width: 100px;
-    height: 75px;
-    padding: 5px 10px 15px 20px;
-    border-style: solid;
-    border-width: 5px 10px 15px 20px;
-    float: left;
-}
-
-.green {
-    background-color: green;
-    width: 30px;
-    height: 20px;
-    font: 10px/1 Ahem;
-}
-
-.verticalSize {
-    width: 20px;
-    height: 30px;
-}
-
-</style>
-<body>
-
-<p>This test checks the behavior of the positioned grid children in combination with the writing modes and text direction properties.</p>
-<p>For the test to pass you should see no red and only green boxes. The black box will be positioned depending on the writing mode and text direction values.</p>
-
-<div class="grid">
-    <div class="green">XX</div>
-</div>
-
-<div class="grid verticalRL">
-    <div class="green verticalSize">XX</div>
-</div>
-
-<div class="grid verticalLR">
-    <div class="green verticalSize">XX</div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="green">XX</div>
-</div>
-
-<div class="grid verticalRL directionRTL">
-    <div class="green verticalSize">XX</div>
-</div>
-
-<div class="grid verticalLR directionRTL">
-    <div class="green verticalSize">XX</div>
-</div>
-
-<div class="grid">
-    <div class="green">XX</div>
-</div>
-
-<div class="grid verticalRL">
-    <div class="green verticalSize">XX</div>
-</div>
-
-<div class="grid verticalLR">
-    <div class="green verticalSize">XX</div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="green">XX</div>
-</div>
-
-<div class="grid verticalRL directionRTL">
-    <div class="green verticalSize">XX</div>
-</div>
-
-<div class="grid verticalLR directionRTL">
-    <div class="green verticalSize">XX</div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-children-writing-modes.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-children-writing-modes.html
deleted file mode 100644
index 652f095..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-children-writing-modes.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    margin: 5px;
-    width: 100px;
-    height: 75px;
-    grid: 20px / 30px;
-    padding: 5px 10px 15px 20px;
-    border-style: solid;
-    border-width: 5px 10px 15px 20px;
-    float: left;
-    /* Ensures that the grid container is the containing block of the grid children. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.onlyFirstRowOnlyFirstColumn {
-    background-color: green;
-    grid-column: 1 / 2;
-    grid-row: 1 / 2;
-}
-
-.offsets {
-    left: 0;
-    top: 0;
-}
-
-.red {
-    background-color: red;
-}
-
-</style>
-<body>
-
-<p>This test checks the behavior of the positioned grid children in combination with the writing modes and text direction properties.</p>
-<p>For the test to pass you should see no red and only green boxes. The black box will be positioned depending on the writing mode and text direction values.</p>
-
-<div class="grid">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalRL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalLR">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalRL directionRTL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalLR directionRTL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalRL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalLR">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalRL directionRTL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-<div class="grid verticalLR directionRTL">
-    <div class="red"></div>
-    <div class="sizedToGridArea absolute offsets onlyFirstRowOnlyFirstColumn">XX</div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-item-dynamic-change-expected.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-item-dynamic-change-expected.html
deleted file mode 100644
index 45add50..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-item-dynamic-change-expected.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<style>
-
-.grid {
-    width: 100px;
-    height: 100px;
-}
-
-.green {
-    background: green;
-}
-
-</style>
-
-<p>This test checks that positioned items can be dynamically changed.</p>
-<p>The test passes if you see a 100x100 green square and no red.</p>
-
-<div class="grid green">
-</div>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-item-dynamic-change.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-item-dynamic-change.html
deleted file mode 100644
index ce7ac8ec..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-item-dynamic-change.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<style>
-
-.grid {
-    display: grid;
-    grid: 50px 50px / 50px 50px;
-    position: relative;
-}
-
-.green {
-    background: green;
-}
-
-.red {
-    background: red;
-}
-
-#item {
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    grid-column: 1 / 2;
-    grid-row: 1 / 2;
-}
-</style>
-
-<p>This test checks that positioned items can be dynamically changed.</p>
-<p>The test passes if you see a 100x100 green square and no red.</p>
-
-<div class="grid">
-    <div class="green"></div>
-    <div class="green"></div>
-    <div class="green"></div>
-    <div class="red"></div>
-    <div id="item" class="green"></div>
-</div>
-
-<script>
-document.body.offsetLeft;
-
-var item = document.getElementById("item");
-item.style.gridColumn = "2 / 3";
-item.style.gridRow = "2 / 3";
-</script>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-expected.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-expected.html
deleted file mode 100644
index 2bd3c2b..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-expected.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<html>
-<style>
-.grid {
-    width: 500px;
-    height: 300px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-}
-
-.container {
-    position: relative;
-    float: left;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.green {
-    background-color: green;
-}
-</style>
-<body>
-
-<p>This test checks that the background of positioned items is painted in the right position.</p>
-
-<p>The test passes if you see 4 green boxes and no red.</p>
-
-<div class="container">
-    <div class="grid"></div>
-    <div class="absolute green" style="left: 55px; top: 50px; width: 100px; height: 50px"></div>
-    <div class="absolute green" style="left: 290px; top: 50px; width: 50px; height: 20px"></div>
-    <div class="absolute green" style="left: 50px; top: 115px; width: 50px; height: 30px"></div>
-    <div class="absolute green" style="left: 175px; top: 135px; width: 145px; height: 75px"></div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl-expected.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl-expected.html
deleted file mode 100644
index 747c9971..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl-expected.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<html>
-<style>
-.grid {
-    width: 500px;
-    height: 300px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-}
-
-.container {
-    position: relative;
-    float: left;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.green {
-    background-color: green;
-}
-</style>
-<body>
-
-<p>This test checks that the background of positioned items is painted in the right position using RTL direction.</p>
-
-<p>The test passes if you see 4 green boxes and no red.</p>
-
-<div class="container">
-    <div class="grid"></div>
-    <div class="absolute green" style="left: 455px; top: 50px; width: 100px; height: 50px"></div>
-    <div class="absolute green" style="left: 390px; top: 50px; width: 50px; height: 20px"></div>
-    <div class="absolute green" style="left: 500px; top: 115px; width: 50px; height: 30px"></div>
-    <div class="absolute green" style="left: 275px; top: 135px; width: 145px; height: 75px"></div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl.html
deleted file mode 100644
index 1c256e8a..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background-rtl.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 200px;
-    grid-template-rows: 50px 150px;
-    width: 500px;
-    height: 300px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-    background-color: transparent;
-}
-
-.container {
-    position: relative;
-    float: left;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.grid > div {
-    background-color: green;
-}
-
-.lengthSize {
-    width: 50px;
-    height: 20px;
-}
-
-.percentageSize {
-    width: 50%;
-    height: 20%;
-}
-
-.offsetsSize {
-    left: 25px;
-    right: 30px;
-    top: 35px;
-    bottom: 40px;
-}
-
-.red {
-    background-color: red;
-}
-</style>
-<body>
-
-<p>This test checks that the background of positioned items is painted in the right position using RTL direction.</p>
-
-<p>The test passes if you see 4 green boxes and no red.</p>
-
-<div class="container">
-    <div class="absolute red" style="left: 455px; top: 50px; width: 100px; height: 50px"></div>
-    <div class="absolute red" style="left: 390px; top: 50px; width: 50px; height: 20px"></div>
-    <div class="absolute red" style="left: 500px; top: 115px; width: 50px; height: 30px"></div>
-    <div class="absolute red" style="left: 275px; top: 135px; width: 145px; height: 75px"></div>
-    <div class="grid directionRTL">
-        <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
-            style="left: 5px;">
-        </div>
-        <div class="absolute onlyFirstRowOnlySecondColumn lengthSize"
-            style="right: 10px;">
-        </div>
-        <div class="absolute onlySecondRowOnlyFirstColumn percentageSize"
-            style="top: 15px;">
-        </div>
-        <div class="absolute onlySecondRowOnlySecondColumn offsetsSize"></div>
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background.html
deleted file mode 100644
index c5eb2f0..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-background.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 200px;
-    grid-template-rows: 50px 150px;
-    width: 500px;
-    height: 300px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-    background-color: transparent;
-}
-
-.container {
-    position: relative;
-    float: left;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.grid > div {
-    background-color: green;
-}
-
-.lengthSize {
-    width: 50px;
-    height: 20px;
-}
-
-.percentageSize {
-    width: 50%;
-    height: 20%;
-}
-
-.offsetsSize {
-    left: 25px;
-    right: 30px;
-    top: 35px;
-    bottom: 40px;
-}
-
-.red {
-    background-color: red;
-}
-</style>
-<body>
-
-<p>This test checks that the background of positioned items is painted in the right position.</p>
-
-<p>The test passes if you see 4 green boxes and no red.</p>
-
-<div class="container">
-    <div class="absolute red" style="left: 55px; top: 50px; width: 100px; height: 50px"></div>
-    <div class="absolute red" style="left: 290px; top: 50px; width: 50px; height: 20px"></div>
-    <div class="absolute red" style="left: 50px; top: 115px; width: 50px; height: 30px"></div>
-    <div class="absolute red" style="left: 175px; top: 135px; width: 145px; height: 75px"></div>
-    <div class="grid">
-        <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
-            style="left: 5px;">
-        </div>
-        <div class="absolute onlyFirstRowOnlySecondColumn lengthSize"
-            style="right: 10px;">
-        </div>
-        <div class="absolute onlySecondRowOnlyFirstColumn percentageSize"
-            style="top: 15px;">
-        </div>
-        <div class="absolute onlySecondRowOnlySecondColumn offsetsSize"></div>
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-content-alignment-rtl.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-content-alignment-rtl.html
deleted file mode 100644
index e8a1285f..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-content-alignment-rtl.html
+++ /dev/null
@@ -1,399 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<link href="resources/grid-alignment.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 50px;
-    grid-template-rows: 70px 30px;
-    width: 400px;
-    height: 200px;
-    margin: 5px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.grid > div {
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    background-color: lime;
-}
-
-.offsets {
-    left: 0;
-    top: 0;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks the behavior of the positioned items in a grid using content alignment in RTL.</p>
-
-<div class="grid directionRTL contentStart">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="175" data-offset-y="50" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="175" data-offset-y="50" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="50" data-offset-y="100" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="50" data-offset-y="100" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="238" data-offset-y="25" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="238" data-offset-y="25" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="217" data-offset-y="33" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="217" data-offset-y="33" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="250" data-offset-y="70" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="250" data-offset-y="70" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="125" data-offset-y="120" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="125" data-offset-y="120" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="63" data-offset-y="145" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="63" data-offset-y="145" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="83" data-offset-y="137" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="83" data-offset-y="137" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="175" data-offset-y="0" data-expected-width="225" data-expected-height="120">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="175" data-offset-y="0" data-expected-width="225" data-expected-height="120">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="50" data-offset-y="0" data-expected-width="350" data-expected-height="170">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="50" data-offset-y="0" data-expected-width="350" data-expected-height="170">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="300" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="238" data-offset-y="0" data-expected-width="162" data-expected-height="95">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="238" data-offset-y="0" data-expected-width="162" data-expected-height="95">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="217" data-offset-y="0" data-expected-width="183" data-expected-height="103">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="217" data-offset-y="0" data-expected-width="183" data-expected-height="103">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="70" data-expected-width="300" data-expected-height="130">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="70" data-expected-width="300" data-expected-height="130">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="120" data-expected-width="175" data-expected-height="80">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="120" data-expected-width="175" data-expected-height="80">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="145" data-expected-width="113" data-expected-height="55">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="145" data-expected-width="113" data-expected-height="55">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="137" data-expected-width="133" data-expected-height="63">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="137" data-expected-width="133" data-expected-height="63">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentStart">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentCenter">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentEnd">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceBetween">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceAround">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL contentSpaceEvenly">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-content-alignment.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-content-alignment.html
deleted file mode 100644
index cf98349..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-content-alignment.html
+++ /dev/null
@@ -1,399 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<link href="resources/grid-alignment.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 50px;
-    grid-template-rows: 70px 30px;
-    width: 400px;
-    height: 200px;
-    margin: 5px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.grid > div {
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    background-color: lime;
-}
-
-.offsets {
-    left: 0;
-    top: 0;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks the behavior of the positioned items in a grid using content alignment.</p>
-
-<div class="grid contentStart">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="125" data-offset-y="50" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="125" data-offset-y="50" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="250" data-offset-y="100" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="250" data-offset-y="100" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="63" data-offset-y="25" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="63" data-offset-y="25" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="83" data-offset-y="33" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="83" data-offset-y="33" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="100" data-offset-y="70" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="100" data-offset-y="70" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="225" data-offset-y="120" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="225" data-offset-y="120" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="288" data-offset-y="145" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="288" data-offset-y="145" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="267" data-offset-y="137" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="267" data-offset-y="137" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="225" data-expected-height="120">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="225" data-expected-height="120">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="350" data-expected-height="170">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="350" data-expected-height="170">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="70">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="163" data-expected-height="95">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="163" data-expected-height="95">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="183" data-expected-height="103">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="183" data-expected-height="103">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="100" data-offset-y="70" data-expected-width="300" data-expected-height="130">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="100" data-offset-y="70" data-expected-width="300" data-expected-height="130">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="225" data-offset-y="120" data-expected-width="175" data-expected-height="80">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="225" data-offset-y="120" data-expected-width="175" data-expected-height="80">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="350" data-offset-y="170" data-expected-width="50" data-expected-height="30">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="288" data-offset-y="145" data-expected-width="112" data-expected-height="55">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="288" data-offset-y="145" data-expected-width="112" data-expected-height="55">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="267" data-offset-y="137" data-expected-width="133" data-expected-height="63">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="267" data-offset-y="137" data-expected-width="133" data-expected-height="63">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentStart">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentCenter">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentEnd">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentSpaceBetween">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentSpaceAround">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid contentSpaceEvenly">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="200">
-    </div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-gaps-rtl.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-gaps-rtl.html
deleted file mode 100644
index d0d3551b..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-gaps-rtl.html
+++ /dev/null
@@ -1,305 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 100px 100px 100px;
-    grid-template-rows: 50px 50px;
-    grid-gap: 25px 50px;
-    width: 800px;
-    height: 200px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.grid > div {
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    background-color: lime;
-}
-
-.offsets {
-    left: 0;
-    top: 0;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks the behavior of the positioned items in a grid container with gaps in RTL.</p>
-
-<div class="grid directionRTL">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 1 / auto; grid-row: 1 / auto;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 1 / auto; grid-row: 1 / auto;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="715" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="715" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 1 / 3; grid-row: 1 / 3;"
-        data-offset-x="565" data-offset-y="15" data-expected-width="250" data-expected-height="125">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 1 / 3; grid-row: 1 / 3;"
-        data-offset-x="565" data-offset-y="15" data-expected-width="250" data-expected-height="125">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 1 / 4; grid-row: 1 / 4;"
-        data-offset-x="415" data-offset-y="15" data-expected-width="400" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 1 / 4; grid-row: 1 / 4;"
-        data-offset-x="415" data-offset-y="15" data-expected-width="400" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 1 / 5; grid-row: 1 / 5;"
-        data-offset-x="265" data-offset-y="15" data-expected-width="550" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 1 / 5; grid-row: 1 / 5;"
-        data-offset-x="265" data-offset-y="15" data-expected-width="550" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 1 / 6; grid-row: 1 / 6;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 1 / 6; grid-row: 1 / 6;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="565" data-offset-y="90" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="565" data-offset-y="90" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 2 / 4; grid-row: 2 / 4;"
-        data-offset-x="415" data-offset-y="90" data-expected-width="250" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 2 / 4; grid-row: 2 / 4;"
-        data-offset-x="415" data-offset-y="90" data-expected-width="250" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 2 / 5; grid-row: 2 / 5;"
-        data-offset-x="265" data-offset-y="90" data-expected-width="400" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 2 / 5; grid-row: 2 / 5;"
-        data-offset-x="265" data-offset-y="90" data-expected-width="400" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 2 / 6; grid-row: 2 / 6;"
-        data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 2 / 6; grid-row: 2 / 6;"
-        data-offset-x="0" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="0" data-offset-y="140" data-expected-width="515" data-expected-height="90">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="0" data-offset-y="140" data-expected-width="515" data-expected-height="90">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 4 / auto; grid-row: 4 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="365" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 4 / auto; grid-row: 4 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="365" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 5 / auto; grid-row: 5 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 5 / auto; grid-row: 5 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: 6 / auto; grid-row: 6 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: 6 / auto; grid-row: 6 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="815" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="815" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="715" data-offset-y="0" data-expected-width="115" data-expected-height="65">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="715" data-offset-y="0" data-expected-width="115" data-expected-height="65">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: auto / 3; grid-row: auto / 3;"
-        data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: auto / 3; grid-row: auto / 3;"
-        data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: auto / 4; grid-row: auto / 4;"
-        data-offset-x="415" data-offset-y="0" data-expected-width="415" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: auto / 4; grid-row: auto / 4;"
-        data-offset-x="415" data-offset-y="0" data-expected-width="415" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: auto / 5; grid-row: auto / 5;"
-        data-offset-x="265" data-offset-y="0" data-expected-width="565" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: auto / 5; grid-row: auto / 5;"
-        data-offset-x="265" data-offset-y="0" data-expected-width="565" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div style="grid-column: auto / 6; grid-row: auto / 6;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="offsets" style="grid-column: auto / 6; grid-row: auto / 6;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-gaps.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-gaps.html
deleted file mode 100644
index 38b1b2c..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-gaps.html
+++ /dev/null
@@ -1,305 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 100px 100px 100px;
-    grid-template-rows: 50px 50px;
-    grid-gap: 25px 50px;
-    width: 800px;
-    height: 200px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.grid > div {
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    background-color: lime;
-}
-
-.offsets {
-    left: 0;
-    top: 0;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks the behavior of the positioned items in a grid container with gaps.</p>
-
-<div class="grid">
-    <div style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: auto / auto; grid-row: auto / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 1 / auto; grid-row: 1 / auto;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 1 / auto; grid-row: 1 / auto;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 1 / 2; grid-row: 1 / 2;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 1 / 3; grid-row: 1 / 3;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="250" data-expected-height="125">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 1 / 3; grid-row: 1 / 3;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="250" data-expected-height="125">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 1 / 4; grid-row: 1 / 4;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="400" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 1 / 4; grid-row: 1 / 4;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="400" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 1 / 5; grid-row: 1 / 5;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="550" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 1 / 5; grid-row: 1 / 5;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="550" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 1 / 6; grid-row: 1 / 6;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 1 / 6; grid-row: 1 / 6;"
-        data-offset-x="15" data-offset-y="15" data-expected-width="815" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 2 / 3; grid-row: 2 / 3;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 2 / 4; grid-row: 2 / 4;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="250" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 2 / 4; grid-row: 2 / 4;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="250" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 2 / 5; grid-row: 2 / 5;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="400" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 2 / 5; grid-row: 2 / 5;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="400" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 2 / 6; grid-row: 2 / 6;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 2 / 6; grid-row: 2 / 6;"
-        data-offset-x="165" data-offset-y="90" data-expected-width="665" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="315" data-offset-y="140" data-expected-width="515" data-expected-height="90">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="315" data-offset-y="140" data-expected-width="515" data-expected-height="90">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 4 / auto; grid-row: 4 / auto;"
-        data-offset-x="465" data-offset-y="0" data-expected-width="365" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 4 / auto; grid-row: 4 / auto;"
-        data-offset-x="465" data-offset-y="0" data-expected-width="365" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 5 / auto; grid-row: 5 / auto;"
-        data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 5 / auto; grid-row: 5 / auto;"
-        data-offset-x="565" data-offset-y="0" data-expected-width="265" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: 6 / auto; grid-row: 6 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: 6 / auto; grid-row: 6 / auto;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="115" data-expected-height="65">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="115" data-expected-height="65">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: auto / 3; grid-row: auto / 3;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: auto / 3; grid-row: auto / 3;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="265" data-expected-height="140">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: auto / 4; grid-row: auto / 4;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="415" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: auto / 4; grid-row: auto / 4;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="415" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: auto / 5; grid-row: auto / 5;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="565" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: auto / 5; grid-row: auto / 5;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="565" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div style="grid-column: auto / 6; grid-row: auto / 6;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="offsets" style="grid-column: auto / 6; grid-row: auto / 6;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="830" data-expected-height="230">
-    </div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-line.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-line.html
deleted file mode 100644
index 55554a46..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid-line.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 200px;
-    grid-template-rows: 50px 150px;
-    width: 500px;
-    height: 300px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.startImplicitLine {
-    background-color: blue;
-    grid-column: 5;
-    grid-row: 8;
-}
-
-.endImplicitLine {
-    background-color: orange;
-    grid-column: 1 / 5;
-    grid-row: 1 / 8;
-}
-
-.startImplicitLineSpan {
-    background-color: blue;
-    grid-column: span 5;
-    grid-row: span 8;
-}
-
-.endImplicitLineSpan {
-    background-color: orange;
-    grid-column: 1 / span 5;
-    grid-row: 1 / span 8;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks that grid placement properties of absolutely positioned items using implicit grid lines are treated as "auto".</p>
-
-<div class="grid">
-    <div class="absolute sizedToGridArea startImplicitLine"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
-    </div>
-    <div class="absolute sizedToGridArea endImplicitLine"
-        data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="absolute sizedToGridArea startImplicitLineSpan"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
-    </div>
-    <div class="absolute sizedToGridArea endImplicitLineSpan"
-        data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="absolute sizedToGridArea startImplicitLine"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
-    </div>
-    <div class="absolute sizedToGridArea endImplicitLine"
-        data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="absolute sizedToGridArea startImplicitLineSpan"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
-    </div>
-    <div class="absolute sizedToGridArea endImplicitLineSpan"
-        data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid.html
deleted file mode 100644
index dff31b8a..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-implicit-grid.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    width: 200px;
-    height: 200px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.grid-columns-rows {
-    grid-template-columns: 100px;
-    grid-template-rows: 50px;
-}
-
-.absolute {
-    position: absolute;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks the behavior of the absolutely positioned grid items placed on the implicit grid.</p>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute secondRowSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid grid-columns-rows">
-    <div class="sizedToGridArea absolute secondRowSecondColumn"
-        data-offset-x="115" data-offset-y="65" data-expected-width="115" data-expected-height="165">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
-        data-offset-x="115" data-offset-y="65" data-expected-width="115" data-expected-height="165">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sizedToGridArea absolute secondRowSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-</div>
-
-<div class="grid grid-columns-rows directionRTL">
-    <div class="sizedToGridArea absolute secondRowSecondColumn"
-        data-offset-x="0" data-offset-y="65" data-expected-width="115" data-expected-height="165">
-    </div>
-    <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="230" data-expected-height="230">
-    </div>
-    <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
-        data-offset-x="0" data-offset-y="65" data-expected-width="115" data-expected-height="165">
-    </div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-padding.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-padding.html
deleted file mode 100644
index d0402e5..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-padding.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 200px;
-    grid-template-rows: 50px 150px;
-    width: 500px;
-    height: 300px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.autoFit {
-    grid-template-columns: repeat(auto-fit, 100px);
-    grid-template-rows: repeat(auto-fit, 100px);
-}
-
-.absolute {
-    position: absolute;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-    background: lime;
-}
-
-.gap { grid-gap: 10px; }
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks that positioned grid items can be placed directly on the padding.</p>
-
-<div class="grid">
-    <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: auto / 1;"
-        data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: auto / 1; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / auto;"
-        data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / auto; grid-row: 2 / 3;"
-        data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="absolute" style="grid-column: -5 / 1; grid-row: -5 / 1;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: -5 / 1;"
-        data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: -5 / 1; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / 5; grid-row: 3 / 5;"
-        data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / 5;"
-        data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / 5; grid-row: 2 / 3;"
-        data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="absolute" style="grid-column: span 2 / 1; grid-row: span 2 / 1;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: span 2 / 1;"
-        data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: span 2 / 1; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / span 2; grid-row: 3 / span 2;"
-        data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / span 2;"
-        data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / span 2; grid-row: 2 / 3;"
-        data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="absolute" style="grid-column: foo / 1; grid-row: foo / 1;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: foo / 1;"
-        data-offset-x="15" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: foo / 1; grid-row: 1 / 2;"
-        data-offset-x="0" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / foo; grid-row: 3 / foo;"
-        data-offset-x="315" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / foo;"
-        data-offset-x="115" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / foo; grid-row: 2 / 3;"
-        data-offset-x="315" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: auto / 1;"
-        data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: auto / 1; grid-row: 1 / 2;"
-        data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / auto;"
-        data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / auto; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="absolute" style="grid-column: -5 / 1; grid-row: -5 / 1;"
-        data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: -5 / 1;"
-        data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: -5 / 1; grid-row: 1 / 2;"
-        data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / 5; grid-row: 3 / 5;"
-        data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / 5;"
-        data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / 5; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="absolute" style="grid-column: span 2 / 1; grid-row: span 2 / 1;"
-        data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: span 2 / 1;"
-        data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: span 2 / 1; grid-row: 1 / 2;"
-        data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / span 2; grid-row: 3 / span 2;"
-        data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / span 2;"
-        data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / span 2; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="absolute" style="grid-column: foo / 1; grid-row: foo / 1;"
-        data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: 1 / 2; grid-row: foo / 1;"
-        data-offset-x="415" data-offset-y="0" data-expected-width="100" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: foo / 1; grid-row: 1 / 2;"
-        data-offset-x="515" data-offset-y="15" data-expected-width="15" data-expected-height="50">
-    </div>
-    <div class="absolute" style="grid-column: 3 / foo; grid-row: 3 / foo;"
-        data-offset-x="0" data-offset-y="215" data-expected-width="215" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 3; grid-row: 3 / foo;"
-        data-offset-x="215" data-offset-y="215" data-expected-width="200" data-expected-height="115">
-    </div>
-    <div class="absolute" style="grid-column: 3 / foo; grid-row: 2 / 3;"
-        data-offset-x="0" data-offset-y="65" data-expected-width="215" data-expected-height="150">
-    </div>
-</div>
-
-<div class="grid autoFit gap">
-    <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
-         data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: -1 / auto; grid-row: -1 / auto;"
-         data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-<div class="grid autoFit gap">
-    <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
-         data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: -2 / auto; grid-row: -2 / auto;"
-         data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-<div class="grid autoFit directionRTL gap">
-    <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
-         data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: -1 / auto; grid-row: -1 / auto;"
-         data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-<div class="grid autoFit directionRTL gap">
-    <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
-         data-offset-x="515" data-offset-y="0" data-expected-width="15" data-expected-height="15">
-    </div>
-    <div class="absolute" style="grid-column: -2 / auto; grid-row: -2 / auto;"
-         data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-unknown-named-grid-line.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-unknown-named-grid-line.html
deleted file mode 100644
index 9a2048f5a..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-unknown-named-grid-line.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 200px;
-    grid-template-rows: 50px 150px;
-    width: 500px;
-    height: 300px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.startUnknownLine {
-    background-color: blue;
-    grid-column: foo / 3;
-    grid-row: bar / 3;
-}
-
-.endUnknownLine {
-    background-color: orange;
-    grid-column: 1 / foo;
-    grid-row: 1 / bar;
-}
-
-.startAndEndUnknownLines {
-    background-color: green;
-    grid-column: foo / bar;
-    grid-row: foo / bar;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks that grid placement properties of absolutely positioned items using unknown named grid lines are treated as "auto".</p>
-
-<div class="grid">
-    <div class="absolute sizedToGridArea startAndEndUnknownLines"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
-    </div>
-    <div class="absolute sizedToGridArea endUnknownLine"
-        data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-    <div class="absolute sizedToGridArea startUnknownLine"
-        data-offset-x="0" data-offset-y="0" data-expected-width="315" data-expected-height="215">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="absolute sizedToGridArea startAndEndUnknownLines"
-        data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="330">
-    </div>
-    <div class="absolute sizedToGridArea endUnknownLine"
-        data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="315">
-    </div>
-    <div class="absolute sizedToGridArea startUnknownLine"
-        data-offset-x="215" data-offset-y="0" data-expected-width="315" data-expected-height="215">
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html
deleted file mode 100644
index 39da61f..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-within-grid-implicit-track.html
+++ /dev/null
@@ -1,187 +0,0 @@
-<!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 200px 300px;
-    grid-template-rows: 150px 250px;
-    grid-auto-columns: 100px;
-    grid-auto-rows: 50px;
-    width: 800px;
-    height: 600px;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-    background: cyan;
-}
-
-.sixRowsAndSixColumns {
-    background: magenta;
-    grid-row: -5 / 5;
-    grid-column: -5 / 5;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks that positioned grid items are placed properly (including implicit tracks) even if the grid has implicit tracks.</p>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="215" data-expected-height="115">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="0" data-offset-y="0" data-expected-width="415" data-expected-height="265">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="715" data-offset-y="515" data-expected-width="115" data-expected-height="115">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="415" data-offset-y="265" data-expected-width="415" data-expected-height="365">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: -4 / 1; grid-row: -4 / 1;"
-        data-offset-x="115" data-offset-y="65" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: -4 / 2; grid-row: -4 / 2;"
-        data-offset-x="115" data-offset-y="65" data-expected-width="300" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 3 / 4; grid-row: 3 / 4;"
-        data-offset-x="715" data-offset-y="515" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="15" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 4; grid-row: 2 / 4;"
-        data-offset-x="415" data-offset-y="265" data-expected-width="400" data-expected-height="300">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: auto / 1; grid-row: auto / 1;"
-        data-offset-x="615" data-offset-y="0" data-expected-width="215" data-expected-height="115">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: auto / 2; grid-row: auto / 2;"
-        data-offset-x="415" data-offset-y="0" data-expected-width="415" data-expected-height="265">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 3 / auto; grid-row: 3 / auto;"
-        data-offset-x="0" data-offset-y="515" data-expected-width="115" data-expected-height="115">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 2 / auto; grid-row: 2 / auto;"
-        data-offset-x="0" data-offset-y="265" data-expected-width="415" data-expected-height="365">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: -4 / 1; grid-row: -4 / 1;"
-        data-offset-x="615" data-offset-y="65" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: -4 / 2; grid-row: -4 / 2;"
-        data-offset-x="415" data-offset-y="65" data-expected-width="300" data-expected-height="200">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 3 / 4; grid-row: 3 / 4;"
-        data-offset-x="15" data-offset-y="515" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid directionRTL">
-    <div class="sixRowsAndSixColumns"
-        data-offset-x="-85" data-offset-y="15" data-expected-width="900" data-expected-height="600">
-    </div>
-    <div class="absolute" style="grid-column: 2 / 4; grid-row: 2 / 4;"
-        data-offset-x="15" data-offset-y="265" data-expected-width="400" data-expected-height="300">
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items.html
deleted file mode 100644
index 76b42723..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-sizing-positioned-items.html
+++ /dev/null
@@ -1,196 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 100px 200px;
-    grid-template-rows: 50px 150px;
-    width: 100%;
-    height: 100%;
-    border: 5px solid black;
-    margin: 30px;
-    padding: 15px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.lengthSize {
-    width: 50px;
-    height: 20px;
-}
-
-.percentageSize {
-    width: 50%;
-    height: 20%;
-}
-
-.offsets {
-    left: 5px;
-    right: 10px;
-    top: 15px;
-    bottom: 20px;
-}
-
-.onlyFirstRowOnlyFirstColumn {
-    background-color: blue;
-    grid-column: 1 / 2;
-    grid-row: 1 / 2;
-}
-
-.endSecondRowEndSecondColumn {
-    background-color: orange;
-    grid-column-end: 3;
-    grid-row-end: 3;
-}
-
-</style>
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../resources/check-layout-th.js"></script>
-<body onload="checkLayout('.grid')">
-<div id="log"></div>
-
-<p>This test checks the different size options for absolutely positioned grid items.</p>
-
-<div class="unconstrainedContainer">
-    <div class="grid">
-        <div class="absolute autoRowAutoColumn sizedToGridArea"
-            data-offset-x="0" data-offset-y="0" data-expected-width="1030" data-expected-height="1030">
-        </div>
-        <div class="absolute secondRowSecondColumn sizedToGridArea"
-            data-offset-x="115" data-offset-y="65" data-expected-width="915" data-expected-height="965">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
-            data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn sizedToGridArea"
-            data-offset-x="0" data-offset-y="0" data-expected-width="315" data-expected-height="215">
-        </div>
-    </div>
-</div>
-
-<div class="unconstrainedContainer">
-    <div class="grid">
-        <div class="absolute autoRowAutoColumn lengthSize"
-            data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="20">
-        </div>
-        <div class="absolute secondRowSecondColumn lengthSize"
-            data-offset-x="115" data-offset-y="65" data-expected-width="50" data-expected-height="20">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn lengthSize"
-            data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="20">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn lengthSize"
-            data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="20">
-        </div>
-    </div>
-</div>
-
-<div class="unconstrainedContainer">
-    <div class="grid">
-        <div class="absolute autoRowAutoColumn percentageSize"
-            data-offset-x="0" data-offset-y="0" data-expected-width="515" data-expected-height="206">
-        </div>
-        <div class="absolute secondRowSecondColumn percentageSize"
-            data-offset-x="115" data-offset-y="65" data-expected-width="457.5" data-expected-height="193">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn percentageSize"
-            data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="10">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn percentageSize"
-            data-offset-x="0" data-offset-y="0" data-expected-width="157.5" data-expected-height="43">
-        </div>
-    </div>
-</div>
-
-<div class="unconstrainedContainer">
-    <div class="grid">
-        <div class="absolute autoRowAutoColumn offsets"
-            data-offset-x="5" data-offset-y="15" data-expected-width="1015" data-expected-height="995">
-        </div>
-        <div class="absolute secondRowSecondColumn offsets"
-            data-offset-x="120" data-offset-y="80" data-expected-width="900" data-expected-height="930">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn offsets"
-            data-offset-x="20" data-offset-y="30" data-expected-width="85" data-expected-height="15">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn offsets"
-            data-offset-x="5" data-offset-y="15" data-expected-width="300" data-expected-height="180">
-        </div>
-    </div>
-</div>
-
-<div class="unconstrainedContainer">
-    <div class="grid directionRTL">
-        <div class="absolute autoRowAutoColumn sizedToGridArea"
-            data-offset-x="0" data-offset-y="0" data-expected-width="1030" data-expected-height="1030">
-        </div>
-        <div class="absolute secondRowSecondColumn sizedToGridArea"
-            data-offset-x="0" data-offset-y="65" data-expected-width="915" data-expected-height="965">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
-            data-offset-x="915" data-offset-y="15" data-expected-width="100" data-expected-height="50">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn sizedToGridArea"
-            data-offset-x="715" data-offset-y="0" data-expected-width="315" data-expected-height="215">
-        </div>
-    </div>
-</div>
-
-<div class="unconstrainedContainer">
-    <div class="grid directionRTL">
-        <div class="absolute autoRowAutoColumn lengthSize"
-            data-offset-x="980" data-offset-y="0" data-expected-width="50" data-expected-height="20">
-        </div>
-        <div class="absolute secondRowSecondColumn lengthSize"
-            data-offset-x="865" data-offset-y="65" data-expected-width="50" data-expected-height="20">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn lengthSize"
-            data-offset-x="965" data-offset-y="15" data-expected-width="50" data-expected-height="20">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn lengthSize"
-            data-offset-x="980" data-offset-y="0" data-expected-width="50" data-expected-height="20">
-        </div>
-    </div>
-</div>
-
-<div class="unconstrainedContainer">
-    <div class="grid directionRTL">
-        <div class="absolute autoRowAutoColumn percentageSize"
-            data-offset-x="515" data-offset-y="0" data-expected-width="515" data-expected-height="206">
-        </div>
-        <div class="absolute secondRowSecondColumn percentageSize"
-            data-offset-x="457.5" data-offset-y="65" data-expected-width="457.5" data-expected-height="193">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn percentageSize"
-            data-offset-x="965" data-offset-y="15" data-expected-width="50" data-expected-height="10">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn percentageSize"
-            data-offset-x="873" data-offset-y="0" data-expected-width="157.5" data-expected-height="43">
-        </div>
-    </div>
-</div>
-
-<div class="unconstrainedContainer">
-    <div class="grid directionRTL">
-        <div class="absolute autoRowAutoColumn offsets"
-            data-offset-x="5" data-offset-y="15" data-expected-width="1015" data-expected-height="995">
-        </div>
-        <div class="absolute secondRowSecondColumn offsets"
-            data-offset-x="5" data-offset-y="80" data-expected-width="900" data-expected-height="930">
-        </div>
-        <div class="absolute onlyFirstRowOnlyFirstColumn offsets"
-            data-offset-x="920" data-offset-y="30" data-expected-width="85" data-expected-height="15">
-        </div>
-        <div class="absolute endSecondRowEndSecondColumn offsets"
-            data-offset-x="720" data-offset-y="15" data-expected-width="300" data-expected-height="180">
-        </div>
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-create-implicit-tracks-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-create-implicit-tracks-expected.txt
deleted file mode 100644
index 2b406041..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-create-implicit-tracks-expected.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This test checks that positioned items shouldn't create implicit tracks on the grid.
-
-PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-create-implicit-tracks.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-create-implicit-tracks.html
deleted file mode 100644
index deb4bc7..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-create-implicit-tracks.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-auto-columns: 100px;
-    grid-auto-rows: 50px;
-    width: 400px;
-    height: 300px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-}
-
-.absolute {
-    position: absolute;
-}
-
-.seventhRowFourthColumn {
-    background-color: coral;
-    grid-column: 4;
-    grid-row: 7;
-}
-
-</style>
-<script src="../../resources/check-layout.js"></script>
-<body onload="checkLayout('.grid')">
-
-<p>This test checks that positioned items shouldn't create implicit tracks on the grid.</p>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute seventhRowFourthColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="400" data-expected-height="300">
-    </div>
-    <div class="autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-    </div>
-    <div class="autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="50" data-expected-width="100" data-expected-height="50">
-    </div>
-    <div class="autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="100" data-expected-width="100" data-expected-height="50">
-    </div>
-    <div class="autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="150" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-</body>
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-take-up-space-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-take-up-space-expected.txt
deleted file mode 100644
index 028f251..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-take-up-space-expected.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-This test checks that positioned items shouldn't take up space or otherwise participate in the layout of the grid.
-
-Absolutely positioned:
-
-PASS
-PASS
-PASS
-PASS
-PASS
-PASS
-Fixed positioned:
-
-PASS
-PASS
-PASS
-PASS
-PASS
-PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-take-up-space.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-take-up-space.html
deleted file mode 100644
index da73668..0000000
--- a/third_party/WebKit/LayoutTests/fast/css-grid-layout/positioned-grid-items-should-not-take-up-space.html
+++ /dev/null
@@ -1,184 +0,0 @@
-<!DOCTYPE html>
-<html>
-<link href="resources/grid.css" rel="stylesheet">
-<style>
-
-.grid {
-    grid-template-columns: 50px 100px;
-    grid-template-rows: 50px 100px;
-    width: 150px;
-    height: 150px;
-    /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
-    position: relative;
-    /* Ensures that the grid container is the containing block of the fixed positioned grid children. */
-    transform: translate(10px, 20px);
-}
-
-.absolute {
-    position: absolute;
-}
-
-.fixed {
-    position: fixed;
-}
-
-.offsetLeft100 {
-    left: 100px;
-}
-
-</style>
-<script src="../../resources/check-layout.js"></script>
-<body onload="checkLayout('.grid')">
-
-<p>This test checks that positioned items shouldn't take up space or otherwise participate in the layout of the grid.</p>
-
-<p>Absolutely positioned:</p>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft100"
-        data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea absolute autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft100"
-        data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-        <div class="sizedToGridArea absolute autoRowAutoColumn"
-            data-offset-x="50" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-        </div>
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-        <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft100"
-            data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-        </div>
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
-    </div>
-</div>
-
-<p>Fixed positioned:</p>
-
-<div class="grid">
-    <div class="sizedToGridArea fixed autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea fixed autoRowAutoColumn offsetLeft100"
-        data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea fixed autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea fixed autoRowAutoColumn offsetLeft100"
-        data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-        <div class="sizedToGridArea fixed autoRowAutoColumn"
-            data-offset-x="50" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-        </div>
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
-    </div>
-</div>
-
-<div class="grid">
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50">
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50">
-        <div class="sizedToGridArea fixed autoRowAutoColumn offsetLeft100"
-            data-offset-x="100" data-offset-y="0" data-expected-width="150" data-expected-height="150">
-        </div>
-    </div>
-    <div class="sizedToGridArea autoRowAutoColumn"
-        data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="100">
-    </div>
-</div>
-
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-webgl-preserveDrawingBuffer.html b/third_party/WebKit/LayoutTests/fast/webgl/OffscreenCanvas-webgl-preserveDrawingBuffer.html
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-webgl-preserveDrawingBuffer.html
rename to third_party/WebKit/LayoutTests/fast/webgl/OffscreenCanvas-webgl-preserveDrawingBuffer.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
index e03381f..c40cbc3 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
@@ -294,13 +294,6 @@
     request2 = new Request(request1);
     assert_equals(request2.integrity, 'sha256-deadbeef',
                   'Request.integrity should match');
-    init['mode'] = 'no-cors';
-    assert_throws(
-        {name: 'TypeError'},
-        function() {
-            var request = new Request(URL, init);
-        },
-        'new Request with a non-empty integrity and mode of \'no-cors\' should throw');
 }, 'Request integrity test');
 
 test(function() {
diff --git a/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/toDataURL-supportedTypes-expected.txt b/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/toDataURL-supportedTypes-expected.txt
deleted file mode 100644
index cc25bc1..0000000
--- a/third_party/WebKit/LayoutTests/virtual/display_list_2d_canvas/fast/canvas/toDataURL-supportedTypes-expected.txt
+++ /dev/null
@@ -1,34 +0,0 @@
- The Actual Canvas 
-Given MIMEType: image/png
-Used MIMEType: image/png
-MIME types are the SAME.
-
-Given MIMEType: image/jpeg
-Used MIMEType: image/jpeg
-MIME types are the SAME.
-
-Given MIMEType: image/webp
-Used MIMEType: image/webp
-MIME types are the SAME.
-
-Given MIMEType: 
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: null
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: undefined
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: image/gif
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: image/x-webkitbitmap
-Used MIMEType: image/png
-MIME types DIFFER.
-
-
diff --git a/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/toDataURL-supportedTypes-expected.txt b/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/toDataURL-supportedTypes-expected.txt
deleted file mode 100644
index cc25bc1..0000000
--- a/third_party/WebKit/LayoutTests/virtual/gpu/fast/canvas/toDataURL-supportedTypes-expected.txt
+++ /dev/null
@@ -1,34 +0,0 @@
- The Actual Canvas 
-Given MIMEType: image/png
-Used MIMEType: image/png
-MIME types are the SAME.
-
-Given MIMEType: image/jpeg
-Used MIMEType: image/jpeg
-MIME types are the SAME.
-
-Given MIMEType: image/webp
-Used MIMEType: image/webp
-MIME types are the SAME.
-
-Given MIMEType: 
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: null
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: undefined
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: image/gif
-Used MIMEType: image/png
-MIME types DIFFER.
-
-Given MIMEType: image/x-webkitbitmap
-Used MIMEType: image/png
-MIME types DIFFER.
-
-
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
index 000a573..950e7bc5 100644
--- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
+++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
@@ -26,7 +26,7 @@
 
  public:
   static RefPtr<RejectedPromises> Create() {
-    return AdoptRef(new RejectedPromises());
+    return WTF::AdoptRef(new RejectedPromises());
   }
 
   ~RejectedPromises();
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.cpp b/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.cpp
index 6f9dbcfb..bf194b7f 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingForTesting.cpp
@@ -15,7 +15,7 @@
     v8::Local<v8::Context> context,
     RefPtr<DOMWrapperWorld> world) {
   RefPtr<ScriptStateForTesting> script_state =
-      AdoptRef(new ScriptStateForTesting(context, std::move(world)));
+      WTF::AdoptRef(new ScriptStateForTesting(context, std::move(world)));
   // This ref() is for keeping this ScriptState alive as long as the v8::Context
   // is alive.  This is deref()ed in the weak callback of the v8::Context.
   script_state->Ref();
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.cpp
index e4320c882..e1e5490 100644
--- a/third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/serialization/SerializedScriptValue.cpp
@@ -89,7 +89,7 @@
 }
 
 RefPtr<SerializedScriptValue> SerializedScriptValue::Create() {
-  return AdoptRef(new SerializedScriptValue);
+  return WTF::AdoptRef(new SerializedScriptValue);
 }
 
 RefPtr<SerializedScriptValue> SerializedScriptValue::Create(
@@ -102,8 +102,8 @@
   DataBufferPtr data_buffer = AllocateBuffer(data_buffer_size.ValueOrDie());
   data.CopyTo(reinterpret_cast<UChar*>(data_buffer.get()), 0, data.length());
 
-  return AdoptRef(new SerializedScriptValue(std::move(data_buffer),
-                                            data_buffer_size.ValueOrDie()));
+  return WTF::AdoptRef(new SerializedScriptValue(
+      std::move(data_buffer), data_buffer_size.ValueOrDie()));
 }
 
 // Versions 16 and below (prior to April 2017) used ntohs() to byte-swap SSV
@@ -226,7 +226,8 @@
   std::copy(data, data + length, data_buffer.get());
   SwapWiredDataIfNeeded(data_buffer.get(), length);
 
-  return AdoptRef(new SerializedScriptValue(std::move(data_buffer), length));
+  return WTF::AdoptRef(
+      new SerializedScriptValue(std::move(data_buffer), length));
 }
 
 RefPtr<SerializedScriptValue> SerializedScriptValue::Create(
@@ -244,7 +245,7 @@
   });
   SwapWiredDataIfNeeded(data_buffer.get(), buffer->size());
 
-  return AdoptRef(
+  return WTF::AdoptRef(
       new SerializedScriptValue(std::move(data_buffer), buffer->size()));
 }
 
diff --git a/third_party/WebKit/Source/core/dom/Text.idl b/third_party/WebKit/Source/core/dom/Text.idl
index 8279e99..36f98f54 100644
--- a/third_party/WebKit/Source/core/dom/Text.idl
+++ b/third_party/WebKit/Source/core/dom/Text.idl
@@ -31,5 +31,5 @@
     [ImplementedAs=assignedSlotForBinding] readonly attribute HTMLSlotElement? assignedSlot;
 
     // Non-standard API:
-    NodeList getDestinationInsertionPoints();
+    [RuntimeEnabled=ShadowDOMV0] NodeList getDestinationInsertionPoints();
 };
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
index d048a8e1..65cfb0d 100644
--- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
@@ -206,8 +206,6 @@
     if (RuntimeEnabledFeatures::ServiceWorkerScriptStreamingEnabled()) {
       result = LoadingScriptFromInstalledScriptsManager(
           complete_url, &response_url, &source_code, &cached_meta_data);
-      // Temporary for debugging https://crbug.com/760427.
-      CHECK_NE(LoadResult::kFailed, result);
     }
 
     // If the script wasn't provided by the InstalledScriptsManager, load from
diff --git a/third_party/WebKit/Source/modules/fetch/Request.cpp b/third_party/WebKit/Source/modules/fetch/Request.cpp
index 5cc01db..472f689 100644
--- a/third_party/WebKit/Source/modules/fetch/Request.cpp
+++ b/third_party/WebKit/Source/modules/fetch/Request.cpp
@@ -333,13 +333,6 @@
                                      "' is unsupported in no-cors mode.");
       return nullptr;
     }
-    // "If |request|'s integrity metadata is not the empty string, throw a
-    // TypeError."
-    if (!request->Integrity().IsEmpty()) {
-      exception_state.ThrowTypeError(
-          "The integrity attribute is unsupported in no-cors mode.");
-      return nullptr;
-    }
     // "Set |r|'s Headers object's guard to "request-no-cors"."
     r->getHeaders()->SetGuard(Headers::kRequestNoCORSGuard);
   }
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
index 3b98cf7..b7d7f547 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorTest.cpp
@@ -51,16 +51,18 @@
 
 namespace {
 
-class MockScrollableArea : public GarbageCollectedFinalized<MockScrollableArea>,
-                           public ScrollableArea {
-  USING_GARBAGE_COLLECTED_MIXIN(MockScrollableArea);
+class MockScrollableAreaForAnimatorTest
+    : public GarbageCollectedFinalized<MockScrollableAreaForAnimatorTest>,
+      public ScrollableArea {
+  USING_GARBAGE_COLLECTED_MIXIN(MockScrollableAreaForAnimatorTest);
 
  public:
-  static MockScrollableArea* Create(bool scroll_animator_enabled,
-                                    const ScrollOffset& min_offset,
-                                    const ScrollOffset& max_offset) {
-    return new MockScrollableArea(scroll_animator_enabled, min_offset,
-                                  max_offset);
+  static MockScrollableAreaForAnimatorTest* Create(
+      bool scroll_animator_enabled,
+      const ScrollOffset& min_offset,
+      const ScrollOffset& max_offset) {
+    return new MockScrollableAreaForAnimatorTest(scroll_animator_enabled,
+                                                 min_offset, max_offset);
   }
 
   MOCK_CONST_METHOD0(VisualRectForScrollbarParts, LayoutRect());
@@ -125,9 +127,9 @@
   }
 
  private:
-  explicit MockScrollableArea(bool scroll_animator_enabled,
-                              const ScrollOffset& min_offset,
-                              const ScrollOffset& max_offset)
+  explicit MockScrollableAreaForAnimatorTest(bool scroll_animator_enabled,
+                                             const ScrollOffset& min_offset,
+                                             const ScrollOffset& max_offset)
       : scroll_animator_enabled_(scroll_animator_enabled),
         min_offset_(min_offset),
         max_offset_(max_offset) {}
@@ -175,8 +177,9 @@
 // TODO(skobes): Add unit tests for composited scrolling paths.
 
 TEST(ScrollAnimatorTest, MainThreadStates) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   ScrollAnimator* scroll_animator =
       new ScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -228,8 +231,9 @@
 }
 
 TEST(ScrollAnimatorTest, MainThreadEnabled) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   ScrollAnimator* scroll_animator =
       new ScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -307,8 +311,9 @@
 // Test that a smooth scroll offset animation is aborted when followed by a
 // non-smooth scroll offset animation.
 TEST(ScrollAnimatorTest, AnimatedScrollAborted) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   ScrollAnimator* scroll_animator =
       new ScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -354,8 +359,9 @@
 // Test that a smooth scroll offset animation running on the compositor is
 // completed on the main thread.
 TEST(ScrollAnimatorTest, AnimatedScrollTakeover) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   TestScrollAnimator* scroll_animator =
       new TestScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -405,8 +411,9 @@
 }
 
 TEST(ScrollAnimatorTest, Disabled) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      false, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(false, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   ScrollAnimator* scroll_animator =
       new ScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -437,8 +444,9 @@
 // Test that cancelling an animation resets the animation state.
 // See crbug.com/598548.
 TEST(ScrollAnimatorTest, CancellingAnimationResetsState) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   ScrollAnimator* scroll_animator =
       new ScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -502,8 +510,9 @@
 // Test the behavior when in WaitingToCancelOnCompositor and a new user scroll
 // happens.
 TEST(ScrollAnimatorTest, CancellingCompositorAnimation) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   TestScrollAnimator* scroll_animator =
       new TestScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -581,8 +590,9 @@
 // This test verifies that impl only animation updates get cleared once they
 // are pushed to compositor animation host.
 TEST(ScrollAnimatorTest, ImplOnlyAnimationUpdatesCleared) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(),
+                                                ScrollOffset(1000, 1000));
   TestScrollAnimator* animator =
       new TestScrollAnimator(scrollable_area, GetMockedTime);
 
@@ -618,8 +628,9 @@
 }
 
 TEST(ScrollAnimatorTest, MainThreadAnimationTargetAdjustment) {
-  MockScrollableArea* scrollable_area = MockScrollableArea::Create(
-      true, ScrollOffset(-100, -100), ScrollOffset(1000, 1000));
+  MockScrollableAreaForAnimatorTest* scrollable_area =
+      MockScrollableAreaForAnimatorTest::Create(true, ScrollOffset(-100, -100),
+                                                ScrollOffset(1000, 1000));
   ScrollAnimator* animator = new ScrollAnimator(scrollable_area, GetMockedTime);
   scrollable_area->SetScrollAnimator(animator);
 
diff --git a/third_party/closure_compiler/externs/passwords_private.js b/third_party/closure_compiler/externs/passwords_private.js
index 93a6737..78dce7da 100644
--- a/third_party/closure_compiler/externs/passwords_private.js
+++ b/third_party/closure_compiler/externs/passwords_private.js
@@ -39,7 +39,8 @@
  * @typedef {{
  *   loginPair: !chrome.passwordsPrivate.LoginPair,
  *   numCharactersInPassword: number,
- *   federationText: (string|undefined)
+ *   federationText: (string|undefined),
+ *   index: number
  * }}
  * @see https://developer.chrome.com/extensions/passwordsPrivate#type-PasswordUiEntry
  */
@@ -47,7 +48,7 @@
 
 /**
  * @typedef {{
- *   loginPair: !chrome.passwordsPrivate.LoginPair,
+ *   index: number,
  *   plaintextPassword: string
  * }}
  * @see https://developer.chrome.com/extensions/passwordsPrivate#type-PlaintextPasswordEventParameters
@@ -56,7 +57,8 @@
 
 /**
  * @typedef {{
- *   urls: !chrome.passwordsPrivate.UrlCollection
+ *   urls: !chrome.passwordsPrivate.UrlCollection,
+ *   index: number
  * }}
  * @see https://developer.chrome.com/extensions/passwordsPrivate#type-ExceptionEntry
  */
@@ -65,32 +67,29 @@
 /**
  * Removes the saved password corresponding to |loginPair|. If no saved password
  * for this pair exists, this function is a no-op.
- * @param {!chrome.passwordsPrivate.LoginPair} loginPair The LoginPair
- *     corresponding to the entry to remove.
+ * @param {number} index The index for the password entry being removed.
  * @see https://developer.chrome.com/extensions/passwordsPrivate#method-removeSavedPassword
  */
-chrome.passwordsPrivate.removeSavedPassword = function(loginPair) {};
+chrome.passwordsPrivate.removeSavedPassword = function(index) {};
 
 /**
  * Removes the saved password exception corresponding to |exceptionUrl|. If no
  * exception with this URL exists, this function is a no-op.
- * @param {string} exceptionUrl The URL corresponding to the exception to
- *     remove.
+ * @param {number} index The index for the exception url entry being removed.
  * @see https://developer.chrome.com/extensions/passwordsPrivate#method-removePasswordException
  */
-chrome.passwordsPrivate.removePasswordException = function(exceptionUrl) {};
+chrome.passwordsPrivate.removePasswordException = function(index) {};
 
 /**
- * Returns the plaintext password corresponding to |loginPair|. Note that on
- * some operating systems, this call may result in an OS-level reauthentication.
- * Once the password has been fetched, it will be returned via the
+ * Returns the plaintext password corresponding to |index|. Note that on some
+ * operating systems, this call may result in an OS-level reauthentication. Once
+ * the password has been fetched, it will be returned via the
  * onPlaintextPasswordRetrieved event. TODO(hcarmona): Investigate using a
  * callback for consistency.
- * @param {!chrome.passwordsPrivate.LoginPair} loginPair The LoginPair
- *     corresponding to the entry whose password     is to be returned.
+ * @param {number} index The index for the password entry being being retrieved.
  * @see https://developer.chrome.com/extensions/passwordsPrivate#method-requestPlaintextPassword
  */
-chrome.passwordsPrivate.requestPlaintextPassword = function(loginPair) {};
+chrome.passwordsPrivate.requestPlaintextPassword = function(index) {};
 
 /**
  * Returns the list of saved passwords.
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc
index e2123e3..d6831ab7 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -1309,18 +1309,14 @@
  public:
   bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
                     base::trace_event::ProcessMemoryDump* pmd) override {
-    // Don't dump in background mode ("from the field") until whitelisted.
-    if (args.level_of_detail ==
-        base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
-      return true;
-    }
-
     auto db_visitor = [](const base::trace_event::MemoryDumpArgs& args,
                          base::trace_event::ProcessMemoryDump* pmd,
                          TrackedDB* db) {
       auto* dump = DBTracker::GetOrCreateAllocatorDump(pmd, db);
-      // TODO(ssid): Do not add string attribute in background mode.
-      dump->AddString("name", "", db->name());
+      if (args.level_of_detail !=
+          base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
+        dump->AddString("name", "", db->name());
+      }
     };
 
     DBTracker::GetInstance()->VisitDatabases(
@@ -1357,10 +1353,6 @@
 base::trace_event::MemoryAllocatorDump* DBTracker::GetOrCreateAllocatorDump(
     base::trace_event::ProcessMemoryDump* pmd,
     TrackedDB* db) {
-  if (pmd->dump_args().level_of_detail ==
-      base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
-    return nullptr;
-  }
   std::string dump_name = base::StringPrintf("leveldatabase/0x%" PRIXPTR,
                                              reinterpret_cast<uintptr_t>(db));
   auto* dump = pmd->GetAllocatorDump(dump_name);
diff --git a/third_party/leveldatabase/env_chromium.h b/third_party/leveldatabase/env_chromium.h
index f3d3e34..fb283d0 100644
--- a/third_party/leveldatabase/env_chromium.h
+++ b/third_party/leveldatabase/env_chromium.h
@@ -289,6 +289,7 @@
 
   friend class ChromiumEnvDBTrackerTest;
   FRIEND_TEST_ALL_PREFIXES(ChromiumEnvDBTrackerTest, IsTrackedDB);
+  FRIEND_TEST_ALL_PREFIXES(ChromiumEnvDBTrackerTest, GetOrCreateAllocatorDump);
 
   DBTracker();
   ~DBTracker();
diff --git a/third_party/leveldatabase/env_chromium_unittest.cc b/third_party/leveldatabase/env_chromium_unittest.cc
index 6bb850b..5225087 100644
--- a/third_party/leveldatabase/env_chromium_unittest.cc
+++ b/third_party/leveldatabase/env_chromium_unittest.cc
@@ -15,12 +15,16 @@
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
 #include "base/test/test_suite.h"
+#include "base/trace_event/process_memory_dump.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/leveldatabase/env_chromium.h"
 #include "third_party/leveldatabase/src/include/leveldb/db.h"
 
 #define FPL FILE_PATH_LITERAL
 
+using base::trace_event::MemoryDumpArgs;
+using base::trace_event::MemoryDumpLevelOfDetail;
+using base::trace_event::ProcessMemoryDump;
 using leveldb::DB;
 using leveldb::Env;
 using leveldb::ReadOptions;
@@ -291,6 +295,30 @@
   base::ScopedTempDir scoped_temp_dir_;
 };
 
+TEST_F(ChromiumEnvDBTrackerTest, GetOrCreateAllocatorDump) {
+  Options options;
+  options.create_if_missing = true;
+  std::string name = temp_path().AsUTF8Unsafe();
+  DBTracker::TrackedDB* tracked_db;
+  Status s = DBTracker::GetInstance()->OpenDatabase(options, name, &tracked_db);
+  ASSERT_TRUE(s.ok()) << s.ToString();
+
+  const MemoryDumpArgs detailed_args = {MemoryDumpLevelOfDetail::DETAILED};
+  ProcessMemoryDump pmd(nullptr, detailed_args);
+  auto* mad =
+      DBTracker::GetInstance()->GetOrCreateAllocatorDump(&pmd, tracked_db);
+  delete tracked_db;
+  ASSERT_TRUE(mad != nullptr);
+
+  // Check that the size was added.
+  auto& entries = mad->entries();
+  ASSERT_EQ(1ul, entries.size());
+  EXPECT_EQ(base::trace_event::MemoryAllocatorDump::kNameSize, entries[0].name);
+  EXPECT_EQ(base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+            entries[0].units);
+  EXPECT_GE(entries[0].value_uint64, 0ul);
+}
+
 TEST_F(ChromiumEnvDBTrackerTest, OpenDatabase) {
   struct KeyValue {
     const char* key;
diff --git a/tools/gn/bundle_data.cc b/tools/gn/bundle_data.cc
index a4bdfd8..f117ec29 100644
--- a/tools/gn/bundle_data.cc
+++ b/tools/gn/bundle_data.cc
@@ -156,6 +156,34 @@
 }
 
 SourceFile BundleData::GetBundleRootDirOutput(const Settings* settings) const {
+  // TODO(crbug.com/764286): all bundles used to be created in $root_out_dir
+  // and the bundle main output was assumed to be the first path component
+  // relative to $root_out_dir.
+  //
+  // This broke when Chrome on iOS had to generate multiple bundles with the
+  // same names (variation of the same bundle with some assets swapped). To
+  // fix this, a new variable $bundle_contents_dir was added to support that
+  // macOS bundle files are not in the root of the bundle but in a subdirectory.
+  //
+  // To allow migration introducing this variable without breaking existing
+  // code, the function does the following heuristic:
+  // 1. if $bundle_contents_dir is defined, then returns $bundle_root_dir,
+  // 2. otherwise, returns the first component of $bundle_root_dir relative
+  //    to $root_out_dir (this was the old code).
+  //
+  // Remove those heuristics when all the code has been fixed to use the new
+  // variable $bundle_contents_dir instead of $bundle_root_dir, and just return
+  // the value of $bundle_root_dir.
+
+  if (!contents_dir().is_null()) {
+    std::string root_dir_value = root_dir().value();
+    size_t last_separator = root_dir_value.rfind('/');
+    if (last_separator != std::string::npos)
+      root_dir_value = root_dir_value.substr(0, last_separator);
+
+    return SourceFile(SourceFile::SWAP_IN, &root_dir_value);
+  }
+
   const SourceDir& build_dir = settings->toolchain_output_dir();
   std::string bundle_root_relative = RebasePath(root_dir().value(), build_dir);
 
diff --git a/tools/gn/bundle_data.h b/tools/gn/bundle_data.h
index 1fe61635..5264b9ef 100644
--- a/tools/gn/bundle_data.h
+++ b/tools/gn/bundle_data.h
@@ -88,6 +88,9 @@
   SourceDir& root_dir() { return root_dir_; }
   const SourceDir& root_dir() const { return root_dir_; }
 
+  SourceDir& contents_dir() { return contents_dir_; }
+  const SourceDir& contents_dir() const { return contents_dir_; }
+
   SourceDir& resources_dir() { return resources_dir_; }
   const SourceDir& resources_dir() const { return resources_dir_; }
 
@@ -159,8 +162,9 @@
   std::vector<LabelPattern> bundle_deps_filter_;
 
   // All those values are subdirectories relative to root_build_dir, and apart
-  // from root_dir, they are either equal to root_dir_ or subdirectories of it.
+  // from root_dir_, they are either equal to root_dir_ or subdirectories of it.
   SourceDir root_dir_;
+  SourceDir contents_dir_;
   SourceDir resources_dir_;
   SourceDir executable_dir_;
   SourceDir plugins_dir_;
diff --git a/tools/gn/bundle_file_rule.cc b/tools/gn/bundle_file_rule.cc
index 5c4fc27..6631a59 100644
--- a/tools/gn/bundle_file_rule.cc
+++ b/tools/gn/bundle_file_rule.cc
@@ -35,6 +35,9 @@
       case SUBSTITUTION_BUNDLE_ROOT_DIR:
         output_path.append(bundle_data.root_dir().value());
         break;
+      case SUBSTITUTION_BUNDLE_CONTENTS_DIR:
+        output_path.append(bundle_data.contents_dir().value());
+        break;
       case SUBSTITUTION_BUNDLE_RESOURCES_DIR:
         output_path.append(bundle_data.resources_dir().value());
         break;
diff --git a/tools/gn/create_bundle_target_generator.cc b/tools/gn/create_bundle_target_generator.cc
index 96df746..9797321 100644
--- a/tools/gn/create_bundle_target_generator.cc
+++ b/tools/gn/create_bundle_target_generator.cc
@@ -33,6 +33,9 @@
   if (!FillBundleDir(SourceDir(), variables::kBundleRootDir,
                      &bundle_data.root_dir()))
     return;
+  if (!FillBundleDir(bundle_data.root_dir(), variables::kBundleContentsDir,
+                     &bundle_data.contents_dir()))
+    return;
   if (!FillBundleDir(bundle_data.root_dir(), variables::kBundleResourcesDir,
                      &bundle_data.resources_dir()))
     return;
diff --git a/tools/gn/docs/reference.md b/tools/gn/docs/reference.md
index 2c8aa7f..037214dc 100644
--- a/tools/gn/docs/reference.md
+++ b/tools/gn/docs/reference.md
@@ -80,6 +80,7 @@
     *   [args: [string list] Arguments passed to an action.](#args)
     *   [asmflags: [string list] Flags passed to the assembler.](#asmflags)
     *   [assert_no_deps: [label pattern list] Ensure no deps on these targets.](#assert_no_deps)
+    *   [bundle_contents_dir: Expansion of {{bundle_contents_dir}} in create_bundle.](#bundle_contents_dir)
     *   [bundle_deps_filter: [label list] A list of labels that are filtered out.](#bundle_deps_filter)
     *   [bundle_executable_dir: Expansion of {{bundle_executable_dir}} in create_bundle](#bundle_executable_dir)
     *   [bundle_plugins_dir: Expansion of {{bundle_plugins_dir}} in create_bundle.](#bundle_plugins_dir)
@@ -1292,11 +1293,11 @@
 #### **Variables**
 
 ```
-  bundle_root_dir*, bundle_resources_dir*, bundle_executable_dir*,
-  bundle_plugins_dir*, bundle_deps_filter, deps, data_deps, public_deps,
-  visibility, product_type, code_signing_args, code_signing_script,
-  code_signing_sources, code_signing_outputs, xcode_extra_attributes,
-  xcode_test_application_name, partial_info_plist
+  bundle_root_dir*, bundle_contents_dir*, bundle_resources_dir*,
+  bundle_executable_dir*, bundle_plugins_dir*, bundle_deps_filter, deps,
+  data_deps, public_deps, visibility, product_type, code_signing_args,
+  code_signing_script, code_signing_sources, code_signing_outputs,
+  xcode_extra_attributes, xcode_test_application_name, partial_info_plist
   * = required
 ```
 
@@ -1326,7 +1327,7 @@
       bundle_data("${app_name}_bundle_info_plist") {
         deps = [ ":${app_name}_generate_info_plist" ]
         sources = [ "$gen_path/Info.plist" ]
-        outputs = [ "{{bundle_root_dir}}/Info.plist" ]
+        outputs = [ "{{bundle_contents_dir}}/Info.plist" ]
       }
 
       executable("${app_name}_generate_executable") {
@@ -1354,19 +1355,21 @@
 
         if (is_ios) {
           bundle_root_dir = "${root_build_dir}/$target_name"
-          bundle_resources_dir = bundle_root_dir
-          bundle_executable_dir = bundle_root_dir
-          bundle_plugins_dir = bundle_root_dir + "/Plugins"
+          bundle_contents_dir = bundle_root_dir
+          bundle_resources_dir = bundle_contents_dir
+          bundle_executable_dir = bundle_contents_dir
+          bundle_plugins_dir = "${bundle_contents_dir}/Plugins"
 
           extra_attributes = {
             ONLY_ACTIVE_ARCH = "YES"
             DEBUG_INFORMATION_FORMAT = "dwarf"
           }
         } else {
-          bundle_root_dir = "${root_build_dir}/target_name/Contents"
-          bundle_resources_dir = bundle_root_dir + "/Resources"
-          bundle_executable_dir = bundle_root_dir + "/MacOS"
-          bundle_plugins_dir = bundle_root_dir + "/Plugins"
+          bundle_root_dir = "${root_build_dir}/target_name"
+          bundle_contents_dir  = "${bundle_root_dir}/Contents"
+          bundle_resources_dir = "${bundle_contents_dir}/Resources"
+          bundle_executable_dir = "${bundle_contents_dir}/MacOS"
+          bundle_plugins_dir = "${bundle_contents_dir}/Plugins"
         }
         deps = [ ":${app_name}_bundle_info_plist" ]
         if (is_ios && code_signing) {
@@ -3901,6 +3904,18 @@
     ]
   }
 ```
+### <a name="bundle_contents_dir"></a>**bundle_contents_dir**: Expansion of {{bundle_contents_dir}} in
+```
+                             create_bundle.
+
+  A string corresponding to a path in $root_build_dir.
+
+  This string is used by the "create_bundle" target to expand the
+  {{bundle_contents_dir}} of the "bundle_data" target it depends on. This must
+  correspond to a path under "bundle_root_dir".
+
+  See "gn help bundle_root_dir" for examples.
+```
 ### <a name="bundle_deps_filter"></a>**bundle_deps_filter**: [label list] A list of labels that are filtered out.
 
 ```
@@ -3982,15 +3997,16 @@
 ```
   bundle_data("info_plist") {
     sources = [ "Info.plist" ]
-    outputs = [ "{{bundle_root_dir}}/Info.plist" ]
+    outputs = [ "{{bundle_contents_dir}}/Info.plist" ]
   }
 
   create_bundle("doom_melon.app") {
     deps = [ ":info_plist" ]
-    bundle_root_dir = root_build_dir + "/doom_melon.app/Contents"
-    bundle_resources_dir = bundle_root_dir + "/Resources"
-    bundle_executable_dir = bundle_root_dir + "/MacOS"
-    bundle_plugins_dir = bundle_root_dir + "/PlugIns"
+    bundle_root_dir = "${root_build_dir}/doom_melon.app"
+    bundle_contents_dir = "${bundle_root_dir}/Contents"
+    bundle_resources_dir = "${bundle_contents_dir}/Resources"
+    bundle_executable_dir = "${bundle_contents_dir}/MacOS"
+    bundle_plugins_dir = "${bundle_contents_dir}/PlugIns"
   }
 ```
 ### <a name="cflags*"></a>**cflags***: Flags passed to the C compiler.
diff --git a/tools/gn/functions_target.cc b/tools/gn/functions_target.cc
index 7b62643..7cf65f94 100644
--- a/tools/gn/functions_target.cc
+++ b/tools/gn/functions_target.cc
@@ -358,11 +358,11 @@
 
 Variables
 
-  bundle_root_dir*, bundle_resources_dir*, bundle_executable_dir*,
-  bundle_plugins_dir*, bundle_deps_filter, deps, data_deps, public_deps,
-  visibility, product_type, code_signing_args, code_signing_script,
-  code_signing_sources, code_signing_outputs, xcode_extra_attributes,
-  xcode_test_application_name, partial_info_plist
+  bundle_root_dir*, bundle_contents_dir*, bundle_resources_dir*,
+  bundle_executable_dir*, bundle_plugins_dir*, bundle_deps_filter, deps,
+  data_deps, public_deps, visibility, product_type, code_signing_args,
+  code_signing_script, code_signing_sources, code_signing_outputs,
+  xcode_extra_attributes, xcode_test_application_name, partial_info_plist
   * = required
 
 Example
@@ -390,7 +390,7 @@
       bundle_data("${app_name}_bundle_info_plist") {
         deps = [ ":${app_name}_generate_info_plist" ]
         sources = [ "$gen_path/Info.plist" ]
-        outputs = [ "{{bundle_root_dir}}/Info.plist" ]
+        outputs = [ "{{bundle_contents_dir}}/Info.plist" ]
       }
 
       executable("${app_name}_generate_executable") {
@@ -418,19 +418,21 @@
 
         if (is_ios) {
           bundle_root_dir = "${root_build_dir}/$target_name"
-          bundle_resources_dir = bundle_root_dir
-          bundle_executable_dir = bundle_root_dir
-          bundle_plugins_dir = bundle_root_dir + "/Plugins"
+          bundle_contents_dir = bundle_root_dir
+          bundle_resources_dir = bundle_contents_dir
+          bundle_executable_dir = bundle_contents_dir
+          bundle_plugins_dir = "${bundle_contents_dir}/Plugins"
 
           extra_attributes = {
             ONLY_ACTIVE_ARCH = "YES"
             DEBUG_INFORMATION_FORMAT = "dwarf"
           }
         } else {
-          bundle_root_dir = "${root_build_dir}/target_name/Contents"
-          bundle_resources_dir = bundle_root_dir + "/Resources"
-          bundle_executable_dir = bundle_root_dir + "/MacOS"
-          bundle_plugins_dir = bundle_root_dir + "/Plugins"
+          bundle_root_dir = "${root_build_dir}/target_name"
+          bundle_contents_dir  = "${bundle_root_dir}/Contents"
+          bundle_resources_dir = "${bundle_contents_dir}/Resources"
+          bundle_executable_dir = "${bundle_contents_dir}/MacOS"
+          bundle_plugins_dir = "${bundle_contents_dir}/Plugins"
         }
         deps = [ ":${app_name}_bundle_info_plist" ]
         if (is_ios && code_signing) {
diff --git a/tools/gn/misc/emacs/gn-mode.el b/tools/gn/misc/emacs/gn-mode.el
index 931207ba..4474bde3 100644
--- a/tools/gn/misc/emacs/gn-mode.el
+++ b/tools/gn/misc/emacs/gn-mode.el
@@ -92,7 +92,7 @@
     "output_prefix_override" "outputs" "pool" "precompiled_header"
     "precompiled_header_type" "precompiled_source" "product_type" "public"
     "public_configs" "public_deps" "response_file_contents" "script" "sources"
-    "testonly" "visibility" "write_runtime_deps"))
+    "testonly" "visibility" "write_runtime_deps" "bundle_contents_dir"))
 
 (defconst gn-font-lock-keywords
   `((,(regexp-opt gn-font-lock-reserved-keywords 'words) .
diff --git a/tools/gn/ninja_create_bundle_target_writer_unittest.cc b/tools/gn/ninja_create_bundle_target_writer_unittest.cc
index 51692e9..06fbd51 100644
--- a/tools/gn/ninja_create_bundle_target_writer_unittest.cc
+++ b/tools/gn/ninja_create_bundle_target_writer_unittest.cc
@@ -14,11 +14,15 @@
 namespace {
 
 void SetupBundleDataDir(BundleData* bundle_data, const std::string& root_dir) {
-  std::string bundle_root_dir = root_dir + "/bar.bundle/Contents";
+  std::string bundle_root_dir = root_dir + "/bar.bundle";
   bundle_data->root_dir() = SourceDir(bundle_root_dir);
-  bundle_data->resources_dir() = SourceDir(bundle_root_dir + "/Resources");
-  bundle_data->executable_dir() = SourceDir(bundle_root_dir + "/MacOS");
-  bundle_data->plugins_dir() = SourceDir(bundle_root_dir + "/Plug Ins");
+  bundle_data->contents_dir() = SourceDir(bundle_root_dir + "/Contents");
+  bundle_data->resources_dir() =
+      SourceDir(bundle_data->contents_dir().value() + "/Resources");
+  bundle_data->executable_dir() =
+      SourceDir(bundle_data->contents_dir().value() + "/MacOS");
+  bundle_data->plugins_dir() =
+      SourceDir(bundle_data->contents_dir().value() + "/Plug Ins");
 }
 
 }  // namespace
@@ -65,6 +69,48 @@
   EXPECT_EQ(expected, out_str);
 }
 
+// Tests creating a bundle in a sub-directory of $root_out_dir.
+TEST(NinjaCreateBundleTargetWriter, InSubDirectory) {
+  Err err;
+  TestWithScope setup;
+
+  Target bundle_data(setup.settings(), Label(SourceDir("//foo/"), "data"));
+  bundle_data.set_output_type(Target::BUNDLE_DATA);
+  bundle_data.sources().push_back(SourceFile("//foo/input1.txt"));
+  bundle_data.sources().push_back(SourceFile("//foo/input2.txt"));
+  bundle_data.action_values().outputs() = SubstitutionList::MakeForTest(
+      "{{bundle_resources_dir}}/{{source_file_part}}");
+  bundle_data.SetToolchain(setup.toolchain());
+  bundle_data.visibility().SetPublic();
+  ASSERT_TRUE(bundle_data.OnResolved(&err));
+
+  Target create_bundle(
+      setup.settings(),
+      Label(SourceDir("//baz/"), "bar", setup.toolchain()->label().dir(),
+            setup.toolchain()->label().name()));
+  SetupBundleDataDir(&create_bundle.bundle_data(), "//out/Debug/gen");
+  create_bundle.set_output_type(Target::CREATE_BUNDLE);
+  create_bundle.private_deps().push_back(LabelTargetPair(&bundle_data));
+  create_bundle.SetToolchain(setup.toolchain());
+  ASSERT_TRUE(create_bundle.OnResolved(&err));
+
+  std::ostringstream out;
+  NinjaCreateBundleTargetWriter writer(&create_bundle, out);
+  writer.Run();
+
+  const char expected[] =
+      "build gen/bar.bundle/Contents/Resources/input1.txt: copy_bundle_data "
+          "../../foo/input1.txt\n"
+      "build gen/bar.bundle/Contents/Resources/input2.txt: copy_bundle_data "
+          "../../foo/input2.txt\n"
+      "build obj/baz/bar.stamp: stamp "
+          "gen/bar.bundle/Contents/Resources/input1.txt "
+          "gen/bar.bundle/Contents/Resources/input2.txt\n"
+      "build gen/bar.bundle: phony obj/baz/bar.stamp\n";
+  std::string out_str = out.str();
+  EXPECT_EQ(expected, out_str);
+}
+
 // Tests empty asset catalog with partial_info_plist property defined.
 TEST(NinjaCreateBundleTargetWriter, JustPartialInfoPlist) {
   Err err;
@@ -182,7 +228,7 @@
   bundle_data0.set_output_type(Target::BUNDLE_DATA);
   bundle_data0.sources().push_back(SourceFile("//qux/qux-Info.plist"));
   bundle_data0.action_values().outputs() =
-      SubstitutionList::MakeForTest("{{bundle_root_dir}}/Info.plist");
+      SubstitutionList::MakeForTest("{{bundle_contents_dir}}/Info.plist");
   bundle_data0.SetToolchain(setup.toolchain());
   bundle_data0.visibility().SetPublic();
   ASSERT_TRUE(bundle_data0.OnResolved(&err));
diff --git a/tools/gn/substitution_type.cc b/tools/gn/substitution_type.cc
index 77b2b79..14bdcdc8 100644
--- a/tools/gn/substitution_type.cc
+++ b/tools/gn/substitution_type.cc
@@ -51,6 +51,7 @@
     "{{arflags}}",  // SUBSTITUTION_ARFLAGS
 
     "{{bundle_root_dir}}",            // SUBSTITUTION_BUNDLE_ROOT_DIR
+    "{{bundle_contents_dir}}",        // SUBSTITUTION_BUNDLE_CONTENTS_DIR
     "{{bundle_resources_dir}}",       // SUBSTITUTION_BUNDLE_RESOURCES_DIR
     "{{bundle_executable_dir}}",      // SUBSTITUTION_BUNDLE_EXECUTABLE_DIR
     "{{bundle_plugins_dir}}",         // SUBSTITUTION_BUNDLE_PLUGINS_DIR
@@ -105,6 +106,7 @@
     "arflags",  // SUBSTITUTION_ARFLAGS
 
     "bundle_root_dir",        // SUBSTITUTION_BUNDLE_ROOT_DIR
+    "bundle_contents_dir",    // SUBSTITUTION_BUNDLE_CONTENTS_DIR
     "bundle_resources_dir",   // SUBSTITUTION_BUNDLE_RESOURCES_DIR
     "bundle_executable_dir",  // SUBSTITUTION_BUNDLE_EXECUTABLE_DIR
     "bundle_plugins_dir",     // SUBSTITUTION_BUNDLE_PLUGINS_DIR
@@ -140,6 +142,7 @@
 
 bool SubstitutionIsInBundleDir(SubstitutionType type) {
   return type == SUBSTITUTION_BUNDLE_ROOT_DIR ||
+         type == SUBSTITUTION_BUNDLE_CONTENTS_DIR ||
          type == SUBSTITUTION_BUNDLE_RESOURCES_DIR ||
          type == SUBSTITUTION_BUNDLE_EXECUTABLE_DIR ||
          type == SUBSTITUTION_BUNDLE_PLUGINS_DIR;
@@ -151,6 +154,7 @@
          type == SUBSTITUTION_SOURCE_FILE_PART ||
          type == SUBSTITUTION_SOURCE_ROOT_RELATIVE_DIR ||
          type == SUBSTITUTION_BUNDLE_ROOT_DIR ||
+         type == SUBSTITUTION_BUNDLE_CONTENTS_DIR ||
          type == SUBSTITUTION_BUNDLE_RESOURCES_DIR ||
          type == SUBSTITUTION_BUNDLE_EXECUTABLE_DIR ||
          type == SUBSTITUTION_BUNDLE_PLUGINS_DIR;
diff --git a/tools/gn/substitution_type.h b/tools/gn/substitution_type.h
index 6cdc3af..bb3c803 100644
--- a/tools/gn/substitution_type.h
+++ b/tools/gn/substitution_type.h
@@ -66,6 +66,7 @@
 
   // Valid for bundle_data targets.
   SUBSTITUTION_BUNDLE_ROOT_DIR,        // {{bundle_root_dir}}
+  SUBSTITUTION_BUNDLE_CONTENTS_DIR,    // {{bundle_contents_dir}}
   SUBSTITUTION_BUNDLE_RESOURCES_DIR,   // {{bundle_resources_dir}}
   SUBSTITUTION_BUNDLE_EXECUTABLE_DIR,  // {{bundle_executable_dir}}
   SUBSTITUTION_BUNDLE_PLUGINS_DIR,     // {{bundle_plugins_dir}}
diff --git a/tools/gn/variables.cc b/tools/gn/variables.cc
index 57523df8c..582e3b6 100644
--- a/tools/gn/variables.cc
+++ b/tools/gn/variables.cc
@@ -586,18 +586,36 @@
 
   bundle_data("info_plist") {
     sources = [ "Info.plist" ]
-    outputs = [ "{{bundle_root_dir}}/Info.plist" ]
+    outputs = [ "{{bundle_contents_dir}}/Info.plist" ]
   }
 
   create_bundle("doom_melon.app") {
     deps = [ ":info_plist" ]
-    bundle_root_dir = root_build_dir + "/doom_melon.app/Contents"
-    bundle_resources_dir = bundle_root_dir + "/Resources"
-    bundle_executable_dir = bundle_root_dir + "/MacOS"
-    bundle_plugins_dir = bundle_root_dir + "/PlugIns"
+    bundle_root_dir = "${root_build_dir}/doom_melon.app"
+    bundle_contents_dir = "${bundle_root_dir}/Contents"
+    bundle_resources_dir = "${bundle_contents_dir}/Resources"
+    bundle_executable_dir = "${bundle_contents_dir}/MacOS"
+    bundle_plugins_dir = "${bundle_contents_dir}/PlugIns"
   }
 )";
 
+const char kBundleContentsDir[] = "bundle_contents_dir";
+const char kBundleContentsDir_HelpShort[] =
+    "bundle_contents_dir: "
+        "Expansion of {{bundle_contents_dir}} in create_bundle.";
+const char kBundleContentsDir_Help[] =
+    R"(bundle_contents_dir: Expansion of {{bundle_contents_dir}} in
+                             create_bundle.
+
+  A string corresponding to a path in $root_build_dir.
+
+  This string is used by the "create_bundle" target to expand the
+  {{bundle_contents_dir}} of the "bundle_data" target it depends on. This must
+  correspond to a path under "bundle_root_dir".
+
+  See "gn help bundle_root_dir" for examples.
+)";
+
 const char kBundleResourcesDir[] = "bundle_resources_dir";
 const char kBundleResourcesDir_HelpShort[] =
     "bundle_resources_dir: "
@@ -1931,6 +1949,7 @@
     INSERT_VARIABLE(Asmflags)
     INSERT_VARIABLE(AssertNoDeps)
     INSERT_VARIABLE(BundleRootDir)
+    INSERT_VARIABLE(BundleContentsDir)
     INSERT_VARIABLE(BundleResourcesDir)
     INSERT_VARIABLE(BundleDepsFilter)
     INSERT_VARIABLE(BundleExecutableDir)
diff --git a/tools/gn/variables.h b/tools/gn/variables.h
index 4b176665..0e3891d 100644
--- a/tools/gn/variables.h
+++ b/tools/gn/variables.h
@@ -107,6 +107,10 @@
 extern const char kBundleRootDir_HelpShort[];
 extern const char kBundleRootDir_Help[];
 
+extern const char kBundleContentsDir[];
+extern const char kBundleContentsDir_HelpShort[];
+extern const char kBundleContentsDir_Help[];
+
 extern const char kBundleResourcesDir[];
 extern const char kBundleResourcesDir_HelpShort[];
 extern const char kBundleResourcesDir_Help[];
diff --git a/tools/perf/page_sets/page_cycler_story.py b/tools/perf/page_sets/page_cycler_story.py
index 1103897..4f631d0 100644
--- a/tools/perf/page_sets/page_cycler_story.py
+++ b/tools/perf/page_sets/page_cycler_story.py
@@ -2,7 +2,8 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from telemetry.core import util
+import py_utils
+
 from telemetry.page import page
 from telemetry.page import cache_temperature as cache_temperature_module
 from telemetry.page import shared_page_state
@@ -29,5 +30,7 @@
                            timeout_in_seconds=_NAVIGATION_TIMEOUT)
 
   def RunPageInteractions(self, action_runner):
-    util.WaitFor(action_runner.tab.HasReachedQuiescence,
-        _WEB_CONTENTS_TIMEOUT)
+    py_utils.WaitFor(action_runner.tab.HasReachedQuiescence,
+                     _WEB_CONTENTS_TIMEOUT)
+    py_utils.WaitFor(action_runner.tab.IsServiceWorkerActivatedOrNotRegistered,
+                     _WEB_CONTENTS_TIMEOUT)
diff --git a/ui/arc/notification/arc_notification_content_view.cc b/ui/arc/notification/arc_notification_content_view.cc
index 220524d1..314ecaa 100644
--- a/ui/arc/notification/arc_notification_content_view.cc
+++ b/ui/arc/notification/arc_notification_content_view.cc
@@ -84,7 +84,8 @@
 
     // TODO(yoshiki): Use a better tigger (eg. focusing EditText on
     // notification) than clicking (crbug.com/697379).
-    if (event->type() == ui::ET_MOUSE_PRESSED)
+    if (event->type() == ui::ET_MOUSE_PRESSED ||
+        event->type() == ui::ET_GESTURE_TAP)
       owner_->Activate();
 
     views::Widget* widget = owner_->GetWidget();
diff --git a/ui/message_center/message_center_switches.h b/ui/message_center/message_center_switches.h
index 3f3401ee..a589933 100644
--- a/ui/message_center/message_center_switches.h
+++ b/ui/message_center/message_center_switches.h
@@ -11,9 +11,6 @@
 namespace switches {
 
 MESSAGE_CENTER_EXPORT extern const char
-    kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval[];
-
-MESSAGE_CENTER_EXPORT extern const char
     kEnableMessageCenterNewStyleNotification[];
 MESSAGE_CENTER_EXPORT extern const char
     kDisableMessageCenterNewStyleNotification[];
diff --git a/ui/message_center/public/cpp/message_center_switches.cc b/ui/message_center/public/cpp/message_center_switches.cc
index cea62ed..08bcec0 100644
--- a/ui/message_center/public/cpp/message_center_switches.cc
+++ b/ui/message_center/public/cpp/message_center_switches.cc
@@ -24,12 +24,6 @@
 
 namespace switches {
 
-// Enables message center to always move other notifications upwards when a
-// notification is removed, no matter whether the message center is displayed
-// top down or not.
-const char kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval[] =
-    "enable-message-center-always-scroll-up-upon-notification-removal";
-
 // Flag to enable or disable new-style notification. This flag will be removed
 // once the feature gets stable.
 const char kEnableMessageCenterNewStyleNotification[] =
diff --git a/ui/message_center/public/cpp/message_center_switches.h b/ui/message_center/public/cpp/message_center_switches.h
index a124c615..461b81d 100644
--- a/ui/message_center/public/cpp/message_center_switches.h
+++ b/ui/message_center/public/cpp/message_center_switches.h
@@ -16,9 +16,6 @@
 namespace switches {
 
 MESSAGE_CENTER_PUBLIC_EXPORT extern const char
-    kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval[];
-
-MESSAGE_CENTER_PUBLIC_EXPORT extern const char
     kEnableMessageCenterNewStyleNotification[];
 MESSAGE_CENTER_PUBLIC_EXPORT extern const char
     kDisableMessageCenterNewStyleNotification[];
diff --git a/ui/message_center/views/message_list_view.cc b/ui/message_center/views/message_list_view.cc
index 59adfe0..af8fc27 100644
--- a/ui/message_center/views/message_list_view.cc
+++ b/ui/message_center/views/message_list_view.cc
@@ -362,11 +362,7 @@
     return;
   }
 
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableMessageCenterAlwaysScrollUpUponNotificationRemoval))
-    AnimateNotificationsBelowTarget();
-  else
-    AnimateNotifications();
+  AnimateNotifications();
 
   // Should calculate and set new size after calling AnimateNotifications()
   // because fixed_height_ may be updated in it.
@@ -380,55 +376,6 @@
     GetWidget()->SynthesizeMouseMoveEvent();
 }
 
-// TODO(yoshiki): Remove this method. It is no longer maintained.
-void MessageListView::AnimateNotificationsBelowTarget() {
-  int target_index = -1;
-  int padding = kMarginBetweenItems - MessageView::GetShadowInsets().bottom();
-  gfx::Rect child_area = GetContentsBounds();
-  if (reposition_top_ >= 0) {
-    for (int i = 0; i < child_count(); ++i) {
-      views::View* child = child_at(i);
-      if (child->y() >= reposition_top_) {
-        // Find the target.
-        target_index = i;
-        break;
-      }
-    }
-  }
-  int top;
-  if (target_index != -1) {
-    // Layout the target.
-    int y = reposition_top_;
-    views::View* target = child_at(target_index);
-    int target_height = target->GetHeightForWidth(child_area.width());
-    if (AnimateChild(target, y - target_height, target_height,
-                     false /* animate_on_move */)) {
-      y -= target_height + padding;
-    }
-
-    // Layout the items above the target.
-    for (int i = target_index - 1; i >= 0; --i) {
-      views::View* child = child_at(i);
-      int height = child->GetHeightForWidth(child_area.width());
-      if (AnimateChild(child, y - height, height, false /* animate_on_move */))
-        y -= height + padding;
-    }
-
-    top = reposition_top_ + target_height + padding;
-  } else {
-    target_index = -1;
-    top = GetInsets().top();
-  }
-
-  // Layout the items below the target (or all items if target is unavailable).
-  for (int i = target_index + 1; i < child_count(); ++i) {
-    views::View* child = child_at(i);
-    int height = child->GetHeightForWidth(child_area.width());
-    if (AnimateChild(child, top, height, true /* animate_on_move */))
-      top += height + padding;
-  }
-}
-
 std::vector<int> MessageListView::ComputeRepositionOffsets(
     const std::vector<int>& heights,
     const std::vector<bool>& deleting,
diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm
index 191212f9..5faee65a 100644
--- a/ui/views/cocoa/bridged_content_view.mm
+++ b/ui/views/cocoa/bridged_content_view.mm
@@ -649,8 +649,11 @@
 
 // NSView implementation.
 
+// Always refuse first responder. Note this does not prevent the view becoming
+// first responder via -[NSWindow makeFirstResponder:] when invoked during Init
+// or by FocusManager.
 - (BOOL)acceptsFirstResponder {
-  return YES;
+  return NO;
 }
 
 - (BOOL)becomeFirstResponder {
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm
index 90799a4..b3fd155 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -132,10 +132,12 @@
 
   delegate_->OnNativeWidgetCreated(true);
 
-  bridge_->SetFocusManager(GetWidget()->GetFocusManager());
-
   DCHECK(GetWidget()->GetRootView());
   bridge_->SetRootView(GetWidget()->GetRootView());
+  if (auto* focus_manager = GetWidget()->GetFocusManager()) {
+    [window makeFirstResponder:bridge_->ns_view()];
+    bridge_->SetFocusManager(focus_manager);
+  }
 
   // "Infer" must be handled by ViewsDelegate::OnBeforeWidgetInit().
   DCHECK_NE(Widget::InitParams::INFER_OPACITY, params.opacity);